Skip to content

Fes2014 Implementation#7

Merged
ecomodeller merged 18 commits into
mainfrom
FES2014
Oct 31, 2025
Merged

Fes2014 Implementation#7
ecomodeller merged 18 commits into
mainfrom
FES2014

Conversation

@Baran-Oz
Copy link
Copy Markdown
Collaborator

  • New method for tide prediction has been implemented
  • Tidal constituents for both water level and tidal currents from FES2014/AVISO (https://www.aviso.altimetry.fr/en/data/products/auxiliary-products/global-tide-fes.html) are now read and used for the prediction.
  • New tests are created
  • Validation of the tidal water level are completed. Tidal currents validation, however, needs more focus. AVISO provides amplitude and phase for each constituent but they must be converted to the elliptic parameters, namely, major-minor axes, inclination, and amplitude.

@Baran-Oz Baran-Oz requested a review from ecomodeller August 26, 2025 10:29
Comment thread tidepredictor/data.py

ut_constants = _add_constituent("MSQM", freq_rad_per_sec)

FES2014_CONSTITUENTS = [
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a list of files rather than a list of constituents. I suggest skipping .nc in each line or rename the variable to something that indicate that it is a list of files.

Comment thread tidepredictor/data.py Outdated
lon, lat = _convert_FES2014_coords(lon, lat)
for cons in FES2014_CONSTITUENTS:
file_path = self.file_path / cons
name = cons.split(".")[0].upper()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to above comment. I would do rather have a list of constituents.

Comment thread tidepredictor/data.py Outdated
name = cons.split(".")[0].upper()

return constituents
if name == "LA2": # Special case for LA2
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary, isn't it possible to fix this by modifying the constituent file?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it's not super necessary and we can proceed as you want. I just thought that it would be handier for the users to just store the files as they are provided and we take care of renaming within the script. Should I remove it?

Comment thread tidepredictor/data.py Outdated
df = ds.sel(lon=lon, lat=lat, method="nearest").to_dataframe()

# Check if the file is a NetCDF file or a directory
if ".nc" not in self.file_path.suffixes:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this if/else more clearer that it is either FES2014 or DTU10, checking for ".nc" is not obvious.

Comment thread tidepredictor/data.py Outdated
)
constituents[name] = constituent
# Check if the file is a NetCDF file or a directory
if ".nc" not in self.file_path.suffixes:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments above. Consider creating separate classes for reading FES2014 and DTU10. Then you would only need a branch in single place.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree! I changed it

Comment thread tidepredictor/data.py Outdated
tuple[float, float]
Latitude and Longitude in corrected format for FES2014
"""
if lat < -90 or lat > 90:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this check necessary here? Validating user input should not be done in a conversion function.

Comment thread tidepredictor/data.py Outdated
Amplitudes of northward (v) component
PHIv : array_like
Phase lags of v component (degrees)
plot_demo : tuple of indices (optional)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plot_demo is not a parameter of this function.

Comment thread tidepredictor/data.py Outdated
return lon, lat


def ap2ep(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reconsider name of function and parameters.

@ecomodeller ecomodeller merged commit d44e0bf into main Oct 31, 2025
@ecomodeller ecomodeller deleted the FES2014 branch October 31, 2025 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants