roms-tools 2.4.0__py3-none-any.whl → 2.6.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 (214) hide show
  1. ci/environment-with-xesmf.yml +16 -0
  2. roms_tools/__init__.py +1 -1
  3. roms_tools/analysis/roms_output.py +339 -234
  4. roms_tools/analysis/utils.py +137 -0
  5. roms_tools/plot.py +353 -214
  6. roms_tools/regrid.py +154 -9
  7. roms_tools/setup/boundary_forcing.py +51 -37
  8. roms_tools/setup/datasets.py +129 -74
  9. roms_tools/setup/grid.py +32 -33
  10. roms_tools/setup/initial_conditions.py +30 -37
  11. roms_tools/setup/nesting.py +238 -64
  12. roms_tools/setup/river_forcing.py +256 -86
  13. roms_tools/setup/surface_forcing.py +40 -28
  14. roms_tools/setup/tides.py +10 -13
  15. roms_tools/setup/topography.py +27 -4
  16. roms_tools/setup/utils.py +28 -12
  17. roms_tools/tests/test_analysis/test_roms_output.py +299 -80
  18. roms_tools/tests/test_regrid.py +85 -2
  19. roms_tools/tests/test_setup/test_boundary_forcing.py +63 -0
  20. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zattrs +3 -1
  21. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zmetadata +3 -1
  22. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_east/0.0.0 +0 -0
  23. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_south/0.0.0 +0 -0
  24. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_west/0.0.0 +0 -0
  25. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_east/0.0.0 +0 -0
  26. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_south/0.0.0 +0 -0
  27. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/0.0.0 +0 -0
  28. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_east/0.0.0 +0 -0
  29. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_south/0.0.0 +0 -0
  30. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_west/0.0.0 +0 -0
  31. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_east/0.0.0 +0 -0
  32. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_south/0.0.0 +0 -0
  33. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/0.0.0 +0 -0
  34. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_east/0.0.0 +0 -0
  35. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_south/0.0.0 +0 -0
  36. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/0.0.0 +0 -0
  37. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_east/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_south/0.0.0 +0 -0
  42. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/0.0.0 +0 -0
  43. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_east/0.0.0 +0 -0
  44. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_south/0.0.0 +0 -0
  45. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/0.0.0 +0 -0
  46. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_east/0.0.0 +0 -0
  47. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_south/0.0.0 +0 -0
  48. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/0.0.0 +0 -0
  49. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_east/0.0.0 +0 -0
  50. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_south/0.0.0 +0 -0
  51. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/0.0.0 +0 -0
  52. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_east/0.0.0 +0 -0
  53. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_south/0.0.0 +0 -0
  54. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/0.0.0 +0 -0
  55. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_east/0.0.0 +0 -0
  56. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_south/0.0.0 +0 -0
  57. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/0.0.0 +0 -0
  58. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_east/0.0.0 +0 -0
  59. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_north/0.0.0 +0 -0
  60. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_south/0.0.0 +0 -0
  61. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/0.0.0 +0 -0
  62. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_east/0.0.0 +0 -0
  63. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_south/0.0.0 +0 -0
  64. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/0.0.0 +0 -0
  65. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_east/0.0.0 +0 -0
  66. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_south/0.0.0 +0 -0
  67. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/0.0.0 +0 -0
  68. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_east/0.0.0 +0 -0
  69. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_south/0.0.0 +0 -0
  70. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/0.0.0 +0 -0
  71. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_east/0.0.0 +0 -0
  72. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_south/0.0.0 +0 -0
  73. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/0.0.0 +0 -0
  74. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_east/0.0.0 +0 -0
  75. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_north/0.0.0 +0 -0
  76. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_south/0.0.0 +0 -0
  77. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_west/0.0.0 +0 -0
  78. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_east/0.0.0 +0 -0
  79. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_north/0.0.0 +0 -0
  80. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_south/0.0.0 +0 -0
  81. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_west/0.0.0 +0 -0
  82. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_east/0.0.0 +0 -0
  83. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_north/0.0.0 +0 -0
  84. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_south/0.0.0 +0 -0
  85. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_west/0.0.0 +0 -0
  86. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_east/0.0.0 +0 -0
  87. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_north/0.0.0 +0 -0
  88. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_south/0.0.0 +0 -0
  89. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_west/0.0.0 +0 -0
  90. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_east/0.0.0 +0 -0
  91. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_north/0.0.0 +0 -0
  92. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_south/0.0.0 +0 -0
  93. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_west/0.0.0 +0 -0
  94. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_east/0.0.0 +0 -0
  95. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_north/0.0.0 +0 -0
  96. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_south/0.0.0 +0 -0
  97. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_west/0.0.0 +0 -0
  98. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_east/0.0.0 +0 -0
  99. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_north/0.0.0 +0 -0
  100. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_south/0.0.0 +0 -0
  101. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_west/0.0.0 +0 -0
  102. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_east/0.0.0 +0 -0
  103. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_north/0.0.0 +0 -0
  104. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_south/0.0.0 +0 -0
  105. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_west/0.0.0 +0 -0
  106. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_east/0.0.0 +0 -0
  107. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_north/0.0.0 +0 -0
  108. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_south/0.0.0 +0 -0
  109. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_west/0.0.0 +0 -0
  110. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_east/0.0.0 +0 -0
  111. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_north/0.0.0 +0 -0
  112. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_south/0.0.0 +0 -0
  113. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_west/0.0.0 +0 -0
  114. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_east/0.0.0 +0 -0
  115. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_north/0.0.0 +0 -0
  116. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_south/0.0.0 +0 -0
  117. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_west/0.0.0 +0 -0
  118. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_east/0.0.0 +0 -0
  119. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_north/0.0.0 +0 -0
  120. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_south/0.0.0 +0 -0
  121. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_west/0.0.0 +0 -0
  122. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_east/0.0.0 +0 -0
  123. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_north/0.0.0 +0 -0
  124. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_south/0.0.0 +0 -0
  125. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_west/0.0.0 +0 -0
  126. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_east/0.0.0 +0 -0
  127. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_north/0.0.0 +0 -0
  128. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_south/0.0.0 +0 -0
  129. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_west/0.0.0 +0 -0
  130. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_east/0.0.0 +0 -0
  131. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_north/0.0.0 +0 -0
  132. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_south/0.0.0 +0 -0
  133. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_west/0.0.0 +0 -0
  134. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/.zattrs +2 -2
  135. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/.zmetadata +8 -7
  136. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/abs_time/.zattrs +1 -0
  137. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/dust/0.0.0 +0 -0
  138. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/dust_time/.zattrs +1 -1
  139. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/iron/0.0.0 +0 -0
  140. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/iron_time/.zattrs +1 -1
  141. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nhy/0.0.0 +0 -0
  142. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nhy_time/.zattrs +1 -1
  143. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nox/0.0.0 +0 -0
  144. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nox_time/.zattrs +1 -1
  145. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air/0.0.0 +0 -0
  146. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air_alt/0.0.0 +0 -0
  147. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_time/.zattrs +1 -1
  148. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zattrs +2 -2
  149. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zmetadata +2 -2
  150. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/dust/0.0.0 +0 -0
  151. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/iron/0.0.0 +0 -0
  152. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nhy/0.0.0 +0 -0
  153. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nox/0.0.0 +0 -0
  154. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air/0.0.0 +0 -0
  155. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air_alt/0.0.0 +0 -0
  156. roms_tools/tests/test_setup/test_data/grid.zarr/.zattrs +1 -1
  157. roms_tools/tests/test_setup/test_data/grid.zarr/.zmetadata +2 -2
  158. roms_tools/tests/test_setup/test_data/grid.zarr/angle/0.0 +0 -0
  159. roms_tools/tests/test_setup/test_data/grid.zarr/angle_coarse/0.0 +0 -0
  160. roms_tools/tests/test_setup/test_data/grid.zarr/f/0.0 +0 -0
  161. roms_tools/tests/test_setup/test_data/grid.zarr/h/.zattrs +1 -1
  162. roms_tools/tests/test_setup/test_data/grid.zarr/h/0.0 +0 -0
  163. roms_tools/tests/test_setup/test_data/grid.zarr/lat_coarse/0.0 +0 -0
  164. roms_tools/tests/test_setup/test_data/grid.zarr/lat_rho/0.0 +0 -0
  165. roms_tools/tests/test_setup/test_data/grid.zarr/lat_u/0.0 +0 -0
  166. roms_tools/tests/test_setup/test_data/grid.zarr/lat_v/0.0 +0 -0
  167. roms_tools/tests/test_setup/test_data/grid.zarr/pm/0.0 +0 -0
  168. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zattrs +1 -1
  169. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zmetadata +1 -1
  170. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/angle/0.0 +0 -0
  171. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/angle_coarse/0.0 +0 -0
  172. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/f/0.0 +0 -0
  173. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/h/0.0 +0 -0
  174. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_coarse/0.0 +0 -0
  175. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_rho/0.0 +0 -0
  176. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_u/0.0 +0 -0
  177. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_v/0.0 +0 -0
  178. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_coarse/0.0 +0 -0
  179. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_rho/0.0 +0 -0
  180. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_u/0.0 +0 -0
  181. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_v/0.0 +0 -0
  182. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/pm/0.0 +0 -0
  183. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/pn/0.0 +0 -0
  184. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/.zattrs +1 -1
  185. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/.zmetadata +1 -1
  186. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/salt/0.0.0.0 +0 -0
  187. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/temp/0.0.0.0 +0 -0
  188. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/u/0.0.0.0 +0 -0
  189. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ubar/0.0.0 +0 -0
  190. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/v/0.0.0.0 +0 -0
  191. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/vbar/0.0.0 +0 -0
  192. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zeta/0.0.0 +0 -0
  193. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/.zmetadata +27 -1
  194. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/nriver/.zarray +20 -0
  195. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/nriver/.zattrs +6 -0
  196. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/nriver/0 +0 -0
  197. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_location/.zattrs +1 -1
  198. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/.zmetadata +27 -1
  199. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/nriver/.zarray +20 -0
  200. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/nriver/.zattrs +6 -0
  201. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/nriver/0 +0 -0
  202. roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/river_location/.zattrs +1 -1
  203. roms_tools/tests/test_setup/test_initial_conditions.py +16 -0
  204. roms_tools/tests/test_setup/test_nesting.py +141 -104
  205. roms_tools/tests/test_setup/test_river_forcing.py +580 -266
  206. roms_tools/tests/test_setup/test_surface_forcing.py +47 -0
  207. roms_tools/tests/test_setup/test_validation.py +34 -2
  208. roms_tools/utils.py +11 -7
  209. roms_tools/vertical_coordinate.py +1 -0
  210. {roms_tools-2.4.0.dist-info → roms_tools-2.6.0.dist-info}/METADATA +22 -11
  211. {roms_tools-2.4.0.dist-info → roms_tools-2.6.0.dist-info}/RECORD +214 -206
  212. {roms_tools-2.4.0.dist-info → roms_tools-2.6.0.dist-info}/WHEEL +1 -1
  213. {roms_tools-2.4.0.dist-info → roms_tools-2.6.0.dist-info/licenses}/LICENSE +0 -0
  214. {roms_tools-2.4.0.dist-info → roms_tools-2.6.0.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,7 @@ import xarray as xr
3
3
  import numpy as np
4
4
  import logging
5
5
  from pathlib import Path
6
- from roms_tools import Grid, Nesting
6
+ from roms_tools import Grid, ChildGrid
7
7
  from roms_tools.setup.utils import get_boundary_coords
8
8
  from conftest import calculate_file_hash
9
9
  from roms_tools.setup.nesting import (
@@ -15,14 +15,14 @@ from roms_tools.setup.nesting import (
15
15
 
16
16
 
17
17
  @pytest.fixture()
18
- def parent_grid():
18
+ def big_grid():
19
19
  return Grid(
20
20
  nx=5, ny=7, center_lon=-23, center_lat=61, rot=20, size_x=1800, size_y=2400
21
21
  )
22
22
 
23
23
 
24
24
  @pytest.fixture()
25
- def child_grid():
25
+ def small_grid():
26
26
  return Grid(
27
27
  nx=10, ny=10, center_lon=-23, center_lat=61, rot=-20, size_x=500, size_y=500
28
28
  )
@@ -36,30 +36,44 @@ def baby_grid():
36
36
 
37
37
 
38
38
  @pytest.fixture()
39
- def parent_grid_that_straddles():
39
+ def big_grid_that_straddles():
40
40
  return Grid(
41
41
  nx=5, ny=7, center_lon=10, center_lat=61, rot=20, size_x=1800, size_y=2400
42
42
  )
43
43
 
44
44
 
45
45
  @pytest.fixture()
46
- def child_grid_that_straddles():
46
+ def small_grid_that_straddles():
47
47
  return Grid(
48
48
  nx=10, ny=10, center_lon=10, center_lat=61, rot=-20, size_x=500, size_y=500
49
49
  )
50
50
 
51
51
 
52
52
  @pytest.fixture()
53
- def nesting(parent_grid, child_grid):
54
- return Nesting(parent_grid=parent_grid, child_grid=child_grid, period=3600.0)
53
+ def child_grid(big_grid):
54
+ return ChildGrid(
55
+ parent_grid=big_grid,
56
+ nx=10,
57
+ ny=10,
58
+ center_lon=-23,
59
+ center_lat=61,
60
+ rot=-20,
61
+ size_x=500,
62
+ size_y=500,
63
+ )
55
64
 
56
65
 
57
66
  @pytest.fixture()
58
- def nesting_that_straddles(parent_grid_that_straddles, child_grid_that_straddles):
59
- return Nesting(
60
- parent_grid=parent_grid_that_straddles,
61
- child_grid=child_grid_that_straddles,
62
- period=3600.0,
67
+ def child_grid_that_straddles(big_grid_that_straddles):
68
+ return ChildGrid(
69
+ parent_grid=big_grid_that_straddles,
70
+ nx=10,
71
+ ny=10,
72
+ center_lon=10,
73
+ center_lat=61,
74
+ rot=-20,
75
+ size_x=500,
76
+ size_y=500,
63
77
  )
64
78
 
65
79
 
@@ -67,8 +81,8 @@ class TestInterpolateIndices:
67
81
  @pytest.mark.parametrize(
68
82
  "grid",
69
83
  [
70
- "parent_grid",
71
- "parent_grid_that_straddles",
84
+ "big_grid",
85
+ "big_grid_that_straddles",
72
86
  ],
73
87
  )
74
88
  def test_correct_indices_of_same_grid(self, grid, caplog, request):
@@ -114,34 +128,34 @@ class TestInterpolateIndices:
114
128
  np.testing.assert_allclose(i_xi.values, expected_i_xi)
115
129
 
116
130
  @pytest.mark.parametrize(
117
- "parent_grid_fixture, child_grid_fixture",
131
+ "big_grid_fixture, small_grid_fixture",
118
132
  [
119
- ("parent_grid", "child_grid"),
120
- ("parent_grid_that_straddles", "child_grid_that_straddles"),
133
+ ("big_grid", "small_grid"),
134
+ ("big_grid_that_straddles", "small_grid_that_straddles"),
121
135
  ],
122
136
  )
123
137
  def test_indices_are_within_range_of_parent_grid(
124
- self, parent_grid_fixture, child_grid_fixture, request
138
+ self, big_grid_fixture, small_grid_fixture, request
125
139
  ):
126
140
  """Ensure interpolated indices fall within the parent grid's bounds."""
127
141
 
128
- parent_grid = request.getfixturevalue(parent_grid_fixture)
129
- child_grid = request.getfixturevalue(child_grid_fixture)
142
+ big_grid = request.getfixturevalue(big_grid_fixture)
143
+ small_grid = request.getfixturevalue(small_grid_fixture)
130
144
 
131
145
  bdry_coords_dict = get_boundary_coords()
132
146
  for location in ["rho", "u", "v"]:
133
147
  for direction in ["south", "east", "north", "west"]:
134
148
  bdry_coords = bdry_coords_dict[location][direction]
135
- lon = child_grid.ds[f"lon_{location}"].isel(**bdry_coords)
136
- lat = child_grid.ds[f"lat_{location}"].isel(**bdry_coords)
137
- mask = child_grid.ds[f"mask_{location}"].isel(**bdry_coords)
149
+ lon = small_grid.ds[f"lon_{location}"].isel(**bdry_coords)
150
+ lat = small_grid.ds[f"lat_{location}"].isel(**bdry_coords)
151
+ mask = small_grid.ds[f"mask_{location}"].isel(**bdry_coords)
138
152
 
139
- i_eta, i_xi = interpolate_indices(parent_grid.ds, lon, lat, mask)
153
+ i_eta, i_xi = interpolate_indices(big_grid.ds, lon, lat, mask)
140
154
 
141
155
  expected_i_eta_min = -0.5
142
- expected_i_eta_max = parent_grid.ds.eta_rho[-1] - 0.5
156
+ expected_i_eta_max = big_grid.ds.eta_rho[-1] - 0.5
143
157
  expected_i_xi_min = -0.5
144
- expected_i_xi_max = parent_grid.ds.xi_rho[-1] - 0.5
158
+ expected_i_xi_max = big_grid.ds.xi_rho[-1] - 0.5
145
159
 
146
160
  assert (i_eta >= expected_i_eta_min).all()
147
161
  assert (i_eta <= expected_i_eta_max).all()
@@ -150,36 +164,34 @@ class TestInterpolateIndices:
150
164
 
151
165
 
152
166
  class TestMapChildBoundaries:
153
- def test_update_indices_does_nothing_if_no_parent_land(self, child_grid, baby_grid):
167
+ def test_update_indices_does_nothing_if_no_parent_land(self, small_grid, baby_grid):
154
168
  """Verify no change in indices when parent grid has no land at boundaries."""
155
169
 
156
170
  ds_without_updated_indices = map_child_boundaries_onto_parent_grid_indices(
157
- child_grid.ds, baby_grid.ds, update_land_indices=False
171
+ small_grid.ds, baby_grid.ds, update_land_indices=False
158
172
  )
159
173
  ds_with_updated_indices = map_child_boundaries_onto_parent_grid_indices(
160
- child_grid.ds, baby_grid.ds, update_land_indices=True
174
+ small_grid.ds, baby_grid.ds, update_land_indices=True
161
175
  )
162
176
 
163
177
  xr.testing.assert_allclose(ds_without_updated_indices, ds_with_updated_indices)
164
178
 
165
179
  @pytest.mark.parametrize(
166
- "parent_grid_fixture, child_grid_fixture",
180
+ "big_grid_fixture, small_grid_fixture",
167
181
  [
168
- ("parent_grid", "child_grid"),
169
- ("parent_grid_that_straddles", "child_grid_that_straddles"),
182
+ ("big_grid", "small_grid"),
183
+ ("big_grid_that_straddles", "small_grid_that_straddles"),
170
184
  ],
171
185
  )
172
186
  def test_updated_indices_map_to_wet_points(
173
- self, parent_grid_fixture, child_grid_fixture, request
187
+ self, big_grid_fixture, small_grid_fixture, request
174
188
  ):
175
189
  """Check updated indices map to wet points on the parent grid."""
176
190
 
177
- parent_grid = request.getfixturevalue(parent_grid_fixture)
178
- child_grid = request.getfixturevalue(child_grid_fixture)
191
+ big_grid = request.getfixturevalue(big_grid_fixture)
192
+ small_grid = request.getfixturevalue(small_grid_fixture)
179
193
 
180
- ds = map_child_boundaries_onto_parent_grid_indices(
181
- parent_grid.ds, child_grid.ds
182
- )
194
+ ds = map_child_boundaries_onto_parent_grid_indices(big_grid.ds, small_grid.ds)
183
195
  for direction in ["south", "east", "north", "west"]:
184
196
  for location in ["rho", "u", "v"]:
185
197
  if location == "rho":
@@ -191,7 +203,7 @@ class TestMapChildBoundaries:
191
203
  for i in range(len(i_xi)):
192
204
  i_eta_lower = int(np.floor(i_eta[i]))
193
205
  i_xi_lower = int(np.floor(i_xi[i]))
194
- mask = parent_grid.ds.mask_rho.isel(
206
+ mask = big_grid.ds.mask_rho.isel(
195
207
  eta_rho=slice(i_eta_lower, i_eta_lower + 2),
196
208
  xi_rho=slice(i_xi_lower, i_xi_lower + 2),
197
209
  )
@@ -199,24 +211,24 @@ class TestMapChildBoundaries:
199
211
  # TODO: check also u and v locations
200
212
 
201
213
  @pytest.mark.parametrize(
202
- "parent_grid_fixture, child_grid_fixture",
214
+ "big_grid_fixture, small_grid_fixture",
203
215
  [
204
- ("parent_grid", "child_grid"),
205
- ("parent_grid_that_straddles", "child_grid_that_straddles"),
216
+ ("big_grid", "small_grid"),
217
+ ("big_grid_that_straddles", "small_grid_that_straddles"),
206
218
  ],
207
219
  )
208
220
  def test_indices_are_monotonically_increasing(
209
- self, parent_grid_fixture, child_grid_fixture, request
221
+ self, big_grid_fixture, small_grid_fixture, request
210
222
  ):
211
223
  """Test that child boundary indices are monotonically increasing or decreasing
212
224
  in both the xi and eta directions, for all boundaries and locations."""
213
225
 
214
- parent_grid = request.getfixturevalue(parent_grid_fixture)
215
- child_grid = request.getfixturevalue(child_grid_fixture)
226
+ big_grid = request.getfixturevalue(big_grid_fixture)
227
+ small_grid = request.getfixturevalue(small_grid_fixture)
216
228
 
217
229
  for update_land_indices in [False, True]:
218
230
  ds = map_child_boundaries_onto_parent_grid_indices(
219
- parent_grid.ds, child_grid.ds, update_land_indices=update_land_indices
231
+ big_grid.ds, small_grid.ds, update_land_indices=update_land_indices
220
232
  )
221
233
 
222
234
  for direction in ["south", "east", "north", "west"]:
@@ -240,7 +252,7 @@ class TestBoundaryDistance:
240
252
  @pytest.mark.parametrize(
241
253
  "grid_fixture",
242
254
  [
243
- "child_grid",
255
+ "small_grid",
244
256
  "baby_grid",
245
257
  ],
246
258
  )
@@ -266,10 +278,10 @@ class TestBoundaryDistance:
266
278
  == 1
267
279
  )
268
280
 
269
- def test_boundary_distance_for_grid_with_land_along_boundary(self, parent_grid):
281
+ def test_boundary_distance_for_grid_with_land_along_boundary(self, big_grid):
270
282
  """Test that there are 1s along the boundary of alpha if the grid has land along
271
283
  the boundary."""
272
- alpha = compute_boundary_distance(parent_grid.ds.mask_rho)
284
+ alpha = compute_boundary_distance(big_grid.ds.mask_rho)
273
285
  assert (alpha.isel(eta_rho=0) == 1).any()
274
286
  assert (alpha.isel(eta_rho=-1) == 1).any()
275
287
  assert (alpha.isel(xi_rho=0) == 1).any()
@@ -278,21 +290,21 @@ class TestBoundaryDistance:
278
290
 
279
291
  class TestModifyChid:
280
292
  def test_mask_is_not_modified_if_no_parent_land_along_boundaries(
281
- self, child_grid, baby_grid
293
+ self, small_grid, baby_grid
282
294
  ):
283
295
  """Confirm child mask remains unchanged if no parent land is at boundaries."""
284
296
 
285
297
  mask_original = baby_grid.ds.mask_rho.copy()
286
298
  modified_baby_grid_ds = modify_child_topography_and_mask(
287
- child_grid.ds, baby_grid.ds
299
+ small_grid.ds, baby_grid.ds
288
300
  )
289
301
  xr.testing.assert_allclose(modified_baby_grid_ds.mask_rho, mask_original)
290
302
 
291
303
  @pytest.mark.parametrize(
292
304
  "grid_fixture",
293
305
  [
294
- "parent_grid",
295
- "child_grid",
306
+ "big_grid",
307
+ "small_grid",
296
308
  "baby_grid",
297
309
  ],
298
310
  )
@@ -308,16 +320,16 @@ class TestModifyChid:
308
320
  xr.testing.assert_allclose(modified_grid_ds.h, h_original)
309
321
  xr.testing.assert_allclose(modified_grid_ds.mask_rho, mask_original)
310
322
 
311
- def test_modification_only_along_boundaries(self, parent_grid, child_grid):
323
+ def test_modification_only_along_boundaries(self, big_grid, small_grid):
312
324
  """Test that modifications to the child grid's topography and mask occur only
313
325
  along the boundaries, leaving the interior unchanged."""
314
326
 
315
327
  # Make copies of original data for comparison
316
- h_original = child_grid.ds.h.copy()
317
- mask_original = child_grid.ds.mask_rho.copy()
328
+ h_original = small_grid.ds.h.copy()
329
+ mask_original = small_grid.ds.mask_rho.copy()
318
330
 
319
331
  # Apply the modification function
320
- modified_ds = modify_child_topography_and_mask(parent_grid.ds, child_grid.ds)
332
+ modified_ds = modify_child_topography_and_mask(big_grid.ds, small_grid.ds)
321
333
 
322
334
  # Calculate the center indices for the grid
323
335
  eta_center = h_original.sizes["eta_rho"] // 2
@@ -339,23 +351,24 @@ class TestModifyChid:
339
351
 
340
352
  class TestNesting:
341
353
  @pytest.mark.parametrize(
342
- "nesting_fixture",
343
- ["nesting", "nesting_that_straddles"],
354
+ "child_grid_fixture",
355
+ ["child_grid", "child_grid_that_straddles"],
344
356
  )
345
- def test_successful_initialization(self, nesting_fixture, request):
346
- nesting = request.getfixturevalue(nesting_fixture)
357
+ def test_successful_initialization(self, child_grid_fixture, request):
358
+ child_grid = request.getfixturevalue(child_grid_fixture)
347
359
 
348
- assert nesting.boundaries == {
360
+ assert child_grid.boundaries == {
349
361
  "south": True,
350
362
  "east": True,
351
363
  "north": True,
352
364
  "west": True,
353
365
  }
354
- assert nesting.child_prefix == "child"
355
- assert nesting.period == 3600.0
356
- assert isinstance(nesting.ds, xr.Dataset)
366
+ assert child_grid.metadata["prefix"] == "child"
367
+ assert child_grid.metadata["period"] == 3600.0
368
+ assert isinstance(child_grid.ds, xr.Dataset)
369
+ assert isinstance(child_grid.ds_nesting, xr.Dataset)
357
370
 
358
- ds = nesting.ds
371
+ ds = child_grid.ds_nesting
359
372
  for direction in ["south", "east", "north", "west"]:
360
373
  for location in ["r", "u", "v"]:
361
374
  assert f"child_{direction}_{location}" in ds.data_vars
@@ -379,58 +392,76 @@ class TestNesting:
379
392
  )
380
393
 
381
394
  @pytest.mark.parametrize(
382
- "parent_grid_fixture, child_grid_fixture",
395
+ "big_grid_fixture, small_grid_fixture",
383
396
  [
384
- ("parent_grid", "child_grid_that_straddles"),
385
- ("parent_grid_that_straddles", "child_grid"),
397
+ ("big_grid", "small_grid_that_straddles"),
398
+ ("big_grid_that_straddles", "small_grid"),
386
399
  ],
387
400
  )
388
401
  def test_error_if_child_grid_beyond_parent_grid(
389
- self, parent_grid_fixture, child_grid_fixture, request
402
+ self, big_grid_fixture, small_grid_fixture, request
390
403
  ):
391
- parent_grid = request.getfixturevalue(parent_grid_fixture)
392
- child_grid = request.getfixturevalue(child_grid_fixture)
404
+ big_grid = request.getfixturevalue(big_grid_fixture)
405
+ small_grid = request.getfixturevalue(small_grid_fixture)
406
+
407
+ import dataclasses
408
+
409
+ params = dataclasses.asdict(small_grid)
410
+ del params["ds"], params["straddle"]
393
411
 
394
412
  with pytest.raises(ValueError, match="Some points are outside the grid."):
395
- Nesting(parent_grid=parent_grid, child_grid=child_grid)
413
+ ChildGrid(parent_grid=big_grid, **params)
396
414
 
397
415
  @pytest.mark.parametrize(
398
- "nesting_fixture",
399
- ["nesting", "nesting_that_straddles"],
416
+ "child_grid_fixture",
417
+ ["child_grid", "child_grid_that_straddles"],
400
418
  )
401
- def test_plot(self, nesting_fixture, request):
419
+ def test_plot(self, child_grid_fixture, request):
402
420
  """Test plot method."""
403
- nesting = request.getfixturevalue(nesting_fixture)
421
+ child_grid = request.getfixturevalue(child_grid_fixture)
404
422
 
405
- nesting.plot()
406
- nesting.plot(with_dim_names=True)
423
+ child_grid.plot()
424
+ child_grid.plot_nesting()
425
+ child_grid.plot_nesting(with_dim_names=True)
407
426
 
408
- def test_save(self, nesting, tmp_path):
409
- """Test save method."""
427
+ def test_save(self, child_grid, tmp_path):
428
+ """Test save methods."""
410
429
 
411
- for file_str, grid_file_str in zip(
412
- ["test_nesting", "test_nesting.nc"], ["test_grid", "test_grid.nc"]
413
- ):
430
+ for file_str in ["test_grid", "test_grid.nc"]:
414
431
  # Create a temporary filepath using the tmp_path fixture
415
- for filepath, grid_filepath in zip(
416
- [tmp_path / file_str, str(tmp_path / file_str)],
417
- [tmp_path / grid_file_str, str(tmp_path / grid_file_str)],
418
- ): # test for Path object and str
432
+ for filepath in [tmp_path / file_str, str(tmp_path / file_str)]:
419
433
 
420
- saved_filenames = nesting.save(filepath, grid_filepath)
434
+ saved_filenames = child_grid.save(filepath)
421
435
  # Check if the .nc file was created
422
436
  filepath = Path(filepath).with_suffix(".nc")
423
- grid_filepath = Path(grid_filepath).with_suffix(".nc")
424
- assert saved_filenames == [filepath, grid_filepath]
437
+ assert saved_filenames == [filepath]
425
438
  assert filepath.exists()
426
- assert grid_filepath.exists()
427
439
  # Clean up the .nc file
428
440
  filepath.unlink()
429
- grid_filepath.unlink()
430
441
 
431
- def test_roundtrip_yaml(self, nesting, tmp_path):
432
- """Test that creating a Nesting object, saving its parameters to yaml file, and
433
- re-opening yaml file creates the same object."""
442
+ for file_str in ["test_nesting", "test_nesting.nc"]:
443
+ # Create a temporary filepath using the tmp_path fixture
444
+ for filepath in [tmp_path / file_str, str(tmp_path / file_str)]:
445
+
446
+ saved_filenames = child_grid.save_nesting(filepath)
447
+ # Check if the .nc file was created
448
+ filepath = Path(filepath).with_suffix(".nc")
449
+ assert saved_filenames == [filepath]
450
+ assert filepath.exists()
451
+ # Clean up the .nc file
452
+ filepath.unlink()
453
+
454
+ def test_disabled_from_file_method(self):
455
+ """Test that parent from_file method is indeed disabled."""
456
+ with pytest.raises(
457
+ NotImplementedError,
458
+ match="The 'from_file' method is disabled in this subclass.",
459
+ ):
460
+ ChildGrid.from_file(filepath="some_file.nc")
461
+
462
+ def test_roundtrip_yaml(self, child_grid, tmp_path):
463
+ """Test that creating a ChildGrid object, saving its parameters to yaml file,
464
+ and re-opening yaml file creates the same object."""
434
465
 
435
466
  # Create a temporary filepath using the tmp_path fixture
436
467
  file_str = "test_yaml"
@@ -439,16 +470,16 @@ class TestNesting:
439
470
  str(tmp_path / file_str),
440
471
  ]: # test for Path object and str
441
472
 
442
- nesting.to_yaml(filepath)
473
+ child_grid.to_yaml(filepath)
443
474
 
444
- nesting_from_file = Nesting.from_yaml(filepath)
475
+ child_grid_from_file = ChildGrid.from_yaml(filepath)
445
476
 
446
- assert nesting == nesting_from_file
477
+ assert child_grid == child_grid_from_file
447
478
 
448
479
  filepath = Path(filepath)
449
480
  filepath.unlink()
450
481
 
451
- def test_files_have_same_hash(self, nesting, tmp_path):
482
+ def test_files_have_same_hash(self, child_grid, tmp_path):
452
483
 
453
484
  yaml_filepath = tmp_path / "test_yaml.yaml"
454
485
  filepath1 = tmp_path / "test1.nc"
@@ -456,14 +487,20 @@ class TestNesting:
456
487
  grid_filepath1 = tmp_path / "grid_test1.nc"
457
488
  grid_filepath2 = tmp_path / "grid_test2.nc"
458
489
 
459
- nesting.to_yaml(yaml_filepath)
460
- nesting.save(filepath1, grid_filepath1)
461
- nesting_from_file = Nesting.from_yaml(yaml_filepath)
462
- nesting_from_file.save(filepath2, grid_filepath2)
490
+ child_grid.to_yaml(yaml_filepath)
491
+ child_grid.save(grid_filepath1)
492
+ child_grid.save_nesting(filepath1)
493
+
494
+ child_grid_from_file = ChildGrid.from_yaml(yaml_filepath)
495
+ child_grid_from_file.save(grid_filepath2)
496
+ child_grid_from_file.save_nesting(filepath2)
463
497
 
464
498
  hash1 = calculate_file_hash(filepath1)
465
499
  hash2 = calculate_file_hash(filepath2)
500
+ assert hash1 == hash2, f"Hashes do not match: {hash1} != {hash2}"
466
501
 
502
+ hash1 = calculate_file_hash(grid_filepath1)
503
+ hash2 = calculate_file_hash(grid_filepath2)
467
504
  assert hash1 == hash2, f"Hashes do not match: {hash1} != {hash2}"
468
505
 
469
506
  yaml_filepath.unlink()