eo-tides 0.5.0__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 +50 -0
- eo_tides/eo.py +532 -0
- eo_tides/model.py +825 -0
- eo_tides/stats.py +581 -0
- eo_tides/utils.py +705 -0
- eo_tides/validation.py +334 -0
- eo_tides-0.5.0.dist-info/LICENSE +201 -0
- eo_tides-0.5.0.dist-info/METADATA +118 -0
- eo_tides-0.5.0.dist-info/RECORD +11 -0
- eo_tides-0.5.0.dist-info/WHEEL +5 -0
- eo_tides-0.5.0.dist-info/top_level.txt +1 -0
eo_tides/validation.py
ADDED
@@ -0,0 +1,334 @@
|
|
1
|
+
import datetime
|
2
|
+
import warnings
|
3
|
+
from math import sqrt
|
4
|
+
from numbers import Number
|
5
|
+
|
6
|
+
import geopandas as gpd
|
7
|
+
import pandas as pd
|
8
|
+
import tqdm
|
9
|
+
from odc.geo.geom import BoundingBox
|
10
|
+
from pandas.tseries.offsets import MonthBegin, MonthEnd, YearBegin, YearEnd
|
11
|
+
from scipy import stats
|
12
|
+
from shapely.geometry import Point
|
13
|
+
from sklearn.metrics import mean_absolute_error, mean_squared_error
|
14
|
+
|
15
|
+
|
16
|
+
def eval_metrics(x, y, round=3, all_regress=False):
|
17
|
+
"""
|
18
|
+
Calculate a set of common statistical metrics
|
19
|
+
based on two input actual and predicted vectors.
|
20
|
+
|
21
|
+
These include:
|
22
|
+
|
23
|
+
* Pearson correlation
|
24
|
+
* Root Mean Squared Error
|
25
|
+
* Mean Absolute Error
|
26
|
+
* R-squared
|
27
|
+
* Bias
|
28
|
+
* Linear regression parameters (slope, p-value, intercept, standard error)
|
29
|
+
|
30
|
+
Parameters
|
31
|
+
----------
|
32
|
+
x : numpy.array
|
33
|
+
An array providing "actual" variable values.
|
34
|
+
y : numpy.array
|
35
|
+
An array providing "predicted" variable values.
|
36
|
+
round : int
|
37
|
+
Number of decimal places to round each metric
|
38
|
+
to. Defaults to 3.
|
39
|
+
all_regress : bool
|
40
|
+
Whether to return linear regression p-value,
|
41
|
+
intercept and standard error (in addition to
|
42
|
+
only regression slope). Defaults to False.
|
43
|
+
|
44
|
+
Returns
|
45
|
+
-------
|
46
|
+
pandas.Series
|
47
|
+
A `pd.Series` containing all calculated metrics.
|
48
|
+
"""
|
49
|
+
|
50
|
+
# Create dataframe to drop na
|
51
|
+
xy_df = pd.DataFrame({"x": x, "y": y}).dropna()
|
52
|
+
|
53
|
+
# Compute linear regression
|
54
|
+
lin_reg = stats.linregress(x=xy_df.x, y=xy_df.y)
|
55
|
+
|
56
|
+
# Calculate statistics
|
57
|
+
stats_dict = {
|
58
|
+
"Correlation": xy_df.corr().iloc[0, 1],
|
59
|
+
"RMSE": sqrt(mean_squared_error(xy_df.x, xy_df.y)),
|
60
|
+
"MAE": mean_absolute_error(xy_df.x, xy_df.y),
|
61
|
+
"R-squared": lin_reg.rvalue**2,
|
62
|
+
"Bias": (xy_df.y - xy_df.x).mean(),
|
63
|
+
"Regression slope": lin_reg.slope,
|
64
|
+
}
|
65
|
+
|
66
|
+
# Additional regression params
|
67
|
+
if all_regress:
|
68
|
+
stats_dict.update({
|
69
|
+
"Regression p-value": lin_reg.pvalue,
|
70
|
+
"Regression intercept": lin_reg.intercept,
|
71
|
+
"Regression standard error": lin_reg.stderr,
|
72
|
+
})
|
73
|
+
|
74
|
+
# Return as
|
75
|
+
return pd.Series(stats_dict).round(round)
|
76
|
+
|
77
|
+
|
78
|
+
def _round_date_strings(date, round_type="end"):
|
79
|
+
"""
|
80
|
+
Round a date string up or down to the start or end of a given time
|
81
|
+
period.
|
82
|
+
|
83
|
+
Parameters
|
84
|
+
----------
|
85
|
+
date : str
|
86
|
+
Date string of variable precision (e.g. "2020", "2020-01",
|
87
|
+
"2020-01-01").
|
88
|
+
round_type : str, optional
|
89
|
+
Type of rounding to perform. Valid options are "start" or "end".
|
90
|
+
If "start", date is rounded down to the start of the time period.
|
91
|
+
If "end", date is rounded up to the end of the time period.
|
92
|
+
Default is "end".
|
93
|
+
|
94
|
+
Returns
|
95
|
+
-------
|
96
|
+
date_rounded : str
|
97
|
+
The rounded date string.
|
98
|
+
|
99
|
+
Examples
|
100
|
+
--------
|
101
|
+
>>> round_date_strings('2020')
|
102
|
+
'2020-12-31 00:00:00'
|
103
|
+
|
104
|
+
>>> round_date_strings('2020-01', round_type='start')
|
105
|
+
'2020-01-01 00:00:00'
|
106
|
+
|
107
|
+
>>> round_date_strings('2020-01', round_type='end')
|
108
|
+
'2020-01-31 00:00:00'
|
109
|
+
"""
|
110
|
+
|
111
|
+
# Determine precision of input date string
|
112
|
+
date_segments = len(date.split("-"))
|
113
|
+
|
114
|
+
# If provided date has no "-", treat it as having year precision
|
115
|
+
if date_segments == 1 and round_type == "start":
|
116
|
+
date_rounded = str(pd.to_datetime(date) + YearBegin(0))
|
117
|
+
elif date_segments == 1 and round_type == "end":
|
118
|
+
date_rounded = str(pd.to_datetime(date) + YearEnd(0))
|
119
|
+
|
120
|
+
# If provided date has one "-", treat it as having month precision
|
121
|
+
elif date_segments == 2 and round_type == "start":
|
122
|
+
date_rounded = str(pd.to_datetime(date) + MonthBegin(0))
|
123
|
+
elif date_segments == 2 and round_type == "end":
|
124
|
+
date_rounded = str(pd.to_datetime(date) + MonthEnd(0))
|
125
|
+
|
126
|
+
# If more than one "-", then return date as-is
|
127
|
+
elif date_segments > 2:
|
128
|
+
date_rounded = date
|
129
|
+
|
130
|
+
return date_rounded
|
131
|
+
|
132
|
+
|
133
|
+
def _load_gauge_metadata(metadata_path):
|
134
|
+
# Load metadata
|
135
|
+
metadata_df = pd.read_csv(metadata_path)
|
136
|
+
metadata_df.columns = (
|
137
|
+
metadata_df.columns.str.replace(" ", "_", regex=False)
|
138
|
+
.str.replace("(", "", regex=False)
|
139
|
+
.str.replace(")", "", regex=False)
|
140
|
+
.str.replace("/", "_", regex=False)
|
141
|
+
.str.lower()
|
142
|
+
)
|
143
|
+
metadata_df = metadata_df.set_index("site_code")
|
144
|
+
|
145
|
+
# Convert metadata to GeoDataFrame
|
146
|
+
metadata_gdf = gpd.GeoDataFrame(
|
147
|
+
data=metadata_df,
|
148
|
+
geometry=gpd.points_from_xy(metadata_df.longitude, metadata_df.latitude),
|
149
|
+
crs="EPSG:4326",
|
150
|
+
)
|
151
|
+
|
152
|
+
return metadata_df, metadata_gdf
|
153
|
+
|
154
|
+
|
155
|
+
def _load_gesla_dataset(site, path, na_value):
|
156
|
+
# Read dataset
|
157
|
+
gesla_df = pd.read_csv(
|
158
|
+
path,
|
159
|
+
skiprows=41,
|
160
|
+
names=["date", "time", "sea_level", "qc_flag", "use_flag"],
|
161
|
+
sep=r"\s+",
|
162
|
+
na_values=na_value,
|
163
|
+
)
|
164
|
+
|
165
|
+
# Combine two date fields
|
166
|
+
gesla_df = (
|
167
|
+
gesla_df.assign(
|
168
|
+
time=pd.to_datetime(gesla_df["date"] + " " + gesla_df["time"]),
|
169
|
+
site_code=site,
|
170
|
+
)
|
171
|
+
.drop(columns=["date"])
|
172
|
+
.set_index("time")
|
173
|
+
)
|
174
|
+
|
175
|
+
return gesla_df
|
176
|
+
|
177
|
+
|
178
|
+
def _nearest_row(gdf, x, y, max_distance=None):
|
179
|
+
# Create a point to find the nearest neighbor for
|
180
|
+
target_point = gpd.GeoDataFrame({"geometry": [Point(x, y)]}, crs="EPSG:4326")
|
181
|
+
|
182
|
+
# Use sjoin_nearest to find the closest point
|
183
|
+
return gpd.sjoin_nearest(target_point, gdf, how="left", max_distance=max_distance)
|
184
|
+
|
185
|
+
|
186
|
+
def load_gauge_gesla(
|
187
|
+
x=None,
|
188
|
+
y=None,
|
189
|
+
site_code=None,
|
190
|
+
time=("2018", "2020"),
|
191
|
+
max_distance=None,
|
192
|
+
correct_mean=False,
|
193
|
+
filter_use_flag=True,
|
194
|
+
site_metadata=True,
|
195
|
+
data_path="/gdata1/data/sea_level/gesla/",
|
196
|
+
metadata_path="/gdata1/data/sea_level/GESLA3_ALL 2.csv",
|
197
|
+
):
|
198
|
+
"""
|
199
|
+
Load Global Extreme Sea Level Analysis (GESLA) tide gauge data.
|
200
|
+
|
201
|
+
Load and process all available GESLA measured sea-level data
|
202
|
+
with an `x, y, time` spatio-temporal query, or from a list of
|
203
|
+
specific tide gauges. Can optionally filter by gauge quality
|
204
|
+
and append detailed gauge metadata.
|
205
|
+
|
206
|
+
Modified from original code in <https://github.com/philiprt/GeslaDataset>.
|
207
|
+
|
208
|
+
Parameters
|
209
|
+
----------
|
210
|
+
x, y : numeric or list/tuple, optional
|
211
|
+
Coordinates (in degrees longitude, latitude) used to load GESLA
|
212
|
+
tide gauge observations. If provided as singular values
|
213
|
+
(e.g. `x=150, y=-32`), then the nearest tide gauge will be returned.
|
214
|
+
If provided as a list or tuple (e.g. `x=(150, 152), y=(-32, -30)`),
|
215
|
+
then all gauges within the provided bounding box will be loaded.
|
216
|
+
Leave as `None` to return all available gauges, or if providing a
|
217
|
+
list of site codes using `site_code`.
|
218
|
+
site_code : str or list of str, optional
|
219
|
+
GESLA site code(s) for which to load data (e.g. `site_code="62650"`).
|
220
|
+
If `site_code` is provided, `x` and `y` will be ignored.
|
221
|
+
time : tuple or list of str, optional
|
222
|
+
Time range to consider, given as a tuple of start and end dates,
|
223
|
+
e.g. `time=("2020", "2021")`. The default of None will return all
|
224
|
+
tide observations from the year 1800 onward.
|
225
|
+
max_distance : numeric, optional
|
226
|
+
Optional max distance within which to return the nearest tide gauge
|
227
|
+
when `x` and `y` are provided as singular coordinates. Defaults to
|
228
|
+
None, which will always return a tide gauge no matter how far away
|
229
|
+
it is located from `x` and `y`.
|
230
|
+
correct_mean : bool, optional
|
231
|
+
Whether to correct sea level measurements to a standardised mean
|
232
|
+
sea level by subtracting the mean of all observed sea level
|
233
|
+
observations. This can be useful when GESLA tide heights come
|
234
|
+
from different or unknown tide datums. Note: the observed mean
|
235
|
+
sea level calculated here may differ from true long-term/
|
236
|
+
astronomical Mean Sea Level (MSL) datum.
|
237
|
+
filter_use_flag : bool, optional
|
238
|
+
Whether to filter out low quality observations with a "use_flag"
|
239
|
+
value of 0 (do not use). Defaults to True.
|
240
|
+
site_metadata : bool, optional
|
241
|
+
Whether to add tide gauge station metadata as additional columns
|
242
|
+
in the output DataFrame. Defaults to True.
|
243
|
+
data_path : str, optional
|
244
|
+
Path to the raw GESLA data files. Default is
|
245
|
+
`/gdata1/data/sea_level/gesla/`.
|
246
|
+
metadata_path : str, optional
|
247
|
+
Path to the GESLA station metadata file.
|
248
|
+
Default is `/gdata1/data/sea_level/GESLA3_ALL 2.csv`.
|
249
|
+
|
250
|
+
Returns
|
251
|
+
-------
|
252
|
+
pd.DataFrame
|
253
|
+
Processed GESLA data as a DataFrame with columns including:
|
254
|
+
|
255
|
+
- "time": Timestamps,
|
256
|
+
- "sea_level": Observed sea level (m),
|
257
|
+
- "qc_flag": Observed sea level QC flag,
|
258
|
+
- "use_flag": Use-in-analysis flag (1 = use, 0 = do not use),
|
259
|
+
|
260
|
+
...and additional columns from station metadata.
|
261
|
+
"""
|
262
|
+
# Load tide gauge metadata
|
263
|
+
metadata_df, metadata_gdf = _load_gauge_metadata(metadata_path)
|
264
|
+
|
265
|
+
# Use supplied site codes if available
|
266
|
+
if site_code is not None:
|
267
|
+
site_code = [site_code] if not isinstance(site_code, list) else site_code
|
268
|
+
|
269
|
+
# If x and y are tuples, use xy bounds to identify sites
|
270
|
+
elif isinstance(x, (tuple, list)) & isinstance(y, (tuple, list)):
|
271
|
+
bbox = BoundingBox.from_xy(x, y)
|
272
|
+
site_code = metadata_gdf.cx[bbox.left : bbox.right, bbox.top : bbox.bottom].index
|
273
|
+
|
274
|
+
# If x and y are single numbers, select nearest row
|
275
|
+
elif isinstance(x, Number) & isinstance(y, Number):
|
276
|
+
with warnings.catch_warnings():
|
277
|
+
warnings.simplefilter("ignore")
|
278
|
+
site_code = (
|
279
|
+
_nearest_row(metadata_gdf, x, y, max_distance).rename({"index_right": "site_code"}, axis=1).site_code
|
280
|
+
)
|
281
|
+
# site_code = _nearest_row(metadata_gdf, x, y, max_distance).site_code
|
282
|
+
|
283
|
+
# Raise exception if no valid tide gauges are found
|
284
|
+
if site_code.isnull().all():
|
285
|
+
raise Exception(f"No tide gauge found within {max_distance} degrees of {x}, {y}.")
|
286
|
+
|
287
|
+
# Otherwise if all are None, return all available site codes
|
288
|
+
elif (site_code is None) & (x is None) & (y is None):
|
289
|
+
site_code = metadata_df.index.to_list()
|
290
|
+
|
291
|
+
else:
|
292
|
+
raise TypeError(
|
293
|
+
"`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)`)."
|
294
|
+
)
|
295
|
+
|
296
|
+
# Prepare times
|
297
|
+
if time is None:
|
298
|
+
time = ["1800", str(datetime.datetime.now().year)]
|
299
|
+
time = [time] if not isinstance(time, (list, tuple)) else time
|
300
|
+
start_time = _round_date_strings(time[0], round_type="start")
|
301
|
+
end_time = _round_date_strings(time[-1], round_type="end")
|
302
|
+
|
303
|
+
# Identify paths to load and nodata values for each site
|
304
|
+
metadata_df["file_name"] = data_path + metadata_df["file_name"]
|
305
|
+
paths_na = metadata_df.loc[site_code, ["file_name", "null_value"]]
|
306
|
+
|
307
|
+
# Load and combine into a single dataframe
|
308
|
+
gauge_list = [
|
309
|
+
_load_gesla_dataset(s, p, na_value=na)
|
310
|
+
for s, p, na in tqdm.tqdm(paths_na.itertuples(), total=len(paths_na), desc="Loading GESLA gauges")
|
311
|
+
]
|
312
|
+
data_df = pd.concat(gauge_list).sort_index().loc[slice(start_time, end_time)].reset_index().set_index("site_code")
|
313
|
+
|
314
|
+
# Optionally filter by use flag column
|
315
|
+
if filter_use_flag:
|
316
|
+
data_df = data_df.loc[data_df.use_flag == 1]
|
317
|
+
|
318
|
+
# Optionally insert metadata into dataframe
|
319
|
+
if site_metadata:
|
320
|
+
data_df[metadata_df.columns] = metadata_df.loc[site_code]
|
321
|
+
|
322
|
+
# Add time to index and remove duplicates
|
323
|
+
data_df = data_df.set_index("time", append=True)
|
324
|
+
duplicates = data_df.index.duplicated()
|
325
|
+
if duplicates.sum() > 0:
|
326
|
+
warnings.warn("Duplicate timestamps were removed.")
|
327
|
+
data_df = data_df.loc[~duplicates]
|
328
|
+
|
329
|
+
# Remove observed mean sea level if requested
|
330
|
+
if correct_mean:
|
331
|
+
data_df["sea_level"] = data_df["sea_level"].sub(data_df.groupby("site_code")["sea_level"].transform("mean"))
|
332
|
+
|
333
|
+
# Return data
|
334
|
+
return data_df
|
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright 2024 Geoscience Australia
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
@@ -0,0 +1,118 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: eo-tides
|
3
|
+
Version: 0.5.0
|
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
|
+
Project-URL: Homepage, https://GeoscienceAustralia.github.io/eo-tides/
|
8
|
+
Project-URL: Repository, https://github.com/GeoscienceAustralia/eo-tides
|
9
|
+
Project-URL: Documentation, https://GeoscienceAustralia.github.io/eo-tides/
|
10
|
+
Keywords: earth observation,tide modelling,tide modeling,satellite data,coastal analysis,oceanography,remote sensing
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
12
|
+
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
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
23
|
+
Requires-Python: <4.0,>=3.10
|
24
|
+
Description-Content-Type: text/markdown
|
25
|
+
License-File: LICENSE
|
26
|
+
Requires-Dist: colorama>=0.4.3
|
27
|
+
Requires-Dist: geopandas>=0.10.0
|
28
|
+
Requires-Dist: matplotlib>=3.8.0
|
29
|
+
Requires-Dist: numpy>=1.26.0
|
30
|
+
Requires-Dist: odc-geo>=0.4.7
|
31
|
+
Requires-Dist: pandas>=2.2.0
|
32
|
+
Requires-Dist: psutil>=5.8.0
|
33
|
+
Requires-Dist: pyogrio>=0.10.0
|
34
|
+
Requires-Dist: pyproj>=3.7.0
|
35
|
+
Requires-Dist: pyTMD==2.2.0
|
36
|
+
Requires-Dist: scikit-learn>=1.4.0
|
37
|
+
Requires-Dist: scipy>=1.14.1
|
38
|
+
Requires-Dist: shapely>=2.0.6
|
39
|
+
Requires-Dist: tqdm>=4.55.0
|
40
|
+
Requires-Dist: xarray>=2022.3.0
|
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"
|
47
|
+
|
48
|
+
# `eo-tides`: Tide modelling tools for large-scale satellite earth observation analysis
|
49
|
+
|
50
|
+
<img align="right" width="200" src="https://github.com/GeoscienceAustralia/eo-tides/blob/main/docs/assets/eo-tides-logo.gif?raw=true" alt="eo-tides logo" style="margin-right: 40px;">
|
51
|
+
|
52
|
+
[](https://pypi.org/project/eo-tides/)
|
53
|
+
[](https://github.com/GeoscienceAustralia/eo-tides/actions/workflows/main.yml?query=branch%3Amain)
|
54
|
+
[](https://github.com/GeoscienceAustralia/eo-tides/blob/main/pyproject.toml)
|
55
|
+
[](https://codecov.io/gh/GeoscienceAustralia/eo-tides)
|
56
|
+
[](https://img.shields.io/github/license/GeoscienceAustralia/eo-tides)
|
57
|
+
|
58
|
+
- ⚙️ **Github repository**: <https://github.com/GeoscienceAustralia/eo-tides/>
|
59
|
+
- 📘 **Documentation**: <https://GeoscienceAustralia.github.io/eo-tides/>
|
60
|
+
- 🐍 **PyPI**: <https://pypi.org/project/eo-tides/>
|
61
|
+
|
62
|
+
<br>
|
63
|
+
|
64
|
+
`eo-tides` provides powerful parallelized tools for integrating satellite Earth observation data with tide modelling. 🛠️🌊🛰️
|
65
|
+
|
66
|
+
`eo-tides` combines advanced tide modelling functionality from the [`pyTMD`](https://pytmd.readthedocs.io/en/latest/) package with [`pandas`](https://pandas.pydata.org/docs/index.html), [`xarray`](https://docs.xarray.dev/en/stable/) and [`odc-geo`](https://odc-geo.readthedocs.io/en/latest/), providing a suite of flexible tools for efficient analysis of coastal and ocean Earth observation data – from regional, continental, to global scale.
|
67
|
+
|
68
|
+
These tools can be applied to petabytes of freely available satellite data (e.g. from [Digital Earth Australia](https://knowledge.dea.ga.gov.au/) or [Microsoft Planetary Computer](https://planetarycomputer.microsoft.com/)) loaded via Open Data Cube's [`odc-stac`](https://odc-stac.readthedocs.io/en/latest/) or [`datacube`](https://opendatacube.readthedocs.io/en/latest/) packages, supporting coastal and ocean earth observation analysis for any time period or location globally.
|
69
|
+
|
70
|
+

|
71
|
+
|
72
|
+
## Highlights
|
73
|
+
|
74
|
+
- 🌊 Model tide heights and phases (e.g. high, low, ebb, flow) from multiple global ocean tide models in parallel, and return a `pandas.DataFrame` for further analysis
|
75
|
+
- 🛰️ "Tag" satellite data with tide heights based on the exact moment of image acquisition
|
76
|
+
- 🌐 Model tides for every individual satellite pixel through time, producing three-dimensional "tide height" `xarray`-format datacubes that can be integrated with satellite data
|
77
|
+
- 📈 Calculate statistics describing local tide dynamics, as well as biases caused by interactions between tidal processes and satellite orbits
|
78
|
+
- 🛠️ Validate modelled tides using measured sea levels from coastal tide gauges (e.g. [GESLA Global Extreme Sea Level Analysis](https://gesla.org/))
|
79
|
+
<!-- - 🎯 Combine multiple tide models into a single locally-optimised "ensemble" model informed by satellite altimetry and satellite-observed patterns of tidal inundation -->
|
80
|
+
|
81
|
+
## Supported tide models
|
82
|
+
|
83
|
+
`eo-tides` supports [all ocean tide models supported by `pyTMD`](https://pytmd.readthedocs.io/en/latest/getting_started/Getting-Started.html#model-database). These include:
|
84
|
+
|
85
|
+
- [Empirical Ocean Tide model](https://doi.org/10.5194/essd-13-3869-2021) (EOT20)
|
86
|
+
- [Finite Element Solution tide models](https://doi.org/10.5194/os-2020-96) (FES2022, FES2014, FES2012)
|
87
|
+
- [TOPEX/POSEIDON global tide models](https://www.tpxo.net/global) (TPXO10, TPXO9, TPXO8)
|
88
|
+
- [Global Ocean Tide models](https://doi.org/10.1002/2016RG000546) (GOT5.6, GOT5.5, GOT4.10, GOT4.8, GOT4.7)
|
89
|
+
- [Hamburg direct data Assimilation Methods for Tides models](https://doi.org/10.1002/2013JC009766) (HAMTIDE11)
|
90
|
+
|
91
|
+
For instructions on how to set up these models for use in `eo-tides`, refer to [Setting up tide models](setup.md).
|
92
|
+
|
93
|
+
## Installing and setting up `eo-tides`
|
94
|
+
|
95
|
+
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.
|
96
|
+
|
97
|
+
## Jupyter Notebooks code examples
|
98
|
+
|
99
|
+
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/).
|
100
|
+
|
101
|
+
## Citing `eo-tides`
|
102
|
+
|
103
|
+
To cite `eo-tides` in your work, please use the following citation:
|
104
|
+
|
105
|
+
```
|
106
|
+
Bishop-Taylor, R., Sagar, S., Phillips, C., & Newey, V. (2024). eo-tides: Tide modelling tools for large-scale satellite earth observation analysis. https://github.com/GeoscienceAustralia/eo-tides
|
107
|
+
```
|
108
|
+
|
109
|
+
In addition, please consider also citing the underlying [`pyTMD` Python package](https://pytmd.readthedocs.io/en/latest/) which powers the tide modelling functionality behind `eo-tides`:
|
110
|
+
|
111
|
+
```
|
112
|
+
Sutterley, T. C., Alley, K., Brunt, K., Howard, S., Padman, L., Siegfried, M. (2017) pyTMD: Python-based tidal prediction software. 10.5281/zenodo.5555395
|
113
|
+
```
|
114
|
+
|
115
|
+
## Acknowledgements
|
116
|
+
|
117
|
+
For a full list of acknowledgements, refer to [Citations and Credits](https://geoscienceaustralia.github.io/eo-tides/credits/).
|
118
|
+
This repository was initialised using the [`cookiecutter-uv`](https://github.com/fpgmaas/cookiecutter-uv) package.
|
@@ -0,0 +1,11 @@
|
|
1
|
+
eo_tides/__init__.py,sha256=pGvVlxMKiYjm_273G-oYcOgVuPra7uEdNZv0oN1i69c,1693
|
2
|
+
eo_tides/eo.py,sha256=nuaOppYJCVL8mbFyaL9e4ahHB_LBGBrr5XfnAopmW5M,22746
|
3
|
+
eo_tides/model.py,sha256=xpKaVO1_cLLwbODpffqDL80Hw7Yv9JchH42tKhX1oto,34585
|
4
|
+
eo_tides/stats.py,sha256=RXs3J3YZH3yOrzDibEDp3-7wjkleOEFzO33lp27ATuE,22993
|
5
|
+
eo_tides/utils.py,sha256=9xJ1q-b-TVHg5zFyLy6AT_srrPQDvmFdWJmlGSPaJF0,26563
|
6
|
+
eo_tides/validation.py,sha256=KP8WLT5z7KLFjQ9oDla7VJOyLQAK4SVbcz2ySAbsbwI,11882
|
7
|
+
eo_tides-0.5.0.dist-info/LICENSE,sha256=owxWsXViCL2J6Ks3XYhot7t4Y93nstmXAT95Zf030Cc,11350
|
8
|
+
eo_tides-0.5.0.dist-info/METADATA,sha256=CtP3dQKJAbs1bEZaJz0egfina4OD4jba4TGDlLxxIPg,7906
|
9
|
+
eo_tides-0.5.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
10
|
+
eo_tides-0.5.0.dist-info/top_level.txt,sha256=lXZDUUM1DlLdKWHRn8zdmtW8Rx-eQOIWVvt0b8VGiyQ,9
|
11
|
+
eo_tides-0.5.0.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
eo_tides
|