eo-tides 0.7.6.dev1__py3-none-any.whl → 0.7.6.dev3__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/__init__.py +14 -18
- eo_tides/eo.py +57 -41
- eo_tides/model.py +227 -153
- eo_tides/stats.py +65 -27
- eo_tides/utils.py +107 -71
- eo_tides/validation.py +26 -21
- {eo_tides-0.7.6.dev1.dist-info → eo_tides-0.7.6.dev3.dist-info}/METADATA +2 -2
- eo_tides-0.7.6.dev3.dist-info/RECORD +10 -0
- eo_tides-0.7.6.dev1.dist-info/RECORD +0 -10
- {eo_tides-0.7.6.dev1.dist-info → eo_tides-0.7.6.dev3.dist-info}/WHEEL +0 -0
- {eo_tides-0.7.6.dev1.dist-info → eo_tides-0.7.6.dev3.dist-info}/licenses/LICENSE +0 -0
eo_tides/validation.py
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
"""Validation tools for comparing modelled tides to observed tide gauge data.
|
2
|
+
|
3
|
+
This module provides functions for loading, filtering, and analysing
|
4
|
+
observed tide gauge data to validate modelled tide heights.
|
5
|
+
"""
|
6
|
+
|
1
7
|
import datetime
|
2
8
|
import warnings
|
3
9
|
from math import sqrt
|
@@ -14,10 +20,8 @@ from shapely.geometry import Point
|
|
14
20
|
from sklearn.metrics import mean_absolute_error, mean_squared_error
|
15
21
|
|
16
22
|
|
17
|
-
def eval_metrics(x, y, round=3, all_regress=False):
|
18
|
-
"""
|
19
|
-
Calculate a set of common statistical metrics
|
20
|
-
based on two input actual and predicted vectors.
|
23
|
+
def eval_metrics(x, y, round=3, all_regress=False): # noqa: A002
|
24
|
+
"""Calculate common statistical validation metrics.
|
21
25
|
|
22
26
|
These include:
|
23
27
|
|
@@ -46,8 +50,8 @@ def eval_metrics(x, y, round=3, all_regress=False):
|
|
46
50
|
-------
|
47
51
|
pandas.Series
|
48
52
|
A `pd.Series` containing all calculated metrics.
|
49
|
-
"""
|
50
53
|
|
54
|
+
"""
|
51
55
|
# Create dataframe to drop na
|
52
56
|
xy_df = pd.DataFrame({"x": x, "y": y}).dropna()
|
53
57
|
|
@@ -77,9 +81,7 @@ def eval_metrics(x, y, round=3, all_regress=False):
|
|
77
81
|
|
78
82
|
|
79
83
|
def _round_date_strings(date, round_type="end"):
|
80
|
-
"""
|
81
|
-
Round a date string up or down to the start or end of a given time
|
82
|
-
period.
|
84
|
+
"""Round a date string up or down to the start or end of a time period.
|
83
85
|
|
84
86
|
Parameters
|
85
87
|
----------
|
@@ -107,8 +109,8 @@ def _round_date_strings(date, round_type="end"):
|
|
107
109
|
|
108
110
|
>>> round_date_strings('2020-01', round_type='end')
|
109
111
|
'2020-01-31 00:00:00'
|
110
|
-
"""
|
111
112
|
|
113
|
+
"""
|
112
114
|
# Determine precision of input date string
|
113
115
|
date_segments = len(date.split("-"))
|
114
116
|
|
@@ -194,8 +196,7 @@ def load_gauge_gesla(
|
|
194
196
|
data_path="GESLA3.0_ALL",
|
195
197
|
metadata_path="",
|
196
198
|
):
|
197
|
-
"""
|
198
|
-
Load Global Extreme Sea Level Analysis (GESLA) tide gauge data.
|
199
|
+
"""Load Global Extreme Sea Level Analysis (GESLA) tide gauge data.
|
199
200
|
|
200
201
|
Load and process all available GESLA measured sea-level data
|
201
202
|
with an `x, y, time` spatio-temporal query, or from a list of
|
@@ -259,24 +260,27 @@ def load_gauge_gesla(
|
|
259
260
|
- "use_flag": Use-in-analysis flag (1 = use, 0 = do not use),
|
260
261
|
|
261
262
|
...and additional columns from station metadata.
|
263
|
+
|
262
264
|
"""
|
263
265
|
# Expand and validate data and metadata paths
|
264
266
|
data_path = Path(data_path).expanduser()
|
265
267
|
metadata_path = Path(metadata_path).expanduser()
|
266
268
|
|
267
269
|
if not data_path.exists():
|
268
|
-
|
270
|
+
err_msg = (
|
269
271
|
f"GESLA raw data directory not found at: {data_path}\n"
|
270
272
|
"Download 'GESLA-3 DATA' from: "
|
271
|
-
"https://gesla787883612.wordpress.com/downloads/"
|
273
|
+
"https://gesla787883612.wordpress.com/downloads/",
|
272
274
|
)
|
275
|
+
raise FileNotFoundError(err_msg)
|
273
276
|
|
274
277
|
if not metadata_path.exists():
|
275
|
-
|
278
|
+
err_msg = (
|
276
279
|
f"GESLA station metadata file not found at: {metadata_path}\n"
|
277
280
|
"Download the 'GESLA-3 CSV META-DATA FILE' from: "
|
278
|
-
"https://gesla787883612.wordpress.com/downloads/"
|
281
|
+
"https://gesla787883612.wordpress.com/downloads/",
|
279
282
|
)
|
283
|
+
raise FileNotFoundError(err_msg)
|
280
284
|
|
281
285
|
# Load tide gauge metadata
|
282
286
|
metadata_df, metadata_gdf = _load_gauge_metadata(metadata_path)
|
@@ -297,20 +301,21 @@ def load_gauge_gesla(
|
|
297
301
|
site_code = (
|
298
302
|
_nearest_row(metadata_gdf, x, y, max_distance).rename({"index_right": "site_code"}, axis=1).site_code
|
299
303
|
)
|
300
|
-
# site_code = _nearest_row(metadata_gdf, x, y, max_distance).site_code
|
301
304
|
|
302
305
|
# Raise exception if no valid tide gauges are found
|
303
|
-
if site_code.
|
304
|
-
|
306
|
+
if site_code.isna().all():
|
307
|
+
err_msg = f"No tide gauge found within {max_distance} degrees of {x}, {y}."
|
308
|
+
raise Exception(err_msg)
|
305
309
|
|
306
310
|
# Otherwise if all are None, return all available site codes
|
307
311
|
elif (site_code is None) & (x is None) & (y is None):
|
308
312
|
site_code = metadata_df.index.to_list()
|
309
313
|
|
310
314
|
else:
|
311
|
-
|
312
|
-
"`x` and `y` must be provided as either singular coordinates (e.g. `x=150`), or as a tuple bounding box (e.g. `x=(150, 152)`)."
|
315
|
+
err_msg = (
|
316
|
+
"`x` and `y` must be provided as either singular coordinates (e.g. `x=150`), or as a tuple bounding box (e.g. `x=(150, 152)`).",
|
313
317
|
)
|
318
|
+
raise Exception(err_msg)
|
314
319
|
|
315
320
|
# Prepare times
|
316
321
|
if time is None:
|
@@ -342,7 +347,7 @@ def load_gauge_gesla(
|
|
342
347
|
data_df = data_df.set_index("time", append=True)
|
343
348
|
duplicates = data_df.index.duplicated()
|
344
349
|
if duplicates.sum() > 0:
|
345
|
-
warnings.warn("Duplicate timestamps were removed.")
|
350
|
+
warnings.warn("Duplicate timestamps were removed.", stacklevel=2)
|
346
351
|
data_df = data_df.loc[~duplicates]
|
347
352
|
|
348
353
|
# Remove observed mean sea level if requested
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: eo-tides
|
3
|
-
Version: 0.7.6.
|
3
|
+
Version: 0.7.6.dev3
|
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
|
@@ -32,7 +32,7 @@ Requires-Dist: pandas>=2.2.0
|
|
32
32
|
Requires-Dist: psutil>=5.8.0
|
33
33
|
Requires-Dist: pyogrio>=0.10.0
|
34
34
|
Requires-Dist: pyproj>=3.7.0
|
35
|
-
Requires-Dist: pytmd
|
35
|
+
Requires-Dist: pytmd>=2.2.5
|
36
36
|
Requires-Dist: scikit-learn>=1.4.0
|
37
37
|
Requires-Dist: scipy>=1.14.1
|
38
38
|
Requires-Dist: shapely>=2.0.6
|
@@ -0,0 +1,10 @@
|
|
1
|
+
eo_tides/__init__.py,sha256=HYOWpUHL6oPyJimPOxeloMLyoZ66NYE8G--NPcW5B6o,1857
|
2
|
+
eo_tides/eo.py,sha256=dihO7hOi786Ozz3XwZ4GiWaAFR2j0zx-o8x9OG9wGsQ,24336
|
3
|
+
eo_tides/model.py,sha256=y1TZKS3C7enbfLE_UeST_1UPlnR2XtYE5mCiZrQMb2Y,39413
|
4
|
+
eo_tides/stats.py,sha256=oKq1TQm7LIN0QYVLQaNYxgvMemko6KQHC1sV41RDCZI,23678
|
5
|
+
eo_tides/utils.py,sha256=a9Uq5ZQWRasRbnvEY5N9H6OZNnRRck50cKkTBLs7V1Y,28578
|
6
|
+
eo_tides/validation.py,sha256=mgJBkt1zhkDbdKvX9pJav6LKEZHoZbd972pkx-OZzgc,12856
|
7
|
+
eo_tides-0.7.6.dev3.dist-info/METADATA,sha256=3FEOinJGnUwMCTNVkJ4sIThBY3GkatZOX6_i3trseXk,9319
|
8
|
+
eo_tides-0.7.6.dev3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
+
eo_tides-0.7.6.dev3.dist-info/licenses/LICENSE,sha256=owxWsXViCL2J6Ks3XYhot7t4Y93nstmXAT95Zf030Cc,11350
|
10
|
+
eo_tides-0.7.6.dev3.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
eo_tides/__init__.py,sha256=LLvX-IipE209LbYLObShRLO5vxQQYBaIP1d3TMHix24,1802
|
2
|
-
eo_tides/eo.py,sha256=geXMd9roM7UmZCHK7l7bUUXai2pXGDJdzgAw4GBJ_58,23944
|
3
|
-
eo_tides/model.py,sha256=SWqBr0ajin1gw37nYa8ukHHzeiebK5h8XvkXO9LMX4E,37480
|
4
|
-
eo_tides/stats.py,sha256=lvl9-0k20ffLQh8Y1kAC_afhjQviK11_3_saRUtX3ws,23009
|
5
|
-
eo_tides/utils.py,sha256=wfzJFjWrJVgN8TqRqvwE8Tbtb2WPUQRwmCsihb5j3jc,26625
|
6
|
-
eo_tides/validation.py,sha256=6ugPwhNglIovOVTaozZnAiLaIBqU5acOiVmFPHvFDHE,12657
|
7
|
-
eo_tides-0.7.6.dev1.dist-info/METADATA,sha256=Xv-Yg8N-7ZY6DljJFXro-w6JjUEAK75SszzogU_wHNE,9326
|
8
|
-
eo_tides-0.7.6.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
-
eo_tides-0.7.6.dev1.dist-info/licenses/LICENSE,sha256=owxWsXViCL2J6Ks3XYhot7t4Y93nstmXAT95Zf030Cc,11350
|
10
|
-
eo_tides-0.7.6.dev1.dist-info/RECORD,,
|
File without changes
|
File without changes
|