Skip to content

Commit

Permalink
add PhysOcean.rayleigh_criterion
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Jul 4, 2024
1 parent 5a37176 commit 5cd7f20
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/tides.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,30 @@ function ep2ap(semimajor, eccentricity, inclination, phase)
end

export ep2ap

"""
Tmin = PhysOcean.rayleigh_criterion(f1,f2)
Compute the minimum duration `Tmin` to separate the frequency `f1` and `f2`
following the Rayleigh criterion.
`Tmin` has the inverse of the units of `f1` and `f2`.
For example to resolve the M2 and S2 tides, the duration of the time series has
to be at least 14.765 days:
```
using PhysOcean
f_M2 = 12.4206 # h⁻¹
f_S2 = 12 # h⁻¹
Tmin = PhysOcean.rayleigh_criterion(f_M2,f_S2)
Tmin/24
# output 14.765
```
Reference:
Bruce B. Parker, [Tidal Analysis and Prediction](https://web.archive.org/web/20240626033634/https://tidesandcurrents.noaa.gov/publications/Tidal_Analysis_and_Predictions.pdf), NOAA Special Publication NOS CO-OPS 3, page 84
"""
function rayleigh_criterion(f₁,f₂)
1/abs(1/f₁-1/f₂)
end
12 changes: 12 additions & 0 deletions test/test_tides.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,15 @@ amplitude_u2,phase_u2,amplitude_v2,phase_v2 = ep2ap(semimajor, eccentricity, inc
@test amplitude_v amplitude_v2
@test phase_u phase_u2
@test phase_v phase_v2



# page 82 from
# https://web.archive.org/web/20240626033634/https://tidesandcurrents.noaa.gov/publications/Tidal_Analysis_and_Predictions.pdf

f_M2 = 12.4206
f_S2 = 12
Tmin = PhysOcean.rayleigh_criterion(f_M2,f_S2)

# Table 3.1
@test Tmin/24 14.765 atol=0.001

0 comments on commit 5cd7f20

Please # to comment.