eo-tides 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
eo_tides/__init__.py CHANGED
@@ -28,7 +28,7 @@ validation : Load observed tide gauge data to validate modelled tides
28
28
 
29
29
  # Import commonly used functions for convenience
30
30
  from .eo import pixel_tides, tag_tides
31
- from .model import model_phases, model_tides
31
+ from .model import ensemble_tides, model_phases, model_tides
32
32
  from .stats import pixel_stats, tide_stats
33
33
  from .utils import clip_models, idw, list_models
34
34
  from .validation import eval_metrics, load_gauge_gesla
@@ -38,6 +38,7 @@ __all__ = [
38
38
  "list_models",
39
39
  "model_tides",
40
40
  "model_phases",
41
+ "ensemble_tides",
41
42
  "tag_tides",
42
43
  "pixel_tides",
43
44
  "tide_stats",
eo_tides/eo.py CHANGED
@@ -39,7 +39,7 @@ def _resample_chunks(
39
39
  return data.shape
40
40
 
41
41
  # if data has chunks, then return just spatial chunks
42
- if data.chunks is not None:
42
+ if data.chunks:
43
43
  y_dim, x_dim = data.odc.spatial_dims
44
44
  return data.chunks[y_dim], data.chunks[x_dim]
45
45
 
@@ -101,6 +101,7 @@ def _pixel_tides_resample(
101
101
  resample_method="bilinear",
102
102
  dask_chunks=None,
103
103
  dask_compute=True,
104
+ name="tide_height",
104
105
  ):
105
106
  """Resamples low resolution tides modelled by `pixel_tides` into the
106
107
  geobox (e.g. spatial resolution and extent) of the original higher
@@ -125,6 +126,8 @@ def _pixel_tides_resample(
125
126
  Whether to compute results of the resampling step using Dask.
126
127
  If False, this will return `tides_highres` as a lazy loaded
127
128
  Dask-enabled array.
129
+ name : str, optional
130
+ The name used for the output array. Defaults to "tide_height".
128
131
 
129
132
  Returns
130
133
  -------
@@ -145,7 +148,11 @@ def _pixel_tides_resample(
145
148
  how=gbox,
146
149
  chunks=dask_chunks,
147
150
  resampling=resample_method,
148
- ).rename("tide_height")
151
+ )
152
+
153
+ # Set output name
154
+ if name is not None:
155
+ tides_highres = tides_highres.rename(name)
149
156
 
150
157
  # Optionally process and load into memory with Dask
151
158
  if dask_compute:
@@ -197,10 +204,12 @@ def tag_tides(
197
204
  that can be converted by `pandas.to_datetime()`. For example:
198
205
  `time=pd.date_range(start="2000", end="2001", freq="5h")`
199
206
  model : str or list of str, optional
200
- The tide model (or models) used to model tides. If a list is
201
- provided, a new "tide_model" dimension will be added to the
202
- `xarray.DataArray` outputs. Defaults to "EOT20"; for a full
203
- list of available/supported models, run `eo_tides.model.list_models`.
207
+ The tide model (or list of models) to use to model tides.
208
+ If a list is provided, a new "tide_model" dimension will be
209
+ added to the `xarray.DataArray` outputs. Defaults to "EOT20";
210
+ specify "all" to use all models available in `directory`.
211
+ For a full list of available and supported models, run
212
+ `eo_tides.model.list_models`.
204
213
  directory : str, optional
205
214
  The directory containing tide model data files. If no path is
206
215
  provided, this will default to the environment variable
@@ -326,10 +335,12 @@ def pixel_tides(
326
335
  that can be converted by `pandas.to_datetime()`. For example:
327
336
  `time=pd.date_range(start="2000", end="2001", freq="5h")`
328
337
  model : str or list of str, optional
329
- The tide model (or models) used to model tides. If a list is
330
- provided, a new "tide_model" dimension will be added to the
331
- `xarray.DataArray` outputs. Defaults to "EOT20"; for a full
332
- list of available/supported models, run `eo_tides.model.list_models`.
338
+ The tide model (or list of models) to use to model tides.
339
+ If a list is provided, a new "tide_model" dimension will be
340
+ added to the `xarray.DataArray` outputs. Defaults to "EOT20";
341
+ specify "all" to use all models available in `directory`.
342
+ For a full list of available and supported models, run
343
+ `eo_tides.model.list_models`.
333
344
  directory : str, optional
334
345
  The directory containing tide model data files. If no path is
335
346
  provided, this will default to the environment variable
@@ -369,7 +380,7 @@ def pixel_tides(
369
380
  `data` has a geographic CRS (e.g. degree units).
370
381
  resample_method : str, optional
371
382
  If resampling is requested (see `resample` above), use this
372
- resampling method when converting from low resolution to high
383
+ resampling method when resampling from low resolution to high
373
384
  resolution pixels. Defaults to "bilinear"; valid options include
374
385
  "nearest", "cubic", "min", "max", "average" etc.
375
386
  dask_chunks : tuple of float, optional
@@ -381,7 +392,7 @@ def pixel_tides(
381
392
  `(2048, 2048)`.
382
393
  dask_compute : bool, optional
383
394
  Whether to compute results of the resampling step using Dask.
384
- If False, `tides_highres` will be returned as a Dask array.
395
+ If False, `tides_highres` will be returned as a Dask-enabled array.
385
396
  **model_tides_kwargs :
386
397
  Optional parameters passed to the `eo_tides.model.model_tides`
387
398
  function. Important parameters include `cutoff` (used to