eo-tides 0.0.23__tar.gz → 0.1.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eo-tides
3
- Version: 0.0.23
3
+ Version: 0.1.1
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/
@@ -91,6 +91,10 @@ For instructions on how to set up these models for use in `eo-tides`, refer to [
91
91
 
92
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
93
 
94
+ ## Jupyter Notebooks code examples
95
+
96
+ Interactive Jupyter Notebook usage examples and more complex coastal EO case studies can be found in the [`docs/notebooks/`](https://github.com/GeoscienceAustralia/eo-tides/tree/main/docs/notebooks) directory, or [rendered in the documentation here](https://geoscienceaustralia.github.io/eo-tides/notebooks/Model_tides/).
97
+
94
98
  ## Citing `eo-tides`
95
99
 
96
100
  To cite `eo-tides` in your work, please use the following citation:
@@ -47,6 +47,10 @@ For instructions on how to set up these models for use in `eo-tides`, refer to [
47
47
 
48
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
49
 
50
+ ## Jupyter Notebooks code examples
51
+
52
+ Interactive Jupyter Notebook usage examples and more complex coastal EO case studies can be found in the [`docs/notebooks/`](https://github.com/GeoscienceAustralia/eo-tides/tree/main/docs/notebooks) directory, or [rendered in the documentation here](https://geoscienceaustralia.github.io/eo-tides/notebooks/Model_tides/).
53
+
50
54
  ## Citing `eo-tides`
51
55
 
52
56
  To cite `eo-tides` in your work, please use the following citation:
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
 
4
4
  import os
5
5
  import pathlib
6
+ import textwrap
6
7
  import warnings
7
8
  from concurrent.futures import ProcessPoolExecutor
8
9
  from concurrent.futures.process import BrokenProcessPool
@@ -148,16 +149,19 @@ def list_models(
148
149
 
149
150
  # Raise error or warning if no models are available
150
151
  if not available_models:
151
- warning_text = (
152
- f"No valid tide models are available in `{directory}`. "
153
- "Are you sure you have provided the correct `directory` path, "
154
- "or set the `EO_TIDES_TIDE_MODELS` environment variable "
155
- "to point to the location of your tide model directory?"
156
- )
152
+ warning_msg = textwrap.dedent(
153
+ f"""
154
+ No valid tide models are available in `{directory}`.
155
+ Are you sure you have provided the correct `directory` path, or set the
156
+ `EO_TIDES_TIDE_MODELS` environment variable to point to the location of your
157
+ tide model directory?
158
+ """
159
+ ).strip()
160
+
157
161
  if raise_error:
158
- raise Exception(warning_text)
162
+ raise Exception(warning_msg)
159
163
  else:
160
- warnings.warn(warning_text, UserWarning)
164
+ warnings.warn(warning_msg, UserWarning)
161
165
 
162
166
  # Return list of available and supported models
163
167
  return available_models, supported_models
@@ -286,12 +290,14 @@ def _model_tides(
286
290
 
287
291
  # Raise error if constituent files no not cover analysis extent
288
292
  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
- )
293
+ error_msg = textwrap.dedent(
294
+ f"""
295
+ The {model} tide model constituent files do not cover the requested analysis extent.
296
+ This can occur if you are using clipped model files to improve run times.
297
+ Consider using model files that cover your entire analysis area, or set `crop=False`
298
+ to reduce the extent of tide model constituent files that is loaded.
299
+ """
300
+ ).strip()
295
301
  raise Exception(error_msg)
296
302
 
297
303
  # Calculate complex phase in radians for Euler's
@@ -562,8 +568,8 @@ def model_tides(
562
568
  <https://pytmd.readthedocs.io/en/latest/getting_started/Getting-Started.html#directories>
563
569
 
564
570
  This function is a modification of the `pyTMD` package's
565
- `compute_tidal_elevations` function. For more info:
566
- <https://pytmd.readthedocs.io/en/latest/api_reference/compute_tidal_elevations.html>
571
+ `pyTMD.compute.tide_elevations` function. For more info:
572
+ <https://pytmd.readthedocs.io/en/latest/api_reference/compute.html#pyTMD.compute.tide_elevations>
567
573
 
568
574
  Parameters
569
575
  ----------
@@ -136,7 +136,7 @@ def _plot_biases(
136
136
 
137
137
 
138
138
  def tide_stats(
139
- ds: xr.Dataset,
139
+ ds: xr.Dataset | xr.DataArray,
140
140
  model: str = "EOT20",
141
141
  directory: str | os.PathLike | None = None,
142
142
  tidepost_lat: float | None = None,
@@ -167,7 +167,7 @@ def tide_stats(
167
167
 
168
168
  Parameters
169
169
  ----------
170
- ds : xarray.Dataset
170
+ ds : xarray.Dataset or xarray.DataArray
171
171
  A multi-dimensional dataset (e.g. "x", "y", "time") used
172
172
  to calculate tide statistics. This dataset must contain
173
173
  a "time" dimension.
@@ -266,7 +266,7 @@ def tide_stats(
266
266
  return_tideposts=True,
267
267
  **model_tides_kwargs,
268
268
  )
269
- obs_tides_da = obs_tides_da.sortby("time")
269
+ obs_tides_da = obs_tides_da.reindex_like(ds)
270
270
 
271
271
  # Generate range of times covering entire period of satellite record
272
272
  all_timerange = pd.date_range(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eo-tides
3
- Version: 0.0.23
3
+ Version: 0.1.1
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/
@@ -91,6 +91,10 @@ For instructions on how to set up these models for use in `eo-tides`, refer to [
91
91
 
92
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
93
 
94
+ ## Jupyter Notebooks code examples
95
+
96
+ Interactive Jupyter Notebook usage examples and more complex coastal EO case studies can be found in the [`docs/notebooks/`](https://github.com/GeoscienceAustralia/eo-tides/tree/main/docs/notebooks) directory, or [rendered in the documentation here](https://geoscienceaustralia.github.io/eo-tides/notebooks/Model_tides/).
97
+
94
98
  ## Citing `eo-tides`
95
99
 
96
100
  To cite `eo-tides` in your work, please use the following citation:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "eo-tides"
3
- version = "0.0.23"
3
+ version = "0.1.1"
4
4
  description = "Tide modelling tools for large-scale satellite earth observation analysis"
5
5
  authors = [{ name = "Robbi Bishop-Taylor", email = "Robbi.BishopTaylor@ga.gov.au" }]
6
6
  readme = "README.md"
@@ -223,6 +223,10 @@ def test_model_tides_mode(mode, models, output_format):
223
223
  assert all(modelled_tides_df.index.get_level_values("x") == np.tile(x, len(models)))
224
224
  assert all(modelled_tides_df.index.get_level_values("y") == np.tile(y, len(models)))
225
225
 
226
+ # Verify correct models exist in column
227
+ assert "tide_model" in modelled_tides_df.columns
228
+ assert all(modelled_tides_df.tide_model.unique() == models)
229
+
226
230
  if mode == "one-to-many":
227
231
  if output_format == "wide":
228
232
  # In "wide" output format, the number of rows should equal
@@ -243,6 +247,10 @@ def test_model_tides_mode(mode, models, output_format):
243
247
  assert all(modelled_tides_df.index.get_level_values("x") == np.tile(np.repeat(x, len(times)), len(models)))
244
248
  assert all(modelled_tides_df.index.get_level_values("y") == np.tile(np.repeat(y, len(times)), len(models)))
245
249
 
250
+ # Verify correct models exist in column
251
+ assert "tide_model" in modelled_tides_df.columns
252
+ assert all(modelled_tides_df.tide_model.unique() == models)
253
+
246
254
 
247
255
  # Test ensemble modelling functionality
248
256
  def test_model_tides_ensemble():
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes