roms-tools 0.1.0__py3-none-any.whl → 0.20__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.
@@ -0,0 +1,337 @@
1
+ import pytest
2
+ import numpy as np
3
+ import tempfile
4
+ import os
5
+ from roms_tools import Grid, VerticalCoordinate
6
+ import textwrap
7
+
8
+
9
+ @pytest.fixture
10
+ def example_grid():
11
+ """
12
+ Fixture for creating a Grid object.
13
+ """
14
+ grid = Grid(
15
+ nx=2, ny=2, size_x=500, size_y=1000, center_lon=0, center_lat=55, rot=10
16
+ )
17
+
18
+ return grid
19
+
20
+
21
+ def test_invalid_theta_s_value(example_grid):
22
+ """
23
+ Test the validation of the theta_s value.
24
+ """
25
+ with pytest.raises(ValueError):
26
+
27
+ VerticalCoordinate(
28
+ grid=example_grid,
29
+ N=3,
30
+ theta_s=11.0, # Invalid value, should be 0 < theta_s <= 10
31
+ theta_b=2.0,
32
+ hc=250.0,
33
+ )
34
+
35
+
36
+ def test_invalid_theta_b_value(example_grid):
37
+ """
38
+ Test the validation of the theta_b value.
39
+ """
40
+ with pytest.raises(ValueError):
41
+
42
+ VerticalCoordinate(
43
+ grid=example_grid,
44
+ N=3,
45
+ theta_s=5.0,
46
+ theta_b=5.0, # Invalid value, should be 0 < theta_b <= 4
47
+ hc=250.0,
48
+ )
49
+
50
+
51
+ @pytest.fixture
52
+ def vertical_coordinate(example_grid):
53
+
54
+ return VerticalCoordinate(
55
+ grid=example_grid, N=3, theta_s=5.0, theta_b=2.0, hc=250.0
56
+ )
57
+
58
+
59
+ def test_vertical_coordinate_data_consistency(vertical_coordinate, tmp_path):
60
+ """
61
+ Test that the data within the VerticalCoordinate object remains consistent.
62
+ """
63
+
64
+ # Define the expected data
65
+ expected_sc_r = np.array([-0.8333333, -0.5, -0.16666667], dtype=np.float32)
66
+ expected_Cs_r = np.array([-0.6641397, -0.15129805, -0.01156188], dtype=np.float32)
67
+ expected_layer_depth_rho = np.array(
68
+ [
69
+ [
70
+ [17.235603, 9.938617, 3.2495391],
71
+ [17.235603, 9.938617, 3.2495391],
72
+ [24.206884, 13.7451725, 4.4592304],
73
+ [24.206884, 13.7451725, 4.4592304],
74
+ ],
75
+ [
76
+ [17.235603, 9.938617, 3.2495391],
77
+ [17.235603, 9.938617, 3.2495391],
78
+ [24.206884, 13.7451725, 4.4592304],
79
+ [24.206884, 13.7451725, 4.4592304],
80
+ ],
81
+ [
82
+ [25.667452, 14.528268, 4.7055993],
83
+ [25.667452, 14.528268, 4.7055993],
84
+ [35.966946, 19.916193, 6.377065],
85
+ [35.966946, 19.916193, 6.377065],
86
+ ],
87
+ [
88
+ [25.667452, 14.528268, 4.7055993],
89
+ [25.667452, 14.528268, 4.7055993],
90
+ [35.966946, 19.916193, 6.377065],
91
+ [35.966946, 19.916193, 6.377065],
92
+ ],
93
+ ],
94
+ dtype=np.float32,
95
+ )
96
+ expected_layer_depth_u = np.array(
97
+ [
98
+ [
99
+ [17.235603, 9.938617, 3.2495391],
100
+ [20.721243, 11.841895, 3.854385],
101
+ [24.206884, 13.7451725, 4.4592304],
102
+ ],
103
+ [
104
+ [17.235603, 9.938617, 3.2495391],
105
+ [20.721243, 11.841895, 3.854385],
106
+ [24.206884, 13.7451725, 4.4592304],
107
+ ],
108
+ [
109
+ [25.667452, 14.528268, 4.7055993],
110
+ [30.817198, 17.22223, 5.5413322],
111
+ [35.966946, 19.916193, 6.377065],
112
+ ],
113
+ [
114
+ [25.667452, 14.528268, 4.7055993],
115
+ [30.817198, 17.22223, 5.5413322],
116
+ [35.966946, 19.916193, 6.377065],
117
+ ],
118
+ ],
119
+ dtype=np.float32,
120
+ )
121
+ expected_layer_depth_v = np.array(
122
+ [
123
+ [
124
+ [17.235603, 9.938617, 3.2495391],
125
+ [17.235603, 9.938617, 3.2495391],
126
+ [24.206884, 13.7451725, 4.4592304],
127
+ [24.206884, 13.7451725, 4.4592304],
128
+ ],
129
+ [
130
+ [21.451529, 12.233442, 3.977569],
131
+ [21.451529, 12.233442, 3.977569],
132
+ [30.086914, 16.830683, 5.418148],
133
+ [30.086914, 16.830683, 5.418148],
134
+ ],
135
+ [
136
+ [25.667452, 14.528268, 4.7055993],
137
+ [25.667452, 14.528268, 4.7055993],
138
+ [35.966946, 19.916193, 6.377065],
139
+ [35.966946, 19.916193, 6.377065],
140
+ ],
141
+ ],
142
+ dtype=np.float32,
143
+ )
144
+ expected_interface_depth_rho = np.array(
145
+ [
146
+ [
147
+ [21.013529, 13.487298, 6.5489607, -0.0],
148
+ [21.013529, 13.487298, 6.5489607, -0.0],
149
+ [29.688076, 18.78298, 9.014939, -0.0],
150
+ [29.688076, 18.78298, 9.014939, -0.0],
151
+ ],
152
+ [
153
+ [21.013529, 13.487298, 6.5489607, -0.0],
154
+ [21.013529, 13.487298, 6.5489607, -0.0],
155
+ [29.688076, 18.78298, 9.014939, -0.0],
156
+ [29.688076, 18.78298, 9.014939, -0.0],
157
+ ],
158
+ [
159
+ [31.51735, 19.881702, 9.519225, -0.0],
160
+ [31.51735, 19.881702, 9.519225, -0.0],
161
+ [44.52708, 27.529188, 12.960222, -0.0],
162
+ [44.52708, 27.529188, 12.960222, -0.0],
163
+ ],
164
+ [
165
+ [31.51735, 19.881702, 9.519225, -0.0],
166
+ [31.51735, 19.881702, 9.519225, -0.0],
167
+ [44.52708, 27.529188, 12.960222, -0.0],
168
+ [44.52708, 27.529188, 12.960222, -0.0],
169
+ ],
170
+ ],
171
+ dtype=np.float32,
172
+ )
173
+ expected_interface_depth_u = np.array(
174
+ [
175
+ [
176
+ [21.013529, 13.487298, 6.5489607, -0.0],
177
+ [25.350803, 16.13514, 7.78195, -0.0],
178
+ [29.688076, 18.78298, 9.014939, -0.0],
179
+ ],
180
+ [
181
+ [21.013529, 13.487298, 6.5489607, -0.0],
182
+ [25.350803, 16.13514, 7.78195, -0.0],
183
+ [29.688076, 18.78298, 9.014939, -0.0],
184
+ ],
185
+ [
186
+ [31.51735, 19.881702, 9.519225, -0.0],
187
+ [38.022217, 23.705446, 11.239724, -0.0],
188
+ [44.52708, 27.529188, 12.960222, -0.0],
189
+ ],
190
+ [
191
+ [31.51735, 19.881702, 9.519225, -0.0],
192
+ [38.022217, 23.705446, 11.239724, -0.0],
193
+ [44.52708, 27.529188, 12.960222, -0.0],
194
+ ],
195
+ ],
196
+ dtype=np.float32,
197
+ )
198
+ expected_interface_depth_v = np.array(
199
+ [
200
+ [
201
+ [21.013529, 13.487298, 6.5489607, -0.0],
202
+ [21.013529, 13.487298, 6.5489607, -0.0],
203
+ [29.688076, 18.78298, 9.014939, -0.0],
204
+ [29.688076, 18.78298, 9.014939, -0.0],
205
+ ],
206
+ [
207
+ [26.26544, 16.684502, 8.034093, -0.0],
208
+ [26.26544, 16.684502, 8.034093, -0.0],
209
+ [37.10758, 23.156084, 10.987581, -0.0],
210
+ [37.10758, 23.156084, 10.987581, -0.0],
211
+ ],
212
+ [
213
+ [31.51735, 19.881702, 9.519225, -0.0],
214
+ [31.51735, 19.881702, 9.519225, -0.0],
215
+ [44.52708, 27.529188, 12.960222, -0.0],
216
+ [44.52708, 27.529188, 12.960222, -0.0],
217
+ ],
218
+ ],
219
+ dtype=np.float32,
220
+ )
221
+ # Check the values in the dataset
222
+ assert np.allclose(vertical_coordinate.ds["sc_r"].values, expected_sc_r)
223
+ assert np.allclose(vertical_coordinate.ds["Cs_r"].values, expected_Cs_r)
224
+ assert np.allclose(
225
+ vertical_coordinate.ds["layer_depth_rho"].values, expected_layer_depth_rho
226
+ )
227
+ assert np.allclose(
228
+ vertical_coordinate.ds["layer_depth_u"].values, expected_layer_depth_u
229
+ )
230
+ assert np.allclose(
231
+ vertical_coordinate.ds["layer_depth_v"].values, expected_layer_depth_v
232
+ )
233
+ assert np.allclose(
234
+ vertical_coordinate.ds["interface_depth_rho"].values,
235
+ expected_interface_depth_rho,
236
+ )
237
+ assert np.allclose(
238
+ vertical_coordinate.ds["interface_depth_u"].values, expected_interface_depth_u
239
+ )
240
+ assert np.allclose(
241
+ vertical_coordinate.ds["interface_depth_v"].values, expected_interface_depth_v
242
+ )
243
+
244
+
245
+ def test_plot(vertical_coordinate):
246
+ vertical_coordinate.plot("layer_depth_u", s=0)
247
+ vertical_coordinate.plot("layer_depth_rho", s=-1)
248
+ vertical_coordinate.plot("interface_depth_v", s=-1)
249
+ vertical_coordinate.plot("layer_depth_rho", eta=0)
250
+ vertical_coordinate.plot("layer_depth_u", eta=0)
251
+ vertical_coordinate.plot("layer_depth_v", eta=0)
252
+ vertical_coordinate.plot("interface_depth_rho", eta=0)
253
+ vertical_coordinate.plot("interface_depth_u", eta=0)
254
+ vertical_coordinate.plot("interface_depth_v", eta=0)
255
+ vertical_coordinate.plot("layer_depth_rho", xi=0)
256
+ vertical_coordinate.plot("layer_depth_u", xi=0)
257
+ vertical_coordinate.plot("layer_depth_v", xi=0)
258
+ vertical_coordinate.plot("interface_depth_rho", xi=0)
259
+ vertical_coordinate.plot("interface_depth_u", xi=0)
260
+ vertical_coordinate.plot("interface_depth_v", xi=0)
261
+
262
+
263
+ def test_save(vertical_coordinate, tmp_path):
264
+ filepath = tmp_path / "vertical_coordinate.nc"
265
+ vertical_coordinate.save(filepath)
266
+ assert filepath.exists()
267
+
268
+
269
+ def test_roundtrip(vertical_coordinate):
270
+ """Test that creating a vertical_coordinate, saving it to file, and re-opening it is the same as just creating it."""
271
+
272
+ # Create a temporary file
273
+ with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
274
+ filepath = tmpfile.name
275
+
276
+ try:
277
+ vertical_coordinate.save(filepath)
278
+
279
+ vertical_coordinate_from_file = VerticalCoordinate.from_file(filepath)
280
+
281
+ assert vertical_coordinate.ds == vertical_coordinate_from_file.ds
282
+
283
+ finally:
284
+ os.remove(filepath)
285
+
286
+
287
+ def test_roundtrip_yaml(vertical_coordinate):
288
+ """Test that creating a VerticalCoordinate object, saving its parameters to yaml file, and re-opening yaml file creates the same object."""
289
+
290
+ # Create a temporary file
291
+ with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
292
+ filepath = tmpfile.name
293
+
294
+ try:
295
+ vertical_coordinate.to_yaml(filepath)
296
+
297
+ vertical_coordinate_from_file = VerticalCoordinate.from_yaml(filepath)
298
+
299
+ assert vertical_coordinate == vertical_coordinate_from_file
300
+
301
+ finally:
302
+ os.remove(filepath)
303
+
304
+
305
+ def test_from_yaml_missing_vertical_coordinate():
306
+ yaml_content = textwrap.dedent(
307
+ """\
308
+ ---
309
+ roms_tools_version: 0.0.0
310
+ ---
311
+ Grid:
312
+ nx: 100
313
+ ny: 100
314
+ size_x: 1800
315
+ size_y: 2400
316
+ center_lon: -10
317
+ center_lat: 61
318
+ rot: -20
319
+ topography_source: ETOPO5
320
+ smooth_factor: 8
321
+ hmin: 5.0
322
+ rmax: 0.2
323
+ """
324
+ )
325
+
326
+ with tempfile.NamedTemporaryFile(delete=False) as tmp_file:
327
+ yaml_filepath = tmp_file.name
328
+ tmp_file.write(yaml_content.encode())
329
+
330
+ try:
331
+ with pytest.raises(
332
+ ValueError,
333
+ match="No VerticalCoordinate configuration found in the YAML file.",
334
+ ):
335
+ VerticalCoordinate.from_yaml(yaml_filepath)
336
+ finally:
337
+ os.remove(yaml_filepath)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: roms-tools
3
- Version: 0.1.0
3
+ Version: 0.20
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: numba
31
31
 
32
32
  # ROMS-Tools
33
33
 
34
+ [![codecov](https://codecov.io/gh/CWorthy-ocean/roms-tools/graph/badge.svg?token=5S1oNu39xE)](https://codecov.io/gh/CWorthy-ocean/roms-tools)
34
35
  [![Documentation Status](https://readthedocs.org/projects/roms-tools/badge/?version=latest)](https://roms-tools.readthedocs.io/en/latest/?badge=latest)
35
36
  [![PyPI version](https://badge.fury.io/py/roms-tools.svg)](https://badge.fury.io/py/roms-tools)
36
37
 
@@ -59,7 +60,7 @@ pip install -e .
59
60
 
60
61
  ### Run the tests
61
62
 
62
- Before running the tests you can install and activate the following conda environment:
63
+ Before running the tests, you can install and activate the following conda environment:
63
64
 
64
65
  ```bash
65
66
  cd roms-tools
@@ -0,0 +1,28 @@
1
+ ci/environment.yml,sha256=s_PPgQryNiNnGGVoheZIkwTaoDZ-CfHXRxSTOvF-ZBs,407
2
+ roms_tools/__init__.py,sha256=lMa-9IeCSs1DNSKI00lbuDRUvtWUFWaS_x2nuOwkw88,727
3
+ roms_tools/_version.py,sha256=dNPL38J2xFc6i31ZQ9xa3jAkzFdhMiwrWFuxzB3SCSI,71
4
+ roms_tools/setup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ roms_tools/setup/atmospheric_forcing.py,sha256=Gfg-rP8H9MSUGmlK7MdkpFJ9knkai7x7__EVF3f2Jjo,32200
6
+ roms_tools/setup/boundary_forcing.py,sha256=0jxuCmx30wdcKSfXyuZ5V4hUFBuqOqMpUPRd8A46a9I,26961
7
+ roms_tools/setup/datasets.py,sha256=1CfS9ZHKTw-Dfw5AoLpE12S5G5GU5NXK9JEwZ1wIGGo,15788
8
+ roms_tools/setup/fill.py,sha256=45Ro5oN-n-n_qKZq3qTHn27ZKpTKWhr_9AWw6gUJ-9I,13291
9
+ roms_tools/setup/grid.py,sha256=V3vVOrkmlHM4CfhIGGlGTCw2OvZ62MGnrUHJepDylsA,30848
10
+ roms_tools/setup/initial_conditions.py,sha256=hKKMkOgXMqIWVmbnTVzrTW7YRKZq8FACT9QrTRt2dCE,19704
11
+ roms_tools/setup/plot.py,sha256=vpOoAHE5HvnmeAPyhr-GijGLLlqkEple5hfr_f3Nfn8,6331
12
+ roms_tools/setup/tides.py,sha256=vyZCZArbdoYotFEAUIUJJ5BQzAlybBF87qkTShqOjP4,25731
13
+ roms_tools/setup/topography.py,sha256=x5XfmUmDPxQ6QY0QikmxGiAE4kiDsFtEdKccW9emw2M,8557
14
+ roms_tools/setup/utils.py,sha256=QVfk-PnXDTnfJct3W5g7FLuxu3QLRSbuYiEPO_Sxw6I,6155
15
+ roms_tools/setup/vertical_coordinate.py,sha256=IqZN3vDW4DyeaQSr-Di5O8qH2cLJE__XKmf4lROgF8s,16122
16
+ roms_tools/tests/test_atmospheric_forcing.py,sha256=Ls2R_r_zJ75_nIEGX9sIPWAqrXNTyxImtteNe0oleP8,49011
17
+ roms_tools/tests/test_boundary_forcing.py,sha256=m5Zr_8VMX0XbPhqykovxZeGtUVQ3pn7u9nHokalf9us,11053
18
+ roms_tools/tests/test_datasets.py,sha256=FD3LznVlsdyAGe3pDv937yZYbDyjrs1ry8o0Vz1RCzQ,9793
19
+ roms_tools/tests/test_grid.py,sha256=Dhci5NXOQsASM9mdNCmqyxVXcSasjjlNvcYxKZoah6E,5587
20
+ roms_tools/tests/test_initial_conditions.py,sha256=v_FYD93i-u9fluegJSHZL8_9DszWKkbcX8eg7q_uo3U,9276
21
+ roms_tools/tests/test_tides.py,sha256=arousN9-scdEeEmAa7GCSDVnXbchf2yFamRPsVpR4RA,11104
22
+ roms_tools/tests/test_topography.py,sha256=Nwzor5ciOZfV7Y7fDazE1JH1qxotmJilOpZUcHxAypI,1945
23
+ roms_tools/tests/test_vertical_coordinate.py,sha256=GshM5l1e9bl4RT0HATQJg9YJ9asGK4beqIKbZxr9j7U,10843
24
+ roms_tools-0.20.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
25
+ roms_tools-0.20.dist-info/METADATA,sha256=lWrhiD6ypwLgsdIZE0gXkIJ3-7bv9NYXM5HeZIjIbsU,2709
26
+ roms_tools-0.20.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
27
+ roms_tools-0.20.dist-info/top_level.txt,sha256=aAf4T4nYQSkay5iKJ9kmTjlDgd4ETdp9OSlB4sJdt8Y,19
28
+ roms_tools-0.20.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.3.0)
2
+ Generator: setuptools (71.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,181 +0,0 @@
1
- import pytest
2
- import numpy as np
3
- import numpy.testing as npt
4
- from scipy.ndimage import label
5
- from roms_tools import Grid
6
- from roms_tools.setup.topography import _compute_rfactor
7
- from roms_tools.setup.tides import TPXO
8
- import os
9
- import tempfile
10
-
11
-
12
- class TestCreateGrid:
13
- def test_simple_regression(self):
14
- grid = Grid(
15
- nx=1, ny=1, size_x=100, size_y=100, center_lon=-20, center_lat=0, rot=0
16
- )
17
-
18
- expected_lat = np.array(
19
- [
20
- [-8.99249453e-01, -8.99249453e-01, -8.99249453e-01],
21
- [0.0, 0.0, 0.0],
22
- [8.99249453e-01, 8.99249453e-01, 8.99249453e-01],
23
- ]
24
- )
25
- expected_lon = np.array(
26
- [
27
- [339.10072286, 340.0, 340.89927714],
28
- [339.10072286, 340.0, 340.89927714],
29
- [339.10072286, 340.0, 340.89927714],
30
- ]
31
- )
32
-
33
- # TODO: adapt tolerances according to order of magnitude of respective fields
34
- npt.assert_allclose(grid.ds["lat_rho"], expected_lat, atol=1e-8)
35
- npt.assert_allclose(grid.ds["lon_rho"], expected_lon, atol=1e-8)
36
-
37
- def test_raise_if_domain_too_large(self):
38
- with pytest.raises(ValueError, match="Domain size has to be smaller"):
39
- Grid(nx=3, ny=3, size_x=30000, size_y=30000, center_lon=0, center_lat=51.5)
40
-
41
- # test grid with reasonable domain size
42
- grid = Grid(
43
- nx=3,
44
- ny=3,
45
- size_x=1800,
46
- size_y=2400,
47
- center_lon=-21,
48
- center_lat=61,
49
- rot=20,
50
- )
51
- assert isinstance(grid, Grid)
52
-
53
- def test_grid_straddle_crosses_meridian(self):
54
- grid = Grid(
55
- nx=3,
56
- ny=3,
57
- size_x=100,
58
- size_y=100,
59
- center_lon=0,
60
- center_lat=61,
61
- rot=20,
62
- )
63
- assert grid.straddle
64
-
65
- grid = Grid(
66
- nx=3,
67
- ny=3,
68
- size_x=100,
69
- size_y=100,
70
- center_lon=180,
71
- center_lat=61,
72
- rot=20,
73
- )
74
- assert not grid.straddle
75
-
76
-
77
- class TestGridFromFile:
78
- def test_roundtrip(self):
79
- """Test that creating a grid, saving it to file, and re-opening it is the same as just creating it."""
80
-
81
- # Initialize a Grid object using the initializer
82
- grid_init = Grid(
83
- nx=10,
84
- ny=15,
85
- size_x=100.0,
86
- size_y=150.0,
87
- center_lon=0.0,
88
- center_lat=0.0,
89
- rot=0.0,
90
- topography_source="etopo5",
91
- smooth_factor=2,
92
- hmin=5.0,
93
- rmax=0.2,
94
- )
95
-
96
- # Create a temporary file
97
- with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
98
- filepath = tmpfile.name
99
-
100
- try:
101
- # Save the grid to a file
102
- grid_init.save(filepath)
103
-
104
- # Load the grid from the file
105
- grid_from_file = Grid.from_file(filepath)
106
-
107
- # Assert that the initial grid and the loaded grid are equivalent (including the 'ds' attribute)
108
- assert grid_init == grid_from_file
109
-
110
- finally:
111
- os.remove(filepath)
112
-
113
-
114
- class TestTopography:
115
- def test_enclosed_regions(self):
116
- """Test that there are only two connected regions, one dry and one wet."""
117
-
118
- grid = Grid(
119
- nx=100,
120
- ny=100,
121
- size_x=1800,
122
- size_y=2400,
123
- center_lon=30,
124
- center_lat=61,
125
- rot=20,
126
- )
127
-
128
- reg, nreg = label(grid.ds.mask_rho)
129
- npt.assert_equal(nreg, 2)
130
-
131
- def test_rmax_criterion(self):
132
- grid = Grid(
133
- nx=100,
134
- ny=100,
135
- size_x=1800,
136
- size_y=2400,
137
- center_lon=30,
138
- center_lat=61,
139
- rot=20,
140
- smooth_factor=4,
141
- rmax=0.2,
142
- )
143
- r_eta, r_xi = _compute_rfactor(grid.ds.h)
144
- rmax0 = np.max([r_eta.max(), r_xi.max()])
145
- npt.assert_array_less(rmax0, grid.rmax)
146
-
147
- def test_hmin_criterion(self):
148
- grid = Grid(
149
- nx=100,
150
- ny=100,
151
- size_x=1800,
152
- size_y=2400,
153
- center_lon=30,
154
- center_lat=61,
155
- rot=20,
156
- smooth_factor=2,
157
- rmax=0.2,
158
- hmin=5,
159
- )
160
-
161
- assert np.less_equal(grid.hmin, grid.ds.h.min())
162
-
163
-
164
- class TestTPXO:
165
- def test_load_data_file_not_found(self):
166
- # Test loading data from a non-existing file
167
- with pytest.raises(FileNotFoundError):
168
- TPXO.load_data("non_existing_file.nc")
169
-
170
- def test_load_data_checksum_mismatch(self):
171
- # Create a temporary file for testing
172
- filename = "test_tidal_data.nc"
173
- with open(filename, "wb") as file:
174
- # Write some data to the file
175
- file.write(b"test data")
176
- # Test loading data with incorrect checksum
177
- with open(filename, "wb") as file:
178
- with pytest.raises(ValueError):
179
- TPXO.load_data(filename)
180
- # Remove temporary file
181
- os.remove(filename)
@@ -1,17 +0,0 @@
1
- ci/environment.yml,sha256=OzTO5aTfzirFobAM6TmzJXZ622liCwIzreZH-x7n4mU,394
2
- roms_tools/__init__.py,sha256=9MiZw2yYthIwOrktbOKwNptyZPmMV4_p4aCK4HymzUM,489
3
- roms_tools/_version.py,sha256=FGsmFbZ942cZk42U_qHqxgRCbsD--5Vld_eR6xKJ-mQ,72
4
- roms_tools/setup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- roms_tools/setup/atmospheric_forcing.py,sha256=A6wPmEfjeCIO3tu4TLt4Sul_J6AnF_peWZdON3I_6iw,34790
6
- roms_tools/setup/datasets.py,sha256=0Hcsr7VzE-jo51kSMZ0ltHnIqc3fHe2v9lAC6ig2rH0,1943
7
- roms_tools/setup/fill.py,sha256=8Klt77rkJqyXQ54TUv75KK_5iHcAwH-3bBtO3eoBieM,8701
8
- roms_tools/setup/grid.py,sha256=p8AgCzUx5CkuxFcjFX6X65pYwEyOzxslx_nZDNJd-M4,26449
9
- roms_tools/setup/plot.py,sha256=LZjTB4NHpXGsju_VZSCBwTfyox08nXHh6TkqmNBvz5Y,1809
10
- roms_tools/setup/tides.py,sha256=aOez64Zv6MM1VFs1WIClKPpSg9vySvogqfqbg2eHKHA,20942
11
- roms_tools/setup/topography.py,sha256=hj_IEbMTaazEtp6rrNbqAtGgPesWcCs8eHko0XHEhJg,8010
12
- roms_tools/tests/test_setup.py,sha256=L90eM0IroRhYQ8ZY9BVOyUQND41lzdJKB_y2n7Aihmc,5102
13
- roms_tools-0.1.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
14
- roms_tools-0.1.0.dist-info/METADATA,sha256=XtN4Icf1h7Sh_ZbL9OFNCr9wIkvRpqTuo95szsLNtcg,2567
15
- roms_tools-0.1.0.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
16
- roms_tools-0.1.0.dist-info/top_level.txt,sha256=aAf4T4nYQSkay5iKJ9kmTjlDgd4ETdp9OSlB4sJdt8Y,19
17
- roms_tools-0.1.0.dist-info/RECORD,,