roms-tools 2.0.0__py3-none-any.whl → 2.2.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 +22 -32
- roms_tools/setup/datasets.py +19 -21
- roms_tools/setup/grid.py +253 -139
- roms_tools/setup/initial_conditions.py +29 -6
- roms_tools/setup/mask.py +50 -4
- roms_tools/setup/nesting.py +575 -0
- roms_tools/setup/plot.py +214 -55
- roms_tools/setup/river_forcing.py +125 -29
- roms_tools/setup/surface_forcing.py +33 -12
- roms_tools/setup/tides.py +31 -6
- roms_tools/setup/topography.py +168 -35
- roms_tools/setup/utils.py +137 -21
- roms_tools/tests/test_setup/test_boundary_forcing.py +7 -5
- 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_initial_conditions.py +6 -6
- roms_tools/tests/test_setup/test_nesting.py +489 -0
- roms_tools/tests/test_setup/test_river_forcing.py +50 -13
- roms_tools/tests/test_setup/test_surface_forcing.py +9 -8
- roms_tools/tests/test_setup/test_tides.py +5 -5
- roms_tools/tests/test_setup/test_validation.py +2 -2
- {roms_tools-2.0.0.dist-info → roms_tools-2.2.0.dist-info}/METADATA +9 -5
- {roms_tools-2.0.0.dist-info → roms_tools-2.2.0.dist-info}/RECORD +54 -53
- {roms_tools-2.0.0.dist-info → roms_tools-2.2.0.dist-info}/WHEEL +1 -1
- roms_tools/_version.py +0 -2
- 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_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-2.0.0.dist-info → roms_tools-2.2.0.dist-info}/LICENSE +0 -0
- {roms_tools-2.0.0.dist-info → roms_tools-2.2.0.dist-info}/top_level.txt +0 -0
roms_tools/setup/utils.py
CHANGED
|
@@ -745,6 +745,8 @@ def get_target_coords(grid, use_coarse_grid=False):
|
|
|
745
745
|
mask = grid.ds.get("mask_coarse")
|
|
746
746
|
if mask is not None:
|
|
747
747
|
mask = mask.rename({"eta_coarse": "eta_rho", "xi_coarse": "xi_rho"})
|
|
748
|
+
mask_u = interpolate_from_rho_to_u(mask, method="multiplicative")
|
|
749
|
+
mask_v = interpolate_from_rho_to_v(mask, method="multiplicative")
|
|
748
750
|
|
|
749
751
|
lat_psi = grid.ds.get("lat_psi_coarse")
|
|
750
752
|
lon_psi = grid.ds.get("lon_psi_coarse")
|
|
@@ -754,6 +756,8 @@ def get_target_coords(grid, use_coarse_grid=False):
|
|
|
754
756
|
lon = grid.ds.lon_rho
|
|
755
757
|
angle = grid.ds.angle
|
|
756
758
|
mask = grid.ds.get("mask_rho")
|
|
759
|
+
mask_u = grid.ds.get("mask_u")
|
|
760
|
+
mask_v = grid.ds.get("mask_v")
|
|
757
761
|
lat_psi = grid.ds.get("lat_psi")
|
|
758
762
|
lon_psi = grid.ds.get("lon_psi")
|
|
759
763
|
|
|
@@ -776,6 +780,8 @@ def get_target_coords(grid, use_coarse_grid=False):
|
|
|
776
780
|
"lon_psi": lon_psi,
|
|
777
781
|
"angle": angle,
|
|
778
782
|
"mask": mask,
|
|
783
|
+
"mask_u": mask_u,
|
|
784
|
+
"mask_v": mask_v,
|
|
779
785
|
"straddle": straddle,
|
|
780
786
|
}
|
|
781
787
|
|
|
@@ -927,37 +933,40 @@ def get_vector_pairs(variable_info):
|
|
|
927
933
|
return vector_pairs
|
|
928
934
|
|
|
929
935
|
|
|
930
|
-
def gc_dist(lon1, lat1, lon2, lat2):
|
|
931
|
-
"""Calculate the great circle distance between two points on the Earth's surface
|
|
932
|
-
|
|
933
|
-
radians).
|
|
936
|
+
def gc_dist(lon1, lat1, lon2, lat2, input_in_degrees=True):
|
|
937
|
+
"""Calculate the great circle distance between two points on the Earth's surface
|
|
938
|
+
using the Haversine formula.
|
|
934
939
|
|
|
935
|
-
|
|
936
|
-
|
|
940
|
+
Latitude and longitude are assumed to be in degrees by default. If `input_in_degrees` is set to `False`,
|
|
941
|
+
the input is assumed to already be in radians.
|
|
937
942
|
|
|
938
943
|
Parameters
|
|
939
944
|
----------
|
|
940
945
|
lon1, lat1 : float
|
|
941
|
-
Longitude and latitude of the first point
|
|
946
|
+
Longitude and latitude of the first point.
|
|
942
947
|
lon2, lat2 : float
|
|
943
|
-
Longitude and latitude of the second point
|
|
948
|
+
Longitude and latitude of the second point.
|
|
949
|
+
input_in_degrees : bool, optional
|
|
950
|
+
If True (default), the input coordinates are assumed to be in degrees and will be converted to radians.
|
|
951
|
+
If False, the input is assumed to be in radians and no conversion is applied.
|
|
944
952
|
|
|
945
953
|
Returns
|
|
946
954
|
-------
|
|
947
955
|
dis : float
|
|
948
956
|
The great circle distance between the two points in meters.
|
|
949
|
-
This is the shortest distance along the surface of a sphere (Earth).
|
|
950
957
|
|
|
951
958
|
Notes
|
|
952
959
|
-----
|
|
953
960
|
The radius of the Earth is taken to be 6371315 meters.
|
|
954
961
|
"""
|
|
962
|
+
|
|
955
963
|
# Convert degrees to radians
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
964
|
+
if input_in_degrees:
|
|
965
|
+
d2r = np.pi / 180
|
|
966
|
+
lon1 = lon1 * d2r
|
|
967
|
+
lat1 = lat1 * d2r
|
|
968
|
+
lon2 = lon2 * d2r
|
|
969
|
+
lat2 = lat2 * d2r
|
|
961
970
|
|
|
962
971
|
# Difference in latitudes and longitudes
|
|
963
972
|
dlat = lat2 - lat1
|
|
@@ -1058,12 +1067,21 @@ def _to_yaml(forcing_object, filepath: Union[str, Path]) -> None:
|
|
|
1058
1067
|
filepath = Path(filepath)
|
|
1059
1068
|
|
|
1060
1069
|
# Step 1: Serialize Grid data
|
|
1061
|
-
#
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1070
|
+
# Check if the forcing_object has a grid attribute
|
|
1071
|
+
if hasattr(forcing_object, "grid") and forcing_object.grid is not None:
|
|
1072
|
+
grid_data = asdict(forcing_object.grid)
|
|
1073
|
+
grid_yaml_data = {"Grid": _pop_grid_data(grid_data)}
|
|
1074
|
+
else:
|
|
1075
|
+
parent_grid_data = asdict(forcing_object.parent_grid)
|
|
1076
|
+
parent_grid_yaml_data = {"ParentGrid": _pop_grid_data(parent_grid_data)}
|
|
1077
|
+
child_grid_data = asdict(forcing_object.child_grid)
|
|
1078
|
+
child_grid_yaml_data = {"ChildGrid": _pop_grid_data(child_grid_data)}
|
|
1079
|
+
|
|
1080
|
+
grid_yaml_data = {**parent_grid_yaml_data, **child_grid_yaml_data}
|
|
1081
|
+
|
|
1082
|
+
# Ensure forcing_object.source.path is a string (convert if it's a pathlib object)
|
|
1083
|
+
if hasattr(forcing_object, "source") and "path" in forcing_object.source:
|
|
1084
|
+
forcing_object.source["path"] = str(forcing_object.source["path"])
|
|
1067
1085
|
|
|
1068
1086
|
# Step 2: Get ROMS Tools version
|
|
1069
1087
|
# Fetch the version of the 'roms-tools' package for inclusion in the YAML header
|
|
@@ -1082,7 +1100,16 @@ def _to_yaml(forcing_object, filepath: Union[str, Path]) -> None:
|
|
|
1082
1100
|
filtered_field_names = [
|
|
1083
1101
|
param
|
|
1084
1102
|
for param in field_names
|
|
1085
|
-
if param
|
|
1103
|
+
if param
|
|
1104
|
+
not in (
|
|
1105
|
+
"grid",
|
|
1106
|
+
"parent_grid",
|
|
1107
|
+
"child_grid",
|
|
1108
|
+
"ds",
|
|
1109
|
+
"use_dask",
|
|
1110
|
+
"bypass_validation",
|
|
1111
|
+
"climatology",
|
|
1112
|
+
)
|
|
1086
1113
|
]
|
|
1087
1114
|
|
|
1088
1115
|
for field_name in filtered_field_names:
|
|
@@ -1111,6 +1138,14 @@ def _to_yaml(forcing_object, filepath: Union[str, Path]) -> None:
|
|
|
1111
1138
|
yaml.dump(yaml_data, file, default_flow_style=False, sort_keys=False)
|
|
1112
1139
|
|
|
1113
1140
|
|
|
1141
|
+
def _pop_grid_data(grid_data):
|
|
1142
|
+
grid_data.pop("ds", None) # Remove 'ds' attribute (non-serializable)
|
|
1143
|
+
grid_data.pop("straddle", None)
|
|
1144
|
+
grid_data.pop("verbose", None)
|
|
1145
|
+
|
|
1146
|
+
return grid_data
|
|
1147
|
+
|
|
1148
|
+
|
|
1114
1149
|
def _from_yaml(forcing_object: Type, filepath: Union[str, Path]) -> Dict[str, Any]:
|
|
1115
1150
|
"""Extract the configuration data for a given forcing object from a YAML file.
|
|
1116
1151
|
|
|
@@ -1203,3 +1238,84 @@ def handle_boundaries(field):
|
|
|
1203
1238
|
field[:, -1] = field[:, -2]
|
|
1204
1239
|
|
|
1205
1240
|
return field
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
def get_boundary_coords():
|
|
1244
|
+
"""This function determines the boundary points for the grid variables by specifying
|
|
1245
|
+
the indices for the south, east, north, and west boundaries.
|
|
1246
|
+
|
|
1247
|
+
Returns
|
|
1248
|
+
-------
|
|
1249
|
+
dict
|
|
1250
|
+
A dictionary containing the boundary coordinates for different variable types.
|
|
1251
|
+
The dictionary has the following structure:
|
|
1252
|
+
- Keys: Variable types ("rho", "u", "v", "vector").
|
|
1253
|
+
- Values: Nested dictionaries that map each direction ("south", "east", "north", "west")
|
|
1254
|
+
to another dictionary specifying the boundary coordinates, represented by grid indices
|
|
1255
|
+
for the respective variable types. For example:
|
|
1256
|
+
- "rho" variables (e.g., `eta_rho`, `xi_rho`)
|
|
1257
|
+
- "u" variables (e.g., `xi_u`)
|
|
1258
|
+
- "v" variables (e.g., `eta_v`)
|
|
1259
|
+
- "vector" variables with lists of indices for multiple grid points (e.g., `eta_rho`, `xi_rho`).
|
|
1260
|
+
"""
|
|
1261
|
+
|
|
1262
|
+
bdry_coords = {
|
|
1263
|
+
"rho": {
|
|
1264
|
+
"south": {"eta_rho": 0},
|
|
1265
|
+
"east": {"xi_rho": -1},
|
|
1266
|
+
"north": {"eta_rho": -1},
|
|
1267
|
+
"west": {"xi_rho": 0},
|
|
1268
|
+
},
|
|
1269
|
+
"u": {
|
|
1270
|
+
"south": {"eta_rho": 0},
|
|
1271
|
+
"east": {"xi_u": -1},
|
|
1272
|
+
"north": {"eta_rho": -1},
|
|
1273
|
+
"west": {"xi_u": 0},
|
|
1274
|
+
},
|
|
1275
|
+
"v": {
|
|
1276
|
+
"south": {"eta_v": 0},
|
|
1277
|
+
"east": {"xi_rho": -1},
|
|
1278
|
+
"north": {"eta_v": -1},
|
|
1279
|
+
"west": {"xi_rho": 0},
|
|
1280
|
+
},
|
|
1281
|
+
"vector": {
|
|
1282
|
+
"south": {"eta_rho": [0, 1]},
|
|
1283
|
+
"east": {"xi_rho": [-2, -1]},
|
|
1284
|
+
"north": {"eta_rho": [-2, -1]},
|
|
1285
|
+
"west": {"xi_rho": [0, 1]},
|
|
1286
|
+
},
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
return bdry_coords
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
def wrap_longitudes(grid_ds, straddle):
|
|
1293
|
+
"""Adjusts longitude values in a dataset to handle dateline crossing.
|
|
1294
|
+
|
|
1295
|
+
Parameters
|
|
1296
|
+
----------
|
|
1297
|
+
grid_ds : xr.Dataset
|
|
1298
|
+
The dataset containing longitude variables to adjust.
|
|
1299
|
+
straddle : bool
|
|
1300
|
+
If True, adjusts longitudes to the range [-180, 180] for datasets
|
|
1301
|
+
that straddle the dateline. If False, adjusts longitudes to the
|
|
1302
|
+
range [0, 360].
|
|
1303
|
+
|
|
1304
|
+
Returns
|
|
1305
|
+
-------
|
|
1306
|
+
xr.Dataset
|
|
1307
|
+
The dataset with adjusted longitude values.
|
|
1308
|
+
"""
|
|
1309
|
+
for lon_dim in ["lon_rho", "lon_u", "lon_v"]:
|
|
1310
|
+
if straddle:
|
|
1311
|
+
grid_ds[lon_dim] = xr.where(
|
|
1312
|
+
grid_ds[lon_dim] > 180,
|
|
1313
|
+
grid_ds[lon_dim] - 360,
|
|
1314
|
+
grid_ds[lon_dim],
|
|
1315
|
+
)
|
|
1316
|
+
else:
|
|
1317
|
+
grid_ds[lon_dim] = xr.where(
|
|
1318
|
+
grid_ds[lon_dim] < 0, grid_ds[lon_dim] + 360, grid_ds[lon_dim]
|
|
1319
|
+
)
|
|
1320
|
+
|
|
1321
|
+
return grid_ds
|
|
@@ -19,7 +19,7 @@ import logging
|
|
|
19
19
|
def test_boundary_forcing_creation(boundary_forcing_fixture, request):
|
|
20
20
|
"""Test the creation of the BoundaryForcing object."""
|
|
21
21
|
|
|
22
|
-
fname = download_test_data("GLORYS_coarse_test_data.nc")
|
|
22
|
+
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
23
23
|
boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
24
24
|
assert boundary_forcing.start_time == datetime(2021, 6, 29)
|
|
25
25
|
assert boundary_forcing.end_time == datetime(2021, 6, 30)
|
|
@@ -59,7 +59,9 @@ def test_boundary_forcing_creation(boundary_forcing_fixture, request):
|
|
|
59
59
|
def test_boundary_forcing_creation_with_bgc(boundary_forcing_fixture, request):
|
|
60
60
|
"""Test the creation of the BoundaryForcing object."""
|
|
61
61
|
|
|
62
|
-
fname_bgc =
|
|
62
|
+
fname_bgc = Path(
|
|
63
|
+
download_test_data("CESM_regional_coarse_test_data_climatology.nc")
|
|
64
|
+
)
|
|
63
65
|
boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
64
66
|
|
|
65
67
|
assert boundary_forcing.start_time == datetime(2021, 6, 29)
|
|
@@ -103,7 +105,7 @@ def test_unsuccessful_boundary_forcing_creation_with_1d_fill(use_dask):
|
|
|
103
105
|
hc=250.0, # critical depth
|
|
104
106
|
)
|
|
105
107
|
|
|
106
|
-
fname = download_test_data("GLORYS_coarse_test_data.nc")
|
|
108
|
+
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
107
109
|
|
|
108
110
|
with pytest.raises(ValueError, match="consists entirely of NaNs"):
|
|
109
111
|
|
|
@@ -138,7 +140,7 @@ def test_boundary_divided_by_land_warning(caplog, use_dask):
|
|
|
138
140
|
nx=5, ny=5, size_x=500, size_y=500, center_lon=-10, center_lat=65, rot=0
|
|
139
141
|
)
|
|
140
142
|
|
|
141
|
-
fname = download_test_data("GLORYS_coarse_test_data.nc")
|
|
143
|
+
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
142
144
|
|
|
143
145
|
with caplog.at_level(logging.WARNING):
|
|
144
146
|
BoundaryForcing(
|
|
@@ -158,7 +160,7 @@ def test_1d_and_2d_fill_coincide_if_no_land(use_dask):
|
|
|
158
160
|
# this grid lies entirely over open ocean
|
|
159
161
|
grid = Grid(nx=5, ny=5, size_x=300, size_y=300, center_lon=-5, center_lat=65, rot=0)
|
|
160
162
|
|
|
161
|
-
fname = download_test_data("GLORYS_coarse_test_data.nc")
|
|
163
|
+
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
162
164
|
|
|
163
165
|
kwargs = {
|
|
164
166
|
"grid": grid,
|
|
@@ -120,8 +120,7 @@
|
|
|
120
120
|
"nriver"
|
|
121
121
|
],
|
|
122
122
|
"coordinates": "abs_time river_name tracer_name",
|
|
123
|
-
"long_name": "River tracer data"
|
|
124
|
-
"units": "degrees C [temperature]; psu [salinity]"
|
|
123
|
+
"long_name": "River tracer data"
|
|
125
124
|
},
|
|
126
125
|
"river_volume/.zarray": {
|
|
127
126
|
"chunks": [
|
|
@@ -165,7 +164,7 @@
|
|
|
165
164
|
"id": "blosc",
|
|
166
165
|
"shuffle": 1
|
|
167
166
|
},
|
|
168
|
-
"dtype": "<
|
|
167
|
+
"dtype": "<U4",
|
|
169
168
|
"fill_value": null,
|
|
170
169
|
"filters": null,
|
|
171
170
|
"order": "C",
|
|
Binary file
|
roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/.zmetadata
RENAMED
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"river_tracer/.zarray": {
|
|
122
122
|
"chunks": [
|
|
123
123
|
12,
|
|
124
|
-
|
|
124
|
+
34,
|
|
125
125
|
6
|
|
126
126
|
],
|
|
127
127
|
"compressor": {
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"order": "C",
|
|
138
138
|
"shape": [
|
|
139
139
|
12,
|
|
140
|
-
|
|
140
|
+
34,
|
|
141
141
|
6
|
|
142
142
|
],
|
|
143
143
|
"zarr_format": 2
|
|
@@ -149,8 +149,7 @@
|
|
|
149
149
|
"nriver"
|
|
150
150
|
],
|
|
151
151
|
"coordinates": "abs_time month river_name tracer_name",
|
|
152
|
-
"long_name": "River tracer data"
|
|
153
|
-
"units": "degrees C [temperature]; psu [salinity]"
|
|
152
|
+
"long_name": "River tracer data"
|
|
154
153
|
},
|
|
155
154
|
"river_volume/.zarray": {
|
|
156
155
|
"chunks": [
|
|
@@ -185,7 +184,7 @@
|
|
|
185
184
|
},
|
|
186
185
|
"tracer_name/.zarray": {
|
|
187
186
|
"chunks": [
|
|
188
|
-
|
|
187
|
+
34
|
|
189
188
|
],
|
|
190
189
|
"compressor": {
|
|
191
190
|
"blocksize": 0,
|
|
@@ -199,7 +198,7 @@
|
|
|
199
198
|
"filters": null,
|
|
200
199
|
"order": "C",
|
|
201
200
|
"shape": [
|
|
202
|
-
|
|
201
|
+
34
|
|
203
202
|
],
|
|
204
203
|
"zarr_format": 2
|
|
205
204
|
},
|
|
Binary file
|
|
@@ -431,8 +431,8 @@ def test_era5_correction_choose_subdomain(use_dask):
|
|
|
431
431
|
data = ERA5Correction(use_dask=use_dask)
|
|
432
432
|
lats = data.ds.latitude[10:20]
|
|
433
433
|
lons = data.ds.longitude[10:20]
|
|
434
|
-
|
|
435
|
-
data.choose_subdomain(
|
|
434
|
+
target_coords = {"lat": lats, "lon": lons}
|
|
435
|
+
data.choose_subdomain(target_coords, straddle=False)
|
|
436
436
|
assert (data.ds["latitude"] == lats).all()
|
|
437
437
|
assert (data.ds["longitude"] == lons).all()
|
|
438
438
|
|
|
@@ -26,7 +26,7 @@ def test_initial_conditions_creation(ic_fixture, request):
|
|
|
26
26
|
assert ic.ini_time == datetime(2021, 6, 29)
|
|
27
27
|
assert ic.source == {
|
|
28
28
|
"name": "GLORYS",
|
|
29
|
-
"path": download_test_data("GLORYS_coarse_test_data.nc"),
|
|
29
|
+
"path": Path(download_test_data("GLORYS_coarse_test_data.nc")),
|
|
30
30
|
"climatology": False,
|
|
31
31
|
}
|
|
32
32
|
assert isinstance(ic.ds, xr.Dataset)
|
|
@@ -83,7 +83,7 @@ def test_initial_conditions_missing_physics_path(example_grid, use_dask):
|
|
|
83
83
|
# Test initialization with missing 'name' in bgc_source
|
|
84
84
|
def test_initial_conditions_missing_bgc_name(example_grid, use_dask):
|
|
85
85
|
|
|
86
|
-
fname = download_test_data("GLORYS_coarse_test_data.nc")
|
|
86
|
+
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
87
87
|
with pytest.raises(
|
|
88
88
|
ValueError, match="`bgc_source` must include a 'name' if it is provided."
|
|
89
89
|
):
|
|
@@ -99,7 +99,7 @@ def test_initial_conditions_missing_bgc_name(example_grid, use_dask):
|
|
|
99
99
|
# Test initialization with missing 'path' in bgc_source
|
|
100
100
|
def test_initial_conditions_missing_bgc_path(example_grid, use_dask):
|
|
101
101
|
|
|
102
|
-
fname = download_test_data("GLORYS_coarse_test_data.nc")
|
|
102
|
+
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
103
103
|
with pytest.raises(
|
|
104
104
|
ValueError, match="`bgc_source` must include a 'path' if it is provided."
|
|
105
105
|
):
|
|
@@ -115,7 +115,7 @@ def test_initial_conditions_missing_bgc_path(example_grid, use_dask):
|
|
|
115
115
|
# Test default climatology value
|
|
116
116
|
def test_initial_conditions_default_climatology(example_grid, use_dask):
|
|
117
117
|
|
|
118
|
-
fname = download_test_data("GLORYS_coarse_test_data.nc")
|
|
118
|
+
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
119
119
|
|
|
120
120
|
initial_conditions = InitialConditions(
|
|
121
121
|
grid=example_grid,
|
|
@@ -130,8 +130,8 @@ def test_initial_conditions_default_climatology(example_grid, use_dask):
|
|
|
130
130
|
|
|
131
131
|
def test_initial_conditions_default_bgc_climatology(example_grid, use_dask):
|
|
132
132
|
|
|
133
|
-
fname = download_test_data("GLORYS_coarse_test_data.nc")
|
|
134
|
-
fname_bgc = download_test_data("CESM_regional_test_data_one_time_slice.nc")
|
|
133
|
+
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
134
|
+
fname_bgc = Path(download_test_data("CESM_regional_test_data_one_time_slice.nc"))
|
|
135
135
|
|
|
136
136
|
initial_conditions = InitialConditions(
|
|
137
137
|
grid=example_grid,
|