eo-tides 0.6.2.dev7__py3-none-any.whl → 0.6.2.dev10__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/model.py +55 -15
- {eo_tides-0.6.2.dev7.dist-info → eo_tides-0.6.2.dev10.dist-info}/METADATA +1 -1
- eo_tides-0.6.2.dev10.dist-info/RECORD +10 -0
- eo_tides-0.6.2.dev7.dist-info/RECORD +0 -10
- {eo_tides-0.6.2.dev7.dist-info → eo_tides-0.6.2.dev10.dist-info}/WHEEL +0 -0
- {eo_tides-0.6.2.dev7.dist-info → eo_tides-0.6.2.dev10.dist-info}/licenses/LICENSE +0 -0
eo_tides/model.py
CHANGED
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
3
3
|
|
4
4
|
import os
|
5
5
|
import textwrap
|
6
|
+
import warnings
|
6
7
|
from concurrent.futures import ProcessPoolExecutor
|
7
8
|
from concurrent.futures.process import BrokenProcessPool
|
8
9
|
from functools import partial
|
@@ -83,6 +84,7 @@ def _model_tides(
|
|
83
84
|
cutoff,
|
84
85
|
crop,
|
85
86
|
crop_buffer,
|
87
|
+
append_node,
|
86
88
|
):
|
87
89
|
"""Worker function applied in parallel by `model_tides`. Handles the
|
88
90
|
extraction of tide modelling constituents and tide modelling using
|
@@ -104,12 +106,12 @@ def _model_tides(
|
|
104
106
|
lon,
|
105
107
|
lat,
|
106
108
|
type=pytmd_model.type,
|
107
|
-
crop=crop,
|
109
|
+
crop=True if crop == "auto" else crop,
|
108
110
|
buffer=crop_buffer,
|
109
111
|
method=method,
|
110
112
|
extrapolate=extrapolate,
|
111
113
|
cutoff=cutoff,
|
112
|
-
append_node=
|
114
|
+
append_node=append_node,
|
113
115
|
)
|
114
116
|
|
115
117
|
# TODO: Return constituents
|
@@ -117,16 +119,45 @@ def _model_tides(
|
|
117
119
|
# print(amp.shape, ph.shape, c)
|
118
120
|
# print(pd.DataFrame({"amplitude": amp}))
|
119
121
|
|
120
|
-
|
122
|
+
except ValueError:
|
123
|
+
# If on-the-fly cropping is auto, try again with crop turned off
|
124
|
+
if crop == "auto":
|
125
|
+
warnings.warn(
|
126
|
+
"On-the-fly cropping is not compatible with the provided "
|
127
|
+
"clipped model files; running with `crop=False`."
|
128
|
+
)
|
129
|
+
|
130
|
+
# Read tidal constants and interpolate to grid points
|
131
|
+
amp, ph, c = pytmd_model.extract_constants(
|
132
|
+
lon,
|
133
|
+
lat,
|
134
|
+
type=pytmd_model.type,
|
135
|
+
crop=False,
|
136
|
+
buffer=crop_buffer,
|
137
|
+
method=method,
|
138
|
+
extrapolate=extrapolate,
|
139
|
+
cutoff=cutoff,
|
140
|
+
append_node=append_node,
|
141
|
+
)
|
142
|
+
|
143
|
+
# Otherwise, raise error if cropping if set to True
|
144
|
+
else:
|
145
|
+
error_msg = (
|
146
|
+
"On-the-fly cropping (e.g. `crop=True`) is not compatible with your "
|
147
|
+
"provided clipped model files. Please set `crop=False` or `crop='auto'`, "
|
148
|
+
"or run your analysis on unclipped global model files to avoid this error."
|
149
|
+
)
|
150
|
+
raise Exception(error_msg) from None
|
151
|
+
|
152
|
+
# Raise error if constituent files do not cover analysis extent
|
121
153
|
except IndexError:
|
122
|
-
error_msg =
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
raise Exception(textwrap.dedent(error_msg).strip()) from None
|
154
|
+
error_msg = (
|
155
|
+
f"The {model} tide model constituent files do not cover the analysis extent "
|
156
|
+
f"({min(lon):.2f}, {max(lon):.2f}, {min(lat):.2f}, {max(lat):.2f}). "
|
157
|
+
"This can occur if you are using clipped model files to improve run times. "
|
158
|
+
"Consider using model files that cover your entire analysis area."
|
159
|
+
)
|
160
|
+
raise Exception(error_msg) from None
|
130
161
|
|
131
162
|
# Calculate complex phase in radians for Euler's
|
132
163
|
cph = -1j * ph * np.pi / 180.0
|
@@ -397,8 +428,9 @@ def model_tides(
|
|
397
428
|
method: str = "linear",
|
398
429
|
extrapolate: bool = True,
|
399
430
|
cutoff: float | None = None,
|
400
|
-
crop: bool =
|
431
|
+
crop: bool | str = "auto",
|
401
432
|
crop_buffer: float | None = 5,
|
433
|
+
append_node: bool = False,
|
402
434
|
parallel: bool = True,
|
403
435
|
parallel_splits: int | str = "auto",
|
404
436
|
parallel_max: int | None = None,
|
@@ -503,15 +535,22 @@ def model_tides(
|
|
503
535
|
Extrapolation cutoff in kilometers. The default is None, which
|
504
536
|
will extrapolate for all points regardless of distance from the
|
505
537
|
valid tide modelling domain.
|
506
|
-
crop : bool, optional
|
538
|
+
crop : bool or str, optional
|
507
539
|
Whether to crop tide model constituent files on-the-fly to
|
508
|
-
improve performance. Defaults to
|
509
|
-
|
540
|
+
improve performance. Defaults to "auto", which will attempt to
|
541
|
+
apply on-the-fly cropping where possible (some clipped model
|
542
|
+
files restricted entirely to the western hemisphere are not
|
543
|
+
suitable for on-the-fly cropping). Set `crop_buffer` to
|
544
|
+
customise the buffer distance used to crop the files.
|
510
545
|
crop_buffer : int or float, optional
|
511
546
|
The buffer distance in degrees used to crop tide model
|
512
547
|
constituent files around the modelling area. Defaults to 5,
|
513
548
|
which will crop constituents using a five degree buffer on
|
514
549
|
either side of the analysis extent.
|
550
|
+
append_node: bool, optional
|
551
|
+
Apply adjustments to harmonic constituents to allow for periodic
|
552
|
+
modulations over the 18.6-year nodal period (lunar nodal tide).
|
553
|
+
Default is False.
|
515
554
|
parallel : bool, optional
|
516
555
|
Whether to parallelise tide modelling. If multiple tide models
|
517
556
|
are requested, these will be run in parallel. If enough workers
|
@@ -600,6 +639,7 @@ def model_tides(
|
|
600
639
|
cutoff=np.inf if cutoff is None else cutoff,
|
601
640
|
crop=crop,
|
602
641
|
crop_buffer=crop_buffer,
|
642
|
+
append_node=append_node,
|
603
643
|
)
|
604
644
|
|
605
645
|
# If automatic parallel splits, calculate optimal value
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: eo-tides
|
3
|
-
Version: 0.6.2.
|
3
|
+
Version: 0.6.2.dev10
|
4
4
|
Summary: Tide modelling tools for large-scale satellite earth observation analysis
|
5
5
|
Project-URL: Homepage, https://GeoscienceAustralia.github.io/eo-tides/
|
6
6
|
Project-URL: Repository, https://github.com/GeoscienceAustralia/eo-tides
|
@@ -0,0 +1,10 @@
|
|
1
|
+
eo_tides/__init__.py,sha256=pGvVlxMKiYjm_273G-oYcOgVuPra7uEdNZv0oN1i69c,1693
|
2
|
+
eo_tides/eo.py,sha256=TuFt9SSiO9Z2o8Kr1g-wFPzofp0HTcgkfhT83zu03kc,23983
|
3
|
+
eo_tides/model.py,sha256=EqulqgiqwzOOtBSqgPHDIX1tW3w6e-lkjF6nsjWFG1U,37173
|
4
|
+
eo_tides/stats.py,sha256=ELQpqIH86442IYgjrGrIK3mi0-pu2ZijFw53arA2FYg,23072
|
5
|
+
eo_tides/utils.py,sha256=T19OuPLHzaUKcovCVGANvmOiRu-L8VuDXSTzmNlA6Bo,26647
|
6
|
+
eo_tides/validation.py,sha256=KP8WLT5z7KLFjQ9oDla7VJOyLQAK4SVbcz2ySAbsbwI,11882
|
7
|
+
eo_tides-0.6.2.dev10.dist-info/METADATA,sha256=3_zi2dkFv8Qp85fc6L0po2yJdViJgYUanWidCLF4Wsc,8190
|
8
|
+
eo_tides-0.6.2.dev10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
+
eo_tides-0.6.2.dev10.dist-info/licenses/LICENSE,sha256=owxWsXViCL2J6Ks3XYhot7t4Y93nstmXAT95Zf030Cc,11350
|
10
|
+
eo_tides-0.6.2.dev10.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
eo_tides/__init__.py,sha256=pGvVlxMKiYjm_273G-oYcOgVuPra7uEdNZv0oN1i69c,1693
|
2
|
-
eo_tides/eo.py,sha256=TuFt9SSiO9Z2o8Kr1g-wFPzofp0HTcgkfhT83zu03kc,23983
|
3
|
-
eo_tides/model.py,sha256=JjlT5TgylqKTAw-WQ-BC4zhDL7B_QNP0fwtDyZmX9Y4,35553
|
4
|
-
eo_tides/stats.py,sha256=ELQpqIH86442IYgjrGrIK3mi0-pu2ZijFw53arA2FYg,23072
|
5
|
-
eo_tides/utils.py,sha256=T19OuPLHzaUKcovCVGANvmOiRu-L8VuDXSTzmNlA6Bo,26647
|
6
|
-
eo_tides/validation.py,sha256=KP8WLT5z7KLFjQ9oDla7VJOyLQAK4SVbcz2ySAbsbwI,11882
|
7
|
-
eo_tides-0.6.2.dev7.dist-info/METADATA,sha256=yX0vxHGViA29zRXoOljVkREx2rNVK63YFmGhrWjHWJQ,8189
|
8
|
-
eo_tides-0.6.2.dev7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
-
eo_tides-0.6.2.dev7.dist-info/licenses/LICENSE,sha256=owxWsXViCL2J6Ks3XYhot7t4Y93nstmXAT95Zf030Cc,11350
|
10
|
-
eo_tides-0.6.2.dev7.dist-info/RECORD,,
|
File without changes
|
File without changes
|