eo-tides 0.0.21__tar.gz → 0.0.23__tar.gz
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-0.0.21 → eo_tides-0.0.23}/PKG-INFO +28 -17
- {eo_tides-0.0.21 → eo_tides-0.0.23}/README.md +11 -2
- {eo_tides-0.0.21 → eo_tides-0.0.23}/eo_tides/eo.py +36 -57
- {eo_tides-0.0.21 → eo_tides-0.0.23}/eo_tides/model.py +103 -80
- eo_tides-0.0.23/eo_tides/stats.py +554 -0
- {eo_tides-0.0.21 → eo_tides-0.0.23}/eo_tides/validation.py +20 -13
- {eo_tides-0.0.21 → eo_tides-0.0.23}/eo_tides.egg-info/PKG-INFO +28 -17
- eo_tides-0.0.23/eo_tides.egg-info/requires.txt +20 -0
- {eo_tides-0.0.21 → eo_tides-0.0.23}/pyproject.toml +31 -32
- {eo_tides-0.0.21 → eo_tides-0.0.23}/tests/test_eo.py +24 -44
- {eo_tides-0.0.21 → eo_tides-0.0.23}/tests/test_model.py +48 -49
- {eo_tides-0.0.21 → eo_tides-0.0.23}/tests/test_stats.py +40 -1
- eo_tides-0.0.21/eo_tides/stats.py +0 -266
- eo_tides-0.0.21/eo_tides.egg-info/requires.txt +0 -18
- {eo_tides-0.0.21 → eo_tides-0.0.23}/LICENSE +0 -0
- {eo_tides-0.0.21 → eo_tides-0.0.23}/eo_tides/__init__.py +0 -0
- {eo_tides-0.0.21 → eo_tides-0.0.23}/eo_tides/utils.py +0 -0
- {eo_tides-0.0.21 → eo_tides-0.0.23}/eo_tides.egg-info/SOURCES.txt +0 -0
- {eo_tides-0.0.21 → eo_tides-0.0.23}/eo_tides.egg-info/dependency_links.txt +0 -0
- {eo_tides-0.0.21 → eo_tides-0.0.23}/eo_tides.egg-info/top_level.txt +0 -0
- {eo_tides-0.0.21 → eo_tides-0.0.23}/setup.cfg +0 -0
- {eo_tides-0.0.21 → eo_tides-0.0.23}/tests/test_utils.py +0 -0
- {eo_tides-0.0.21 → eo_tides-0.0.23}/tests/test_validation.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: eo-tides
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.23
|
4
4
|
Summary: Tide modelling tools for large-scale satellite earth observation analysis
|
5
5
|
Author-email: Robbi Bishop-Taylor <Robbi.BishopTaylor@ga.gov.au>
|
6
6
|
Project-URL: Homepage, https://GeoscienceAustralia.github.io/eo-tides/
|
@@ -22,23 +22,25 @@ Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Requires-Python: <4.0,>=3.9
|
23
23
|
Description-Content-Type: text/markdown
|
24
24
|
License-File: LICENSE
|
25
|
-
Requires-Dist: colorama
|
26
|
-
Requires-Dist: geopandas>=
|
27
|
-
Requires-Dist:
|
28
|
-
Requires-Dist:
|
29
|
-
Requires-Dist:
|
30
|
-
Requires-Dist:
|
25
|
+
Requires-Dist: colorama>=0.4.3
|
26
|
+
Requires-Dist: geopandas>=0.10.0
|
27
|
+
Requires-Dist: matplotlib>=3.8.0
|
28
|
+
Requires-Dist: numpy>=1.26.0
|
29
|
+
Requires-Dist: odc-geo>=0.4.7
|
30
|
+
Requires-Dist: pandas>=2.2.0
|
31
|
+
Requires-Dist: pyproj>=3.6.1
|
31
32
|
Requires-Dist: pyTMD==2.1.6
|
32
|
-
Requires-Dist: scikit-learn
|
33
|
-
Requires-Dist: scipy
|
34
|
-
Requires-Dist: shapely
|
35
|
-
Requires-Dist: tqdm
|
36
|
-
Requires-Dist: xarray
|
33
|
+
Requires-Dist: scikit-learn>=1.4.0
|
34
|
+
Requires-Dist: scipy>=1.11.2
|
35
|
+
Requires-Dist: shapely>=2.0.6
|
36
|
+
Requires-Dist: tqdm>=4.55.0
|
37
|
+
Requires-Dist: xarray>=2022.3.0
|
37
38
|
Provides-Extra: notebooks
|
38
39
|
Requires-Dist: odc-stac>=0.3.10; extra == "notebooks"
|
39
|
-
Requires-Dist:
|
40
|
-
Requires-Dist:
|
41
|
-
Requires-Dist:
|
40
|
+
Requires-Dist: odc-geo[tiff,warp]>=0.4.7; extra == "notebooks"
|
41
|
+
Requires-Dist: pystac-client>=0.8.3; extra == "notebooks"
|
42
|
+
Requires-Dist: folium>=0.16.0; extra == "notebooks"
|
43
|
+
Requires-Dist: planetary_computer>=1.0.0; extra == "notebooks"
|
42
44
|
|
43
45
|
# `eo-tides`: Tide modelling tools for large-scale satellite earth observation analysis
|
44
46
|
|
@@ -46,7 +48,7 @@ Requires-Dist: matplotlib; extra == "notebooks"
|
|
46
48
|
|
47
49
|
[](https://pypi.org/project/eo-tides/)
|
48
50
|
[](https://github.com/GeoscienceAustralia/eo-tides/actions/workflows/main.yml?query=branch%3Amain)
|
49
|
-

|
50
52
|
[](https://codecov.io/gh/GeoscienceAustralia/eo-tides)
|
51
53
|
[](https://img.shields.io/github/license/GeoscienceAustralia/eo-tides)
|
52
54
|
|
@@ -69,9 +71,9 @@ These tools can be applied to petabytes of freely available satellite data (e.g.
|
|
69
71
|
- 🌊 Model tides from multiple global ocean tide models in parallel, and return tide heights in standardised `pandas.DataFrame` format for further analysis
|
70
72
|
- 🛰️ "Tag" satellite data with tide height and stage based on the exact moment of image acquisition
|
71
73
|
- 🌐 Model tides for every individual satellite pixel, producing three-dimensional "tide height" `xarray`-format datacubes that can be integrated with satellite data
|
72
|
-
<!-- - 🎯 Combine multiple tide models into a single locally-optimised "ensemble" model informed by satellite altimetry and satellite-observed patterns of tidal inundation -->
|
73
74
|
- 📈 Calculate statistics describing local tide dynamics, as well as biases caused by interactions between tidal processes and satellite orbits
|
74
75
|
- 🛠️ Validate modelled tides using measured sea levels from coastal tide gauges (e.g. [GESLA Global Extreme Sea Level Analysis](https://gesla.org/))
|
76
|
+
<!-- - 🎯 Combine multiple tide models into a single locally-optimised "ensemble" model informed by satellite altimetry and satellite-observed patterns of tidal inundation -->
|
75
77
|
|
76
78
|
## Supported tide models
|
77
79
|
|
@@ -85,6 +87,10 @@ These tools can be applied to petabytes of freely available satellite data (e.g.
|
|
85
87
|
|
86
88
|
For instructions on how to set up these models for use in `eo-tides`, refer to [Setting up tide models](setup.md).
|
87
89
|
|
90
|
+
## Installing and setting up `eo-tides`
|
91
|
+
|
92
|
+
To get started with `eo-tides`, follow the [Installation](https://geoscienceaustralia.github.io/eo-tides/install/) and [Setting up tide models](https://geoscienceaustralia.github.io/eo-tides/setup/) guides.
|
93
|
+
|
88
94
|
## Citing `eo-tides`
|
89
95
|
|
90
96
|
To cite `eo-tides` in your work, please use the following citation:
|
@@ -92,3 +98,8 @@ To cite `eo-tides` in your work, please use the following citation:
|
|
92
98
|
```
|
93
99
|
Bishop-Taylor, R., Sagar, S., Phillips, C., & Newey, V. (2024). eo-tides: Tide modelling tools for large-scale satellite earth observation analysis. https://github.com/GeoscienceAustralia/eo-tides
|
94
100
|
```
|
101
|
+
|
102
|
+
## Acknowledgements
|
103
|
+
|
104
|
+
For a full list of acknowledgements, refer to [Citations and Credits](https://geoscienceaustralia.github.io/eo-tides/credits/).
|
105
|
+
This repository was initialised using the [`cookiecutter-uv`](https://github.com/fpgmaas/cookiecutter-uv) package.
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
[](https://pypi.org/project/eo-tides/)
|
6
6
|
[](https://github.com/GeoscienceAustralia/eo-tides/actions/workflows/main.yml?query=branch%3Amain)
|
7
|
-

|
8
8
|
[](https://codecov.io/gh/GeoscienceAustralia/eo-tides)
|
9
9
|
[](https://img.shields.io/github/license/GeoscienceAustralia/eo-tides)
|
10
10
|
|
@@ -27,9 +27,9 @@ These tools can be applied to petabytes of freely available satellite data (e.g.
|
|
27
27
|
- 🌊 Model tides from multiple global ocean tide models in parallel, and return tide heights in standardised `pandas.DataFrame` format for further analysis
|
28
28
|
- 🛰️ "Tag" satellite data with tide height and stage based on the exact moment of image acquisition
|
29
29
|
- 🌐 Model tides for every individual satellite pixel, producing three-dimensional "tide height" `xarray`-format datacubes that can be integrated with satellite data
|
30
|
-
<!-- - 🎯 Combine multiple tide models into a single locally-optimised "ensemble" model informed by satellite altimetry and satellite-observed patterns of tidal inundation -->
|
31
30
|
- 📈 Calculate statistics describing local tide dynamics, as well as biases caused by interactions between tidal processes and satellite orbits
|
32
31
|
- 🛠️ Validate modelled tides using measured sea levels from coastal tide gauges (e.g. [GESLA Global Extreme Sea Level Analysis](https://gesla.org/))
|
32
|
+
<!-- - 🎯 Combine multiple tide models into a single locally-optimised "ensemble" model informed by satellite altimetry and satellite-observed patterns of tidal inundation -->
|
33
33
|
|
34
34
|
## Supported tide models
|
35
35
|
|
@@ -43,6 +43,10 @@ These tools can be applied to petabytes of freely available satellite data (e.g.
|
|
43
43
|
|
44
44
|
For instructions on how to set up these models for use in `eo-tides`, refer to [Setting up tide models](setup.md).
|
45
45
|
|
46
|
+
## Installing and setting up `eo-tides`
|
47
|
+
|
48
|
+
To get started with `eo-tides`, follow the [Installation](https://geoscienceaustralia.github.io/eo-tides/install/) and [Setting up tide models](https://geoscienceaustralia.github.io/eo-tides/setup/) guides.
|
49
|
+
|
46
50
|
## Citing `eo-tides`
|
47
51
|
|
48
52
|
To cite `eo-tides` in your work, please use the following citation:
|
@@ -50,3 +54,8 @@ To cite `eo-tides` in your work, please use the following citation:
|
|
50
54
|
```
|
51
55
|
Bishop-Taylor, R., Sagar, S., Phillips, C., & Newey, V. (2024). eo-tides: Tide modelling tools for large-scale satellite earth observation analysis. https://github.com/GeoscienceAustralia/eo-tides
|
52
56
|
```
|
57
|
+
|
58
|
+
## Acknowledgements
|
59
|
+
|
60
|
+
For a full list of acknowledgements, refer to [Citations and Credits](https://geoscienceaustralia.github.io/eo-tides/credits/).
|
61
|
+
This repository was initialised using the [`cookiecutter-uv`](https://github.com/fpgmaas/cookiecutter-uv) package.
|
@@ -2,6 +2,7 @@
|
|
2
2
|
from __future__ import annotations
|
3
3
|
|
4
4
|
import os
|
5
|
+
import warnings
|
5
6
|
from typing import TYPE_CHECKING
|
6
7
|
|
7
8
|
import odc.geo.xr
|
@@ -93,19 +94,17 @@ def _pixel_tides_resample(
|
|
93
94
|
|
94
95
|
|
95
96
|
def tag_tides(
|
96
|
-
ds: xr.Dataset,
|
97
|
+
ds: xr.Dataset | xr.DataArray,
|
97
98
|
model: str | list[str] = "EOT20",
|
98
99
|
directory: str | os.PathLike | None = None,
|
99
100
|
tidepost_lat: float | None = None,
|
100
101
|
tidepost_lon: float | None = None,
|
101
|
-
ebb_flow: bool = False,
|
102
|
-
swap_dims: bool = False,
|
103
102
|
**model_tides_kwargs,
|
104
|
-
) -> xr.
|
103
|
+
) -> xr.DataArray:
|
105
104
|
"""
|
106
105
|
Model tide heights for every timestep in a multi-dimensional
|
107
|
-
dataset, and
|
108
|
-
|
106
|
+
dataset, and return a new `tide_height` array that can
|
107
|
+
be used to "tag" each observation with tide data.
|
109
108
|
|
110
109
|
The function models tides at the centroid of the dataset
|
111
110
|
by default, but a custom tidal modelling location can
|
@@ -123,7 +122,7 @@ def tag_tides(
|
|
123
122
|
|
124
123
|
Parameters
|
125
124
|
----------
|
126
|
-
ds : xarray.Dataset
|
125
|
+
ds : xarray.Dataset or xarray.DataArray
|
127
126
|
A multi-dimensional dataset (e.g. "x", "y", "time") to
|
128
127
|
tag with tide heights. This dataset must contain a "time"
|
129
128
|
dimension.
|
@@ -143,16 +142,6 @@ def tag_tides(
|
|
143
142
|
Optional coordinates used to model tides. The default is None,
|
144
143
|
which uses the centroid of the dataset as the tide modelling
|
145
144
|
location.
|
146
|
-
ebb_flow : bool, optional
|
147
|
-
An optional boolean indicating whether to compute if the
|
148
|
-
tide phase was ebbing (falling) or flowing (rising) for each
|
149
|
-
observation. The default is False; if set to True, a new
|
150
|
-
"ebb_flow" variable will be added to the dataset with each
|
151
|
-
observation labelled with "Ebb" or "Flow".
|
152
|
-
swap_dims : bool, optional
|
153
|
-
An optional boolean indicating whether to swap the `time`
|
154
|
-
dimension in the original `ds` to the new "tide_height"
|
155
|
-
variable. Defaults to False.
|
156
145
|
**model_tides_kwargs :
|
157
146
|
Optional parameters passed to the `eo_tides.model.model_tides`
|
158
147
|
function. Important parameters include `cutoff` (used to
|
@@ -174,8 +163,6 @@ def tag_tides(
|
|
174
163
|
|
175
164
|
# Standardise model into a list for easy handling. and verify only one
|
176
165
|
model = [model] if isinstance(model, str) else model
|
177
|
-
if (len(model) > 1) & swap_dims:
|
178
|
-
raise ValueError("Can only swap dimensions when a single tide model is passed to `model`.")
|
179
166
|
|
180
167
|
# If custom tide modelling locations are not provided, use the
|
181
168
|
# dataset centroid
|
@@ -208,48 +195,38 @@ def tag_tides(
|
|
208
195
|
f"`tidepost_lat` and `tidepost_lon` parameters."
|
209
196
|
)
|
210
197
|
|
211
|
-
# Optionally calculate the tide phase for each observation
|
212
|
-
if ebb_flow:
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
198
|
+
# # Optionally calculate the tide phase for each observation
|
199
|
+
# if ebb_flow:
|
200
|
+
# # Model tides for a time 15 minutes prior to each previously
|
201
|
+
# # modelled satellite acquisition time. This allows us to compare
|
202
|
+
# # tide heights to see if they are rising or falling.
|
203
|
+
# print("Modelling tidal phase (e.g. ebb or flow)")
|
204
|
+
# tide_pre_df = model_tides(
|
205
|
+
# x=lon, # type: ignore
|
206
|
+
# y=lat, # type: ignore
|
207
|
+
# time=(ds.time - pd.Timedelta("15 min")),
|
208
|
+
# model=model,
|
209
|
+
# directory=directory,
|
210
|
+
# crs="EPSG:4326",
|
211
|
+
# **model_tides_kwargs,
|
212
|
+
# )
|
213
|
+
|
214
|
+
# # Compare tides computed for each timestep. If the previous tide
|
215
|
+
# # was higher than the current tide, the tide is 'ebbing'. If the
|
216
|
+
# # previous tide was lower, the tide is 'flowing'
|
217
|
+
# tide_df["ebb_flow"] = (tide_df.tide_height < tide_pre_df.tide_height.values).replace({
|
218
|
+
# True: "Ebb",
|
219
|
+
# False: "Flow",
|
220
|
+
# })
|
234
221
|
|
235
222
|
# Convert to xarray format
|
236
|
-
tide_xr = tide_df.reset_index().set_index(["time", "tide_model"]).drop(["x", "y"], axis=1).to_xarray()
|
223
|
+
tide_xr = tide_df.reset_index().set_index(["time", "tide_model"]).drop(["x", "y"], axis=1).tide_height.to_xarray()
|
237
224
|
|
238
225
|
# If only one tidal model exists, squeeze out "tide_model" dim
|
239
226
|
if len(tide_xr.tide_model) == 1:
|
240
|
-
tide_xr = tide_xr.squeeze("tide_model"
|
241
|
-
|
242
|
-
# Add each array into original dataset
|
243
|
-
for var in tide_xr.data_vars:
|
244
|
-
ds[var] = tide_xr[var]
|
245
|
-
|
246
|
-
# Swap dimensions and sort by tide height
|
247
|
-
if swap_dims:
|
248
|
-
ds = ds.swap_dims({"time": "tide_height"})
|
249
|
-
ds = ds.sortby("tide_height")
|
250
|
-
ds = ds.drop_vars("time")
|
227
|
+
tide_xr = tide_xr.squeeze("tide_model")
|
251
228
|
|
252
|
-
return
|
229
|
+
return tide_xr
|
253
230
|
|
254
231
|
|
255
232
|
def pixel_tides(
|
@@ -493,8 +470,10 @@ def pixel_tides(
|
|
493
470
|
# Set dtype to dtype of the input data as quantile always returns
|
494
471
|
# float64 (memory intensive)
|
495
472
|
if calculate_quantiles is not None:
|
496
|
-
|
497
|
-
|
473
|
+
with warnings.catch_warnings():
|
474
|
+
warnings.simplefilter("ignore")
|
475
|
+
print("Computing tide quantiles")
|
476
|
+
tides_lowres = tides_lowres.quantile(q=calculate_quantiles, dim="time").astype(tides_lowres.dtype)
|
498
477
|
|
499
478
|
# If only one tidal model exists, squeeze out "tide_model" dim
|
500
479
|
if len(tides_lowres.tide_model) == 1:
|
@@ -5,6 +5,7 @@ import os
|
|
5
5
|
import pathlib
|
6
6
|
import warnings
|
7
7
|
from concurrent.futures import ProcessPoolExecutor
|
8
|
+
from concurrent.futures.process import BrokenProcessPool
|
8
9
|
from functools import partial
|
9
10
|
from typing import TYPE_CHECKING
|
10
11
|
|
@@ -130,7 +131,7 @@ def list_models(
|
|
130
131
|
# Mark available models with a green tick
|
131
132
|
status = "✅"
|
132
133
|
print(f"{status:^{status_width}}│ {m:<{name_width}} │ {expected_paths[m]:<{path_width}}")
|
133
|
-
except:
|
134
|
+
except FileNotFoundError:
|
134
135
|
if show_supported:
|
135
136
|
# Mark unavailable models with a red cross
|
136
137
|
status = "❌"
|
@@ -199,84 +200,99 @@ def _model_tides(
|
|
199
200
|
lat.max() + buffer,
|
200
201
|
]
|
201
202
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
203
|
+
try:
|
204
|
+
# Read tidal constants and interpolate to grid points
|
205
|
+
if pytmd_model.format in ("OTIS", "ATLAS-compact", "TMD3"):
|
206
|
+
amp, ph, D, c = pyTMD.io.OTIS.extract_constants(
|
207
|
+
lon,
|
208
|
+
lat,
|
209
|
+
pytmd_model.grid_file,
|
210
|
+
pytmd_model.model_file,
|
211
|
+
pytmd_model.projection,
|
212
|
+
type=pytmd_model.type,
|
213
|
+
grid=pytmd_model.file_format,
|
214
|
+
crop=crop,
|
215
|
+
bounds=bounds,
|
216
|
+
method=method,
|
217
|
+
extrapolate=extrapolate,
|
218
|
+
cutoff=cutoff,
|
219
|
+
)
|
218
220
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
221
|
+
# Use delta time at 2000.0 to match TMD outputs
|
222
|
+
deltat = np.zeros((len(timescale)), dtype=np.float64)
|
223
|
+
|
224
|
+
elif pytmd_model.format in ("ATLAS-netcdf",):
|
225
|
+
amp, ph, D, c = pyTMD.io.ATLAS.extract_constants(
|
226
|
+
lon,
|
227
|
+
lat,
|
228
|
+
pytmd_model.grid_file,
|
229
|
+
pytmd_model.model_file,
|
230
|
+
type=pytmd_model.type,
|
231
|
+
crop=crop,
|
232
|
+
bounds=bounds,
|
233
|
+
method=method,
|
234
|
+
extrapolate=extrapolate,
|
235
|
+
cutoff=cutoff,
|
236
|
+
scale=pytmd_model.scale,
|
237
|
+
compressed=pytmd_model.compressed,
|
238
|
+
)
|
237
239
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
240
|
+
# Use delta time at 2000.0 to match TMD outputs
|
241
|
+
deltat = np.zeros((len(timescale)), dtype=np.float64)
|
242
|
+
|
243
|
+
elif pytmd_model.format in ("GOT-ascii", "GOT-netcdf"):
|
244
|
+
amp, ph, c = pyTMD.io.GOT.extract_constants(
|
245
|
+
lon,
|
246
|
+
lat,
|
247
|
+
pytmd_model.model_file,
|
248
|
+
grid=pytmd_model.file_format,
|
249
|
+
crop=crop,
|
250
|
+
bounds=bounds,
|
251
|
+
method=method,
|
252
|
+
extrapolate=extrapolate,
|
253
|
+
cutoff=cutoff,
|
254
|
+
scale=pytmd_model.scale,
|
255
|
+
compressed=pytmd_model.compressed,
|
256
|
+
)
|
255
257
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
258
|
+
# Delta time (TT - UT1)
|
259
|
+
deltat = timescale.tt_ut1
|
260
|
+
|
261
|
+
elif pytmd_model.format in ("FES-ascii", "FES-netcdf"):
|
262
|
+
amp, ph = pyTMD.io.FES.extract_constants(
|
263
|
+
lon,
|
264
|
+
lat,
|
265
|
+
pytmd_model.model_file,
|
266
|
+
type=pytmd_model.type,
|
267
|
+
version=pytmd_model.version,
|
268
|
+
crop=crop,
|
269
|
+
bounds=bounds,
|
270
|
+
method=method,
|
271
|
+
extrapolate=extrapolate,
|
272
|
+
cutoff=cutoff,
|
273
|
+
scale=pytmd_model.scale,
|
274
|
+
compressed=pytmd_model.compressed,
|
275
|
+
)
|
274
276
|
|
275
|
-
|
276
|
-
|
277
|
+
# Available model constituents
|
278
|
+
c = pytmd_model.constituents
|
277
279
|
|
278
|
-
|
279
|
-
|
280
|
+
# Delta time (TT - UT1)
|
281
|
+
deltat = timescale.tt_ut1
|
282
|
+
else:
|
283
|
+
raise Exception(
|
284
|
+
f"Unsupported model format ({pytmd_model.format}). This may be due to an incompatible version of `pyTMD`."
|
285
|
+
)
|
286
|
+
|
287
|
+
# Raise error if constituent files no not cover analysis extent
|
288
|
+
except IndexError:
|
289
|
+
error_msg = (
|
290
|
+
f"The {model} tide model constituent files do not cover the requested analysis extent. "
|
291
|
+
"This can occur if you are using clipped model files to improve run times. "
|
292
|
+
"Consider using model files that cover your analysis area, or set `crop=False` "
|
293
|
+
"to reduce the extent of tide model constituent files that is loaded."
|
294
|
+
)
|
295
|
+
raise Exception(error_msg)
|
280
296
|
|
281
297
|
# Calculate complex phase in radians for Euler's
|
282
298
|
cph = -1j * ph * np.pi / 180.0
|
@@ -783,12 +799,19 @@ def model_tides(
|
|
783
799
|
)
|
784
800
|
|
785
801
|
# Apply func in parallel, iterating through each input param
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
802
|
+
try:
|
803
|
+
model_outputs = list(
|
804
|
+
tqdm(
|
805
|
+
executor.map(iter_func, model_iters, x_iters, y_iters, time_iters),
|
806
|
+
total=len(model_iters),
|
807
|
+
),
|
808
|
+
)
|
809
|
+
except BrokenProcessPool:
|
810
|
+
error_msg = (
|
811
|
+
"Parallelised tide modelling failed, likely to to an out-of-memory error. "
|
812
|
+
"Try reducing the size of your analysis, or set `parallel=False`."
|
813
|
+
)
|
814
|
+
raise RuntimeError(error_msg)
|
792
815
|
|
793
816
|
# Model tides in series if parallelisation is off
|
794
817
|
else:
|