roms-tools 1.4.0__py3-none-any.whl → 1.4.2__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 (250) hide show
  1. ci/environment.yml +1 -8
  2. roms_tools/_version.py +1 -1
  3. roms_tools/setup/boundary_forcing.py +77 -70
  4. roms_tools/setup/datasets.py +38 -59
  5. roms_tools/setup/download.py +3 -6
  6. roms_tools/setup/fill.py +8 -16
  7. roms_tools/setup/grid.py +147 -102
  8. roms_tools/setup/initial_conditions.py +43 -36
  9. roms_tools/setup/mixins.py +10 -14
  10. roms_tools/setup/surface_forcing.py +35 -33
  11. roms_tools/setup/tides.py +37 -41
  12. roms_tools/setup/topography.py +36 -18
  13. roms_tools/setup/utils.py +19 -40
  14. roms_tools/setup/vertical_coordinate.py +4 -6
  15. roms_tools/tests/test_setup/test_boundary_forcing.py +6 -13
  16. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_east/0.0.0 +0 -0
  17. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_north/0.0.0 +0 -0
  18. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_south/0.0.0 +0 -0
  19. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_west/0.0.0 +0 -0
  20. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_east/0.0.0 +0 -0
  21. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_north/0.0.0 +0 -0
  22. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_south/0.0.0 +0 -0
  23. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/0.0.0 +0 -0
  24. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_east/0.0.0 +0 -0
  25. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_north/0.0.0 +0 -0
  26. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_south/0.0.0 +0 -0
  27. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_west/0.0.0 +0 -0
  28. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_east/0.0.0 +0 -0
  29. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_north/0.0.0 +0 -0
  30. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_south/0.0.0 +0 -0
  31. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/0.0.0 +0 -0
  32. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_east/0.0.0 +0 -0
  33. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_north/0.0.0 +0 -0
  34. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_south/0.0.0 +0 -0
  35. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/0.0.0 +0 -0
  36. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_east/0.0.0 +0 -0
  37. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_north/0.0.0 +0 -0
  38. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_south/0.0.0 +0 -0
  39. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_west/0.0.0 +0 -0
  40. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_east/0.0.0 +0 -0
  41. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_north/0.0.0 +0 -0
  42. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_south/0.0.0 +0 -0
  43. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/0.0.0 +0 -0
  44. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_east/0.0.0 +0 -0
  45. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_north/0.0.0 +0 -0
  46. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_south/0.0.0 +0 -0
  47. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/0.0.0 +0 -0
  48. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_east/0.0.0 +0 -0
  49. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_north/0.0.0 +0 -0
  50. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_south/0.0.0 +0 -0
  51. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/0.0.0 +0 -0
  52. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_east/0.0.0 +0 -0
  53. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_north/0.0.0 +0 -0
  54. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_south/0.0.0 +0 -0
  55. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/0.0.0 +0 -0
  56. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_east/0.0.0 +0 -0
  57. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_north/0.0.0 +0 -0
  58. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_south/0.0.0 +0 -0
  59. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/0.0.0 +0 -0
  60. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_east/0.0.0 +0 -0
  61. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_north/0.0.0 +0 -0
  62. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_south/0.0.0 +0 -0
  63. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/0.0.0 +0 -0
  64. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_east/0.0.0 +0 -0
  65. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_north/0.0.0 +0 -0
  66. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_south/0.0.0 +0 -0
  67. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/0.0.0 +0 -0
  68. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_east/0.0.0 +0 -0
  69. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_north/0.0.0 +0 -0
  70. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_south/0.0.0 +0 -0
  71. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/0.0.0 +0 -0
  72. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_east/0.0.0 +0 -0
  73. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_north/0.0.0 +0 -0
  74. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_south/0.0.0 +0 -0
  75. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/0.0.0 +0 -0
  76. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_east/0.0.0 +0 -0
  77. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_north/0.0.0 +0 -0
  78. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_south/0.0.0 +0 -0
  79. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/0.0.0 +0 -0
  80. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_east/0.0.0 +0 -0
  81. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_north/0.0.0 +0 -0
  82. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_south/0.0.0 +0 -0
  83. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/0.0.0 +0 -0
  84. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_east/0.0.0 +0 -0
  85. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_north/0.0.0 +0 -0
  86. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_south/0.0.0 +0 -0
  87. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_west/0.0.0 +0 -0
  88. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_east/0.0.0 +0 -0
  89. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_north/0.0.0 +0 -0
  90. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_south/0.0.0 +0 -0
  91. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_west/0.0.0 +0 -0
  92. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_east/0.0.0 +0 -0
  93. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_north/0.0.0 +0 -0
  94. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_south/0.0.0 +0 -0
  95. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_west/0.0.0 +0 -0
  96. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_east/0.0.0 +0 -0
  97. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_north/0.0.0 +0 -0
  98. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_south/0.0.0 +0 -0
  99. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_west/0.0.0 +0 -0
  100. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_east/0.0.0 +0 -0
  101. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_north/0.0.0 +0 -0
  102. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_south/0.0.0 +0 -0
  103. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_west/0.0.0 +0 -0
  104. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_east/0.0.0 +0 -0
  105. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_north/0.0.0 +0 -0
  106. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_south/0.0.0 +0 -0
  107. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_west/0.0.0 +0 -0
  108. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_east/0.0.0 +0 -0
  109. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_north/0.0.0 +0 -0
  110. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_south/0.0.0 +0 -0
  111. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_west/0.0.0 +0 -0
  112. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_east/0.0.0 +0 -0
  113. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_north/0.0.0 +0 -0
  114. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_south/0.0.0 +0 -0
  115. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_west/0.0.0 +0 -0
  116. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_east/0.0.0 +0 -0
  117. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_north/0.0.0 +0 -0
  118. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_south/0.0.0 +0 -0
  119. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_west/0.0.0 +0 -0
  120. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_east/0.0.0 +0 -0
  121. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_north/0.0.0 +0 -0
  122. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_south/0.0.0 +0 -0
  123. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_west/0.0.0 +0 -0
  124. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_east/0.0.0 +0 -0
  125. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_north/0.0.0 +0 -0
  126. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_south/0.0.0 +0 -0
  127. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_west/0.0.0 +0 -0
  128. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_east/0.0.0 +0 -0
  129. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_north/0.0.0 +0 -0
  130. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_south/0.0.0 +0 -0
  131. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_west/0.0.0 +0 -0
  132. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_east/0.0.0 +0 -0
  133. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_north/0.0.0 +0 -0
  134. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_south/0.0.0 +0 -0
  135. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_west/0.0.0 +0 -0
  136. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_east/0.0.0 +0 -0
  137. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_north/0.0.0 +0 -0
  138. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_south/0.0.0 +0 -0
  139. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_west/0.0.0 +0 -0
  140. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_east/0.0.0 +0 -0
  141. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_north/0.0.0 +0 -0
  142. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_south/0.0.0 +0 -0
  143. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_west/0.0.0 +0 -0
  144. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_east/0.0.0 +0 -0
  145. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_north/0.0.0 +0 -0
  146. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_south/0.0.0 +0 -0
  147. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_west/0.0.0 +0 -0
  148. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_east/0.0.0 +0 -0
  149. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_north/0.0.0 +0 -0
  150. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_south/0.0.0 +0 -0
  151. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_west/0.0.0 +0 -0
  152. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_east/0.0.0 +0 -0
  153. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_north/0.0.0 +0 -0
  154. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_west/0.0.0 +0 -0
  155. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_east/0.0 +0 -0
  156. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_north/0.0 +0 -0
  157. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_west/0.0 +0 -0
  158. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_east/0.0.0 +0 -0
  159. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_north/0.0.0 +0 -0
  160. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_south/0.0.0 +0 -0
  161. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_west/0.0.0 +0 -0
  162. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_east/0.0 +0 -0
  163. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_north/0.0 +0 -0
  164. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_south/0.0 +0 -0
  165. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_west/0.0 +0 -0
  166. roms_tools/tests/test_setup/test_data/grid.zarr/.zattrs +1 -1
  167. roms_tools/tests/test_setup/test_data/grid.zarr/.zmetadata +1 -1
  168. roms_tools/tests/test_setup/test_data/grid.zarr/angle/0.0 +0 -0
  169. roms_tools/tests/test_setup/test_data/grid.zarr/angle_coarse/0.0 +0 -0
  170. roms_tools/tests/test_setup/test_data/grid.zarr/f/0.0 +0 -0
  171. roms_tools/tests/test_setup/test_data/grid.zarr/h/0.0 +0 -0
  172. roms_tools/tests/test_setup/test_data/grid.zarr/lat_coarse/0.0 +0 -0
  173. roms_tools/tests/test_setup/test_data/grid.zarr/lat_rho/0.0 +0 -0
  174. roms_tools/tests/test_setup/test_data/grid.zarr/lat_u/0.0 +0 -0
  175. roms_tools/tests/test_setup/test_data/grid.zarr/lat_v/0.0 +0 -0
  176. roms_tools/tests/test_setup/test_data/grid.zarr/lon_u/0.0 +0 -0
  177. roms_tools/tests/test_setup/test_data/grid.zarr/pm/0.0 +0 -0
  178. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zattrs +1 -1
  179. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zmetadata +1 -1
  180. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/angle/0.0 +0 -0
  181. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/angle_coarse/0.0 +0 -0
  182. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/f/0.0 +0 -0
  183. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/h/0.0 +0 -0
  184. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_coarse/0.0 +0 -0
  185. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_rho/0.0 +0 -0
  186. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_u/0.0 +0 -0
  187. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_v/0.0 +0 -0
  188. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_coarse/0.0 +0 -0
  189. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_rho/0.0 +0 -0
  190. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_u/0.0 +0 -0
  191. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_v/0.0 +0 -0
  192. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/pm/0.0 +0 -0
  193. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/pn/0.0 +0 -0
  194. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK/0.0.0.0 +0 -0
  195. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK_ALT_CO2/0.0.0.0 +0 -0
  196. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC/0.0.0.0 +0 -0
  197. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC_ALT_CO2/0.0.0.0 +0 -0
  198. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOC/0.0.0.0 +0 -0
  199. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOCr/0.0.0.0 +0 -0
  200. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DON/0.0.0.0 +0 -0
  201. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DONr/0.0.0.0 +0 -0
  202. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOP/0.0.0.0 +0 -0
  203. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOPr/0.0.0.0 +0 -0
  204. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Fe/0.0.0.0 +0 -0
  205. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Lig/0.0.0.0 +0 -0
  206. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NH4/0.0.0.0 +0 -0
  207. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NO3/0.0.0.0 +0 -0
  208. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/O2/0.0.0.0 +0 -0
  209. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/PO4/0.0.0.0 +0 -0
  210. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/SiO3/0.0.0.0 +0 -0
  211. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatC/0.0.0.0 +0 -0
  212. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatChl/0.0.0.0 +0 -0
  213. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatFe/0.0.0.0 +0 -0
  214. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatP/0.0.0.0 +0 -0
  215. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatSi/0.0.0.0 +0 -0
  216. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazC/0.0.0.0 +0 -0
  217. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazChl/0.0.0.0 +0 -0
  218. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazFe/0.0.0.0 +0 -0
  219. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazP/0.0.0.0 +0 -0
  220. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/salt/0.0.0.0 +0 -0
  221. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spC/0.0.0.0 +0 -0
  222. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spCaCO3/0.0.0.0 +0 -0
  223. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spChl/0.0.0.0 +0 -0
  224. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spFe/0.0.0.0 +0 -0
  225. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spP/0.0.0.0 +0 -0
  226. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/temp/0.0.0.0 +0 -0
  227. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/u/0.0.0.0 +0 -0
  228. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ubar/0.0.0 +0 -0
  229. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/v/0.0.0.0 +0 -0
  230. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/vbar/0.0.0 +0 -0
  231. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zooC/0.0.0.0 +0 -0
  232. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Im/0.0.0 +0 -0
  233. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Re/0.0.0 +0 -0
  234. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Im/0.0.0 +0 -0
  235. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Re/0.0.0 +0 -0
  236. roms_tools/tests/test_setup/test_datasets.py +8 -18
  237. roms_tools/tests/test_setup/test_grid.py +58 -2
  238. roms_tools/tests/test_setup/test_initial_conditions.py +4 -7
  239. roms_tools/tests/test_setup/test_surface_forcing.py +58 -58
  240. roms_tools/tests/test_setup/test_tides.py +6 -10
  241. roms_tools/tests/test_setup/test_topography.py +38 -0
  242. roms_tools/tests/test_setup/test_vertical_coordinate.py +2 -6
  243. roms_tools/tests/test_utils.py +30 -0
  244. roms_tools/utils.py +45 -10
  245. roms_tools-1.4.2.dist-info/LICENSE +201 -0
  246. {roms_tools-1.4.0.dist-info → roms_tools-1.4.2.dist-info}/METADATA +3 -1
  247. {roms_tools-1.4.0.dist-info → roms_tools-1.4.2.dist-info}/RECORD +249 -249
  248. {roms_tools-1.4.0.dist-info → roms_tools-1.4.2.dist-info}/WHEEL +1 -1
  249. roms_tools-1.4.0.dist-info/LICENSE +0 -674
  250. {roms_tools-1.4.0.dist-info → roms_tools-1.4.2.dist-info}/top_level.txt +0 -0
@@ -9,12 +9,11 @@ from conftest import calculate_file_hash
9
9
 
10
10
  @pytest.fixture
11
11
  def grid_that_straddles_dateline():
12
- """
13
- Fixture for creating a domain that straddles the dateline and lies within the bounds of the regional ERA5 data.
14
- """
12
+ """Fixture for creating a domain that straddles the dateline and lies within the
13
+ bounds of the regional ERA5 data."""
15
14
  grid = Grid(
16
- nx=5,
17
- ny=5,
15
+ nx=20,
16
+ ny=20,
18
17
  size_x=1800,
19
18
  size_y=2400,
20
19
  center_lon=-10,
@@ -27,8 +26,9 @@ def grid_that_straddles_dateline():
27
26
 
28
27
  @pytest.fixture
29
28
  def grid_that_straddles_dateline_but_is_too_big_for_regional_test_data():
30
- """
31
- Fixture for creating a domain that straddles the dateline but exceeds the bounds of the regional ERA5 data.
29
+ """Fixture for creating a domain that straddles the dateline but exceeds the bounds
30
+ of the regional ERA5 data.
31
+
32
32
  Centered east of dateline.
33
33
  """
34
34
  grid = Grid(
@@ -46,9 +46,11 @@ def grid_that_straddles_dateline_but_is_too_big_for_regional_test_data():
46
46
 
47
47
  @pytest.fixture
48
48
  def another_grid_that_straddles_dateline_but_is_too_big_for_regional_test_data():
49
- """
50
- Fixture for creating a domain that straddles the dateline but exceeds the bounds of the regional ERA5 data.
51
- Centered west of dateline. This one was hard to catch for the nan_check for a long time, but should work now.
49
+ """Fixture for creating a domain that straddles the dateline but exceeds the bounds
50
+ of the regional ERA5 data.
51
+
52
+ Centered west of dateline. This one was hard to catch for the nan_check for a long
53
+ time, but should work now.
52
54
  """
53
55
  grid = Grid(
54
56
  nx=5,
@@ -65,9 +67,11 @@ def another_grid_that_straddles_dateline_but_is_too_big_for_regional_test_data()
65
67
 
66
68
  @pytest.fixture
67
69
  def grid_that_lies_east_of_dateline_less_than_five_degrees_away():
68
- """
69
- Fixture for creating a domain that lies east of Greenwich meridian, but less than 5 degrees away.
70
- We care about the 5 degree mark because it decides whether the code handles the longitudes as straddling the dateline or not.
70
+ """Fixture for creating a domain that lies east of Greenwich meridian, but less than
71
+ 5 degrees away.
72
+
73
+ We care about the 5 degree mark because it decides whether the code handles the
74
+ longitudes as straddling the dateline or not.
71
75
  """
72
76
 
73
77
  grid = Grid(
@@ -85,9 +89,11 @@ def grid_that_lies_east_of_dateline_less_than_five_degrees_away():
85
89
 
86
90
  @pytest.fixture
87
91
  def grid_that_lies_east_of_dateline_more_than_five_degrees_away():
88
- """
89
- Fixture for creating a domain that lies east of Greenwich meridian, more than 5 degrees away.
90
- We care about the 5 degree mark because it decides whether the code handles the longitudes as straddling the dateline or not.
92
+ """Fixture for creating a domain that lies east of Greenwich meridian, more than 5
93
+ degrees away.
94
+
95
+ We care about the 5 degree mark because it decides whether the code handles the
96
+ longitudes as straddling the dateline or not.
91
97
  """
92
98
  grid = Grid(
93
99
  nx=5,
@@ -104,9 +110,11 @@ def grid_that_lies_east_of_dateline_more_than_five_degrees_away():
104
110
 
105
111
  @pytest.fixture
106
112
  def grid_that_lies_west_of_dateline_less_than_five_degrees_away():
107
- """
108
- Fixture for creating a domain that lies west of Greenwich meridian, less than 5 degrees away.
109
- We care about the 5 degree mark because it decides whether the code handles the longitudes as straddling the dateline or not.
113
+ """Fixture for creating a domain that lies west of Greenwich meridian, less than 5
114
+ degrees away.
115
+
116
+ We care about the 5 degree mark because it decides whether the code handles the
117
+ longitudes as straddling the dateline or not.
110
118
  """
111
119
 
112
120
  grid = Grid(
@@ -124,9 +132,11 @@ def grid_that_lies_west_of_dateline_less_than_five_degrees_away():
124
132
 
125
133
  @pytest.fixture
126
134
  def grid_that_lies_west_of_dateline_more_than_five_degrees_away():
127
- """
128
- Fixture for creating a domain that lies west of Greenwich meridian, more than 5 degrees away.
129
- We care about the 5 degree mark because it decides whether the code handles the longitudes as straddling the dateline or not.
135
+ """Fixture for creating a domain that lies west of Greenwich meridian, more than 5
136
+ degrees away.
137
+
138
+ We care about the 5 degree mark because it decides whether the code handles the
139
+ longitudes as straddling the dateline or not.
130
140
  """
131
141
 
132
142
  grid = Grid(
@@ -144,8 +154,10 @@ def grid_that_lies_west_of_dateline_more_than_five_degrees_away():
144
154
 
145
155
  @pytest.fixture
146
156
  def grid_that_straddles_180_degree_meridian():
147
- """
148
- Fixture for creating a domain that straddles 180 degree meridian. This is a good test grid for the global ERA5 data, which comes on an [-180, 180] longitude grid.
157
+ """Fixture for creating a domain that straddles 180 degree meridian.
158
+
159
+ This is a good test grid for the global ERA5 data, which comes on an [-180, 180]
160
+ longitude grid.
149
161
  """
150
162
 
151
163
  grid = Grid(
@@ -172,8 +184,7 @@ def grid_that_straddles_180_degree_meridian():
172
184
  ],
173
185
  )
174
186
  def test_successful_initialization_with_regional_data(grid_fixture, request, use_dask):
175
- """
176
- Test the initialization of SurfaceForcing with regional ERA5 data.
187
+ """Test the initialization of SurfaceForcing with regional ERA5 data.
177
188
 
178
189
  This test checks the following:
179
190
  1. SurfaceForcing object initializes successfully with provided regional data.
@@ -242,8 +253,7 @@ def test_successful_initialization_with_regional_data(grid_fixture, request, use
242
253
  def test_nan_detection_initialization_with_regional_data(
243
254
  grid_fixture, request, use_dask
244
255
  ):
245
- """
246
- Test handling of NaN values during initialization with regional data.
256
+ """Test handling of NaN values during initialization with regional data.
247
257
 
248
258
  Ensures ValueError is raised if NaN values are detected in the dataset.
249
259
  """
@@ -270,10 +280,11 @@ def test_nan_detection_initialization_with_regional_data(
270
280
  def test_no_longitude_intersection_initialization_with_regional_data(
271
281
  grid_that_straddles_180_degree_meridian, use_dask
272
282
  ):
273
- """
274
- Test initialization of SurfaceForcing with a grid that straddles the 180° meridian.
283
+ """Test initialization of SurfaceForcing with a grid that straddles the 180°
284
+ meridian.
275
285
 
276
- Ensures ValueError is raised when the longitude range does not intersect with the dataset.
286
+ Ensures ValueError is raised when the longitude range does not intersect with the
287
+ dataset.
277
288
  """
278
289
  start_time = datetime(2020, 1, 31)
279
290
  end_time = datetime(2020, 2, 2)
@@ -309,11 +320,11 @@ def test_no_longitude_intersection_initialization_with_regional_data(
309
320
  ],
310
321
  )
311
322
  def test_successful_initialization_with_global_data(grid_fixture, request, use_dask):
312
- """
313
- Test initialization of SurfaceForcing with global data.
323
+ """Test initialization of SurfaceForcing with global data.
314
324
 
315
325
  Verifies that the SurfaceForcing object is correctly initialized with global data,
316
- including the correct handling of the grid and physics data. Checks both coarse and fine grid initialization.
326
+ including the correct handling of the grid and physics data. Checks both coarse and
327
+ fine grid initialization.
317
328
  """
318
329
  start_time = datetime(2020, 1, 31)
319
330
  end_time = datetime(2020, 2, 2)
@@ -357,8 +368,7 @@ def test_successful_initialization_with_global_data(grid_fixture, request, use_d
357
368
 
358
369
 
359
370
  def test_nans_filled_in(grid_that_straddles_dateline, use_dask):
360
- """
361
- Test that the surface forcing fields contain no NaNs.
371
+ """Test that the surface forcing fields contain no NaNs.
362
372
 
363
373
  The test is performed twice:
364
374
  - First with the default fine grid.
@@ -405,10 +415,8 @@ def test_nans_filled_in(grid_that_straddles_dateline, use_dask):
405
415
 
406
416
 
407
417
  def test_time_attr_climatology(bgc_surface_forcing_from_climatology):
408
- """
409
- Test that the 'cycle_length' attribute is present in the time coordinate of the BGC dataset
410
- when using climatology data.
411
- """
418
+ """Test that the 'cycle_length' attribute is present in the time coordinate of the
419
+ BGC dataset when using climatology data."""
412
420
  for time_coord in ["pco2_time", "iron_time", "dust_time", "nox_time", "nhy_time"]:
413
421
  assert hasattr(
414
422
  bgc_surface_forcing_from_climatology.ds[time_coord],
@@ -418,10 +426,8 @@ def test_time_attr_climatology(bgc_surface_forcing_from_climatology):
418
426
 
419
427
 
420
428
  def test_time_attr(bgc_surface_forcing):
421
- """
422
- Test that the 'cycle_length' attribute is not present in the time coordinate of the BGC dataset
423
- when not using climatology data.
424
- """
429
+ """Test that the 'cycle_length' attribute is not present in the time coordinate of
430
+ the BGC dataset when not using climatology data."""
425
431
  for time_coord in ["pco2_time", "iron_time", "dust_time", "nox_time", "nhy_time"]:
426
432
  assert not hasattr(
427
433
  bgc_surface_forcing.ds[time_coord],
@@ -448,12 +454,11 @@ def test_time_attr(bgc_surface_forcing):
448
454
  def test_surface_forcing_creation(
449
455
  sfc_forcing_fixture, expected_climatology, expected_fname, request
450
456
  ):
451
- """
452
- Test the creation and initialization of the SurfaceForcing object with BGC.
457
+ """Test the creation and initialization of the SurfaceForcing object with BGC.
453
458
 
454
459
  Verifies that the SurfaceForcing object is properly created with correct attributes.
455
- Ensures that expected variables are present in the dataset
456
- and that attributes match the given configurations.
460
+ Ensures that expected variables are present in the dataset and that attributes match
461
+ the given configurations.
457
462
  """
458
463
 
459
464
  sfc_forcing = request.getfixturevalue(sfc_forcing_fixture)
@@ -491,9 +496,7 @@ def test_surface_forcing_creation(
491
496
  ],
492
497
  )
493
498
  def test_surface_forcing_plot_save(sfc_forcing_fixture, request, tmp_path):
494
- """
495
- Test plot and save methods.
496
- """
499
+ """Test plot and save methods."""
497
500
  sfc_forcing = request.getfixturevalue(sfc_forcing_fixture)
498
501
  sfc_forcing.plot(varname="uwnd", time=0)
499
502
 
@@ -525,9 +528,7 @@ def test_surface_forcing_plot_save(sfc_forcing_fixture, request, tmp_path):
525
528
 
526
529
 
527
530
  def test_surface_forcing_bgc_plot_save(bgc_surface_forcing, tmp_path):
528
- """
529
- Test plot and save methods.
530
- """
531
+ """Test plot and save methods."""
531
532
 
532
533
  # Check the values in the dataset
533
534
  bgc_surface_forcing.plot(varname="pco2_air", time=0)
@@ -562,9 +563,7 @@ def test_surface_forcing_bgc_plot_save(bgc_surface_forcing, tmp_path):
562
563
  def test_surface_forcing_bgc_from_clim_plot_save(
563
564
  bgc_surface_forcing_from_climatology, tmp_path
564
565
  ):
565
- """
566
- Test plot and save methods.
567
- """
566
+ """Test plot and save methods."""
568
567
 
569
568
  # Check the values in the dataset
570
569
  bgc_surface_forcing_from_climatology.plot(varname="pco2_air", time=0)
@@ -609,7 +608,8 @@ def test_surface_forcing_bgc_from_clim_plot_save(
609
608
  ],
610
609
  )
611
610
  def test_roundtrip_yaml(sfc_forcing_fixture, request, tmp_path, use_dask):
612
- """Test that creating an SurfaceForcing object, saving its parameters to yaml file, and re-opening yaml file creates the same object."""
611
+ """Test that creating an SurfaceForcing object, saving its parameters to yaml file,
612
+ and re-opening yaml file creates the same object."""
613
613
 
614
614
  sfc_forcing = request.getfixturevalue(sfc_forcing_fixture)
615
615
 
@@ -25,9 +25,7 @@ def grid_that_is_out_of_bounds_of_regional_tpxo_data():
25
25
 
26
26
  @pytest.fixture
27
27
  def grid_that_straddles_dateline():
28
- """
29
- Fixture for creating a domain that straddles the dateline.
30
- """
28
+ """Fixture for creating a domain that straddles the dateline."""
31
29
  grid = Grid(
32
30
  nx=5,
33
31
  ny=5,
@@ -43,9 +41,7 @@ def grid_that_straddles_dateline():
43
41
 
44
42
  @pytest.fixture
45
43
  def grid_that_straddles_180_degree_meridian():
46
- """
47
- Fixture for creating a domain that straddles 180 degree meridian.
48
- """
44
+ """Fixture for creating a domain that straddles 180 degree meridian."""
49
45
 
50
46
  grid = Grid(
51
47
  nx=5,
@@ -174,9 +170,8 @@ def test_insufficient_number_of_consituents(grid_that_straddles_dateline, use_da
174
170
 
175
171
 
176
172
  def test_tidal_forcing_plot_save(tidal_forcing, tmp_path):
177
- """
178
- Test plot and save methods in the same test since we dask arrays are already computed.
179
- """
173
+ """Test plot and save methods in the same test since we dask arrays are already
174
+ computed."""
180
175
  tidal_forcing.ds.load()
181
176
 
182
177
  tidal_forcing.plot(varname="ssh_Re", ntides=0)
@@ -211,7 +206,8 @@ def test_tidal_forcing_plot_save(tidal_forcing, tmp_path):
211
206
 
212
207
 
213
208
  def test_roundtrip_yaml(tidal_forcing, tmp_path, use_dask):
214
- """Test that creating a TidalForcing object, saving its parameters to yaml file, and re-opening yaml file creates the same object."""
209
+ """Test that creating a TidalForcing object, saving its parameters to yaml file, and
210
+ re-opening yaml file creates the same object."""
215
211
 
216
212
  # Create a temporary filepath using the tmp_path fixture
217
213
  file_str = "test_yaml"
@@ -56,3 +56,41 @@ def test_hmin_criterion():
56
56
 
57
57
  assert grid.hmin == 10.0
58
58
  assert np.less_equal(grid.hmin, grid.ds.h.min())
59
+
60
+
61
+ def test_mask_topography_boundary():
62
+ """Test that the mask and topography along the grid boundaries (north, south, east,
63
+ west) are identical to the adjacent inland cells."""
64
+
65
+ # Create a grid with some land along the northern boundary
66
+ grid = Grid(
67
+ nx=10, ny=10, size_x=1000, size_y=1000, center_lon=-20, center_lat=60, rot=0
68
+ )
69
+
70
+ # Toopography
71
+ np.testing.assert_array_equal(
72
+ grid.ds.h.isel(eta_rho=0).data, grid.ds.h.isel(eta_rho=1).data
73
+ )
74
+ np.testing.assert_array_equal(
75
+ grid.ds.h.isel(eta_rho=-1).data, grid.ds.h.isel(eta_rho=-2).data
76
+ )
77
+ np.testing.assert_array_equal(
78
+ grid.ds.h.isel(xi_rho=0).data, grid.ds.h.isel(xi_rho=1).data
79
+ )
80
+ np.testing.assert_array_equal(
81
+ grid.ds.h.isel(xi_rho=-1).data, grid.ds.h.isel(xi_rho=-2).data
82
+ )
83
+
84
+ # Mask
85
+ np.testing.assert_array_equal(
86
+ grid.ds.mask_rho.isel(eta_rho=0).data, grid.ds.mask_rho.isel(eta_rho=1).data
87
+ )
88
+ np.testing.assert_array_equal(
89
+ grid.ds.mask_rho.isel(eta_rho=-1).data, grid.ds.mask_rho.isel(eta_rho=-2).data
90
+ )
91
+ np.testing.assert_array_equal(
92
+ grid.ds.mask_rho.isel(xi_rho=0).data, grid.ds.mask_rho.isel(xi_rho=1).data
93
+ )
94
+ np.testing.assert_array_equal(
95
+ grid.ds.mask_rho.isel(xi_rho=-1).data, grid.ds.mask_rho.isel(xi_rho=-2).data
96
+ )
@@ -3,9 +3,7 @@ from roms_tools import Grid
3
3
 
4
4
 
5
5
  def test_invalid_theta_s_value():
6
- """
7
- Test the validation of the theta_s value.
8
- """
6
+ """Test the validation of the theta_s value."""
9
7
  with pytest.raises(ValueError):
10
8
 
11
9
  Grid(
@@ -24,9 +22,7 @@ def test_invalid_theta_s_value():
24
22
 
25
23
 
26
24
  def test_invalid_theta_b_value():
27
- """
28
- Test the validation of the theta_b value.
29
- """
25
+ """Test the validation of the theta_b value."""
30
26
  with pytest.raises(ValueError):
31
27
  Grid(
32
28
  nx=2,
@@ -23,6 +23,8 @@ class TestPartitionGrid:
23
23
  "xi_rho": 32,
24
24
  "xi_u": 31,
25
25
  "eta_v": 10,
26
+ # "eta_psi": 11,
27
+ # "xi_psi": 33,
26
28
  "eta_coarse": 6,
27
29
  "xi_coarse": 17,
28
30
  "s_rho": 100,
@@ -33,6 +35,8 @@ class TestPartitionGrid:
33
35
  "xi_rho": 32,
34
36
  "xi_u": 31,
35
37
  "eta_v": 10,
38
+ # "eta_psi": 10,
39
+ # "xi_psi": 33,
36
40
  "eta_coarse": 5,
37
41
  "xi_coarse": 17,
38
42
  "s_rho": 100,
@@ -43,6 +47,8 @@ class TestPartitionGrid:
43
47
  "xi_rho": 32,
44
48
  "xi_u": 31,
45
49
  "eta_v": 11,
50
+ # "eta_psi": 12,
51
+ # "xi_psi": 33,
46
52
  "eta_coarse": 6,
47
53
  "xi_coarse": 17,
48
54
  "s_rho": 100,
@@ -57,6 +63,8 @@ class TestPartitionGrid:
57
63
  "xi_rho": 11,
58
64
  "xi_u": 10,
59
65
  "eta_v": 31,
66
+ # "eta_psi": 33,
67
+ # "xi_psi": 11,
60
68
  "eta_coarse": 17,
61
69
  "xi_coarse": 6,
62
70
  "s_rho": 100,
@@ -67,6 +75,8 @@ class TestPartitionGrid:
67
75
  "xi_rho": 10,
68
76
  "xi_u": 10,
69
77
  "eta_v": 31,
78
+ # "eta_psi": 33,
79
+ # "xi_psi": 10,
70
80
  "eta_coarse": 17,
71
81
  "xi_coarse": 5,
72
82
  "s_rho": 100,
@@ -77,6 +87,8 @@ class TestPartitionGrid:
77
87
  "xi_rho": 11,
78
88
  "xi_u": 11,
79
89
  "eta_v": 31,
90
+ # "eta_psi": 33,
91
+ # "xi_psi": 12,
80
92
  "eta_coarse": 17,
81
93
  "xi_coarse": 6,
82
94
  "s_rho": 100,
@@ -96,6 +108,8 @@ class TestPartitionGrid:
96
108
  "xi_rho": 11,
97
109
  "xi_u": 10,
98
110
  "eta_v": 10,
111
+ # "eta_psi": 11,
112
+ # "xi_psi": 11,
99
113
  "eta_coarse": 6,
100
114
  "xi_coarse": 6,
101
115
  "s_rho": 100,
@@ -107,6 +121,8 @@ class TestPartitionGrid:
107
121
  "xi_u": 10,
108
122
  "eta_v": 10,
109
123
  "eta_coarse": 5,
124
+ # "eta_psi": 10,
125
+ # "xi_psi": 11,
110
126
  "xi_coarse": 6,
111
127
  "s_rho": 100,
112
128
  "s_w": 101,
@@ -116,6 +132,8 @@ class TestPartitionGrid:
116
132
  "xi_rho": 11,
117
133
  "xi_u": 10,
118
134
  "eta_v": 11,
135
+ # "eta_psi": 12,
136
+ # "xi_psi": 11,
119
137
  "eta_coarse": 6,
120
138
  "xi_coarse": 6,
121
139
  "s_rho": 100,
@@ -126,6 +144,8 @@ class TestPartitionGrid:
126
144
  "xi_rho": 10,
127
145
  "xi_u": 10,
128
146
  "eta_v": 10,
147
+ # "eta_psi": 11,
148
+ # "xi_psi": 10,
129
149
  "eta_coarse": 6,
130
150
  "xi_coarse": 5,
131
151
  "s_rho": 100,
@@ -136,6 +156,8 @@ class TestPartitionGrid:
136
156
  "xi_rho": 10,
137
157
  "xi_u": 10,
138
158
  "eta_v": 10,
159
+ # "eta_psi": 10,
160
+ # "xi_psi": 10,
139
161
  "eta_coarse": 5,
140
162
  "xi_coarse": 5,
141
163
  "s_rho": 100,
@@ -146,6 +168,8 @@ class TestPartitionGrid:
146
168
  "xi_rho": 10,
147
169
  "xi_u": 10,
148
170
  "eta_v": 11,
171
+ # "eta_psi": 12,
172
+ # "xi_psi": 10,
149
173
  "eta_coarse": 6,
150
174
  "xi_coarse": 5,
151
175
  "s_rho": 100,
@@ -156,6 +180,8 @@ class TestPartitionGrid:
156
180
  "xi_rho": 11,
157
181
  "xi_u": 11,
158
182
  "eta_v": 10,
183
+ # "eta_psi": 11,
184
+ # "xi_psi": 12,
159
185
  "eta_coarse": 6,
160
186
  "xi_coarse": 6,
161
187
  "s_rho": 100,
@@ -166,6 +192,8 @@ class TestPartitionGrid:
166
192
  "xi_rho": 11,
167
193
  "xi_u": 11,
168
194
  "eta_v": 10,
195
+ # "eta_psi": 10,
196
+ # "xi_psi": 12,
169
197
  "eta_coarse": 5,
170
198
  "xi_coarse": 6,
171
199
  "s_rho": 100,
@@ -176,6 +204,8 @@ class TestPartitionGrid:
176
204
  "xi_rho": 11,
177
205
  "xi_u": 11,
178
206
  "eta_v": 11,
207
+ # "eta_psi": 12,
208
+ # "xi_psi": 12,
179
209
  "eta_coarse": 6,
180
210
  "xi_coarse": 6,
181
211
  "s_rho": 100,
roms_tools/utils.py CHANGED
@@ -9,12 +9,12 @@ from pathlib import Path
9
9
  def partition(
10
10
  ds: xr.Dataset, np_eta: int = 1, np_xi: int = 1
11
11
  ) -> tuple[list[int], list[xr.Dataset]]:
12
- """
13
- Partition a ROMS (Regional Ocean Modeling System) dataset into smaller spatial tiles.
12
+ """Partition a ROMS (Regional Ocean Modeling System) dataset into smaller spatial
13
+ tiles.
14
14
 
15
15
  This function divides the input dataset into `np_eta` by `np_xi` tiles, where each tile
16
16
  represents a subdomain of the original dataset. The partitioning is performed along
17
- the spatial dimensions `eta_rho`, `xi_rho`, `eta_v`, `xi_u`, `eta_coarse`, and `xi_coarse`,
17
+ the spatial dimensions `eta_rho`, `xi_rho`, `eta_v`, `xi_u`, `eta_psi`, `xi_psi`, `eta_coarse`, and `xi_coarse`,
18
18
  depending on which dimensions are present in the dataset.
19
19
 
20
20
  Parameters
@@ -32,6 +32,7 @@ def partition(
32
32
  -------
33
33
  tuple[list[int], list[xr.Dataset]]
34
34
  A tuple containing two elements:
35
+
35
36
  - A list of integers representing the file numbers associated with each partition.
36
37
  - A list of `xarray.Dataset` objects, each representing a partitioned subdomain of the original dataset.
37
38
 
@@ -69,6 +70,8 @@ def partition(
69
70
  "xi_rho",
70
71
  "eta_v",
71
72
  "xi_u",
73
+ "eta_psi",
74
+ "xi_psi",
72
75
  "eta_coarse",
73
76
  "xi_coarse",
74
77
  ]
@@ -88,8 +91,7 @@ def partition(
88
91
  n_xi_ghost_cells = 1
89
92
 
90
93
  def integer_division_or_raise(a: int, b: int, dimension: str) -> int:
91
- """
92
- Perform integer division and ensure that the division is exact.
94
+ """Perform integer division and ensure that the division is exact.
93
95
 
94
96
  Parameters
95
97
  ----------
@@ -123,6 +125,7 @@ def partition(
123
125
  eta_rho_domain_size = integer_division_or_raise(
124
126
  ds.sizes["eta_rho"] - 2 * n_eta_ghost_cells, np_eta, "eta_rho"
125
127
  )
128
+
126
129
  if "xi_rho" in dims_to_partition:
127
130
  xi_rho_domain_size = integer_division_or_raise(
128
131
  ds.sizes["xi_rho"] - 2 * n_xi_ghost_cells, np_xi, "xi_rho"
@@ -132,11 +135,22 @@ def partition(
132
135
  eta_v_domain_size = integer_division_or_raise(
133
136
  ds.sizes["eta_v"] - 1 * n_eta_ghost_cells, np_eta, "eta_v"
134
137
  )
138
+
135
139
  if "xi_u" in dims_to_partition:
136
140
  xi_u_domain_size = integer_division_or_raise(
137
141
  ds.sizes["xi_u"] - 1 * n_xi_ghost_cells, np_xi, "xi_u"
138
142
  )
139
143
 
144
+ if "eta_psi" in dims_to_partition:
145
+ eta_psi_domain_size = integer_division_or_raise(
146
+ ds.sizes["eta_psi"] - 3 * n_eta_ghost_cells, np_eta, "eta_psi"
147
+ )
148
+
149
+ if "xi_psi" in dims_to_partition:
150
+ xi_psi_domain_size = integer_division_or_raise(
151
+ ds.sizes["xi_psi"] - 3 * n_xi_ghost_cells, np_xi, "xi_psi"
152
+ )
153
+
140
154
  if "eta_coarse" in dims_to_partition:
141
155
  eta_coarse_domain_size = integer_division_or_raise(
142
156
  ds.sizes["eta_coarse"] - 2 * n_eta_ghost_cells, np_eta, "eta_coarse"
@@ -167,7 +181,12 @@ def partition(
167
181
  + [eta_rho_domain_size] * (np_eta - 2)
168
182
  + [eta_rho_domain_size + n_eta_ghost_cells]
169
183
  )
170
-
184
+ if "eta_psi" in dims_to_partition:
185
+ partitioned_sizes["eta_psi"] = (
186
+ [n_eta_ghost_cells + eta_psi_domain_size]
187
+ + [eta_psi_domain_size] * (np_eta - 2)
188
+ + [eta_psi_domain_size + 2 * n_eta_ghost_cells]
189
+ )
171
190
  if "eta_coarse" in dims_to_partition:
172
191
  partitioned_sizes["eta_coarse"] = (
173
192
  [eta_coarse_domain_size + n_eta_ghost_cells]
@@ -181,7 +200,12 @@ def partition(
181
200
  + [xi_rho_domain_size] * (np_xi - 2)
182
201
  + [xi_rho_domain_size + n_xi_ghost_cells]
183
202
  )
184
-
203
+ if "xi_psi" in dims_to_partition:
204
+ partitioned_sizes["xi_psi"] = (
205
+ [n_xi_ghost_cells + xi_psi_domain_size]
206
+ + [xi_psi_domain_size] * (np_xi - 2)
207
+ + [xi_psi_domain_size + 2 * n_xi_ghost_cells]
208
+ )
185
209
  if "xi_coarse" in dims_to_partition:
186
210
  partitioned_sizes["xi_coarse"] = (
187
211
  [xi_coarse_domain_size + n_xi_ghost_cells]
@@ -190,7 +214,7 @@ def partition(
190
214
  )
191
215
 
192
216
  def cumsum(pmf):
193
- """Implementation of cumsum which ensures the result starts with zero"""
217
+ """Implementation of cumsum which ensures the result starts with zero."""
194
218
  cdf = np.empty(len(pmf) + 1, dtype=int)
195
219
  cdf[0] = 0
196
220
  np.cumsum(pmf, out=cdf[1:])
@@ -229,6 +253,18 @@ def partition(
229
253
  indexers["xi_u"] = slice(
230
254
  int(xi_u_partition_indices[j]), int(xi_u_partition_indices[j + 1])
231
255
  )
256
+ if "eta_psi" in dims_to_partition:
257
+ eta_psi_partition_indices = cumsum(partitioned_sizes["eta_psi"])
258
+ indexers["eta_psi"] = slice(
259
+ int(eta_psi_partition_indices[i]),
260
+ int(eta_psi_partition_indices[i + 1]),
261
+ )
262
+ if "xi_psi" in dims_to_partition:
263
+ xi_psi_partition_indices = cumsum(partitioned_sizes["xi_psi"])
264
+ indexers["xi_psi"] = slice(
265
+ int(xi_psi_partition_indices[j]),
266
+ int(xi_psi_partition_indices[j + 1]),
267
+ )
232
268
 
233
269
  if "eta_coarse" in dims_to_partition:
234
270
  eta_coarse_partition_indices = cumsum(partitioned_sizes["eta_coarse"])
@@ -254,8 +290,7 @@ def partition(
254
290
  def partition_netcdf(
255
291
  filepath: Union[str, Path], np_eta: int = 1, np_xi: int = 1
256
292
  ) -> None:
257
- """
258
- Partition a ROMS NetCDF file into smaller spatial tiles and save them to disk.
293
+ """Partition a ROMS NetCDF file into smaller spatial tiles and save them to disk.
259
294
 
260
295
  This function divides the dataset in the specified NetCDF file into `np_eta` by `np_xi` tiles.
261
296
  Each tile is saved as a separate NetCDF file.