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.
Files changed (124) hide show
  1. roms_tools/__init__.py +2 -1
  2. roms_tools/setup/boundary_forcing.py +246 -146
  3. roms_tools/setup/datasets.py +229 -69
  4. roms_tools/setup/download.py +13 -17
  5. roms_tools/setup/grid.py +777 -614
  6. roms_tools/setup/initial_conditions.py +168 -32
  7. roms_tools/setup/mask.py +115 -0
  8. roms_tools/setup/nesting.py +575 -0
  9. roms_tools/setup/plot.py +218 -63
  10. roms_tools/setup/regrid.py +4 -2
  11. roms_tools/setup/river_forcing.py +125 -29
  12. roms_tools/setup/surface_forcing.py +31 -25
  13. roms_tools/setup/tides.py +29 -14
  14. roms_tools/setup/topography.py +250 -153
  15. roms_tools/setup/utils.py +174 -44
  16. roms_tools/setup/vertical_coordinate.py +5 -16
  17. roms_tools/tests/test_setup/test_boundary_forcing.py +10 -5
  18. roms_tools/tests/test_setup/test_data/grid.zarr/.zattrs +0 -1
  19. roms_tools/tests/test_setup/test_data/grid.zarr/.zmetadata +56 -201
  20. roms_tools/tests/test_setup/test_data/grid.zarr/Cs_r/.zattrs +1 -1
  21. roms_tools/tests/test_setup/test_data/grid.zarr/Cs_w/.zattrs +1 -1
  22. roms_tools/tests/test_setup/test_data/grid.zarr/{layer_depth_rho → sigma_r}/.zarray +2 -6
  23. roms_tools/tests/test_setup/test_data/grid.zarr/sigma_r/.zattrs +7 -0
  24. roms_tools/tests/test_setup/test_data/grid.zarr/sigma_r/0 +0 -0
  25. roms_tools/tests/test_setup/test_data/grid.zarr/sigma_w/.zarray +20 -0
  26. roms_tools/tests/test_setup/test_data/grid.zarr/sigma_w/.zattrs +7 -0
  27. roms_tools/tests/test_setup/test_data/grid.zarr/sigma_w/0 +0 -0
  28. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zattrs +1 -2
  29. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zmetadata +58 -203
  30. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/Cs_r/.zattrs +1 -1
  31. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/Cs_w/.zattrs +1 -1
  32. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/h/.zattrs +1 -1
  33. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/h/0.0 +0 -0
  34. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_coarse/0.0 +0 -0
  35. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_rho/0.0 +0 -0
  36. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_u/0.0 +0 -0
  37. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_v/0.0 +0 -0
  38. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/sigma_r/.zarray +20 -0
  39. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/sigma_r/.zattrs +7 -0
  40. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/sigma_r/0 +0 -0
  41. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/sigma_w/.zarray +20 -0
  42. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/sigma_w/.zattrs +7 -0
  43. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/sigma_w/0 +0 -0
  44. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/.zmetadata +2 -3
  45. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_tracer/.zattrs +1 -2
  46. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/tracer_name/.zarray +1 -1
  47. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/tracer_name/0 +0 -0
  48. roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/.zmetadata +5 -6
  49. roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_tracer/.zarray +2 -2
  50. roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_tracer/.zattrs +1 -2
  51. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/river_tracer/0.0.0 +0 -0
  52. roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/tracer_name/.zarray +2 -2
  53. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/tracer_name/0 +0 -0
  54. roms_tools/tests/test_setup/test_datasets.py +2 -2
  55. roms_tools/tests/test_setup/test_grid.py +110 -12
  56. roms_tools/tests/test_setup/test_initial_conditions.py +2 -1
  57. roms_tools/tests/test_setup/test_nesting.py +489 -0
  58. roms_tools/tests/test_setup/test_river_forcing.py +53 -15
  59. roms_tools/tests/test_setup/test_surface_forcing.py +3 -22
  60. roms_tools/tests/test_setup/test_tides.py +2 -1
  61. roms_tools/tests/test_setup/test_topography.py +106 -1
  62. roms_tools/tests/test_setup/test_validation.py +2 -2
  63. {roms_tools-1.7.0.dist-info → roms_tools-2.1.0.dist-info}/LICENSE +1 -1
  64. {roms_tools-1.7.0.dist-info → roms_tools-2.1.0.dist-info}/METADATA +9 -4
  65. {roms_tools-1.7.0.dist-info → roms_tools-2.1.0.dist-info}/RECORD +85 -108
  66. {roms_tools-1.7.0.dist-info → roms_tools-2.1.0.dist-info}/WHEEL +1 -1
  67. roms_tools/_version.py +0 -2
  68. roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_rho/.zarray +0 -24
  69. roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_rho/.zattrs +0 -9
  70. roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_rho/0.0.0 +0 -0
  71. roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_u/.zarray +0 -24
  72. roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_u/.zattrs +0 -9
  73. roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_u/0.0.0 +0 -0
  74. roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_v/.zarray +0 -24
  75. roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_v/.zattrs +0 -9
  76. roms_tools/tests/test_setup/test_data/grid.zarr/interface_depth_v/0.0.0 +0 -0
  77. roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_rho/.zattrs +0 -9
  78. roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_rho/0.0.0 +0 -0
  79. roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_u/.zarray +0 -24
  80. roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_u/.zattrs +0 -9
  81. roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_u/0.0.0 +0 -0
  82. roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_v/.zarray +0 -24
  83. roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_v/.zattrs +0 -9
  84. roms_tools/tests/test_setup/test_data/grid.zarr/layer_depth_v/0.0.0 +0 -0
  85. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_rho/.zarray +0 -24
  86. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_rho/.zattrs +0 -9
  87. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_rho/0.0.0 +0 -0
  88. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_u/.zarray +0 -24
  89. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_u/.zattrs +0 -9
  90. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_u/0.0.0 +0 -0
  91. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_v/.zarray +0 -24
  92. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_v/.zattrs +0 -9
  93. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/interface_depth_v/0.0.0 +0 -0
  94. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_rho/.zarray +0 -24
  95. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_rho/.zattrs +0 -9
  96. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_rho/0.0.0 +0 -0
  97. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_u/.zarray +0 -24
  98. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_u/.zattrs +0 -9
  99. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_u/0.0.0 +0 -0
  100. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_v/.zarray +0 -24
  101. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_v/.zattrs +0 -9
  102. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/layer_depth_v/0.0.0 +0 -0
  103. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_tracer/0.0.0 +0 -0
  104. roms_tools/tests/test_setup/test_data/river_forcing.zarr/tracer_name/0 +0 -0
  105. roms_tools/tests/test_setup/test_vertical_coordinate.py +0 -91
  106. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/.zattrs +0 -0
  107. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/.zgroup +0 -0
  108. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/abs_time/.zarray +0 -0
  109. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/abs_time/.zattrs +0 -0
  110. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/abs_time/0 +0 -0
  111. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/month/.zarray +0 -0
  112. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/month/.zattrs +0 -0
  113. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/month/0 +0 -0
  114. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_name/.zarray +0 -0
  115. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_name/.zattrs +0 -0
  116. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_name/0 +0 -0
  117. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_time/.zarray +0 -0
  118. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_time/.zattrs +0 -0
  119. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_time/0 +0 -0
  120. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_volume/.zarray +0 -0
  121. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_volume/.zattrs +0 -0
  122. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/river_volume/0.0 +0 -0
  123. /roms_tools/tests/test_setup/test_data/{river_forcing.zarr → river_forcing_with_bgc.zarr}/tracer_name/.zattrs +0 -0
  124. {roms_tools-1.7.0.dist-info → roms_tools-2.1.0.dist-info}/top_level.txt +0 -0
@@ -1,9 +0,0 @@
1
- {
2
- "_ARRAY_DIMENSIONS": [
3
- "s_w",
4
- "eta_rho",
5
- "xi_u"
6
- ],
7
- "long_name": "Interface depth at u-points",
8
- "units": "m"
9
- }
@@ -1,24 +0,0 @@
1
- {
2
- "chunks": [
3
- 101,
4
- 2,
5
- 3
6
- ],
7
- "compressor": {
8
- "blocksize": 0,
9
- "clevel": 5,
10
- "cname": "lz4",
11
- "id": "blosc",
12
- "shuffle": 1
13
- },
14
- "dtype": "<f4",
15
- "fill_value": "NaN",
16
- "filters": null,
17
- "order": "C",
18
- "shape": [
19
- 101,
20
- 2,
21
- 3
22
- ],
23
- "zarr_format": 2
24
- }
@@ -1,9 +0,0 @@
1
- {
2
- "_ARRAY_DIMENSIONS": [
3
- "s_w",
4
- "eta_v",
5
- "xi_rho"
6
- ],
7
- "long_name": "Interface depth at v-points",
8
- "units": "m"
9
- }
@@ -1,24 +0,0 @@
1
- {
2
- "chunks": [
3
- 100,
4
- 3,
5
- 3
6
- ],
7
- "compressor": {
8
- "blocksize": 0,
9
- "clevel": 5,
10
- "cname": "lz4",
11
- "id": "blosc",
12
- "shuffle": 1
13
- },
14
- "dtype": "<f4",
15
- "fill_value": "NaN",
16
- "filters": null,
17
- "order": "C",
18
- "shape": [
19
- 100,
20
- 3,
21
- 3
22
- ],
23
- "zarr_format": 2
24
- }
@@ -1,9 +0,0 @@
1
- {
2
- "_ARRAY_DIMENSIONS": [
3
- "s_rho",
4
- "eta_rho",
5
- "xi_rho"
6
- ],
7
- "long_name": "Layer depth at rho-points",
8
- "units": "m"
9
- }
@@ -1,24 +0,0 @@
1
- {
2
- "chunks": [
3
- 100,
4
- 3,
5
- 2
6
- ],
7
- "compressor": {
8
- "blocksize": 0,
9
- "clevel": 5,
10
- "cname": "lz4",
11
- "id": "blosc",
12
- "shuffle": 1
13
- },
14
- "dtype": "<f4",
15
- "fill_value": "NaN",
16
- "filters": null,
17
- "order": "C",
18
- "shape": [
19
- 100,
20
- 3,
21
- 2
22
- ],
23
- "zarr_format": 2
24
- }
@@ -1,9 +0,0 @@
1
- {
2
- "_ARRAY_DIMENSIONS": [
3
- "s_rho",
4
- "eta_rho",
5
- "xi_u"
6
- ],
7
- "long_name": "Layer depth at u-points",
8
- "units": "m"
9
- }
@@ -1,24 +0,0 @@
1
- {
2
- "chunks": [
3
- 100,
4
- 2,
5
- 3
6
- ],
7
- "compressor": {
8
- "blocksize": 0,
9
- "clevel": 5,
10
- "cname": "lz4",
11
- "id": "blosc",
12
- "shuffle": 1
13
- },
14
- "dtype": "<f4",
15
- "fill_value": "NaN",
16
- "filters": null,
17
- "order": "C",
18
- "shape": [
19
- 100,
20
- 2,
21
- 3
22
- ],
23
- "zarr_format": 2
24
- }
@@ -1,9 +0,0 @@
1
- {
2
- "_ARRAY_DIMENSIONS": [
3
- "s_rho",
4
- "eta_v",
5
- "xi_rho"
6
- ],
7
- "long_name": "Layer depth at v-points",
8
- "units": "m"
9
- }
@@ -1,91 +0,0 @@
1
- import pytest
2
- from roms_tools import Grid
3
-
4
-
5
- def test_invalid_theta_s_value():
6
- """Test the validation of the theta_s value."""
7
- with pytest.raises(ValueError):
8
-
9
- Grid(
10
- nx=2,
11
- ny=2,
12
- size_x=500,
13
- size_y=1000,
14
- center_lon=0,
15
- center_lat=55,
16
- rot=10,
17
- N=3,
18
- theta_s=11.0, # Invalid value, should be 0 < theta_s <= 10
19
- theta_b=2.0,
20
- hc=250.0,
21
- )
22
-
23
-
24
- def test_invalid_theta_b_value():
25
- """Test the validation of the theta_b value."""
26
- with pytest.raises(ValueError):
27
- Grid(
28
- nx=2,
29
- ny=2,
30
- size_x=500,
31
- size_y=1000,
32
- center_lon=0,
33
- center_lat=55,
34
- rot=10,
35
- N=3,
36
- theta_s=5.0,
37
- theta_b=5.0, # Invalid value, should be 0 < theta_b <= 4
38
- hc=250.0,
39
- )
40
-
41
-
42
- def test_update_vertical_coordinate():
43
-
44
- grid = Grid(
45
- nx=2, ny=2, size_x=500, size_y=1000, center_lon=0, center_lat=55, rot=10
46
- )
47
-
48
- assert grid.N == 100
49
- assert grid.theta_s == 5.0
50
- assert grid.theta_b == 2.0
51
- assert grid.hc == 300.0
52
- assert len(grid.ds.s_rho) == 100
53
-
54
- grid.update_vertical_coordinate(N=3, theta_s=10.0, theta_b=1.0, hc=400.0)
55
-
56
- assert grid.N == 3
57
- assert grid.theta_s == 10.0
58
- assert grid.theta_b == 1.0
59
- assert grid.hc == 400.0
60
- assert len(grid.ds.s_rho) == 3
61
-
62
-
63
- def test_plot():
64
- grid = Grid(
65
- nx=2,
66
- ny=2,
67
- size_x=500,
68
- size_y=1000,
69
- center_lon=0,
70
- center_lat=55,
71
- rot=10,
72
- N=3,
73
- theta_s=5.0,
74
- theta_b=2.0,
75
- hc=250.0,
76
- )
77
- grid.plot_vertical_coordinate("layer_depth_u", s=0)
78
- grid.plot_vertical_coordinate("layer_depth_rho", s=-1)
79
- grid.plot_vertical_coordinate("interface_depth_v", s=-1)
80
- grid.plot_vertical_coordinate("layer_depth_rho", eta=0)
81
- grid.plot_vertical_coordinate("layer_depth_u", eta=0)
82
- grid.plot_vertical_coordinate("layer_depth_v", eta=0)
83
- grid.plot_vertical_coordinate("interface_depth_rho", eta=0)
84
- grid.plot_vertical_coordinate("interface_depth_u", eta=0)
85
- grid.plot_vertical_coordinate("interface_depth_v", eta=0)
86
- grid.plot_vertical_coordinate("layer_depth_rho", xi=0)
87
- grid.plot_vertical_coordinate("layer_depth_u", xi=0)
88
- grid.plot_vertical_coordinate("layer_depth_v", xi=0)
89
- grid.plot_vertical_coordinate("interface_depth_rho", xi=0)
90
- grid.plot_vertical_coordinate("interface_depth_u", xi=0)
91
- grid.plot_vertical_coordinate("interface_depth_v", xi=0)