Closed robbibt closed 1 year ago
To test:
import datacube
import odc.geo.xr
import pandas as pd
from dea_tools.coastal import pixel_tides
dc = datacube.Datacube()
ds = dc.load( product="ga_ls8c_ard_3", x=(122.2, 122.5), y=(-17.0, -17.3), time=("2015"), dask_chunks={}, )
tides_highres, tides_lowres = pixel_tides( ds=ds, times=pd.date_range("2020-01-01", "2020-01-02", periods=20), model=["TPXO9-atlas-v5", "FES2014", "FES2012"], directory="/gdata1/data/tide_models_clipped/", cutoff=20, )
tides_highres.isel(time=[0, 1, 2, 3, 4]).plot.imshow(col="time", row="tide_model")
Proposed changes
Currently, the
pixel_tides
function only allows us to run a single tide model at once (by default, "FES2014").This PR updates the function to allow a user to specify a list of tide models:
Outputs are now returned as an
xr.DataArray
with a new "tide_model" dimension, making it easy to plot and compare different model outputs:For backwards compatibility, the "tide_model" dimension is squeezed out if only one model is requested (the default).
Other minor updates:
test_coastal.py
to test the existing "calculate_quantiles" functionality that is used for Intertidal Exposure.pixel_tides
to usexr_reproject
fromodc.geo
instead ofodc.algo
pixel_tides
docstring and fixed up some silly mistakes