tfv-get-tools 0.2.4__tar.gz → 0.2.5__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.
- {tfv_get_tools-0.2.4/src/tfv_get_tools.egg-info → tfv_get_tools-0.2.5}/PKG-INFO +57 -43
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/README.md +54 -40
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/pyproject.toml +2 -4
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/_standard_attrs.py +2 -2
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/cli/_cli_base.py +9 -1
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/cli/atmos_cli.py +11 -11
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/cli/ocean_cli.py +7 -11
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/cli/tide_cli.py +8 -3
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/fvc/_atmos.py +17 -4
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/atmos/barra2.py +1 -1
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/atmos/cfsr.py +1 -1
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/ocean/hycom.py +25 -2
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/era5.py +1 -1
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/tide/_tidal_base.py +194 -42
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/utilities/horizontal_padding.py +14 -3
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5/src/tfv_get_tools.egg-info}/PKG-INFO +57 -43
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools.egg-info/requires.txt +1 -1
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/tests/test_cli_get_atmos.py +2 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/tests/test_tide_extraction.py +29 -14
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/LICENSE +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/setup.cfg +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/__init__.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/atmos.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/cli/wave_cli.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/fvc/__init__.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/fvc/_fvc.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/fvc/_ocean.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/fvc/_tide.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/ocean.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/__init__.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/_custom_conversions.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/_downloader.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/_merger.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/_utilities.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/atmos/cfgs/barra2_c2.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/atmos/cfgs/barra2_r2.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/atmos/cfgs/barra2_re2.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/atmos/cfgs/cfsr.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/atmos/cfgs/era5.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/atmos/cfgs/era5_gcp.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/atmos/era5.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/atmos/era5_gcp.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/ocean/cfgs/copernicus_blk.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/ocean/cfgs/copernicus_glo.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/ocean/cfgs/copernicus_nws.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/ocean/cfgs/hycom.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/ocean/copernicus_ocean.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/cawcr.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/cfgs/cawcr_aus_10m.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/cfgs/cawcr_aus_4m.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/cfgs/cawcr_glob_24m.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/cfgs/cawcr_pac_10m.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/cfgs/cawcr_pac_4m.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/cfgs/copernicus_glo.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/cfgs/copernicus_nws.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/cfgs/era5.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/cfgs/era5_gcp.yaml +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/copernicus_wave.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/providers/wave/era5_gcp.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/tide/__init__.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/tide/_nodestring.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/utilities/_tfv_bc.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/utilities/land_masking.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/utilities/parsers.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/utilities/warnings.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools/wave.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools.egg-info/SOURCES.txt +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools.egg-info/dependency_links.txt +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools.egg-info/entry_points.txt +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/src/tfv_get_tools.egg-info/top_level.txt +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/tests/test_all_downloaders.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/tests/test_downloader.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/tests/test_era5_merger.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/tests/test_frontend_python_api.py +0 -0
- {tfv_get_tools-0.2.4 → tfv_get_tools-0.2.5}/tests/test_mergers.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tfv_get_tools
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: Tool for downloading and processing data for TUFLOW FV modelling
|
|
5
|
-
Author-email:
|
|
5
|
+
Author-email: TUFLOW Support <support@tuflow.com>
|
|
6
6
|
License: MIT
|
|
7
7
|
Project-URL: Homepage, https://gitlab.com/tuflow-user-group/tuflow-fv/data-pre-processing/tfv-get-tools
|
|
8
8
|
Project-URL: Repository, https://gitlab.com/tuflow-user-group/tuflow-fv/data-pre-processing/tfv-get-tools
|
|
@@ -28,7 +28,7 @@ Requires-Dist: siphon>=0.9
|
|
|
28
28
|
Requires-Dist: cdsapi>=0.7.0
|
|
29
29
|
Requires-Dist: copernicusmarine>=1.2.3
|
|
30
30
|
Requires-Dist: bottleneck>=1.3.5
|
|
31
|
-
Requires-Dist: pyTMD
|
|
31
|
+
Requires-Dist: pyTMD<3,>=2.1.7
|
|
32
32
|
Requires-Dist: shapely>=2.0.6
|
|
33
33
|
Requires-Dist: geopandas>=1.0.1
|
|
34
34
|
Provides-Extra: dev
|
|
@@ -104,29 +104,30 @@ The package provides command-line tools for downloading and processing data:
|
|
|
104
104
|
|
|
105
105
|
**Ocean Data Example:**
|
|
106
106
|
```bash
|
|
107
|
-
# Download HYCOM data for January 2011
|
|
108
|
-
GetOcean A 2011-01-01 2011-02-01 153
|
|
107
|
+
# Download HYCOM data for January 2011 on the east coast of Australia
|
|
108
|
+
GetOcean A 2011-01-01 2011-02-01 153 154 -29 -28
|
|
109
109
|
|
|
110
|
-
# Download with
|
|
111
|
-
GetOcean A -p raw_data -pf
|
|
110
|
+
# Download with options (output directory path (-p), custom filename prefix (-pf) 3-hourly data (-ts), top 20 m (-z))
|
|
111
|
+
GetOcean A -p raw_data -pf studysite -ts 3 -z 0 20 2011-01-01 2011-02-01 153 154 -29 -28
|
|
112
112
|
|
|
113
|
-
# Merge downloaded files
|
|
114
|
-
GetOcean B -i raw_data -o output -
|
|
113
|
+
# Merge downloaded files with options (input directory (-i), output directory (-o), timezone conversion (-tz), timezone attribute metadata (-ltz) and custom filename (-f))
|
|
114
|
+
GetOcean B -i raw_data -o output -tz 10 -ltz AEST -f merged_hycom.nc
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
**Atmospheric Data Example:**
|
|
118
118
|
```bash
|
|
119
|
-
# Download ERA5 atmospheric data
|
|
120
|
-
GetAtmos A
|
|
119
|
+
# Download ERA5 atmospheric data with options (output directory path (-p))
|
|
120
|
+
GetAtmos A -p raw_data 2010-03-01 2010-04-01 153 154 -29 -28
|
|
121
121
|
|
|
122
|
-
# Merge with
|
|
123
|
-
GetAtmos B -i raw_data -o output -rp
|
|
122
|
+
# Merge downloaded files with options (input directory (-i), output directory (-o), reprojected to EPSG:28356 (-rp), timezone conversion (-tz) and timezone attribute metadata (-ltz))
|
|
123
|
+
GetAtmos B -i raw_data -o output -rp 28356 -tz 10 -ltz AEST
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
**Tidal Data Example:**
|
|
127
127
|
```bash
|
|
128
|
-
# Extract tidal data using a boundary nodestring shapefile
|
|
129
|
-
GetTide output/tide_data.nc
|
|
128
|
+
# Extract tidal data from FES2022 extrapolated ocean tide using a boundary nodestring shapefile
|
|
129
|
+
GetTide output/tide_data.nc 2010-03-01 2010-04-01 nodestrings/2d_ns_Open_Boundary_001_L.shp -s FES2022_extrapolated fes2022b/ocean_tide_extrapolated
|
|
130
|
+
# Get Tide supports multiple FES tide models and each requires a specific directory structure. Refer to the wiki: (https://fvwiki.tuflow.com/TUFLOW_FV_Get_Tide_draft#Mandatory_FES_Folder_Structure)
|
|
130
131
|
```
|
|
131
132
|
|
|
132
133
|
### Python API
|
|
@@ -139,20 +140,20 @@ from tfv_get_tools import DownloadOcean, MergeOcean
|
|
|
139
140
|
result = DownloadOcean(
|
|
140
141
|
start_date='2011-01-01',
|
|
141
142
|
end_date='2011-02-01',
|
|
142
|
-
xlims=(153,
|
|
143
|
-
ylims=(-29, -
|
|
143
|
+
xlims=(153, 154),
|
|
144
|
+
ylims=(-29, -28),
|
|
144
145
|
out_path='./raw_data',
|
|
145
146
|
source='HYCOM',
|
|
146
147
|
time_interval=24
|
|
147
148
|
)
|
|
148
149
|
|
|
149
|
-
# Merge downloaded files
|
|
150
|
+
# Merge downloaded files and shift time +10h with timezone attribute set to 'AEST'
|
|
150
151
|
MergeOcean(
|
|
151
152
|
in_path='./raw_data',
|
|
152
153
|
out_path='./output',
|
|
153
|
-
source='HYCOM',
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
source='HYCOM',
|
|
155
|
+
local_tz=(10, 'AEST'),
|
|
156
|
+
fname= 'HYCOM_20110101_20110201_AEST.nc',
|
|
156
157
|
)
|
|
157
158
|
```
|
|
158
159
|
|
|
@@ -162,21 +163,22 @@ from tfv_get_tools import DownloadAtmos, MergeAtmos
|
|
|
162
163
|
|
|
163
164
|
# Download BARRA2 data
|
|
164
165
|
result = DownloadAtmos(
|
|
165
|
-
start_date='
|
|
166
|
-
end_date='
|
|
167
|
-
xlims=(
|
|
168
|
-
ylims=(-
|
|
166
|
+
start_date='2022-12-01',
|
|
167
|
+
end_date='2023-01-01',
|
|
168
|
+
xlims=(153, 154),
|
|
169
|
+
ylims=(-29, -28),
|
|
169
170
|
out_path='./raw_data',
|
|
170
171
|
source='BARRA2',
|
|
171
172
|
model='C2'
|
|
172
173
|
)
|
|
173
174
|
|
|
174
|
-
# Merge
|
|
175
|
+
# Merge downloaded files, reproject to GDA2020 MGA56, and shift time +10h with timezone attribute set to 'AEST'
|
|
175
176
|
MergeAtmos(
|
|
176
177
|
in_path='./raw_data',
|
|
177
178
|
out_path='./output',
|
|
179
|
+
fname= 'BARRA2_C2_20221201_20230101_EPSG7856_AEST.nc',
|
|
178
180
|
source='BARRA2',
|
|
179
|
-
model='C2',
|
|
181
|
+
model='C2',
|
|
180
182
|
reproject=7856,
|
|
181
183
|
local_tz=(10.0, 'AEST')
|
|
182
184
|
)
|
|
@@ -187,38 +189,50 @@ MergeAtmos(
|
|
|
187
189
|
from pathlib import Path
|
|
188
190
|
from tfv_get_tools.tide import ExtractTide
|
|
189
191
|
|
|
192
|
+
# User input
|
|
193
|
+
t_start = '2023-01-01'
|
|
194
|
+
t_end = '2023-02-01'
|
|
195
|
+
fes_dir = './fes2022b/ocean_tide_extrapolated' # Get Tide supports multiple FES tide models and each requires a specific directory structure. Refer to the wiki: (https://fvwiki.tuflow.com/TUFLOW_FV_Get_Tide_draft#Mandatory_FES_Folder_Structure)
|
|
196
|
+
output_dir = './output'
|
|
197
|
+
shp_file = './2d_ns_Open_Boundary_001_L.shp'
|
|
198
|
+
output_name = 'GOC_FES2022_extrapolated_20230101_20230125.nc'
|
|
199
|
+
model = 'FES2022_extrapolated'
|
|
200
|
+
|
|
190
201
|
# Basic tidal extraction
|
|
191
202
|
ExtractTide(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
203
|
+
time_start=t_start,
|
|
204
|
+
time_end=t_end,
|
|
205
|
+
model_dir=fes_dir,
|
|
206
|
+
source=model,
|
|
207
|
+
fname=output_name,
|
|
208
|
+
out_path=output_dir,
|
|
196
209
|
freq='15min',
|
|
197
|
-
shapefile=
|
|
210
|
+
shapefile=shp_file,
|
|
198
211
|
)
|
|
199
212
|
|
|
200
213
|
# Advanced usage with constituent caching
|
|
201
214
|
from tfv_get_tools.tide import load_nodestring_shapefile, process_nodestring_gdf, get_constituents
|
|
202
215
|
|
|
203
216
|
# Load and process boundary shapefile
|
|
204
|
-
gdf = load_nodestring_shapefile(
|
|
205
|
-
coordinates = process_nodestring_gdf(gdf, spacing=
|
|
217
|
+
gdf = load_nodestring_shapefile(shp_file)
|
|
218
|
+
coordinates = process_nodestring_gdf(gdf, spacing=2500)
|
|
206
219
|
|
|
207
220
|
# Extract constituents once (slow first time, fast afterwards)
|
|
208
221
|
constituents = get_constituents(
|
|
209
222
|
coordinates,
|
|
210
|
-
|
|
211
|
-
|
|
223
|
+
model_dir=fes_dir,
|
|
224
|
+
source=model,
|
|
225
|
+
save_cons='boundary_constituents.pkl',
|
|
212
226
|
)
|
|
213
227
|
|
|
214
228
|
# Use cached constituents for faster extraction
|
|
215
229
|
ExtractTide(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
out_path=
|
|
230
|
+
time_start=t_start,
|
|
231
|
+
time_end=t_end,
|
|
232
|
+
fname=output_name,
|
|
233
|
+
out_path=output_dir,
|
|
220
234
|
freq='15min',
|
|
221
|
-
constituents='boundary_constituents.pkl'
|
|
235
|
+
constituents='boundary_constituents.pkl',
|
|
222
236
|
)
|
|
223
237
|
```
|
|
224
238
|
|
|
@@ -276,7 +290,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
276
290
|
|
|
277
291
|
## Authors
|
|
278
292
|
|
|
279
|
-
Developed by [TUFLOW](https://www.tuflow.com/),
|
|
293
|
+
Developed by [TUFLOW](https://www.tuflow.com/), 2026
|
|
280
294
|
|
|
281
295
|
## Project Status
|
|
282
296
|
|
|
@@ -284,4 +298,4 @@ Developed by [TUFLOW](https://www.tuflow.com/), 2025
|
|
|
284
298
|
|
|
285
299
|
---
|
|
286
300
|
|
|
287
|
-
*Last updated:
|
|
301
|
+
*Last updated: January 2026*
|
|
@@ -58,29 +58,30 @@ The package provides command-line tools for downloading and processing data:
|
|
|
58
58
|
|
|
59
59
|
**Ocean Data Example:**
|
|
60
60
|
```bash
|
|
61
|
-
# Download HYCOM data for January 2011
|
|
62
|
-
GetOcean A 2011-01-01 2011-02-01 153
|
|
61
|
+
# Download HYCOM data for January 2011 on the east coast of Australia
|
|
62
|
+
GetOcean A 2011-01-01 2011-02-01 153 154 -29 -28
|
|
63
63
|
|
|
64
|
-
# Download with
|
|
65
|
-
GetOcean A -p raw_data -pf
|
|
64
|
+
# Download with options (output directory path (-p), custom filename prefix (-pf) 3-hourly data (-ts), top 20 m (-z))
|
|
65
|
+
GetOcean A -p raw_data -pf studysite -ts 3 -z 0 20 2011-01-01 2011-02-01 153 154 -29 -28
|
|
66
66
|
|
|
67
|
-
# Merge downloaded files
|
|
68
|
-
GetOcean B -i raw_data -o output -
|
|
67
|
+
# Merge downloaded files with options (input directory (-i), output directory (-o), timezone conversion (-tz), timezone attribute metadata (-ltz) and custom filename (-f))
|
|
68
|
+
GetOcean B -i raw_data -o output -tz 10 -ltz AEST -f merged_hycom.nc
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
**Atmospheric Data Example:**
|
|
72
72
|
```bash
|
|
73
|
-
# Download ERA5 atmospheric data
|
|
74
|
-
GetAtmos A
|
|
73
|
+
# Download ERA5 atmospheric data with options (output directory path (-p))
|
|
74
|
+
GetAtmos A -p raw_data 2010-03-01 2010-04-01 153 154 -29 -28
|
|
75
75
|
|
|
76
|
-
# Merge with
|
|
77
|
-
GetAtmos B -i raw_data -o output -rp
|
|
76
|
+
# Merge downloaded files with options (input directory (-i), output directory (-o), reprojected to EPSG:28356 (-rp), timezone conversion (-tz) and timezone attribute metadata (-ltz))
|
|
77
|
+
GetAtmos B -i raw_data -o output -rp 28356 -tz 10 -ltz AEST
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
**Tidal Data Example:**
|
|
81
81
|
```bash
|
|
82
|
-
# Extract tidal data using a boundary nodestring shapefile
|
|
83
|
-
GetTide output/tide_data.nc
|
|
82
|
+
# Extract tidal data from FES2022 extrapolated ocean tide using a boundary nodestring shapefile
|
|
83
|
+
GetTide output/tide_data.nc 2010-03-01 2010-04-01 nodestrings/2d_ns_Open_Boundary_001_L.shp -s FES2022_extrapolated fes2022b/ocean_tide_extrapolated
|
|
84
|
+
# Get Tide supports multiple FES tide models and each requires a specific directory structure. Refer to the wiki: (https://fvwiki.tuflow.com/TUFLOW_FV_Get_Tide_draft#Mandatory_FES_Folder_Structure)
|
|
84
85
|
```
|
|
85
86
|
|
|
86
87
|
### Python API
|
|
@@ -93,20 +94,20 @@ from tfv_get_tools import DownloadOcean, MergeOcean
|
|
|
93
94
|
result = DownloadOcean(
|
|
94
95
|
start_date='2011-01-01',
|
|
95
96
|
end_date='2011-02-01',
|
|
96
|
-
xlims=(153,
|
|
97
|
-
ylims=(-29, -
|
|
97
|
+
xlims=(153, 154),
|
|
98
|
+
ylims=(-29, -28),
|
|
98
99
|
out_path='./raw_data',
|
|
99
100
|
source='HYCOM',
|
|
100
101
|
time_interval=24
|
|
101
102
|
)
|
|
102
103
|
|
|
103
|
-
# Merge downloaded files
|
|
104
|
+
# Merge downloaded files and shift time +10h with timezone attribute set to 'AEST'
|
|
104
105
|
MergeOcean(
|
|
105
106
|
in_path='./raw_data',
|
|
106
107
|
out_path='./output',
|
|
107
|
-
source='HYCOM',
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
source='HYCOM',
|
|
109
|
+
local_tz=(10, 'AEST'),
|
|
110
|
+
fname= 'HYCOM_20110101_20110201_AEST.nc',
|
|
110
111
|
)
|
|
111
112
|
```
|
|
112
113
|
|
|
@@ -116,21 +117,22 @@ from tfv_get_tools import DownloadAtmos, MergeAtmos
|
|
|
116
117
|
|
|
117
118
|
# Download BARRA2 data
|
|
118
119
|
result = DownloadAtmos(
|
|
119
|
-
start_date='
|
|
120
|
-
end_date='
|
|
121
|
-
xlims=(
|
|
122
|
-
ylims=(-
|
|
120
|
+
start_date='2022-12-01',
|
|
121
|
+
end_date='2023-01-01',
|
|
122
|
+
xlims=(153, 154),
|
|
123
|
+
ylims=(-29, -28),
|
|
123
124
|
out_path='./raw_data',
|
|
124
125
|
source='BARRA2',
|
|
125
126
|
model='C2'
|
|
126
127
|
)
|
|
127
128
|
|
|
128
|
-
# Merge
|
|
129
|
+
# Merge downloaded files, reproject to GDA2020 MGA56, and shift time +10h with timezone attribute set to 'AEST'
|
|
129
130
|
MergeAtmos(
|
|
130
131
|
in_path='./raw_data',
|
|
131
132
|
out_path='./output',
|
|
133
|
+
fname= 'BARRA2_C2_20221201_20230101_EPSG7856_AEST.nc',
|
|
132
134
|
source='BARRA2',
|
|
133
|
-
model='C2',
|
|
135
|
+
model='C2',
|
|
134
136
|
reproject=7856,
|
|
135
137
|
local_tz=(10.0, 'AEST')
|
|
136
138
|
)
|
|
@@ -141,38 +143,50 @@ MergeAtmos(
|
|
|
141
143
|
from pathlib import Path
|
|
142
144
|
from tfv_get_tools.tide import ExtractTide
|
|
143
145
|
|
|
146
|
+
# User input
|
|
147
|
+
t_start = '2023-01-01'
|
|
148
|
+
t_end = '2023-02-01'
|
|
149
|
+
fes_dir = './fes2022b/ocean_tide_extrapolated' # Get Tide supports multiple FES tide models and each requires a specific directory structure. Refer to the wiki: (https://fvwiki.tuflow.com/TUFLOW_FV_Get_Tide_draft#Mandatory_FES_Folder_Structure)
|
|
150
|
+
output_dir = './output'
|
|
151
|
+
shp_file = './2d_ns_Open_Boundary_001_L.shp'
|
|
152
|
+
output_name = 'GOC_FES2022_extrapolated_20230101_20230125.nc'
|
|
153
|
+
model = 'FES2022_extrapolated'
|
|
154
|
+
|
|
144
155
|
# Basic tidal extraction
|
|
145
156
|
ExtractTide(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
157
|
+
time_start=t_start,
|
|
158
|
+
time_end=t_end,
|
|
159
|
+
model_dir=fes_dir,
|
|
160
|
+
source=model,
|
|
161
|
+
fname=output_name,
|
|
162
|
+
out_path=output_dir,
|
|
150
163
|
freq='15min',
|
|
151
|
-
shapefile=
|
|
164
|
+
shapefile=shp_file,
|
|
152
165
|
)
|
|
153
166
|
|
|
154
167
|
# Advanced usage with constituent caching
|
|
155
168
|
from tfv_get_tools.tide import load_nodestring_shapefile, process_nodestring_gdf, get_constituents
|
|
156
169
|
|
|
157
170
|
# Load and process boundary shapefile
|
|
158
|
-
gdf = load_nodestring_shapefile(
|
|
159
|
-
coordinates = process_nodestring_gdf(gdf, spacing=
|
|
171
|
+
gdf = load_nodestring_shapefile(shp_file)
|
|
172
|
+
coordinates = process_nodestring_gdf(gdf, spacing=2500)
|
|
160
173
|
|
|
161
174
|
# Extract constituents once (slow first time, fast afterwards)
|
|
162
175
|
constituents = get_constituents(
|
|
163
176
|
coordinates,
|
|
164
|
-
|
|
165
|
-
|
|
177
|
+
model_dir=fes_dir,
|
|
178
|
+
source=model,
|
|
179
|
+
save_cons='boundary_constituents.pkl',
|
|
166
180
|
)
|
|
167
181
|
|
|
168
182
|
# Use cached constituents for faster extraction
|
|
169
183
|
ExtractTide(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
out_path=
|
|
184
|
+
time_start=t_start,
|
|
185
|
+
time_end=t_end,
|
|
186
|
+
fname=output_name,
|
|
187
|
+
out_path=output_dir,
|
|
174
188
|
freq='15min',
|
|
175
|
-
constituents='boundary_constituents.pkl'
|
|
189
|
+
constituents='boundary_constituents.pkl',
|
|
176
190
|
)
|
|
177
191
|
```
|
|
178
192
|
|
|
@@ -230,7 +244,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
230
244
|
|
|
231
245
|
## Authors
|
|
232
246
|
|
|
233
|
-
Developed by [TUFLOW](https://www.tuflow.com/),
|
|
247
|
+
Developed by [TUFLOW](https://www.tuflow.com/), 2026
|
|
234
248
|
|
|
235
249
|
## Project Status
|
|
236
250
|
|
|
@@ -238,4 +252,4 @@ Developed by [TUFLOW](https://www.tuflow.com/), 2025
|
|
|
238
252
|
|
|
239
253
|
---
|
|
240
254
|
|
|
241
|
-
*Last updated:
|
|
255
|
+
*Last updated: January 2026*
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "tfv_get_tools"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.5"
|
|
4
4
|
description = "Tool for downloading and processing data for TUFLOW FV modelling"
|
|
5
5
|
authors = [
|
|
6
|
-
{ name = "Alex Waterhouse", email = "alex.waterhouse@apac.bmt.org" },
|
|
7
|
-
{ name = "Mitchell Smith", email = "mitchell.smith@apac.bmt.org" },
|
|
8
6
|
{ name = "TUFLOW Support", email = "support@tuflow.com" },
|
|
9
7
|
]
|
|
10
8
|
license = { text = "MIT" }
|
|
@@ -31,7 +29,7 @@ dependencies = [
|
|
|
31
29
|
"cdsapi>=0.7.0",
|
|
32
30
|
"copernicusmarine>=1.2.3",
|
|
33
31
|
"bottleneck>=1.3.5",
|
|
34
|
-
"pyTMD>=2.1.
|
|
32
|
+
"pyTMD>=2.1.7,<3",
|
|
35
33
|
"shapely >= 2.0.6",
|
|
36
34
|
"geopandas >= 1.0.1",
|
|
37
35
|
]
|
|
@@ -61,12 +61,12 @@ STDVARS = {
|
|
|
61
61
|
"water_temp": {
|
|
62
62
|
"long_name": "sea_water_temperature",
|
|
63
63
|
"standard_name": "sea_water_temperature",
|
|
64
|
-
"units": "
|
|
64
|
+
"units": "degC"
|
|
65
65
|
},
|
|
66
66
|
"salinity": {
|
|
67
67
|
"long_name": "sea_water_salinity",
|
|
68
68
|
"standard_name": "sea_water_practical_salinity",
|
|
69
|
-
"units": "
|
|
69
|
+
"units": "psu"
|
|
70
70
|
},
|
|
71
71
|
# Wave parameters
|
|
72
72
|
"hs": {
|
|
@@ -17,7 +17,7 @@ class CLIBase(ABC):
|
|
|
17
17
|
self.parser = argparse.ArgumentParser(
|
|
18
18
|
prog=prog_name,
|
|
19
19
|
description=description,
|
|
20
|
-
epilog="See '<command> --help' to read about a specific sub-command
|
|
20
|
+
epilog="See '<command> --help' to read about a specific sub-command",
|
|
21
21
|
)
|
|
22
22
|
self.subparsers = self.parser.add_subparsers(
|
|
23
23
|
dest="command", help="Sub-commands"
|
|
@@ -53,7 +53,15 @@ class CLIBase(ABC):
|
|
|
53
53
|
default=".",
|
|
54
54
|
type=self.dir_path,
|
|
55
55
|
help="Output directory, needs to exist first",
|
|
56
|
+
)
|
|
57
|
+
parser.add_argument(
|
|
58
|
+
"-pf",
|
|
59
|
+
"--prefix",
|
|
60
|
+
type=str,
|
|
61
|
+
default=None,
|
|
62
|
+
help="Filename prefix"
|
|
56
63
|
)
|
|
64
|
+
|
|
57
65
|
self.add_source_arguments(parser)
|
|
58
66
|
parser.set_defaults(func=self.run_download)
|
|
59
67
|
|
|
@@ -42,8 +42,8 @@ def print_atmos_info():
|
|
|
42
42
|
|
|
43
43
|
3. BoM's "BARRA2"
|
|
44
44
|
- "R2" - An 11-km grid reanalysis covering Australia
|
|
45
|
-
- "C2" - An 4-km grid reanalysis covering Australia, with only wind and pressure fields downloaded
|
|
46
|
-
- "RE2" - (Testing Only) An experimental ensembles 22-km grid covering Australia
|
|
45
|
+
- "C2" - An 4-km grid reanalysis covering Australia, with only wind and pressure fields downloaded
|
|
46
|
+
- "RE2" - (Testing Only) An experimental ensembles 22-km grid covering Australia
|
|
47
47
|
|
|
48
48
|
Example Usage:
|
|
49
49
|
---------
|
|
@@ -114,25 +114,19 @@ class GetAtmos(CLIBase):
|
|
|
114
114
|
"""
|
|
115
115
|
super().add_source_arguments(parser)
|
|
116
116
|
|
|
117
|
-
parser.add_argument(
|
|
118
|
-
'--info',
|
|
119
|
-
action="store_true",
|
|
120
|
-
help="Display the full program help"
|
|
121
|
-
)
|
|
122
|
-
|
|
123
117
|
parser.add_argument(
|
|
124
118
|
"-s",
|
|
125
119
|
"--source",
|
|
126
120
|
type=str,
|
|
127
121
|
default="ERA5",
|
|
128
|
-
help='Atmos data source. Default = "ERA5".
|
|
122
|
+
help='Atmos data source. Default = "ERA5". Specified CFSR and BARRA2',
|
|
129
123
|
)
|
|
130
124
|
parser.add_argument(
|
|
131
125
|
"-m",
|
|
132
126
|
"--model",
|
|
133
127
|
type=str,
|
|
134
128
|
default="default",
|
|
135
|
-
help='Model from source. Default is "default".
|
|
129
|
+
help='Model from source. Default is "default". Refer to GetAtmos --info',
|
|
136
130
|
)
|
|
137
131
|
parser.add_argument(
|
|
138
132
|
"--test",
|
|
@@ -155,8 +149,10 @@ class GetAtmos(CLIBase):
|
|
|
155
149
|
xlims,
|
|
156
150
|
ylims,
|
|
157
151
|
source=args.source,
|
|
152
|
+
model=args.model,
|
|
158
153
|
out_path=args.path,
|
|
159
154
|
TEST_MODE=args.test,
|
|
155
|
+
prefix=args.prefix,
|
|
160
156
|
)
|
|
161
157
|
|
|
162
158
|
def run_merge(self, args):
|
|
@@ -189,4 +185,8 @@ class GetAtmos(CLIBase):
|
|
|
189
185
|
local_tz=tz,
|
|
190
186
|
wrapto360=args.wrapto360,
|
|
191
187
|
pad_dry=args.pad_dry,
|
|
192
|
-
)
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
# For debugging
|
|
191
|
+
if __name__ == "__main__":
|
|
192
|
+
entry()
|
|
@@ -38,7 +38,8 @@ def print_ocean_info():
|
|
|
38
38
|
1. (Default) "HYCOM" - Global Ocean Forecasting System
|
|
39
39
|
- "default" - Global ocean analysis and forecast system
|
|
40
40
|
|
|
41
|
-
2.
|
|
41
|
+
2. "Copernicus" - Copernicus Marine Service
|
|
42
|
+
- "default" - Global ocean analysis and forecast system
|
|
42
43
|
|
|
43
44
|
Example Usage:
|
|
44
45
|
---------
|
|
@@ -89,7 +90,7 @@ class GetOcean(CLIBase):
|
|
|
89
90
|
"--timestep",
|
|
90
91
|
default=24,
|
|
91
92
|
type=int,
|
|
92
|
-
help="Download timestep interval in hours, only relevant for HYCOM. Must be a multiple of 3 (highest resolution available). Default is 24 (daily). All sources other than HYCOM are downloaded in the best available time resolution
|
|
93
|
+
help="Download timestep interval in hours, only relevant for HYCOM. Must be a multiple of 3 (highest resolution available). Default is 24 (daily). All sources other than HYCOM are downloaded in the best available time resolution",
|
|
93
94
|
)
|
|
94
95
|
|
|
95
96
|
dparser.add_argument(
|
|
@@ -98,7 +99,7 @@ class GetOcean(CLIBase):
|
|
|
98
99
|
nargs=2,
|
|
99
100
|
type=float,
|
|
100
101
|
default=None,
|
|
101
|
-
help='Minimum and maximum depth "zmin zmax". Defaults to the maximum for source
|
|
102
|
+
help='Minimum and maximum depth "zmin zmax". Defaults to the maximum for source',
|
|
102
103
|
)
|
|
103
104
|
|
|
104
105
|
self.add_info_parser()
|
|
@@ -127,25 +128,19 @@ class GetOcean(CLIBase):
|
|
|
127
128
|
"""
|
|
128
129
|
super().add_source_arguments(parser)
|
|
129
130
|
|
|
130
|
-
parser.add_argument(
|
|
131
|
-
'--info',
|
|
132
|
-
action="store_true",
|
|
133
|
-
help="Display the full program help"
|
|
134
|
-
)
|
|
135
|
-
|
|
136
131
|
parser.add_argument(
|
|
137
132
|
"-s",
|
|
138
133
|
"--source",
|
|
139
134
|
type=str,
|
|
140
135
|
default="HYCOM",
|
|
141
|
-
help='Ocean data source. Default = "HYCOM".
|
|
136
|
+
help='Ocean data source. Default = "HYCOM". Specified = Copernicus',
|
|
142
137
|
)
|
|
143
138
|
parser.add_argument(
|
|
144
139
|
"-m",
|
|
145
140
|
"--model",
|
|
146
141
|
type=str,
|
|
147
142
|
default="default",
|
|
148
|
-
help='Model from source. Default is "default".
|
|
143
|
+
help='Model from source. Default is "default". Refer to GetOcean info',
|
|
149
144
|
)
|
|
150
145
|
|
|
151
146
|
def run_download(self, args):
|
|
@@ -169,6 +164,7 @@ class GetOcean(CLIBase):
|
|
|
169
164
|
time_interval=args.timestep,
|
|
170
165
|
source=args.source,
|
|
171
166
|
out_path=args.path,
|
|
167
|
+
prefix=args.prefix,
|
|
172
168
|
)
|
|
173
169
|
|
|
174
170
|
def run_merge(self, args):
|
|
@@ -70,15 +70,17 @@ def entry():
|
|
|
70
70
|
)
|
|
71
71
|
|
|
72
72
|
parser.add_argument(
|
|
73
|
+
"-s",
|
|
73
74
|
"--source",
|
|
74
75
|
type=str,
|
|
75
76
|
default=None,
|
|
76
|
-
help="Tidal model source name. This will attempt to be automatically detected from model_dir, but it can be overriden if there are issues
|
|
77
|
+
help="Tidal model source name. This will attempt to be automatically detected from model_dir, but it can be overriden if there are issues"
|
|
77
78
|
)
|
|
78
79
|
parser.add_argument(
|
|
79
80
|
"-fvc",
|
|
80
81
|
"--write_fvc",
|
|
81
82
|
action="store_true",
|
|
83
|
+
default=True, # <-- makes it True unless overridden
|
|
82
84
|
help="Write a TUFLOW FV '.fvc' file to accompany extracted tide dataset",
|
|
83
85
|
)
|
|
84
86
|
|
|
@@ -104,9 +106,9 @@ def entry():
|
|
|
104
106
|
|
|
105
107
|
|
|
106
108
|
ExtractTide(
|
|
109
|
+
args.time_start,
|
|
110
|
+
args.time_end,
|
|
107
111
|
args.out,
|
|
108
|
-
args.tstart,
|
|
109
|
-
args.tend,
|
|
110
112
|
model_dir,
|
|
111
113
|
shapefile=args.nodestring,
|
|
112
114
|
freq=args.freq,
|
|
@@ -116,3 +118,6 @@ def entry():
|
|
|
116
118
|
write_fvc=args.write_fvc,
|
|
117
119
|
)
|
|
118
120
|
|
|
121
|
+
# For debugging
|
|
122
|
+
if __name__ == "__main__":
|
|
123
|
+
entry()
|
|
@@ -35,6 +35,9 @@ class AtmosFVCWriter(FVCWriter):
|
|
|
35
35
|
"prate": {"tfv_var": "PRECIP_GRID", "bc_scale": 1.0, "bc_offset": 0.0},
|
|
36
36
|
"dlwrf": {"tfv_var": "LW_RAD_GRID", "bc_scale": 1.0, "bc_offset": 0.0},
|
|
37
37
|
"dswrf": {"tfv_var": "SW_RAD_GRID", "bc_scale": 1.0, "bc_offset": 0.0},
|
|
38
|
+
"avg_tprate": {"tfv_var": "PRECIP_GRID", "bc_scale": 1.0, "bc_offset": 0.0},
|
|
39
|
+
"avg_sdlwrf": {"tfv_var": "LW_RAD_GRID", "bc_scale": 1.0, "bc_offset": 0.0},
|
|
40
|
+
"avg_sdswrf": {"tfv_var": "SW_RAD_GRID", "bc_scale": 1.0, "bc_offset": 0.0},
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
def __init__(self, var_mappings: Optional[Dict] = None, source=None, model=None, info_url=None):
|
|
@@ -106,10 +109,20 @@ class AtmosFVCWriter(FVCWriter):
|
|
|
106
109
|
f" BC Header == {self.time_var}, {var_name}",
|
|
107
110
|
]
|
|
108
111
|
)
|
|
109
|
-
if
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
if var_name in ("prate", "avg_tprate"):
|
|
113
|
+
bc_scale = 86.4
|
|
114
|
+
lines.append(f" BC Scale == {bc_scale} ! Conversion: [kg m-2 s-1] to [m day-1]")
|
|
115
|
+
elif var_name == "mslp":
|
|
116
|
+
lines.append(f" BC Scale == {bc_scale} ! Conversion: pascal [Pa] to hectopascal [hPa]")
|
|
117
|
+
if bc_offset != 0.0:
|
|
118
|
+
lines.append(f" BC Offset == {bc_offset}")
|
|
119
|
+
elif var_name == "t2m":
|
|
120
|
+
lines.append(f" BC Offset == {bc_offset} ! Conversion: kelvin [K] to Celsius [C]")
|
|
121
|
+
else:
|
|
122
|
+
if bc_scale != 1.0:
|
|
123
|
+
lines.append(f" BC Scale == {bc_scale}")
|
|
124
|
+
if bc_offset != 0.0:
|
|
125
|
+
lines.append(f" BC Offset == {bc_offset}")
|
|
113
126
|
|
|
114
127
|
# Common BC settings
|
|
115
128
|
lines.extend(
|
|
@@ -184,7 +184,7 @@ class MergeBARRA2(BaseMerger):
|
|
|
184
184
|
# Merge the common start_dates first, then concatenate by time afterwards
|
|
185
185
|
dssetm = []
|
|
186
186
|
for v in dsset.values():
|
|
187
|
-
dssetm.append(xr.merge(v))
|
|
187
|
+
dssetm.append(xr.merge(v,compat="override"))
|
|
188
188
|
|
|
189
189
|
ds = xr.concat(
|
|
190
190
|
dssetm,
|
|
@@ -184,7 +184,7 @@ class MergeCFSRAtmos(BaseMerger):
|
|
|
184
184
|
kwargs=dict(fill_value='extrapolate'))
|
|
185
185
|
for ds in date_group
|
|
186
186
|
]
|
|
187
|
-
merged_by_date.append(xr.merge(interpolated, compat='override'))
|
|
187
|
+
merged_by_date.append(xr.merge(interpolated, compat='override',join='outer'))
|
|
188
188
|
|
|
189
189
|
# Concatenate along time dimension
|
|
190
190
|
merged = xr.concat(merged_by_date, dim="time", combine_attrs="override",
|