Skip to content

Commit

Permalink
Add extra test
Browse files Browse the repository at this point in the history
  • Loading branch information
robbibt committed Oct 2, 2024
1 parent da795e0 commit db668f8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ coverage:
status:
project:
default:
target: 80%
target: 75%
threshold: 0.5%
7 changes: 3 additions & 4 deletions eo_tides/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,10 +885,9 @@ def tag_tides(
**model_tides_kwargs,
):
"""
Model tide heights for every timestep in a multi-
dimensional dataset, and add them as a new `tide_height`
variable giving the height of the tide at the exact
moment of each acquisition.
Model tide heights for every timestep in a multi-dimensional
dataset, and add them as a new `tide_height` (and optionally,
`ebb_flow`) variable that "tags" each observation with tide data.
The function models tides at the centroid of the dataset
by default, but a custom tidal modelling location can
Expand Down
16 changes: 16 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,22 @@ def test_tag_tides(satellite_ds, measured_tides_ds, ebb_flow, swap_dims, tidepos
assert abs(val_stats["Bias"]) < 0.20


def test_tag_tides_multiple(satellite_ds):
# Model multiple models at once
tagged_tides_ds = tag_tides(satellite_ds, model=["FES2014", "HAMTIDE11"], ebb_flow=True)

assert "tide_model" in tagged_tides_ds.dims
assert tagged_tides_ds.tide_height.dims == ("time", "tide_model")
assert tagged_tides_ds.ebb_flow.dims == ("time", "tide_model")

# Test that multiple tide models are correlated
val_stats = eval_metrics(
x=tagged_tides_ds.sel(tide_model="FES2014").tide_height,
y=tagged_tides_ds.sel(tide_model="HAMTIDE11").tide_height,
)
assert val_stats["Correlation"] > 0.99


# Run tests for default and custom resolutions
@pytest.mark.parametrize("resolution", [None, "custom"])
def test_pixel_tides(satellite_ds, measured_tides_ds, resolution):
Expand Down

0 comments on commit db668f8

Please sign in to comment.