Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor inputs to streamline API across functions #19

Merged
merged 14 commits into from
Oct 28, 2024
Merged

Conversation

robbibt
Copy link
Member

@robbibt robbibt commented Oct 20, 2024

New features

  • New phase_tides function for calculating tidal phases ("low-flow", high-flow", "high-ebb", "low-ebb") for each tide height in a timeseries. Ebb and low phases are calculated by running the eo_tides.model.model_tides function twice, once for the requested timesteps, and again after subtracting a small time offset (by default, 15 minutes). If tides increased over this period, they are assigned as "flow"; if they decreased, they are assigned as "ebb". Tides are considered "high" if equal or greater than 0 metres tide height, otherwise "low".

Major changes

  • Major refactor to use consistent input parameters across all EO focused functions: input can now be either xr.DataArray or xr.Dataset or odc.geo.geobox.GeoBox; if an xarray object is passed, it must have a "time" dimension; if GeoBox is passed, time must be provided by the time parameter.
  • The ds param in all satellite data functions (tag_tides, pixel_tides, tide_stats, pixel_tides) has been renamed to a more generic name data (to account for now accepting either xarray.Dataset, xarray.DataArray or a odc.geo.geobox.GeoBox inputs).
  • All time parameters now accept inputs in np.ndarray, pd.DatetimeIndex` or pd.Timestamp format
  • model_tides now uses default cropping approach from pyTMD, rather than applying a bespoke 1 degree buffer around the selected analysis area
  • model_tides refactored to use simpler approach to loading tide consistuents enabled in pyTMD==2.1.7

@codecov-commenter
Copy link

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@robbibt robbibt marked this pull request as ready for review October 28, 2024 00:07
@robbibt robbibt linked an issue Oct 28, 2024 that may be closed by this pull request
@robbibt robbibt added this to the v0.2.0 milestone Oct 28, 2024
@robbibt robbibt merged commit 3a63b3b into main Oct 28, 2024
11 checks passed
@robbibt robbibt deleted the refactor_inputs branch October 28, 2024 00:19
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.

Move ebb-flow functionality to model_tides?
2 participants