roms-tools 2.3.0__py3-none-any.whl → 2.5.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 (303) hide show
  1. ci/environment.yml +1 -0
  2. roms_tools/__init__.py +2 -1
  3. roms_tools/analysis/roms_output.py +81 -98
  4. roms_tools/plot.py +4 -2
  5. roms_tools/setup/boundary_forcing.py +207 -208
  6. roms_tools/setup/datasets.py +149 -33
  7. roms_tools/setup/grid.py +35 -102
  8. roms_tools/setup/initial_conditions.py +179 -132
  9. roms_tools/setup/nesting.py +239 -86
  10. roms_tools/setup/river_forcing.py +266 -128
  11. roms_tools/setup/surface_forcing.py +137 -76
  12. roms_tools/setup/tides.py +10 -36
  13. roms_tools/setup/topography.py +25 -2
  14. roms_tools/setup/utils.py +52 -82
  15. roms_tools/tests/test_analysis/test_roms_output.py +233 -70
  16. roms_tools/tests/test_setup/test_boundary_forcing.py +283 -57
  17. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zattrs +3 -1
  18. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zmetadata +3 -1
  19. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_east/0.0.0 +0 -0
  20. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_south/0.0.0 +0 -0
  21. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_west/0.0.0 +0 -0
  22. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_east/0.0.0 +0 -0
  23. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_south/0.0.0 +0 -0
  24. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/0.0.0 +0 -0
  25. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_east/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_south/0.0.0 +0 -0
  30. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/0.0.0 +0 -0
  31. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_east/0.0.0 +0 -0
  32. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_south/0.0.0 +0 -0
  33. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/0.0.0 +0 -0
  34. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_east/0.0.0 +0 -0
  35. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_south/0.0.0 +0 -0
  36. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_west/0.0.0 +0 -0
  37. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_east/0.0.0 +0 -0
  38. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_south/0.0.0 +0 -0
  39. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/0.0.0 +0 -0
  40. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_east/0.0.0 +0 -0
  41. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_south/0.0.0 +0 -0
  42. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/0.0.0 +0 -0
  43. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_east/0.0.0 +0 -0
  44. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_south/0.0.0 +0 -0
  45. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/0.0.0 +0 -0
  46. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_east/0.0.0 +0 -0
  47. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_south/0.0.0 +0 -0
  48. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/0.0.0 +0 -0
  49. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_east/0.0.0 +0 -0
  50. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_south/0.0.0 +0 -0
  51. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/0.0.0 +0 -0
  52. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_east/0.0.0 +0 -0
  53. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_south/0.0.0 +0 -0
  54. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/0.0.0 +0 -0
  55. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_east/0.0.0 +0 -0
  56. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_north/0.0.0 +0 -0
  57. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_south/0.0.0 +0 -0
  58. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/0.0.0 +0 -0
  59. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_east/0.0.0 +0 -0
  60. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_south/0.0.0 +0 -0
  61. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/0.0.0 +0 -0
  62. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_east/0.0.0 +0 -0
  63. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_south/0.0.0 +0 -0
  64. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/0.0.0 +0 -0
  65. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_east/0.0.0 +0 -0
  66. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_south/0.0.0 +0 -0
  67. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/0.0.0 +0 -0
  68. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_east/0.0.0 +0 -0
  69. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_south/0.0.0 +0 -0
  70. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/0.0.0 +0 -0
  71. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_east/0.0.0 +0 -0
  72. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_north/0.0.0 +0 -0
  73. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_south/0.0.0 +0 -0
  74. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_west/0.0.0 +0 -0
  75. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_east/0.0.0 +0 -0
  76. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_north/0.0.0 +0 -0
  77. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_south/0.0.0 +0 -0
  78. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_west/0.0.0 +0 -0
  79. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_east/0.0.0 +0 -0
  80. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_north/0.0.0 +0 -0
  81. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_south/0.0.0 +0 -0
  82. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_west/0.0.0 +0 -0
  83. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_east/0.0.0 +0 -0
  84. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_north/0.0.0 +0 -0
  85. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_south/0.0.0 +0 -0
  86. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_west/0.0.0 +0 -0
  87. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_east/0.0.0 +0 -0
  88. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_north/0.0.0 +0 -0
  89. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_south/0.0.0 +0 -0
  90. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_west/0.0.0 +0 -0
  91. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_east/0.0.0 +0 -0
  92. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_north/0.0.0 +0 -0
  93. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_south/0.0.0 +0 -0
  94. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_west/0.0.0 +0 -0
  95. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_east/0.0.0 +0 -0
  96. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_north/0.0.0 +0 -0
  97. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_south/0.0.0 +0 -0
  98. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_west/0.0.0 +0 -0
  99. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_east/0.0.0 +0 -0
  100. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_north/0.0.0 +0 -0
  101. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_south/0.0.0 +0 -0
  102. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_west/0.0.0 +0 -0
  103. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_east/0.0.0 +0 -0
  104. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_north/0.0.0 +0 -0
  105. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_south/0.0.0 +0 -0
  106. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_west/0.0.0 +0 -0
  107. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_east/0.0.0 +0 -0
  108. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_north/0.0.0 +0 -0
  109. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_south/0.0.0 +0 -0
  110. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_west/0.0.0 +0 -0
  111. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_east/0.0.0 +0 -0
  112. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_north/0.0.0 +0 -0
  113. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_south/0.0.0 +0 -0
  114. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_west/0.0.0 +0 -0
  115. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_east/0.0.0 +0 -0
  116. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_north/0.0.0 +0 -0
  117. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_south/0.0.0 +0 -0
  118. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_west/0.0.0 +0 -0
  119. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_east/0.0.0 +0 -0
  120. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_north/0.0.0 +0 -0
  121. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_south/0.0.0 +0 -0
  122. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_west/0.0.0 +0 -0
  123. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_east/0.0.0 +0 -0
  124. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_north/0.0.0 +0 -0
  125. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_south/0.0.0 +0 -0
  126. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_west/0.0.0 +0 -0
  127. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_east/0.0.0 +0 -0
  128. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_north/0.0.0 +0 -0
  129. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_south/0.0.0 +0 -0
  130. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_west/0.0.0 +0 -0
  131. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/.zattrs +2 -2
  132. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/.zmetadata +8 -7
  133. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/abs_time/.zattrs +1 -0
  134. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/dust/0.0.0 +0 -0
  135. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/dust_time/.zattrs +1 -1
  136. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/iron/0.0.0 +0 -0
  137. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/iron_time/.zattrs +1 -1
  138. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nhy/0.0.0 +0 -0
  139. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nhy_time/.zattrs +1 -1
  140. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nox/0.0.0 +0 -0
  141. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nox_time/.zattrs +1 -1
  142. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air/0.0.0 +0 -0
  143. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air_alt/0.0.0 +0 -0
  144. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_time/.zattrs +1 -1
  145. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zattrs +2 -2
  146. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zmetadata +2 -2
  147. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/dust/0.0.0 +0 -0
  148. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/iron/0.0.0 +0 -0
  149. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nhy/0.0.0 +0 -0
  150. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nox/0.0.0 +0 -0
  151. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air/0.0.0 +0 -0
  152. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air_alt/0.0.0 +0 -0
  153. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/.zattrs +5 -3
  154. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/.zmetadata +156 -121
  155. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/abs_time/.zarray +2 -2
  156. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/abs_time/.zattrs +2 -1
  157. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/abs_time/0 +0 -0
  158. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/bry_time/.zarray +2 -2
  159. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/bry_time/.zattrs +1 -1
  160. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/bry_time/0 +0 -0
  161. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_east/.zarray +4 -4
  162. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_east/0.0.0 +0 -0
  163. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_north/.zarray +4 -4
  164. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_north/0.0.0 +0 -0
  165. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_south/.zarray +4 -4
  166. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_south/0.0.0 +0 -0
  167. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_west/.zarray +4 -4
  168. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_west/0.0.0 +0 -0
  169. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_east/.zarray +4 -4
  170. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_east/0.0.0 +0 -0
  171. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_north/.zarray +4 -4
  172. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_north/0.0.0 +0 -0
  173. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_south/.zarray +4 -4
  174. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_south/0.0.0 +0 -0
  175. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_west/.zarray +4 -4
  176. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_west/0.0.0 +0 -0
  177. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_east/.zarray +4 -4
  178. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_east/0.0.0 +0 -0
  179. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_north/.zarray +4 -4
  180. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_north/0.0.0 +0 -0
  181. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_south/.zarray +4 -4
  182. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_south/0.0.0 +0 -0
  183. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_west/.zarray +4 -4
  184. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_west/0.0.0 +0 -0
  185. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_east/.zarray +4 -4
  186. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_east/0.0 +0 -0
  187. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_north/.zarray +4 -4
  188. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_north/0.0 +0 -0
  189. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_south/.zarray +4 -4
  190. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_south/0.0 +0 -0
  191. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_west/.zarray +4 -4
  192. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_west/0.0 +0 -0
  193. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_east/.zarray +4 -4
  194. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_east/0.0.0 +0 -0
  195. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_north/.zarray +4 -4
  196. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_north/0.0.0 +0 -0
  197. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_south/.zarray +4 -4
  198. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_south/0.0.0 +0 -0
  199. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_west/.zarray +4 -4
  200. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_west/0.0.0 +0 -0
  201. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_east/.zarray +4 -4
  202. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_east/0.0 +0 -0
  203. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_north/.zarray +4 -4
  204. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_north/0.0 +0 -0
  205. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_south/.zarray +4 -4
  206. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_south/0.0 +0 -0
  207. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_west/.zarray +4 -4
  208. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_west/0.0 +0 -0
  209. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_east/.zarray +4 -4
  210. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_east/.zattrs +8 -0
  211. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_east/0.0 +0 -0
  212. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_north/.zarray +4 -4
  213. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_north/.zattrs +8 -0
  214. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_north/0.0 +0 -0
  215. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/.zarray +4 -4
  216. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/.zattrs +8 -0
  217. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/0.0 +0 -0
  218. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_west/.zarray +4 -4
  219. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_west/.zattrs +8 -0
  220. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_west/0.0 +0 -0
  221. roms_tools/tests/test_setup/test_data/grid.zarr/.zattrs +1 -1
  222. roms_tools/tests/test_setup/test_data/grid.zarr/.zmetadata +2 -2
  223. roms_tools/tests/test_setup/test_data/grid.zarr/angle/0.0 +0 -0
  224. roms_tools/tests/test_setup/test_data/grid.zarr/angle_coarse/0.0 +0 -0
  225. roms_tools/tests/test_setup/test_data/grid.zarr/f/0.0 +0 -0
  226. roms_tools/tests/test_setup/test_data/grid.zarr/h/.zattrs +1 -1
  227. roms_tools/tests/test_setup/test_data/grid.zarr/h/0.0 +0 -0
  228. roms_tools/tests/test_setup/test_data/grid.zarr/lat_coarse/0.0 +0 -0
  229. roms_tools/tests/test_setup/test_data/grid.zarr/lat_rho/0.0 +0 -0
  230. roms_tools/tests/test_setup/test_data/grid.zarr/lat_u/0.0 +0 -0
  231. roms_tools/tests/test_setup/test_data/grid.zarr/lat_v/0.0 +0 -0
  232. roms_tools/tests/test_setup/test_data/grid.zarr/pm/0.0 +0 -0
  233. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zattrs +4 -4
  234. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zmetadata +4 -4
  235. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/angle/0.0 +0 -0
  236. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/angle_coarse/0.0 +0 -0
  237. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/f/0.0 +0 -0
  238. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/h/0.0 +0 -0
  239. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_coarse/0.0 +0 -0
  240. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_rho/0.0 +0 -0
  241. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_u/0.0 +0 -0
  242. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_v/0.0 +0 -0
  243. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_coarse/0.0 +0 -0
  244. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_rho/0.0 +0 -0
  245. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_u/0.0 +0 -0
  246. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_v/0.0 +0 -0
  247. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_coarse/0.0 +0 -0
  248. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_rho/0.0 +0 -0
  249. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_u/0.0 +0 -0
  250. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_v/0.0 +0 -0
  251. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/pm/0.0 +0 -0
  252. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/pn/0.0 +0 -0
  253. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/.zattrs +2 -1
  254. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/.zmetadata +6 -4
  255. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Cs_r/.zattrs +1 -1
  256. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Cs_w/.zattrs +1 -1
  257. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NH4/0.0.0.0 +0 -0
  258. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NO3/0.0.0.0 +0 -0
  259. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/PO4/0.0.0.0 +0 -0
  260. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/abs_time/.zattrs +1 -0
  261. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatSi/0.0.0.0 +0 -0
  262. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ocean_time/.zattrs +1 -1
  263. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/salt/0.0.0.0 +0 -0
  264. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spC/0.0.0.0 +0 -0
  265. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spCaCO3/0.0.0.0 +0 -0
  266. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spFe/0.0.0.0 +0 -0
  267. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/temp/0.0.0.0 +0 -0
  268. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/u/0.0.0.0 +0 -0
  269. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ubar/0.0.0 +0 -0
  270. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/v/0.0.0.0 +0 -0
  271. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/vbar/0.0.0 +0 -0
  272. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zeta/0.0.0 +0 -0
  273. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/.zmetadata +56 -0
  274. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/nriver/.zarray +20 -0
  275. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/nriver/.zattrs +6 -0
  276. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/nriver/0 +0 -0
  277. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_location/.zarray +22 -0
  278. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_location/.zattrs +8 -0
  279. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_location/0.0 +0 -0
  280. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/.zmetadata +56 -0
  281. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/nriver/.zarray +20 -0
  282. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/nriver/.zattrs +6 -0
  283. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/nriver/0 +0 -0
  284. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/river_location/.zarray +22 -0
  285. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/river_location/.zattrs +8 -0
  286. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/river_location/0.0 +0 -0
  287. roms_tools/tests/test_setup/test_grid.py +0 -13
  288. roms_tools/tests/test_setup/test_initial_conditions.py +220 -66
  289. roms_tools/tests/test_setup/test_nesting.py +139 -118
  290. roms_tools/tests/test_setup/test_river_forcing.py +583 -293
  291. roms_tools/tests/test_setup/test_surface_forcing.py +149 -73
  292. roms_tools/tests/test_setup/test_tides.py +4 -16
  293. roms_tools/tests/test_setup/test_utils.py +1 -0
  294. roms_tools/tests/test_setup/test_validation.py +34 -2
  295. roms_tools/tests/{test_utils.py → test_tiling/test_partition.py} +1 -1
  296. roms_tools/tiling/partition.py +338 -0
  297. roms_tools/utils.py +66 -333
  298. roms_tools/vertical_coordinate.py +54 -133
  299. {roms_tools-2.3.0.dist-info → roms_tools-2.5.0.dist-info}/METADATA +1 -1
  300. {roms_tools-2.3.0.dist-info → roms_tools-2.5.0.dist-info}/RECORD +303 -290
  301. {roms_tools-2.3.0.dist-info → roms_tools-2.5.0.dist-info}/WHEEL +1 -1
  302. {roms_tools-2.3.0.dist-info → roms_tools-2.5.0.dist-info}/LICENSE +0 -0
  303. {roms_tools-2.3.0.dist-info → roms_tools-2.5.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,20 @@
1
+ {
2
+ "chunks": [
3
+ 6
4
+ ],
5
+ "compressor": {
6
+ "blocksize": 0,
7
+ "clevel": 5,
8
+ "cname": "lz4",
9
+ "id": "blosc",
10
+ "shuffle": 1
11
+ },
12
+ "dtype": "<i8",
13
+ "fill_value": null,
14
+ "filters": null,
15
+ "order": "C",
16
+ "shape": [
17
+ 6
18
+ ],
19
+ "zarr_format": 2
20
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "_ARRAY_DIMENSIONS": [
3
+ "nriver"
4
+ ],
5
+ "long_name": "River ID (1-based Fortran indexing)"
6
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "chunks": [
3
+ 20,
4
+ 20
5
+ ],
6
+ "compressor": {
7
+ "blocksize": 0,
8
+ "clevel": 5,
9
+ "cname": "lz4",
10
+ "id": "blosc",
11
+ "shuffle": 1
12
+ },
13
+ "dtype": "<f8",
14
+ "fill_value": "NaN",
15
+ "filters": null,
16
+ "order": "C",
17
+ "shape": [
18
+ 20,
19
+ 20
20
+ ],
21
+ "zarr_format": 2
22
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "_ARRAY_DIMENSIONS": [
3
+ "eta_rho",
4
+ "xi_rho"
5
+ ],
6
+ "long_name": "River ID plus local volume fraction",
7
+ "units": "none"
8
+ }
@@ -90,7 +90,6 @@ def test_plot_save_methods(tmp_path):
90
90
  str(tmp_path / file_str),
91
91
  ]: # test for Path object and str
92
92
 
93
- # Test saving without partitioning
94
93
  saved_filenames = grid.save(filepath)
95
94
  # Check if the .nc file was created
96
95
  filepath = Path(filepath).with_suffix(".nc")
@@ -100,18 +99,6 @@ def test_plot_save_methods(tmp_path):
100
99
  # Clean up the .nc file
101
100
  filepath.unlink()
102
101
 
103
- # Test saving with partitioning
104
- saved_filenames = grid.save(filepath, np_eta=2, np_xi=5)
105
-
106
- filepath_str = str(filepath.with_suffix(""))
107
- expected_filepath_list = [
108
- Path(filepath_str + f".{index}.nc") for index in range(10)
109
- ]
110
- assert saved_filenames == expected_filepath_list
111
- for expected_filepath in expected_filepath_list:
112
- assert expected_filepath.exists()
113
- expected_filepath.unlink()
114
-
115
102
 
116
103
  def test_raise_if_domain_too_large():
117
104
  with pytest.raises(ValueError, match="Domain size exceeds"):
@@ -4,17 +4,20 @@ from roms_tools import InitialConditions, Grid
4
4
  import xarray as xr
5
5
  import numpy as np
6
6
  import textwrap
7
+ import logging
7
8
  from roms_tools.download import download_test_data
8
9
  from roms_tools.setup.datasets import CESMBGCDataset
9
10
  from pathlib import Path
10
- from conftest import calculate_file_hash
11
+ from conftest import calculate_data_hash
11
12
 
12
13
 
13
14
  @pytest.mark.parametrize(
14
15
  "ic_fixture",
15
16
  [
16
17
  "initial_conditions",
18
+ "initial_conditions_adjusted_for_zeta",
17
19
  "initial_conditions_with_bgc",
20
+ "initial_conditions_with_bgc_adjusted_for_zeta",
18
21
  "initial_conditions_with_bgc_from_climatology",
19
22
  ],
20
23
  )
@@ -29,6 +32,7 @@ def test_initial_conditions_creation(ic_fixture, request):
29
32
  "path": Path(download_test_data("GLORYS_coarse_test_data.nc")),
30
33
  "climatology": False,
31
34
  }
35
+ assert hasattr(ic.ds, "adjust_depth_for_sea_surface_height")
32
36
  assert isinstance(ic.ds, xr.Dataset)
33
37
  assert "temp" in ic.ds
34
38
  assert "salt" in ic.ds
@@ -112,6 +116,22 @@ def test_initial_conditions_missing_bgc_path(example_grid, use_dask):
112
116
  )
113
117
 
114
118
 
119
+ # Test initialization with missing ini_time
120
+ def test_initial_conditions_missing_ini_time(example_grid, use_dask):
121
+
122
+ fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
123
+ with pytest.raises(
124
+ ValueError,
125
+ match="`ini_time` must be a valid datetime object and cannot be None.",
126
+ ):
127
+ InitialConditions(
128
+ grid=example_grid,
129
+ ini_time=None,
130
+ source={"name": "GLORYS", "path": fname},
131
+ use_dask=use_dask,
132
+ )
133
+
134
+
115
135
  # Test default climatology value
116
136
  def test_initial_conditions_default_climatology(example_grid, use_dask):
117
137
 
@@ -144,6 +164,128 @@ def test_initial_conditions_default_bgc_climatology(example_grid, use_dask):
144
164
  assert initial_conditions.bgc_source["climatology"] is False
145
165
 
146
166
 
167
+ def test_info_depth(caplog, use_dask):
168
+
169
+ grid = Grid(
170
+ nx=2,
171
+ ny=2,
172
+ size_x=500,
173
+ size_y=1000,
174
+ center_lon=0,
175
+ center_lat=55,
176
+ rot=10,
177
+ N=3, # number of vertical levels
178
+ theta_s=5.0, # surface control parameter
179
+ theta_b=2.0, # bottom control parameter
180
+ hc=250.0, # critical depth
181
+ )
182
+
183
+ fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
184
+
185
+ with caplog.at_level(logging.INFO):
186
+
187
+ InitialConditions(
188
+ grid=grid,
189
+ ini_time=datetime(2021, 6, 29),
190
+ source={"path": fname, "name": "GLORYS"},
191
+ adjust_depth_for_sea_surface_height=True,
192
+ use_dask=use_dask,
193
+ )
194
+ # Verify the warning message in the log
195
+ assert "Sea surface height will be used to adjust depth coordinates." in caplog.text
196
+
197
+ # Clear the log before the next test
198
+ caplog.clear()
199
+
200
+ with caplog.at_level(logging.INFO):
201
+
202
+ InitialConditions(
203
+ grid=grid,
204
+ ini_time=datetime(2021, 6, 29),
205
+ source={"path": fname, "name": "GLORYS"},
206
+ adjust_depth_for_sea_surface_height=False,
207
+ use_dask=use_dask,
208
+ )
209
+ # Verify the warning message in the log
210
+ assert (
211
+ "Sea surface height will NOT be used to adjust depth coordinates."
212
+ in caplog.text
213
+ )
214
+
215
+
216
+ @pytest.mark.parametrize(
217
+ "initial_conditions_fixture",
218
+ [
219
+ "initial_conditions_adjusted_for_zeta",
220
+ "initial_conditions_with_bgc_adjusted_for_zeta",
221
+ ],
222
+ )
223
+ def test_correct_depth_coords_adjusted_for_zeta(
224
+ initial_conditions_fixture, request, use_dask
225
+ ):
226
+
227
+ initial_conditions = request.getfixturevalue(initial_conditions_fixture)
228
+
229
+ # compute interface depth at rho-points and write it into .ds_depth_coords
230
+ zeta = initial_conditions.ds.zeta
231
+ initial_conditions._get_depth_coordinates(
232
+ zeta, location="rho", depth_type="interface"
233
+ )
234
+ # Test that lowermost interface coincides with topography
235
+ assert np.allclose(
236
+ initial_conditions.ds_depth_coords["interface_depth_rho"]
237
+ .isel(s_w=0)
238
+ .squeeze()
239
+ .values, # Extract raw NumPy array
240
+ initial_conditions.grid.ds.h.values,
241
+ atol=1e-6, # Adjust tolerance as needed
242
+ )
243
+
244
+ # Test that uppermost interface coincides with sea surface height
245
+ assert np.allclose(
246
+ initial_conditions.ds_depth_coords["interface_depth_rho"]
247
+ .isel(s_w=-1)
248
+ .squeeze()
249
+ .values,
250
+ -zeta.values,
251
+ atol=1e-6,
252
+ )
253
+
254
+
255
+ @pytest.mark.parametrize(
256
+ "initial_conditions_fixture",
257
+ [
258
+ "initial_conditions",
259
+ "initial_conditions",
260
+ ],
261
+ )
262
+ def test_correct_depth_coords_zero_zeta(initial_conditions_fixture, request, use_dask):
263
+
264
+ initial_conditions = request.getfixturevalue(initial_conditions_fixture)
265
+
266
+ # compute interface depth at rho-points and write it into .ds_depth_coords
267
+ initial_conditions._get_depth_coordinates(0, location="rho", depth_type="interface")
268
+ # Test that lowermost interface coincides with topography
269
+ assert np.allclose(
270
+ initial_conditions.ds_depth_coords["interface_depth_rho"]
271
+ .isel(s_w=0)
272
+ .squeeze()
273
+ .values, # Extract raw NumPy array
274
+ initial_conditions.grid.ds.h.values,
275
+ atol=1e-6, # Adjust tolerance as needed
276
+ )
277
+
278
+ # Test that uppermost interface coincides with sea surface height
279
+ assert np.allclose(
280
+ initial_conditions.ds_depth_coords["interface_depth_rho"]
281
+ .isel(s_w=-1)
282
+ .squeeze()
283
+ .values,
284
+ 0 * initial_conditions.grid.ds.h.values,
285
+ atol=1e-6,
286
+ )
287
+
288
+
147
289
  def test_interpolation_from_climatology(
148
290
  initial_conditions_with_bgc_from_climatology, use_dask
149
291
  ):
@@ -176,47 +318,61 @@ def test_interpolation_from_climatology(
176
318
  )
177
319
 
178
320
 
179
- def test_initial_conditions_plot(initial_conditions_with_bgc_from_climatology):
321
+ @pytest.mark.parametrize(
322
+ "initial_conditions_fixture",
323
+ [
324
+ "initial_conditions_with_bgc_adjusted_for_zeta",
325
+ "initial_conditions_with_bgc_from_climatology",
326
+ ],
327
+ )
328
+ def test_initial_conditions_plot(initial_conditions_fixture, request):
180
329
  """Test plot method."""
181
330
 
182
- initial_conditions_with_bgc_from_climatology.plot(var_name="temp", s=0)
183
- initial_conditions_with_bgc_from_climatology.plot(
184
- var_name="temp", s=0, depth_contours=True
185
- )
186
- initial_conditions_with_bgc_from_climatology.plot(
187
- var_name="temp", eta=0, layer_contours=True
188
- )
189
- initial_conditions_with_bgc_from_climatology.plot(
190
- var_name="temp", xi=0, layer_contours=True
191
- )
192
- initial_conditions_with_bgc_from_climatology.plot(var_name="temp", eta=0)
193
- initial_conditions_with_bgc_from_climatology.plot(var_name="temp", xi=0)
194
- initial_conditions_with_bgc_from_climatology.plot(var_name="temp", s=0, xi=0)
195
- initial_conditions_with_bgc_from_climatology.plot(var_name="temp", eta=0, xi=0)
196
- initial_conditions_with_bgc_from_climatology.plot(
197
- var_name="u", s=0, layer_contours=True
198
- )
199
- initial_conditions_with_bgc_from_climatology.plot(var_name="u", s=0)
200
- initial_conditions_with_bgc_from_climatology.plot(var_name="u", eta=0)
201
- initial_conditions_with_bgc_from_climatology.plot(var_name="u", xi=0)
202
- initial_conditions_with_bgc_from_climatology.plot(
203
- var_name="v", s=0, layer_contours=True
204
- )
205
- initial_conditions_with_bgc_from_climatology.plot(var_name="v", s=0)
206
- initial_conditions_with_bgc_from_climatology.plot(var_name="v", eta=0)
207
- initial_conditions_with_bgc_from_climatology.plot(var_name="v", xi=0)
208
- initial_conditions_with_bgc_from_climatology.plot(var_name="zeta")
209
- initial_conditions_with_bgc_from_climatology.plot(var_name="ubar")
210
- initial_conditions_with_bgc_from_climatology.plot(var_name="vbar")
211
- initial_conditions_with_bgc_from_climatology.plot(var_name="ALK", s=0, xi=0)
212
- initial_conditions_with_bgc_from_climatology.plot(var_name="ALK", eta=0, xi=0)
213
-
214
-
215
- def test_initial_conditions_save(
216
- initial_conditions_with_bgc_from_climatology, tmp_path
217
- ):
331
+ initial_conditions = request.getfixturevalue(initial_conditions_fixture)
332
+
333
+ # horizontal slices plots
334
+ for depth_contours in [True, False]:
335
+ initial_conditions.plot(var_name="temp", s=0, depth_contours=depth_contours)
336
+ initial_conditions.plot(var_name="u", s=0, depth_contours=depth_contours)
337
+ initial_conditions.plot(var_name="v", s=0, depth_contours=depth_contours)
338
+ initial_conditions.plot(var_name="ALK", s=0, depth_contours=depth_contours)
339
+
340
+ # section plots
341
+ for layer_contours in [True, False]:
342
+ initial_conditions.plot(var_name="temp", eta=0, layer_contours=layer_contours)
343
+ initial_conditions.plot(var_name="temp", xi=0, layer_contours=layer_contours)
344
+ initial_conditions.plot(var_name="ALK", eta=0, layer_contours=layer_contours)
345
+ initial_conditions.plot(var_name="ALK", xi=0, layer_contours=layer_contours)
346
+ initial_conditions.plot(var_name="u", eta=0, layer_contours=layer_contours)
347
+ initial_conditions.plot(var_name="u", xi=0, layer_contours=layer_contours)
348
+ initial_conditions.plot(var_name="v", eta=0, layer_contours=layer_contours)
349
+ initial_conditions.plot(var_name="v", xi=0, layer_contours=layer_contours)
350
+
351
+ # 1D plot in horizontal
352
+ initial_conditions.plot(var_name="temp", s=0, xi=0)
353
+ initial_conditions.plot(var_name="ALK", s=0, xi=0)
354
+
355
+ # 1D plot in vertical
356
+ initial_conditions.plot(var_name="temp", eta=0, xi=0)
357
+ initial_conditions.plot(var_name="ALK", eta=0, xi=0)
358
+
359
+ initial_conditions.plot(var_name="zeta")
360
+ initial_conditions.plot(var_name="ubar")
361
+ initial_conditions.plot(var_name="vbar")
362
+
363
+
364
+ @pytest.mark.parametrize(
365
+ "initial_conditions_fixture",
366
+ [
367
+ "initial_conditions",
368
+ "initial_conditions_adjusted_for_zeta",
369
+ ],
370
+ )
371
+ def test_initial_conditions_save(initial_conditions_fixture, request, tmp_path):
218
372
  """Test save method."""
219
373
 
374
+ initial_conditions = request.getfixturevalue(initial_conditions_fixture)
375
+
220
376
  for file_str in ["test_ic", "test_ic.nc"]:
221
377
  # Create a temporary filepath using the tmp_path fixture
222
378
  for filepath in [
@@ -224,10 +380,7 @@ def test_initial_conditions_save(
224
380
  str(tmp_path / file_str),
225
381
  ]: # test for Path object and str
226
382
 
227
- # Test saving without partitioning
228
- saved_filenames = initial_conditions_with_bgc_from_climatology.save(
229
- filepath
230
- )
383
+ saved_filenames = initial_conditions.save(filepath)
231
384
  # Check if the .nc file was created
232
385
  filepath = Path(filepath).with_suffix(".nc")
233
386
  assert saved_filenames == [filepath]
@@ -235,27 +388,20 @@ def test_initial_conditions_save(
235
388
  # Clean up the .nc file
236
389
  filepath.unlink()
237
390
 
238
- # Test saving with partitioning
239
- saved_filenames = initial_conditions_with_bgc_from_climatology.save(
240
- filepath, np_eta=2
241
- )
242
-
243
- filepath_str = str(filepath.with_suffix(""))
244
- expected_filepath_list = [
245
- Path(filepath_str + f".{index}.nc") for index in range(2)
246
- ]
247
- assert saved_filenames == expected_filepath_list
248
- for expected_filepath in expected_filepath_list:
249
- assert expected_filepath.exists()
250
- expected_filepath.unlink()
251
-
252
391
 
253
- def test_roundtrip_yaml(
254
- initial_conditions_with_bgc_from_climatology, tmp_path, use_dask
255
- ):
392
+ @pytest.mark.parametrize(
393
+ "initial_conditions_fixture",
394
+ [
395
+ "initial_conditions",
396
+ "initial_conditions_adjusted_for_zeta",
397
+ ],
398
+ )
399
+ def test_roundtrip_yaml(initial_conditions_fixture, request, tmp_path, use_dask):
256
400
  """Test that creating an InitialConditions object, saving its parameters to yaml
257
401
  file, and re-opening yaml file creates the same object."""
258
402
 
403
+ initial_conditions = request.getfixturevalue(initial_conditions_fixture)
404
+
259
405
  # Create a temporary filepath using the tmp_path fixture
260
406
  file_str = "test_yaml"
261
407
  for filepath in [
@@ -263,21 +409,28 @@ def test_roundtrip_yaml(
263
409
  str(tmp_path / file_str),
264
410
  ]: # test for Path object and str
265
411
 
266
- initial_conditions_with_bgc_from_climatology.to_yaml(filepath)
412
+ initial_conditions.to_yaml(filepath)
267
413
 
268
414
  initial_conditions_from_file = InitialConditions.from_yaml(
269
415
  filepath, use_dask=use_dask
270
416
  )
271
417
 
272
- assert (
273
- initial_conditions_with_bgc_from_climatology == initial_conditions_from_file
274
- )
418
+ assert initial_conditions == initial_conditions_from_file
275
419
 
276
420
  filepath = Path(filepath)
277
421
  filepath.unlink()
278
422
 
279
423
 
280
- def test_files_have_same_hash(initial_conditions, tmp_path, use_dask):
424
+ @pytest.mark.parametrize(
425
+ "initial_conditions_fixture",
426
+ [
427
+ "initial_conditions",
428
+ "initial_conditions_adjusted_for_zeta",
429
+ ],
430
+ )
431
+ def test_files_have_same_hash(initial_conditions_fixture, request, tmp_path, use_dask):
432
+
433
+ initial_conditions = request.getfixturevalue(initial_conditions_fixture)
281
434
 
282
435
  yaml_filepath = tmp_path / "test_yaml.yaml"
283
436
  filepath1 = tmp_path / "test1.nc"
@@ -288,8 +441,9 @@ def test_files_have_same_hash(initial_conditions, tmp_path, use_dask):
288
441
  ic_from_file = InitialConditions.from_yaml(yaml_filepath, use_dask)
289
442
  ic_from_file.save(filepath2)
290
443
 
291
- hash1 = calculate_file_hash(filepath1)
292
- hash2 = calculate_file_hash(filepath2)
444
+ # Only compare hash of datasets because metadata is non-deterministic with dask
445
+ hash1 = calculate_data_hash(filepath1)
446
+ hash2 = calculate_data_hash(filepath2)
293
447
 
294
448
  assert hash1 == hash2, f"Hashes do not match: {hash1} != {hash2}"
295
449