# Harmonic analysis The harmonic analysis estimate the signal that match specific frequencies (here the tidal component or tidal waves) in a given time series. This analysis et completly dependent to the period used: if the time series is too short, the the signal matching the frequencies cannot be estimated. To get more information on the tidal wave frequencies, the separability between them and the aliasing impact, look to the [showarg](../../infos/showarg.md) command. ## Time series To compute the harmonic analysis for M2 on a tide gauges (single location observation), use the [detidor](../../tidal-processing/detidor.md) command: ``` bash rep=/ecola/share/tmp/training/GESLA-3.0/ detidor $rep/vigo-vigo-esp-ieo -format GESLA -s 2000/01/01 -f 2020/01/01 \ -w M2 ``` To compute the harmonic analysis of all tidal constituants, you can use the spectrum aliases: ``` bash rep=/ecola/share/tmp/training/GESLA-3.0/ detidor $rep/vigo-vigo-esp-ieo -format GESLA vigo-vigo-esp-ieo \ -s 2000/01/01 -f 2020/01/01 \ -spectrum COASTAL ``` The complex coefficents (ampltitude and phase lag) of each tidal constituent is then stored in the files : - "vigo-vigo-esp-ieo_2000-01-01_2015-12-31.customed-01.mgr" - "vigo-vigo-esp-ieo_2000-01-01_2015-12-31.COASTAL_75.mgr". To merge mgr files together in order to build a tide gauge harmonics database, use [concatenator](../../format-interpolation-regridding/concatenator.md) command. ## Altimetry To compute the harmonic analysis on along-track altimetry (multiple locations with different time observation), use the [altimetry-detidor](../../tidal-processing/altimetry-detidor.md) command: ``` bash rep=/ecola/share/tmp/training/XTRACK-NEA/SLA/ ln -s $rep/ctoh.sla.ref.TP+J1+J2.NEA.122.nc ctoh.sla.ref.TP+J1+J2.NEA.122.nc altimetry-detidor ctoh.sla.ref.TP+J1+J2.NEA.122.nc \ --tide=no --auto-parse -r 9.9156 -b psd\ -f NETCDF -spectrum COASTAL ``` The complex coefficents (ampltitude and phase lag) of each tidal constituent is then stored in the file "ctoh.sla.ref.TP+J1+J2.NEA.122.mgr.nc" Like for the tide gauges, specific tidal constituent can be used instead of preset spectrum. This exemple account for the aliasing (9.9156 days for TP/Jason) and does not account the for tidal correction that come with the product. (models-harmonics)= ## Models To compute the harmonic analysis on a simulations (multiple location with common time), use the [comodo-detidor](../../tidal-processing/comodo-detidor.md) command: ``` bash rep=/ecola/share/tmp/training/BOBIBE_hourly/ comodo-detidor $rep/2017*.nc \ --only-atlases \ -p atlas \ -s 2017/01/10 -f 2020/01/15 \ -v ssh_w \ -d M2 S2 ``` The harmonic analysis will be stored the files "M2-ssh_w-atlas.nc" and "S2-ssh_w-atlas.nc" in the "atlas" repository. To plot it, launch POCViP and follow this [tutorial](../POCViP/tidal_ellipses.md): ```bash rep=/ecola/share/tmp/training/BOBIBE_grid/ pocvip -f $rep/grid.nc ./atlas/M2-ssh_w-atlas.nc ```