eo-tides 0.6.1__py3-none-any.whl → 0.6.2__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 +87 -33
- {eo_tides-0.6.1.dist-info → eo_tides-0.6.2.dist-info}/METADATA +18 -18
- eo_tides-0.6.2.dist-info/RECORD +10 -0
- {eo_tides-0.6.1.dist-info → eo_tides-0.6.2.dist-info}/WHEEL +1 -2
- eo_tides-0.6.1.dist-info/RECORD +0 -11
- eo_tides-0.6.1.dist-info/top_level.txt +0 -1
- {eo_tides-0.6.1.dist-info → eo_tides-0.6.2.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,
|
@@ -431,10 +463,15 @@ def model_tides(
|
|
431
463
|
|
432
464
|
Parameters
|
433
465
|
----------
|
434
|
-
x
|
435
|
-
One or more x
|
436
|
-
|
437
|
-
|
466
|
+
x : float or list of float
|
467
|
+
One or more x coordinates used to define the location at
|
468
|
+
which to model tides. By default these coordinates should
|
469
|
+
be in "EPSG:4326" WGS84 degrees longitude; use "crs" if they
|
470
|
+
are in a custom coordinate reference system.
|
471
|
+
y : float or list of float
|
472
|
+
One or more y coordinates used to define the location at
|
473
|
+
which to model tides. By default these coordinates should
|
474
|
+
be in "EPSG:4326" WGS84 degrees latitude; use "crs" if they
|
438
475
|
are in a custom coordinate reference system.
|
439
476
|
time : DatetimeLike
|
440
477
|
Times at which to model tide heights (in UTC). Accepts
|
@@ -466,7 +503,7 @@ def model_tides(
|
|
466
503
|
multiple spatial points (e.g. for the same set of satellite
|
467
504
|
acquisition times at various locations across your study area).
|
468
505
|
- "one-to-one": Model tides using a unique timestep for each
|
469
|
-
|
506
|
+
x and y coordinate pair. In this mode, the number of x and
|
470
507
|
y points must equal the number of timesteps provided in "time".
|
471
508
|
output_format : str, optional
|
472
509
|
Whether to return the output dataframe in long format (with
|
@@ -488,26 +525,37 @@ def model_tides(
|
|
488
525
|
- "spline": scipy bivariate spline interpolation
|
489
526
|
- "bilinear": quick bilinear interpolation
|
490
527
|
extrapolate : bool, optional
|
491
|
-
Whether to extrapolate tides into x and y coordinates outside
|
492
|
-
the valid tide modelling domain using nearest-neighbor
|
528
|
+
Whether to extrapolate tides into x and y coordinates outside
|
529
|
+
of the valid tide modelling domain using nearest-neighbor
|
530
|
+
interpolation. The default of True ensures that modelled tides
|
531
|
+
will be returned even if there is no underlying tide model
|
532
|
+
data for a location (e.g. inside estuaries far from the
|
533
|
+
coastline). However, this can also produce unreliable results.
|
493
534
|
cutoff : float, optional
|
494
535
|
Extrapolation cutoff in kilometers. The default is None, which
|
495
536
|
will extrapolate for all points regardless of distance from the
|
496
537
|
valid tide modelling domain.
|
497
|
-
crop : bool, optional
|
538
|
+
crop : bool or str, optional
|
498
539
|
Whether to crop tide model constituent files on-the-fly to
|
499
|
-
improve performance. Defaults to
|
500
|
-
|
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.
|
501
545
|
crop_buffer : int or float, optional
|
502
546
|
The buffer distance in degrees used to crop tide model
|
503
547
|
constituent files around the modelling area. Defaults to 5,
|
504
|
-
which will crop constituents using a five degree buffer on
|
505
|
-
side of the analysis extent.
|
548
|
+
which will crop constituents using a five degree buffer on
|
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.
|
506
554
|
parallel : bool, optional
|
507
|
-
Whether to parallelise tide modelling. If multiple tide models
|
508
|
-
requested, these will be run in parallel
|
509
|
-
|
510
|
-
|
555
|
+
Whether to parallelise tide modelling. If multiple tide models
|
556
|
+
are requested, these will be run in parallel. If enough workers
|
557
|
+
are available, the analysis will also be split into spatial
|
558
|
+
chunks for additional parallelisation (see "parallel_splits"
|
511
559
|
below). Default is True.
|
512
560
|
parallel_splits : str or int, optional
|
513
561
|
Whether to split the input x and y coordinates into smaller,
|
@@ -591,6 +639,7 @@ def model_tides(
|
|
591
639
|
cutoff=np.inf if cutoff is None else cutoff,
|
592
640
|
crop=crop,
|
593
641
|
crop_buffer=crop_buffer,
|
642
|
+
append_node=append_node,
|
594
643
|
)
|
595
644
|
|
596
645
|
# If automatic parallel splits, calculate optimal value
|
@@ -722,11 +771,16 @@ def model_phases(
|
|
722
771
|
|
723
772
|
Parameters
|
724
773
|
----------
|
725
|
-
x
|
726
|
-
One or more x
|
727
|
-
|
728
|
-
|
729
|
-
are in a custom coordinate reference system.
|
774
|
+
x : float or list of float
|
775
|
+
One or more x coordinates used to define the location at
|
776
|
+
which to model tide phases. By default these coordinates
|
777
|
+
should be in "EPSG:4326" WGS84 degrees longitude; use "crs"
|
778
|
+
if they are in a custom coordinate reference system.
|
779
|
+
y : float or list of float
|
780
|
+
One or more y coordinates used to define the location at
|
781
|
+
which to model tide phases. By default these coordinates
|
782
|
+
should be in "EPSG:4326" WGS84 degrees latitude; use "crs"
|
783
|
+
if they are in a custom coordinate reference system.
|
730
784
|
time : DatetimeLike
|
731
785
|
Times at which to model tide phases (in UTC). Accepts
|
732
786
|
any format that can be converted by `pandas.to_datetime()`;
|
@@ -1,28 +1,27 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: eo-tides
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.2
|
4
4
|
Summary: Tide modelling tools for large-scale satellite earth observation analysis
|
5
|
-
Author: Robbi Bishop-Taylor, Stephen Sagar, Claire Phillips, Vanessa Newey
|
6
|
-
Author-email: Robbi.BishopTaylor@ga.gov.au
|
7
5
|
Project-URL: Homepage, https://GeoscienceAustralia.github.io/eo-tides/
|
8
6
|
Project-URL: Repository, https://github.com/GeoscienceAustralia/eo-tides
|
9
7
|
Project-URL: Documentation, https://GeoscienceAustralia.github.io/eo-tides/
|
10
|
-
|
8
|
+
Author: Robbi Bishop-Taylor, Stephen Sagar, Claire Phillips, Vanessa Newey
|
9
|
+
Author-email: Robbi.BishopTaylor@ga.gov.au
|
10
|
+
License-File: LICENSE
|
11
|
+
Keywords: coastal analysis,earth observation,oceanography,remote sensing,satellite data,tide modeling,tide modelling
|
11
12
|
Classifier: Development Status :: 3 - Alpha
|
12
13
|
Classifier: Intended Audience :: Science/Research
|
13
|
-
Classifier: Topic :: Scientific/Engineering
|
14
|
-
Classifier: Topic :: Scientific/Engineering :: GIS
|
15
|
-
Classifier: Topic :: Scientific/Engineering :: Oceanography
|
16
|
-
Classifier: Topic :: Scientific/Engineering :: Visualization
|
17
|
-
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
18
14
|
Classifier: License :: OSI Approved :: Apache Software License
|
19
15
|
Classifier: Programming Language :: Python :: 3.10
|
20
16
|
Classifier: Programming Language :: Python :: 3.11
|
21
17
|
Classifier: Programming Language :: Python :: 3.12
|
22
18
|
Classifier: Programming Language :: Python :: 3.13
|
19
|
+
Classifier: Topic :: Scientific/Engineering
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Oceanography
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
23
24
|
Requires-Python: <4.0,>=3.10
|
24
|
-
Description-Content-Type: text/markdown
|
25
|
-
License-File: LICENSE
|
26
25
|
Requires-Dist: colorama>=0.4.3
|
27
26
|
Requires-Dist: geopandas>=0.10.0
|
28
27
|
Requires-Dist: matplotlib>=3.8.0
|
@@ -32,7 +31,7 @@ Requires-Dist: pandas>=2.2.0
|
|
32
31
|
Requires-Dist: psutil>=5.8.0
|
33
32
|
Requires-Dist: pyogrio>=0.10.0
|
34
33
|
Requires-Dist: pyproj>=3.7.0
|
35
|
-
Requires-Dist:
|
34
|
+
Requires-Dist: pytmd>=2.2.2
|
36
35
|
Requires-Dist: scikit-learn>=1.4.0
|
37
36
|
Requires-Dist: scipy>=1.14.1
|
38
37
|
Requires-Dist: shapely>=2.0.6
|
@@ -40,11 +39,12 @@ Requires-Dist: timescale>=0.0.3
|
|
40
39
|
Requires-Dist: tqdm>=4.55.0
|
41
40
|
Requires-Dist: xarray>=2022.3.0
|
42
41
|
Provides-Extra: notebooks
|
43
|
-
Requires-Dist:
|
44
|
-
Requires-Dist: odc-geo[tiff,warp]>=0.4.7; extra ==
|
45
|
-
Requires-Dist:
|
46
|
-
Requires-Dist:
|
47
|
-
Requires-Dist:
|
42
|
+
Requires-Dist: folium>=0.16.0; extra == 'notebooks'
|
43
|
+
Requires-Dist: odc-geo[tiff,warp]>=0.4.7; extra == 'notebooks'
|
44
|
+
Requires-Dist: odc-stac>=0.3.10; extra == 'notebooks'
|
45
|
+
Requires-Dist: planetary-computer>=1.0.0; extra == 'notebooks'
|
46
|
+
Requires-Dist: pystac-client>=0.8.3; extra == 'notebooks'
|
47
|
+
Description-Content-Type: text/markdown
|
48
48
|
|
49
49
|
# `eo-tides`: Tide modelling tools for large-scale satellite earth observation analysis
|
50
50
|
|
@@ -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.dist-info/METADATA,sha256=sbboJeyayqLIonkWQjjwWT5Svh8jKfTNfeotp7V-fsw,8184
|
8
|
+
eo_tides-0.6.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
+
eo_tides-0.6.2.dist-info/licenses/LICENSE,sha256=owxWsXViCL2J6Ks3XYhot7t4Y93nstmXAT95Zf030Cc,11350
|
10
|
+
eo_tides-0.6.2.dist-info/RECORD,,
|
eo_tides-0.6.1.dist-info/RECORD
DELETED
@@ -1,11 +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=XqgV3Arvkr3Z8PR6EvTMZbg8WnnpYCDOjFL2-sOXeF0,34695
|
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.1.dist-info/LICENSE,sha256=owxWsXViCL2J6Ks3XYhot7t4Y93nstmXAT95Zf030Cc,11350
|
8
|
-
eo_tides-0.6.1.dist-info/METADATA,sha256=sl9C1TQIgpC6ZDLeHAJOm0Ea9tyDyZU4zvJg4fd2OBE,8184
|
9
|
-
eo_tides-0.6.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
10
|
-
eo_tides-0.6.1.dist-info/top_level.txt,sha256=lXZDUUM1DlLdKWHRn8zdmtW8Rx-eQOIWVvt0b8VGiyQ,9
|
11
|
-
eo_tides-0.6.1.dist-info/RECORD,,
|
@@ -1 +0,0 @@
|
|
1
|
-
eo_tides
|
File without changes
|