roms-tools 1.7.0__py3-none-any.whl → 2.1.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.
- roms_tools/__init__.py +2 -1
- roms_tools/setup/boundary_forcing.py +246 -146
- roms_tools/setup/datasets.py +229 -69
- roms_tools/setup/download.py +13 -17
- roms_tools/setup/grid.py +777 -614
- roms_tools/setup/initial_conditions.py +168 -32
- roms_tools/setup/mask.py +115 -0
- roms_tools/setup/nesting.py +575 -0
- roms_tools/setup/plot.py +218 -63
- roms_tools/setup/regrid.py +4 -2
- roms_tools/setup/river_forcing.py +125 -29
- roms_tools/setup/surface_forcing.py +31 -25
- roms_tools/setup/tides.py +29 -14
- roms_tools/setup/topography.py +250 -153
- roms_tools/setup/utils.py +174 -44
- roms_tools/setup/vertical_coordinate.py +5 -16
- roms_tools/tests/test_setup/test_boundary_forcing.py +10 -5
- roms_tools/tests/test_setup/test_data/grid.zarr/.zattrs +0 -1
- roms_tools/tests/test_setup/test_data/grid.zarr/.zmetadata +56 -201
- roms_tools/tests/test_setup/test_data/grid.zarr/Cs_r/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/grid.zarr/Cs_w/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/grid.zarr/{layer_depth_rho → sigma_r}/.zarray +2 -6
- roms_tools/tests/test_setup/test_data/grid.zarr/sigma_r/.zattrs +7 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/sigma_r/0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/sigma_w/.zarray +20 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/sigma_w/.zattrs +7 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/sigma_w/0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zattrs +1 -2
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zmetadata +58 -203
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/Cs_r/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/Cs_w/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/h/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/h/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_coarse/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_rho/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_u/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_v/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/sigma_r/.zarray +20 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/sigma_r/.zattrs +7 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/sigma_r/0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/sigma_w/.zarray +20 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/sigma_w/.zattrs +7 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/sigma_w/0 +0 -0
- roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/.zmetadata +2 -3
- roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_tracer/.zattrs +1 -2
- roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/tracer_name/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/tracer_name/0 +0 -0
- roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/.zmetadata +5 -6
- roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_tracer/.zarray +2 -2
- roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_tracer/.zattrs +1 -2
- roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/river_tracer/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/tracer_name/.zarray +2 -2
- roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/tracer_name/0 +0 -0
- roms_tools/tests/test_setup/test_datasets.py +2 -2
- roms_tools/tests/test_setup/test_grid.py +110 -12
- roms_tools/tests/test_setup/test_initial_conditions.py +2 -1
- roms_tools/tests/test_setup/test_nesting.py +489 -0
- roms_tools/tests/test_setup/test_river_forcing.py +53 -15
- roms_tools/tests/test_setup/test_surface_forcing.py +3 -22
- roms_tools/tests/test_setup/test_tides.py +2 -1
- roms_tools/tests/test_setup/test_topography.py +106 -1
- roms_tools/tests/test_setup/test_validation.py +2 -2
- {roms_tools-1.7.0.dist-info → roms_tools-2.1.0.dist-info}/LICENSE +1 -1
- {roms_tools-1.7.0.dist-info → roms_tools-2.1.0.dist-info}/METADATA +9 -4
- {roms_tools-1.7.0.dist-info → roms_tools-2.1.0.dist-info}/RECORD +85 -108
- {roms_tools-1.7.0.dist-info → roms_tools-2.1.0.dist-info}/WHEEL +1 -1
- roms_tools/_version.py +0 -2
- roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_rho/.zarray +0 -24
- roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_rho/.zattrs +0 -9
- roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_rho/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_u/.zarray +0 -24
- roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_u/.zattrs +0 -9
- roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_u/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_v/.zarray +0 -24
- roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_v/.zattrs +0 -9
- roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_v/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_rho/.zattrs +0 -9
- roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_rho/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_u/.zarray +0 -24
- roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_u/.zattrs +0 -9
- roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_u/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_v/.zarray +0 -24
- roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_v/.zattrs +0 -9
- roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_v/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_rho/.zarray +0 -24
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_rho/.zattrs +0 -9
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_rho/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_u/.zarray +0 -24
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_u/.zattrs +0 -9
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_u/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_v/.zarray +0 -24
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_v/.zattrs +0 -9
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_v/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_rho/.zarray +0 -24
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_rho/.zattrs +0 -9
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_rho/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_u/.zarray +0 -24
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_u/.zattrs +0 -9
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_u/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_v/.zarray +0 -24
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_v/.zattrs +0 -9
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_v/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_tracer/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/river_forcing.zarr/tracer_name/0 +0 -0
- roms_tools/tests/test_setup/test_vertical_coordinate.py +0 -91
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/.zattrs +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/.zgroup +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/abs_time/.zarray +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/abs_time/.zattrs +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/abs_time/0 +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/month/.zarray +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/month/.zattrs +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/month/0 +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_name/.zarray +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_name/.zattrs +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_name/0 +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_time/.zarray +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_time/.zattrs +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_time/0 +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_volume/.zarray +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_volume/.zattrs +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_volume/0.0 +0 -0
- /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/tracer_name/.zattrs +0 -0
- {roms_tools-1.7.0.dist-info → roms_tools-2.1.0.dist-info}/top_level.txt +0 -0
|
@@ -61,7 +61,11 @@ def compare_dictionaries(dict1, dict2):
|
|
|
61
61
|
|
|
62
62
|
@pytest.mark.parametrize(
|
|
63
63
|
"river_forcing_fixture",
|
|
64
|
-
[
|
|
64
|
+
[
|
|
65
|
+
"river_forcing",
|
|
66
|
+
"river_forcing_for_grid_that_straddles_dateline",
|
|
67
|
+
"river_forcing_with_bgc",
|
|
68
|
+
],
|
|
65
69
|
)
|
|
66
70
|
def test_successful_initialization_with_climatological_dai_data(
|
|
67
71
|
river_forcing_fixture, request
|
|
@@ -121,7 +125,11 @@ def test_reproducibility_indices(river_forcing, river_forcing_no_climatology):
|
|
|
121
125
|
|
|
122
126
|
@pytest.mark.parametrize(
|
|
123
127
|
"river_forcing_fixture",
|
|
124
|
-
[
|
|
128
|
+
[
|
|
129
|
+
"river_forcing_climatology",
|
|
130
|
+
"river_forcing_no_climatology",
|
|
131
|
+
"river_forcing_with_bgc",
|
|
132
|
+
],
|
|
125
133
|
)
|
|
126
134
|
def test_constant_tracers(river_forcing_fixture, request):
|
|
127
135
|
river_forcing = request.getfixturevalue(river_forcing_fixture)
|
|
@@ -132,11 +140,18 @@ def test_constant_tracers(river_forcing_fixture, request):
|
|
|
132
140
|
np.testing.assert_allclose(
|
|
133
141
|
river_forcing.ds.river_tracer.isel(ntracers=1).values, 1.0, atol=0
|
|
134
142
|
)
|
|
143
|
+
np.testing.assert_allclose(
|
|
144
|
+
river_forcing.ds.river_tracer.isel(ntracers=slice(2, None)).values, 0.0, atol=0
|
|
145
|
+
)
|
|
135
146
|
|
|
136
147
|
|
|
137
148
|
@pytest.mark.parametrize(
|
|
138
149
|
"river_forcing_fixture",
|
|
139
|
-
[
|
|
150
|
+
[
|
|
151
|
+
"river_forcing_climatology",
|
|
152
|
+
"river_forcing_no_climatology",
|
|
153
|
+
"river_forcing_with_bgc",
|
|
154
|
+
],
|
|
140
155
|
)
|
|
141
156
|
def test_river_locations_are_along_coast(river_forcing_fixture, request):
|
|
142
157
|
river_forcing = request.getfixturevalue(river_forcing_fixture)
|
|
@@ -228,16 +243,18 @@ def test_update_river_flux_variable_without_conflicts(river_forcing, tmp_path):
|
|
|
228
243
|
assert isinstance(another_river_forcing.ds, xr.Dataset)
|
|
229
244
|
|
|
230
245
|
|
|
231
|
-
def test_river_forcing_plot(
|
|
246
|
+
def test_river_forcing_plot(river_forcing_with_bgc):
|
|
232
247
|
"""Test plot method."""
|
|
233
248
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
249
|
+
river_forcing_with_bgc.plot_locations()
|
|
250
|
+
river_forcing_with_bgc.plot("river_volume")
|
|
251
|
+
river_forcing_with_bgc.plot("river_temp")
|
|
252
|
+
river_forcing_with_bgc.plot("river_salt")
|
|
253
|
+
river_forcing_with_bgc.plot("river_ALK")
|
|
254
|
+
river_forcing_with_bgc.plot("river_PO4")
|
|
238
255
|
|
|
239
256
|
|
|
240
|
-
def test_river_forcing_save(
|
|
257
|
+
def test_river_forcing_save(river_forcing_with_bgc, tmp_path):
|
|
241
258
|
"""Test save method."""
|
|
242
259
|
|
|
243
260
|
for file_str, grid_file_str in zip(
|
|
@@ -250,7 +267,7 @@ def test_river_forcing_save(river_forcing, tmp_path):
|
|
|
250
267
|
): # test for Path object and str
|
|
251
268
|
|
|
252
269
|
# Test saving without partitioning
|
|
253
|
-
saved_filenames =
|
|
270
|
+
saved_filenames = river_forcing_with_bgc.save(filepath, grid_filepath)
|
|
254
271
|
# Check if the .nc file was created
|
|
255
272
|
filepath = Path(filepath).with_suffix(".nc")
|
|
256
273
|
grid_filepath = Path(grid_filepath).with_suffix(".nc")
|
|
@@ -262,7 +279,7 @@ def test_river_forcing_save(river_forcing, tmp_path):
|
|
|
262
279
|
grid_filepath.unlink()
|
|
263
280
|
|
|
264
281
|
# Test saving with partitioning
|
|
265
|
-
saved_filenames =
|
|
282
|
+
saved_filenames = river_forcing_with_bgc.save(
|
|
266
283
|
filepath, grid_filepath, np_eta=3, np_xi=3
|
|
267
284
|
)
|
|
268
285
|
|
|
@@ -277,10 +294,20 @@ def test_river_forcing_save(river_forcing, tmp_path):
|
|
|
277
294
|
expected_filepath.unlink()
|
|
278
295
|
|
|
279
296
|
|
|
280
|
-
|
|
297
|
+
@pytest.mark.parametrize(
|
|
298
|
+
"river_forcing_fixture",
|
|
299
|
+
[
|
|
300
|
+
"river_forcing_climatology",
|
|
301
|
+
"river_forcing_no_climatology",
|
|
302
|
+
"river_forcing_with_bgc",
|
|
303
|
+
],
|
|
304
|
+
)
|
|
305
|
+
def test_roundtrip_yaml(river_forcing_fixture, request, tmp_path):
|
|
281
306
|
"""Test that creating an RiverForcing object, saving its parameters to yaml file,
|
|
282
307
|
and re-opening yaml file creates the same object."""
|
|
283
308
|
|
|
309
|
+
river_forcing = request.getfixturevalue(river_forcing_fixture)
|
|
310
|
+
|
|
284
311
|
# Create a temporary filepath using the tmp_path fixture
|
|
285
312
|
file_str = "test_yaml"
|
|
286
313
|
for filepath in [
|
|
@@ -298,7 +325,17 @@ def test_roundtrip_yaml(river_forcing, tmp_path):
|
|
|
298
325
|
filepath.unlink()
|
|
299
326
|
|
|
300
327
|
|
|
301
|
-
|
|
328
|
+
@pytest.mark.parametrize(
|
|
329
|
+
"river_forcing_fixture",
|
|
330
|
+
[
|
|
331
|
+
"river_forcing_climatology",
|
|
332
|
+
"river_forcing_no_climatology",
|
|
333
|
+
"river_forcing_with_bgc",
|
|
334
|
+
],
|
|
335
|
+
)
|
|
336
|
+
def test_files_have_same_hash(river_forcing_fixture, request, tmp_path):
|
|
337
|
+
|
|
338
|
+
river_forcing = request.getfixturevalue(river_forcing_fixture)
|
|
302
339
|
|
|
303
340
|
yaml_filepath = tmp_path / "test_yaml.yaml"
|
|
304
341
|
filepath1 = tmp_path / "test1.nc"
|
|
@@ -323,7 +360,7 @@ def test_files_have_same_hash(river_forcing, tmp_path):
|
|
|
323
360
|
grid_filepath2.unlink()
|
|
324
361
|
|
|
325
362
|
|
|
326
|
-
def
|
|
363
|
+
def test_from_yaml_missing_river_forcing(tmp_path):
|
|
327
364
|
yaml_content = textwrap.dedent(
|
|
328
365
|
"""\
|
|
329
366
|
---
|
|
@@ -337,7 +374,8 @@ def test_from_yaml_missing_initial_conditions(tmp_path):
|
|
|
337
374
|
center_lon: -10
|
|
338
375
|
center_lat: 61
|
|
339
376
|
rot: -20
|
|
340
|
-
topography_source:
|
|
377
|
+
topography_source:
|
|
378
|
+
name: ETOPO5
|
|
341
379
|
hmin: 5.0
|
|
342
380
|
"""
|
|
343
381
|
)
|
|
@@ -153,27 +153,6 @@ def grid_that_lies_west_of_dateline_more_than_five_degrees_away():
|
|
|
153
153
|
return grid
|
|
154
154
|
|
|
155
155
|
|
|
156
|
-
@pytest.fixture
|
|
157
|
-
def grid_that_straddles_180_degree_meridian():
|
|
158
|
-
"""Fixture for creating a domain that straddles 180 degree meridian.
|
|
159
|
-
|
|
160
|
-
This is a good test grid for the global ERA5 data, which comes on an [-180, 180]
|
|
161
|
-
longitude grid.
|
|
162
|
-
"""
|
|
163
|
-
|
|
164
|
-
grid = Grid(
|
|
165
|
-
nx=5,
|
|
166
|
-
ny=5,
|
|
167
|
-
size_x=1800,
|
|
168
|
-
size_y=2400,
|
|
169
|
-
center_lon=180,
|
|
170
|
-
center_lat=61,
|
|
171
|
-
rot=20,
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
return grid
|
|
175
|
-
|
|
176
|
-
|
|
177
156
|
@pytest.mark.parametrize(
|
|
178
157
|
"grid_fixture",
|
|
179
158
|
[
|
|
@@ -206,6 +185,7 @@ def test_successful_initialization_with_regional_data(grid_fixture, request, use
|
|
|
206
185
|
start_time=start_time,
|
|
207
186
|
end_time=end_time,
|
|
208
187
|
source={"name": "ERA5", "path": fname},
|
|
188
|
+
correct_radiation=True,
|
|
209
189
|
use_dask=use_dask,
|
|
210
190
|
)
|
|
211
191
|
|
|
@@ -747,7 +727,8 @@ def test_from_yaml_missing_surface_forcing(tmp_path, use_dask):
|
|
|
747
727
|
center_lon: -10
|
|
748
728
|
center_lat: 61
|
|
749
729
|
rot: -20
|
|
750
|
-
topography_source:
|
|
730
|
+
topography_source:
|
|
731
|
+
name: ETOPO5
|
|
751
732
|
hmin: 5.0
|
|
752
733
|
"""
|
|
753
734
|
)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import pytest
|
|
1
2
|
from roms_tools import Grid
|
|
2
3
|
from roms_tools.setup.topography import _compute_rfactor
|
|
4
|
+
from roms_tools.setup.download import download_test_data
|
|
3
5
|
import numpy as np
|
|
4
6
|
import numpy.testing as npt
|
|
5
7
|
from scipy.ndimage import label
|
|
@@ -52,7 +54,13 @@ def test_hmin_criterion():
|
|
|
52
54
|
assert grid.hmin == 5.0
|
|
53
55
|
assert np.less_equal(grid.hmin, grid.ds.h.min())
|
|
54
56
|
|
|
55
|
-
grid.
|
|
57
|
+
grid.update_topography(hmin=10.0)
|
|
58
|
+
|
|
59
|
+
assert grid.hmin == 10.0
|
|
60
|
+
assert np.less_equal(grid.hmin, grid.ds.h.min())
|
|
61
|
+
|
|
62
|
+
# this should not do anything
|
|
63
|
+
grid.update_topography()
|
|
56
64
|
|
|
57
65
|
assert grid.hmin == 10.0
|
|
58
66
|
assert np.less_equal(grid.hmin, grid.ds.h.min())
|
|
@@ -94,3 +102,100 @@ def test_mask_topography_boundary():
|
|
|
94
102
|
np.testing.assert_array_equal(
|
|
95
103
|
grid.ds.mask_rho.isel(xi_rho=-1).data, grid.ds.mask_rho.isel(xi_rho=-2).data
|
|
96
104
|
)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@pytest.fixture()
|
|
108
|
+
def grid_that_straddles_dateline_with_shifted_global_etopo_data():
|
|
109
|
+
|
|
110
|
+
grid = Grid(
|
|
111
|
+
nx=5,
|
|
112
|
+
ny=5,
|
|
113
|
+
size_x=1000,
|
|
114
|
+
size_y=1000,
|
|
115
|
+
center_lon=0,
|
|
116
|
+
center_lat=0,
|
|
117
|
+
rot=20,
|
|
118
|
+
topography_source={
|
|
119
|
+
"name": "ETOPO5",
|
|
120
|
+
"path": download_test_data("etopo5_coarsened_and_shifted.nc"),
|
|
121
|
+
},
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
return grid
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@pytest.fixture()
|
|
128
|
+
def grid_that_straddles_dateline_with_global_srtm15_data():
|
|
129
|
+
|
|
130
|
+
grid = Grid(
|
|
131
|
+
nx=5,
|
|
132
|
+
ny=5,
|
|
133
|
+
size_x=1000,
|
|
134
|
+
size_y=1000,
|
|
135
|
+
center_lon=0,
|
|
136
|
+
center_lat=0,
|
|
137
|
+
rot=20,
|
|
138
|
+
topography_source={
|
|
139
|
+
"name": "SRTM15",
|
|
140
|
+
"path": download_test_data("srtm15_coarsened.nc"),
|
|
141
|
+
},
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
return grid
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@pytest.fixture()
|
|
148
|
+
def grid_that_straddles_180_degree_meridian_with_shifted_global_etopo_data():
|
|
149
|
+
|
|
150
|
+
grid = Grid(
|
|
151
|
+
nx=5,
|
|
152
|
+
ny=5,
|
|
153
|
+
size_x=1000,
|
|
154
|
+
size_y=1000,
|
|
155
|
+
center_lon=180,
|
|
156
|
+
center_lat=0,
|
|
157
|
+
rot=20,
|
|
158
|
+
topography_source={
|
|
159
|
+
"name": "ETOPO5",
|
|
160
|
+
"path": download_test_data("etopo5_coarsened_and_shifted.nc"),
|
|
161
|
+
},
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
return grid
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
@pytest.fixture()
|
|
168
|
+
def grid_that_straddles_180_degree_meridian_with_global_srtm15_data():
|
|
169
|
+
|
|
170
|
+
grid = Grid(
|
|
171
|
+
nx=5,
|
|
172
|
+
ny=5,
|
|
173
|
+
size_x=1000,
|
|
174
|
+
size_y=1000,
|
|
175
|
+
center_lon=180,
|
|
176
|
+
center_lat=0,
|
|
177
|
+
rot=20,
|
|
178
|
+
topography_source={
|
|
179
|
+
"name": "SRTM15",
|
|
180
|
+
"path": download_test_data("srtm15_coarsened.nc"),
|
|
181
|
+
},
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
return grid
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
@pytest.mark.parametrize(
|
|
188
|
+
"grid_fixture",
|
|
189
|
+
[
|
|
190
|
+
"grid_that_straddles_dateline",
|
|
191
|
+
"grid_that_straddles_180_degree_meridian",
|
|
192
|
+
"grid_that_straddles_dateline_with_shifted_global_etopo_data",
|
|
193
|
+
"grid_that_straddles_180_degree_meridian_with_shifted_global_etopo_data",
|
|
194
|
+
"grid_that_straddles_dateline_with_global_srtm15_data",
|
|
195
|
+
"grid_that_straddles_180_degree_meridian_with_global_srtm15_data",
|
|
196
|
+
],
|
|
197
|
+
)
|
|
198
|
+
def test_successful_initialization(grid_fixture, request):
|
|
199
|
+
|
|
200
|
+
grid = request.getfixturevalue(grid_fixture)
|
|
201
|
+
assert grid is not None
|
|
@@ -23,7 +23,7 @@ def _get_fname(name):
|
|
|
23
23
|
"bgc_surface_forcing_from_climatology",
|
|
24
24
|
"boundary_forcing",
|
|
25
25
|
"bgc_boundary_forcing_from_climatology",
|
|
26
|
-
"
|
|
26
|
+
"river_forcing_with_bgc",
|
|
27
27
|
"river_forcing_no_climatology",
|
|
28
28
|
],
|
|
29
29
|
)
|
|
@@ -62,7 +62,7 @@ def test_save_results(forcing_fixture, request):
|
|
|
62
62
|
"bgc_surface_forcing_from_climatology",
|
|
63
63
|
"boundary_forcing",
|
|
64
64
|
"bgc_boundary_forcing_from_climatology",
|
|
65
|
-
"
|
|
65
|
+
"river_forcing_with_bgc",
|
|
66
66
|
"river_forcing_no_climatology",
|
|
67
67
|
],
|
|
68
68
|
)
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2024 [C-Worthy
|
|
189
|
+
Copyright 2024 [C]-Worthy LLC.
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: roms-tools
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Tools for running and analysing UCLA-ROMS simulations
|
|
5
5
|
Author-email: Nora Loose <nora.loose@gmail.com>, Thomas Nicholas <tom@cworthy.org>
|
|
6
6
|
License: Apache-2
|
|
@@ -31,6 +31,7 @@ Requires-Dist: netcdf4
|
|
|
31
31
|
Requires-Dist: PyYAML
|
|
32
32
|
Requires-Dist: pyamg
|
|
33
33
|
Requires-Dist: bottleneck
|
|
34
|
+
Requires-Dist: regionmask
|
|
34
35
|
Provides-Extra: dask
|
|
35
36
|
Requires-Dist: dask[diagnostics]; extra == "dask"
|
|
36
37
|
|
|
@@ -42,12 +43,16 @@ Requires-Dist: dask[diagnostics]; extra == "dask"
|
|
|
42
43
|

|
|
43
44
|

|
|
44
45
|
|
|
46
|
+
> [!Warning]
|
|
47
|
+
> **This project is still in an early phase of development.**
|
|
48
|
+
>
|
|
49
|
+
> The [python API](https://roms-tools.readthedocs.io/en/latest/api.html) is not yet stable.
|
|
50
|
+
> Therefore whilst you are welcome to try out using the package, we cannot yet guarantee backwards compatibility.
|
|
51
|
+
> We expect to reach a more stable version in Q1 2025.
|
|
45
52
|
|
|
46
53
|
## Overview
|
|
47
54
|
|
|
48
|
-
A suite of
|
|
49
|
-
|
|
50
|
-
<mark>**DISCLAIMER**: This project is **ALPHA** and will be **EXPERIMENTAL** at least throughout 2024. We do not recommend to use this software before this ALPHA development and test phase is completed.</mark>
|
|
55
|
+
A suite of Python tools for setting up a [ROMS](https://github.com/CESR-lab/ucla-roms) simulation.
|
|
51
56
|
|
|
52
57
|
## Installation
|
|
53
58
|
|