eo-tides 0.6.0__py3-none-any.whl → 0.6.1.dev6__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 CHANGED
@@ -19,6 +19,7 @@ import numpy as np
19
19
  import pandas as pd
20
20
  import pyproj
21
21
  import pyTMD
22
+ import timescale.time
22
23
  from tqdm import tqdm
23
24
 
24
25
  from .utils import DatetimeLike, _set_directory, _standardise_models, _standardise_time, idw
@@ -95,7 +96,7 @@ def _model_tides(
95
96
  lon, lat = transformer.transform(x.flatten(), y.flatten())
96
97
 
97
98
  # Convert datetime
98
- timescale = pyTMD.time.timescale().from_datetime(time.flatten())
99
+ ts = timescale.time.Timescale().from_datetime(time.flatten())
99
100
 
100
101
  try:
101
102
  # Read tidal constants and interpolate to grid points
@@ -136,10 +137,10 @@ def _model_tides(
136
137
  # Compute delta times based on model
137
138
  if pytmd_model.corrections in ("OTIS", "ATLAS", "TMD3", "netcdf"):
138
139
  # Use delta time at 2000.0 to match TMD outputs
139
- deltat = np.zeros_like(timescale.tt_ut1)
140
+ deltat = np.zeros_like(ts.tt_ut1)
140
141
  else:
141
142
  # Use interpolated delta times
142
- deltat = timescale.tt_ut1
143
+ deltat = ts.tt_ut1
143
144
 
144
145
  # In "one-to-many" mode, extracted tidal constituents and timesteps
145
146
  # are repeated/multiplied out to match the number of input points and
@@ -149,7 +150,7 @@ def _model_tides(
149
150
  points_repeat = len(x) if mode == "one-to-many" else 1
150
151
  time_repeat = len(time) if mode == "one-to-many" else 1
151
152
  t, hc, deltat = (
152
- np.tile(timescale.tide, points_repeat),
153
+ np.tile(ts.tide, points_repeat),
153
154
  hc.repeat(time_repeat, axis=0),
154
155
  np.tile(deltat, points_repeat),
155
156
  )
@@ -430,10 +431,15 @@ def model_tides(
430
431
 
431
432
  Parameters
432
433
  ----------
433
- x, y : float or list of float
434
- One or more x and y coordinates used to define
435
- the location at which to model tides. By default these
436
- coordinates should be lat/lon; use "crs" if they
434
+ x : float or list of float
435
+ One or more x coordinates used to define the location at
436
+ which to model tides. By default these coordinates should
437
+ be in "EPSG:4326" WGS84 degrees longitude; use "crs" if they
438
+ are in a custom coordinate reference system.
439
+ y : float or list of float
440
+ One or more y coordinates used to define the location at
441
+ which to model tides. By default these coordinates should
442
+ be in "EPSG:4326" WGS84 degrees latitude; use "crs" if they
437
443
  are in a custom coordinate reference system.
438
444
  time : DatetimeLike
439
445
  Times at which to model tide heights (in UTC). Accepts
@@ -465,7 +471,7 @@ def model_tides(
465
471
  multiple spatial points (e.g. for the same set of satellite
466
472
  acquisition times at various locations across your study area).
467
473
  - "one-to-one": Model tides using a unique timestep for each
468
- set of x and y coordinates. In this mode, the number of x and
474
+ x and y coordinate pair. In this mode, the number of x and
469
475
  y points must equal the number of timesteps provided in "time".
470
476
  output_format : str, optional
471
477
  Whether to return the output dataframe in long format (with
@@ -487,8 +493,12 @@ def model_tides(
487
493
  - "spline": scipy bivariate spline interpolation
488
494
  - "bilinear": quick bilinear interpolation
489
495
  extrapolate : bool, optional
490
- Whether to extrapolate tides into x and y coordinates outside of
491
- the valid tide modelling domain using nearest-neighbor.
496
+ Whether to extrapolate tides into x and y coordinates outside
497
+ of the valid tide modelling domain using nearest-neighbor
498
+ interpolation. The default of True ensures that modelled tides
499
+ will be returned even if there is no underlying tide model
500
+ data for a location (e.g. inside estuaries far from the
501
+ coastline). However, this can also produce unreliable results.
492
502
  cutoff : float, optional
493
503
  Extrapolation cutoff in kilometers. The default is None, which
494
504
  will extrapolate for all points regardless of distance from the
@@ -500,13 +510,13 @@ def model_tides(
500
510
  crop_buffer : int or float, optional
501
511
  The buffer distance in degrees used to crop tide model
502
512
  constituent files around the modelling area. Defaults to 5,
503
- which will crop constituents using a five degree buffer on either
504
- side of the analysis extent.
513
+ which will crop constituents using a five degree buffer on
514
+ either side of the analysis extent.
505
515
  parallel : bool, optional
506
- Whether to parallelise tide modelling. If multiple tide models are
507
- requested, these will be run in parallel using `concurrent.futures`.
508
- If enough workers are available, the analysis will also be split
509
- into spatial chunks for additional parallelisation (see "parallel_splits"
516
+ Whether to parallelise tide modelling. If multiple tide models
517
+ are requested, these will be run in parallel. If enough workers
518
+ are available, the analysis will also be split into spatial
519
+ chunks for additional parallelisation (see "parallel_splits"
510
520
  below). Default is True.
511
521
  parallel_splits : str or int, optional
512
522
  Whether to split the input x and y coordinates into smaller,
@@ -721,11 +731,16 @@ def model_phases(
721
731
 
722
732
  Parameters
723
733
  ----------
724
- x, y : float or list of float
725
- One or more x and y coordinates used to define
726
- the location at which to model tide phases. By default
727
- these coordinates should be lat/lon; use "crs" if they
728
- are in a custom coordinate reference system.
734
+ x : float or list of float
735
+ One or more x coordinates used to define the location at
736
+ which to model tide phases. By default these coordinates
737
+ should be in "EPSG:4326" WGS84 degrees longitude; use "crs"
738
+ if they are in a custom coordinate reference system.
739
+ y : float or list of float
740
+ One or more y coordinates used to define the location at
741
+ which to model tide phases. By default these coordinates
742
+ should be in "EPSG:4326" WGS84 degrees latitude; use "crs"
743
+ if they are in a custom coordinate reference system.
729
744
  time : DatetimeLike
730
745
  Times at which to model tide phases (in UTC). Accepts
731
746
  any format that can be converted by `pandas.to_datetime()`;
eo_tides/utils.py CHANGED
@@ -181,9 +181,9 @@ def _clip_model_file(
181
181
  """
182
182
  Clips tide model netCDF datasets to a bounding box.
183
183
 
184
- If the bounding box crosses 0 degrees longitude (e.g. Greenwich),
185
- the function will clip the dataset into two parts and concatenate
186
- them along the x-dimension to create a continuous result.
184
+ If the bounding box crosses 0 degrees longitude (e.g. Greenwich prime
185
+ meridian), the dataset will be clipped into two parts and concatenated
186
+ along the x-dimension to create a continuous result.
187
187
 
188
188
  Parameters
189
189
  ----------
@@ -226,20 +226,22 @@ def _clip_model_file(
226
226
  xcoords = nc[xcoord].compute()
227
227
  ycoords = nc[ycoord].compute()
228
228
 
229
- # If data falls within 0-360 degree bounds, then clip directly
230
- if (bbox.left >= 0) & (bbox.right <= 360):
229
+ # Convert longitudes to 0-360 convention
230
+ left = bbox.left % 360
231
+ right = bbox.right % 360
232
+
233
+ # If left coordinate is smaller than right, bbox does not cross
234
+ # zero longitude and can be clipped directly
235
+ if left <= right: # bbox does not cross 0
231
236
  nc_clipped = nc.sel({
232
237
  ydim: (ycoords >= bbox.bottom) & (ycoords <= bbox.top),
233
- xdim: (xcoords >= bbox.left) & (xcoords <= bbox.right),
238
+ xdim: (xcoords >= left) & (xcoords <= right),
234
239
  })
235
240
 
236
- # If bbox crosses zero longitude, extract left and right
237
- # separately and then combine into one concatenated dataset
238
- elif (bbox.left < 0) & (bbox.right > 0):
239
- # Convert longitudes to 0-360 range
240
- left = bbox.left % 360
241
- right = bbox.right % 360
242
-
241
+ # If left coordinate is larger than right, bbox crosses zero longitude.
242
+ # If so, extract left and right separately and then combine into one
243
+ # concatenated dataset
244
+ elif left > right: # bbox crosses 0
243
245
  # Extract data from left of 0 longitude, and convert lon
244
246
  # coords to -180 to 0 range to enable continuous interpolation
245
247
  # across 0 boundary
@@ -357,7 +359,7 @@ def clip_models(
357
359
  model_files = model_database[m].get("model_file", [])
358
360
  grid_file = model_database[m].get("grid_file", [])
359
361
 
360
- # Convert to list if strings and combine
362
+ # Convert to list of strings and combine
361
363
  model_files = model_files if isinstance(model_files, list) else [model_files]
362
364
  grid_file = grid_file if isinstance(grid_file, list) else [grid_file]
363
365
  all_files = model_files + grid_file
@@ -1,28 +1,27 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: eo-tides
3
- Version: 0.6.0
3
+ Version: 0.6.1.dev6
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
- Keywords: earth observation,tide modelling,tide modeling,satellite data,coastal analysis,oceanography,remote sensing
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,18 +31,20 @@ 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: pyTMD==2.2.1
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
38
+ Requires-Dist: timescale>=0.0.3
39
39
  Requires-Dist: tqdm>=4.55.0
40
40
  Requires-Dist: xarray>=2022.3.0
41
41
  Provides-Extra: notebooks
42
- Requires-Dist: odc-stac>=0.3.10; extra == "notebooks"
43
- Requires-Dist: odc-geo[tiff,warp]>=0.4.7; extra == "notebooks"
44
- Requires-Dist: pystac-client>=0.8.3; extra == "notebooks"
45
- Requires-Dist: folium>=0.16.0; extra == "notebooks"
46
- Requires-Dist: planetary_computer>=1.0.0; extra == "notebooks"
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
47
48
 
48
49
  # `eo-tides`: Tide modelling tools for large-scale satellite earth observation analysis
49
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=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.1.dev6.dist-info/METADATA,sha256=HaLaT7M4sXeNOKVG6OvMWxc1Yv4T-M-tw3_YcI5nquU,8189
8
+ eo_tides-0.6.1.dev6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ eo_tides-0.6.1.dev6.dist-info/licenses/LICENSE,sha256=owxWsXViCL2J6Ks3XYhot7t4Y93nstmXAT95Zf030Cc,11350
10
+ eo_tides-0.6.1.dev6.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
@@ -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=C1KLX-Zd26tghGN-GcOo6J_EXYb6G6LDe_jFgV6dVNM,34697
4
- eo_tides/stats.py,sha256=ELQpqIH86442IYgjrGrIK3mi0-pu2ZijFw53arA2FYg,23072
5
- eo_tides/utils.py,sha256=9xJ1q-b-TVHg5zFyLy6AT_srrPQDvmFdWJmlGSPaJF0,26563
6
- eo_tides/validation.py,sha256=KP8WLT5z7KLFjQ9oDla7VJOyLQAK4SVbcz2ySAbsbwI,11882
7
- eo_tides-0.6.0.dist-info/LICENSE,sha256=owxWsXViCL2J6Ks3XYhot7t4Y93nstmXAT95Zf030Cc,11350
8
- eo_tides-0.6.0.dist-info/METADATA,sha256=nyHw0zHLG-a-gvk4WUf2KHLplabBH12LSN-8uOjTC0M,8152
9
- eo_tides-0.6.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
10
- eo_tides-0.6.0.dist-info/top_level.txt,sha256=lXZDUUM1DlLdKWHRn8zdmtW8Rx-eQOIWVvt0b8VGiyQ,9
11
- eo_tides-0.6.0.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- eo_tides