roms-tools 0.20__py3-none-any.whl → 1.0.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.
@@ -4,7 +4,7 @@ import os
4
4
  from roms_tools import Grid, TidalForcing
5
5
  import xarray as xr
6
6
  import numpy as np
7
- from roms_tools.setup.datasets import download_test_data
7
+ from roms_tools.setup.download import download_test_data
8
8
  import textwrap
9
9
 
10
10
 
@@ -76,7 +76,9 @@ def test_successful_initialization_with_global_data(grid_fixture, request):
76
76
 
77
77
  grid = request.getfixturevalue(grid_fixture)
78
78
 
79
- tidal_forcing = TidalForcing(grid=grid, filename=fname, source="TPXO", ntides=2)
79
+ tidal_forcing = TidalForcing(
80
+ grid=grid, source={"name": "TPXO", "path": fname}, ntides=2
81
+ )
80
82
 
81
83
  assert isinstance(tidal_forcing.ds, xr.Dataset)
82
84
  assert "omega" in tidal_forcing.ds
@@ -89,8 +91,7 @@ def test_successful_initialization_with_global_data(grid_fixture, request):
89
91
  assert "v_Re" in tidal_forcing.ds
90
92
  assert "v_Im" in tidal_forcing.ds
91
93
 
92
- assert tidal_forcing.filename == fname
93
- assert tidal_forcing.source == "TPXO"
94
+ assert tidal_forcing.source == {"name": "TPXO", "path": fname}
94
95
  assert tidal_forcing.ntides == 2
95
96
 
96
97
 
@@ -102,8 +103,7 @@ def test_successful_initialization_with_regional_data(
102
103
 
103
104
  tidal_forcing = TidalForcing(
104
105
  grid=grid_that_lies_within_bounds_of_regional_tpxo_data,
105
- filename=fname,
106
- source="TPXO",
106
+ source={"name": "TPXO", "path": fname},
107
107
  ntides=10,
108
108
  )
109
109
 
@@ -118,8 +118,7 @@ def test_successful_initialization_with_regional_data(
118
118
  assert "v_Re" in tidal_forcing.ds
119
119
  assert "v_Im" in tidal_forcing.ds
120
120
 
121
- assert tidal_forcing.filename == fname
122
- assert tidal_forcing.source == "TPXO"
121
+ assert tidal_forcing.source == {"name": "TPXO", "path": fname}
123
122
  assert tidal_forcing.ntides == 10
124
123
 
125
124
 
@@ -132,8 +131,7 @@ def test_unsuccessful_initialization_with_regional_data_due_to_nans(
132
131
  with pytest.raises(ValueError, match="NaN values found"):
133
132
  TidalForcing(
134
133
  grid=grid_that_is_out_of_bounds_of_regional_tpxo_data,
135
- filename=fname,
136
- source="TPXO",
134
+ source={"name": "TPXO", "path": fname},
137
135
  ntides=10,
138
136
  )
139
137
 
@@ -153,7 +151,7 @@ def test_unsuccessful_initialization_with_regional_data_due_to_no_overlap(
153
151
  with pytest.raises(
154
152
  ValueError, match="Selected longitude range does not intersect with dataset"
155
153
  ):
156
- TidalForcing(grid=grid, filename=fname, source="TPXO", ntides=10)
154
+ TidalForcing(grid=grid, source={"name": "TPXO", "path": fname}, ntides=10)
157
155
 
158
156
 
159
157
  def test_insufficient_number_of_consituents(grid_that_straddles_dateline):
@@ -162,7 +160,9 @@ def test_insufficient_number_of_consituents(grid_that_straddles_dateline):
162
160
 
163
161
  with pytest.raises(ValueError, match="The dataset contains fewer"):
164
162
  TidalForcing(
165
- grid=grid_that_straddles_dateline, filename=fname, source="TPXO", ntides=10
163
+ grid=grid_that_straddles_dateline,
164
+ source={"name": "TPXO", "path": fname},
165
+ ntides=10,
166
166
  )
167
167
 
168
168
 
@@ -175,8 +175,7 @@ def tidal_forcing(
175
175
 
176
176
  return TidalForcing(
177
177
  grid=grid_that_lies_within_bounds_of_regional_tpxo_data,
178
- filename=fname,
179
- source="TPXO",
178
+ source={"name": "TPXO", "path": fname},
180
179
  ntides=1,
181
180
  )
182
181
 
@@ -0,0 +1,16 @@
1
+ from roms_tools.setup.utils import interpolate_from_climatology
2
+ from roms_tools.setup.datasets import ERA5Correction
3
+ from roms_tools.setup.download import download_test_data
4
+ import xarray as xr
5
+
6
+
7
+ def test_interpolate_from_climatology():
8
+
9
+ fname = download_test_data("ERA5_regional_test_data.nc")
10
+ era5_times = xr.open_dataset(fname).time
11
+
12
+ climatology = ERA5Correction()
13
+ field = climatology.ds["ssr_corr"]
14
+
15
+ interpolated_field = interpolate_from_climatology(field, "time", era5_times)
16
+ assert len(interpolated_field.time) == len(era5_times)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: roms-tools
3
- Version: 0.20
3
+ Version: 1.0.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
@@ -18,7 +18,8 @@ Classifier: Programming Language :: Python :: 3.12
18
18
  Requires-Python: >=3.10
19
19
  Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
- Requires-Dist: xarray >=2022.6.0
21
+ Requires-Dist: xarray>=2022.6.0
22
+ Requires-Dist: xarray-datatree
22
23
  Requires-Dist: numpy
23
24
  Requires-Dist: netcdf4
24
25
  Requires-Dist: pooch
@@ -31,9 +32,12 @@ Requires-Dist: numba
31
32
 
32
33
  # ROMS-Tools
33
34
 
35
+ [![PyPI version](https://badge.fury.io/py/roms-tools.svg)](https://badge.fury.io/py/roms-tools)
34
36
  [![codecov](https://codecov.io/gh/CWorthy-ocean/roms-tools/graph/badge.svg?token=5S1oNu39xE)](https://codecov.io/gh/CWorthy-ocean/roms-tools)
35
37
  [![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)
38
+ ![Run Tests](https://github.com/CWorthy-ocean/roms-tools/actions/workflows/tests.yaml/badge.svg)
39
+ ![Supported Python Versions](https://img.shields.io/pypi/pyversions/roms-tools)
40
+
37
41
 
38
42
  ## Overview
39
43
 
@@ -0,0 +1,31 @@
1
+ ci/environment.yml,sha256=tjoIEUdPWfJBO4ijsJYhq7ay8_QfJKxRtq8Z0r8rHTI,427
2
+ roms_tools/__init__.py,sha256=v0fXc7jON8jbXD1zIxuC5dEqIa30PkMzTVe0bLGMrhY,642
3
+ roms_tools/_version.py,sha256=TDFyBsBYj5dQ4UQBcf-o9xaD5eD4cemY65tpAOJYk5Y,72
4
+ roms_tools/setup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ roms_tools/setup/boundary_forcing.py,sha256=ulif6YOZX-RzoJ-HotNlWSb3z3g-7E2qIR_mzv-F8Q4,33179
6
+ roms_tools/setup/datasets.py,sha256=3PJ0JCQUcNVHd4Xl7dodJ6lZJmV5cRkCxH-vOuZtrZ4,41478
7
+ roms_tools/setup/download.py,sha256=SapK5GIx-ykBrqqj0S_dgMxBBDGVKTfgIdbaiiOohhY,4280
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=CzoGLzQiJKRw2V_HChX3XACJU-2uEVD279H_b2PvfIw,21588
11
+ roms_tools/setup/mixins.py,sha256=EDaIbRCPVE2aJkGekh99sAeiSmyl-SUMfiTaCcHGVyg,16808
12
+ roms_tools/setup/plot.py,sha256=vpOoAHE5HvnmeAPyhr-GijGLLlqkEple5hfr_f3Nfn8,6331
13
+ roms_tools/setup/surface_forcing.py,sha256=fZGn93qzPgCJNKPUSjZH3rIfVL2nqXr4OJ7YtR5Tzro,22143
14
+ roms_tools/setup/tides.py,sha256=PP-R4mqMI_RpVOAg0hH3dAAaUjB6C3rSR_JyvJ1zODw,22907
15
+ roms_tools/setup/topography.py,sha256=yNJn9KW9m7UB6nxh5bUQzllt6z22AQahUwWIIUwHz_Y,8557
16
+ roms_tools/setup/utils.py,sha256=6_rNPWSP1Q5PjRlMAKS3GunBWySzPcnj6xYAFaFbqfY,12678
17
+ roms_tools/setup/vertical_coordinate.py,sha256=IqZN3vDW4DyeaQSr-Di5O8qH2cLJE__XKmf4lROgF8s,16122
18
+ roms_tools/tests/test_boundary_forcing.py,sha256=wLhX9UOZ6cfR-c3gw7bvM6ttwMCH8LpZlqXlLrQsvWM,24438
19
+ roms_tools/tests/test_datasets.py,sha256=RPpnKa4kUrXgCUCc3ca7SdHnFs7qQmOwQYQnPEN6T_g,11743
20
+ roms_tools/tests/test_grid.py,sha256=Dhci5NXOQsASM9mdNCmqyxVXcSasjjlNvcYxKZoah6E,5587
21
+ roms_tools/tests/test_initial_conditions.py,sha256=xY-QkpGUEMeO1R076Ww0bSa3p8-qtTLVl1bTFUrv7kw,16701
22
+ roms_tools/tests/test_surface_forcing.py,sha256=CBLOOuA0LxLQwyedbN0idtnl2wVjT5mDq4nR5LH1DxA,78007
23
+ roms_tools/tests/test_tides.py,sha256=wcH8WAvzb-FqJmr_VLTwldV8XalyntZANhy-FRMQ7e4,11133
24
+ roms_tools/tests/test_topography.py,sha256=Nwzor5ciOZfV7Y7fDazE1JH1qxotmJilOpZUcHxAypI,1945
25
+ roms_tools/tests/test_utils.py,sha256=Ey5jrsdd7B9kL5ijqr9CLQNguPlxVMTybIneihdefN8,560
26
+ roms_tools/tests/test_vertical_coordinate.py,sha256=GshM5l1e9bl4RT0HATQJg9YJ9asGK4beqIKbZxr9j7U,10843
27
+ roms_tools-1.0.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
28
+ roms_tools-1.0.0.dist-info/METADATA,sha256=gi-rdZeU47LyWqXw-Xn_KrYpteCjYqVlmQz9lNLccAA,2918
29
+ roms_tools-1.0.0.dist-info/WHEEL,sha256=nCVcAvsfA9TDtwGwhYaRrlPhTLV9m-Ga6mdyDtuwK18,91
30
+ roms_tools-1.0.0.dist-info/top_level.txt,sha256=aAf4T4nYQSkay5iKJ9kmTjlDgd4ETdp9OSlB4sJdt8Y,19
31
+ roms_tools-1.0.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (71.1.0)
2
+ Generator: setuptools (73.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5