roms-tools 0.0.6__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)
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.1
2
+ Name: roms-tools
3
+ Version: 0.20
4
+ Summary: Tools for running and analysing UCLA-ROMS simulations
5
+ Author-email: Nora Loose <nora.loose@gmail.com>, Thomas Nicholas <tom@cworthy.org>
6
+ License: Apache-2
7
+ Project-URL: Home, https://github.com/CWorthy-ocean/roms-tools
8
+ Project-URL: Documentation, https://roms-tools.readthedocs.io/en/latest/
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Topic :: Scientific/Engineering
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: xarray >=2022.6.0
22
+ Requires-Dist: numpy
23
+ Requires-Dist: netcdf4
24
+ Requires-Dist: pooch
25
+ Requires-Dist: matplotlib
26
+ Requires-Dist: cartopy
27
+ Requires-Dist: packaging
28
+ Requires-Dist: scipy
29
+ Requires-Dist: gcm-filters
30
+ Requires-Dist: numba
31
+
32
+ # ROMS-Tools
33
+
34
+ [![codecov](https://codecov.io/gh/CWorthy-ocean/roms-tools/graph/badge.svg?token=5S1oNu39xE)](https://codecov.io/gh/CWorthy-ocean/roms-tools)
35
+ [![Documentation Status](https://readthedocs.org/projects/roms-tools/badge/?version=latest)](https://roms-tools.readthedocs.io/en/latest/?badge=latest)
36
+ [![PyPI version](https://badge.fury.io/py/roms-tools.svg)](https://badge.fury.io/py/roms-tools)
37
+
38
+ ## Overview
39
+
40
+ A suite of python tools for setting up a [ROMS](https://github.com/CESR-lab/ucla-roms) simulation.
41
+
42
+ ## Installation instructions
43
+
44
+ ### Installation from pip
45
+
46
+ ```bash
47
+ pip install roms-tools
48
+ ```
49
+
50
+ ### Installation from GitHub
51
+
52
+ To obtain the latest development version, clone the source repository and install it:
53
+
54
+ ```bash
55
+ git clone https://github.com/CWorthy-ocean/roms-tools.git
56
+ cd roms-tools
57
+ pip install -e .
58
+ ```
59
+
60
+
61
+ ### Run the tests
62
+
63
+ Before running the tests, you can install and activate the following conda environment:
64
+
65
+ ```bash
66
+ cd roms-tools
67
+ conda env create -f ci/environment.yml
68
+ conda activate romstools
69
+ ```
70
+
71
+ Check the installation of `ROMS-Tools` has worked by running the test suite
72
+ ```bash
73
+ pytest
74
+ ```
75
+
76
+ ## Getting Started
77
+
78
+ To learn how to use `ROMS-Tools`, check out the [documentation](https://roms-tools.readthedocs.io/en/latest/).
79
+
80
+ ## Feedback and contributions
81
+
82
+ **If you find a bug, have a feature suggestion, or any other kind of feedback, please start a Discussion.**
83
+
84
+ We also accept contributions in the form of Pull Requests.
85
+
86
+
87
+ ## See also
88
+
89
+ - [ROMS source code](https://github.com/CESR-lab/ucla-roms)
90
+ - [C-Star](https://github.com/CWorthy-ocean/C-Star)
@@ -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: bdist_wheel (0.42.0)
2
+ Generator: setuptools (71.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,2 +1,3 @@
1
+ ci
1
2
  dist
2
3
  roms_tools
@@ -1,54 +0,0 @@
1
- import pytest
2
- import numpy as np
3
- import numpy.testing as npt
4
-
5
- from roms_tools import Grid
6
-
7
-
8
- class TestCreateGrid:
9
- def test_simple_regression(self):
10
- grid = Grid(nx=1, ny=1, size_x=100, size_y=100, center_lon=-20, center_lat=0)
11
-
12
- expected_lat = np.array(
13
- [
14
- [1.79855429e00, 1.79855429e00, 1.79855429e00],
15
- [1.72818690e-14, 1.70960078e-14, 1.70960078e-14],
16
- [-1.79855429e00, -1.79855429e00, -1.79855429e00],
17
- ]
18
- )
19
- expected_lon = np.array(
20
- [
21
- [339.10072286, 340.0, 340.89927714],
22
- [339.10072286, 340.0, 340.89927714],
23
- [339.10072286, 340.0, 340.89927714],
24
- ]
25
- )
26
-
27
- npt.assert_allclose(grid.ds["lat_rho"], expected_lat)
28
- npt.assert_allclose(grid.ds["lon_rho"], expected_lon)
29
-
30
- def test_raise_if_crossing_dateline(self):
31
- with pytest.raises(ValueError, match="cannot cross Greenwich Meridian"):
32
- # test grid centered over London
33
- Grid(nx=3, ny=3, size_x=100, size_y=100, center_lon=0, center_lat=51.5)
34
-
35
- # test Iceland grid which is rotated specifically to avoid Greenwich Meridian
36
- grid = Grid(
37
- nx=100,
38
- ny=100,
39
- size_x=1800,
40
- size_y=2400,
41
- center_lon=-21,
42
- center_lat=61,
43
- rot=20,
44
- )
45
- assert isinstance(grid, Grid)
46
-
47
-
48
- class TestGridFromFile:
49
- def test_equal_to_from_init(self):
50
- ...
51
-
52
- def test_roundtrip(self):
53
- """Test that creating a grid, saving it to file, and re-opening it is the same as just creating it."""
54
- ...
@@ -1,134 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: roms-tools
3
- Version: 0.0.6
4
- Summary: Tools for running and analysing UCLA-ROMS simulations
5
- Author-email: Thomas Nicholas <tom@cworthy.org>
6
- License: Apache-2
7
- Project-URL: Home, https://github.com/CWorthy-ocean/roms-tools
8
- Project-URL: Documentation, https://github.com/CWorthy-ocean/roms-tools#readme
9
- Classifier: Development Status :: 3 - Alpha
10
- Classifier: Intended Audience :: Science/Research
11
- Classifier: Topic :: Scientific/Engineering
12
- Classifier: License :: OSI Approved :: Apache Software License
13
- Classifier: Operating System :: OS Independent
14
- Classifier: Programming Language :: Python
15
- Classifier: Programming Language :: Python :: 3.9
16
- Classifier: Programming Language :: Python :: 3.10
17
- Classifier: Programming Language :: Python :: 3.11
18
- Classifier: Programming Language :: Python :: 3.12
19
- Requires-Python: >=3.9
20
- Description-Content-Type: text/markdown
21
- License-File: LICENSE
22
- Requires-Dist: xarray >=2022.6.0
23
- Requires-Dist: numpy
24
- Requires-Dist: netcdf4
25
- Requires-Dist: matplotlib
26
- Requires-Dist: cartopy
27
- Requires-Dist: packaging
28
-
29
- # ROMS-tools
30
-
31
- ## Overview
32
-
33
- A suite of python tools for setting up a [ROMS](https://github.com/CESR-lab/ucla-roms) simulation.
34
-
35
- _Note these tools are for the [Center for Earth Systems Research Group](http://research.atmos.ucla.edu/cesr/) at UCLA's version of ROMS._
36
-
37
- ## Installation instructions
38
-
39
- Install via pip
40
-
41
- ```bash
42
- pip install roms-tools
43
- ```
44
-
45
- Check the installation has worked by running the tests (you will need to also install pytest to run these)
46
- ```bash
47
- pytest
48
- ```
49
-
50
- Dependencies required are xarray and netcdf4, plus matplotlib and cartopy for visualising grids.
51
-
52
- ROMS-tools should run on any platform that can install the above dependencies.
53
-
54
-
55
- ## Usage instructions
56
-
57
- To set up all the input files for a new ROMS simulation from scratch, follow these steps in order.
58
-
59
- ### Step 1: Make Grid
60
-
61
- The first step is choosing the domain size, location, and resolution. Do this by creating an instance of the `Grid` class:
62
-
63
- ```python
64
- from roms_tools import Grid
65
-
66
- grid = Grid(
67
- nx=100, # number of points in the x-direction (not including 2 boundary cells on either end)
68
- ny=100, # number of points in the y-direction (not including 2 boundary cells on either end)
69
- size_x=1800, # size of the domain in the x-direction (in km)
70
- size_y=2400, # size of the domain in the y-direction (in km)
71
- center_lon=-21, # longitude of the center of the domain
72
- center_lat=61, # latitude of the center of the domain
73
- rot=20, # rotation of the grid's x-direction from lines of constant longitude, with positive values being a counter-clockwise rotation
74
- )
75
- ```
76
-
77
- To visualize the grid we have just created, use the `.plot` method:
78
-
79
- ```python
80
- grid.plot()
81
- ```
82
-
83
- ![iceland_grid](https://github.com/CWorthy-ocean/roms-tools/assets/35968931/de8c03ab-3c61-4ba5-a9b7-65592fd9280f)
84
-
85
- To see the values of the grid variables you can examine the `xarray.Dataset` object returned by the `.ds` property
86
-
87
- ```python
88
- grid.ds
89
- ```
90
- ```
91
- <xarray.Dataset>
92
- Dimensions: (eta_rho: 3, xi_rho: 3, one: 1)
93
- Dimensions without coordinates: eta_rho, xi_rho, one
94
- Data variables:
95
- angle (eta_rho, xi_rho) float64 0.0 0.0 0.0 -1.46e-16 ... 0.0 0.0 0.0
96
- f0 (eta_rho, xi_rho) float64 4.565e-06 4.565e-06 ... -4.565e-06
97
- pn (eta_rho, xi_rho) float64 5e-06 5e-06 5e-06 ... 5e-06 5e-06 5e-06
98
- lon_rho (eta_rho, xi_rho) float64 339.1 340.0 340.9 ... 339.1 340.0 340.9
99
- lat_rho (eta_rho, xi_rho) float64 1.799 1.799 1.799 ... -1.799 -1.799
100
- spherical (one) <U1 'T'
101
- tra_lon (one) int64 -20
102
- tra_lat (one) int64 0
103
- rotate (one) int64 0
104
- Attributes:
105
- Title: ROMS grid. Settings: nx: 1 ny: 1 xsize: 0.1 ysize: 0.1 rotate:...
106
- Date: 2023-11-20
107
- Type: ROMS grid produced by roms-tools
108
- ```
109
-
110
- Once we are happy with our grid, we can save it as a netCDF file via the `.save` method:
111
-
112
- ```python
113
- grid.save('grids/my_new_roms_grid.nc')
114
- ```
115
-
116
- The basic grid domain is now ready for use by ROMS.
117
-
118
-
119
- ### Steps 2-7:
120
-
121
- Coming soon!
122
-
123
-
124
- ## Feedback and contributions
125
-
126
- **If you find a bug, have a feature suggestion, or any other kind of feedback, please start a Discussion.**
127
-
128
- We also accept contributions in the form of Pull Requests.
129
-
130
-
131
- ## See also
132
-
133
- - [ROMS source code](https://github.com/CESR-lab/ucla-roms)
134
- - [C-Star](https://github.com/CWorthy-ocean/C-Star)
@@ -1,10 +0,0 @@
1
- roms_tools/__init__.py,sha256=jIriHk0yQWT8R-Q7NDW5GbG-QrfvtInZz3d8D9IraD8,268
2
- roms_tools/_version.py,sha256=cpn3HR4oc-v9fg0mp22QlFEshFgmthwzGavPDBgcTUQ,72
3
- roms_tools/setup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- roms_tools/setup/grid.py,sha256=i9yZg-7rJZkL8YQn1fni7LfzQPTUbiI_D6aWzqLoUCs,19643
5
- roms_tools/tests/test_setup.py,sha256=T3KjjFZjTLSXkKuXGQysqXN4SwCem0Q1ZGAwv3J0ykQ,1670
6
- roms_tools-0.0.6.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
7
- roms_tools-0.0.6.dist-info/METADATA,sha256=ZhdMb-GOMfD0xa5hOto09tb7glX2wviMPnKcLFgc7Sc,4382
8
- roms_tools-0.0.6.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
9
- roms_tools-0.0.6.dist-info/top_level.txt,sha256=0l4Wl78pqF3KwNEc9_lvelrsq7KNtiSJZM-ZmsPNp1U,16
10
- roms_tools-0.0.6.dist-info/RECORD,,