Skip to content

Commit

Permalink
#279 update tide correction to be compatible with pyTMD 2.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
2320sharon committed Oct 25, 2024
1 parent e5d8486 commit e1b6be1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 40 deletions.
37 changes: 17 additions & 20 deletions scripts/apply_tidal_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,26 +677,23 @@ def model_tides(
# number of time points
n_times = len(time)

if model.format == "FES":
amp, ph = pyTMD.io.FES.extract_constants(
lon,
lat,
model.model_file,
type=model.type,
version=model.version,
method=method,
extrapolate=extrapolate,
cutoff=cutoff,
scale=model.scale,
compressed=model.compressed,
)

# Available model constituents
c = model.constituents

# Delta time (TT - UT1)
# calculating the difference between Terrestrial Time (TT) and UT1 (Universal Time 1),
deltat = timescale.tt_ut1
amp, ph = pyTMD.io.FES.extract_constants(
lon,
lat,
model.model_file,
type=model.type,
version=model.version,
method=method,
extrapolate=extrapolate,
cutoff=cutoff,
scale=model.scale,
compressed=model.compressed,
)
# Available model constituents
c = model.constituents
# Delta time (TT - UT1)
# calculating the difference between Terrestrial Time (TT) and UT1 (Universal Time 1),
deltat = timescale.tt_ut1

# Calculate complex phase in radians for Euler's
cph = -1j * ph * np.pi / 180.0
Expand Down
39 changes: 19 additions & 20 deletions src/coastseg/tide_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ def model_tides(
model
)


# If time passed as a single Timestamp, convert to datetime64
if isinstance(time, pd.Timestamp):
time = time.to_datetime64()
Expand Down Expand Up @@ -674,26 +675,24 @@ def model_tides(
# number of time points
n_times = len(time)

if model.format == "FES":
amp, ph = pyTMD.io.FES.extract_constants(
lon,
lat,
model.model_file,
type=model.type,
version=model.version,
method=method,
extrapolate=extrapolate,
cutoff=cutoff,
scale=model.scale,
compressed=model.compressed,
)

# Available model constituents
c = model.constituents

# Delta time (TT - UT1)
# calculating the difference between Terrestrial Time (TT) and UT1 (Universal Time 1),
deltat = timescale.tt_ut1

amp, ph = pyTMD.io.FES.extract_constants(
lon,
lat,
model.model_file,
type=model.type,
version=model.version,
method=method,
extrapolate=extrapolate,
cutoff=cutoff,
scale=model.scale,
compressed=model.compressed,
)
# Available model constituents
c = model.constituents
# Delta time (TT - UT1)
# calculating the difference between Terrestrial Time (TT) and UT1 (Universal Time 1),
deltat = timescale.tt_ut1

# Calculate complex phase in radians for Euler's
cph = -1j * ph * np.pi / 180.0
Expand Down

0 comments on commit e1b6be1

Please sign in to comment.