roms-tools 3.2.0__py3-none-any.whl → 3.4.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 (318) hide show
  1. roms_tools/__init__.py +1 -1
  2. roms_tools/analysis/cdr_ensemble.py +10 -13
  3. roms_tools/analysis/roms_output.py +5 -304
  4. roms_tools/{download.py → datasets/download.py} +1 -0
  5. roms_tools/{setup/datasets.py → datasets/lat_lon_datasets.py} +85 -854
  6. roms_tools/datasets/river_datasets.py +532 -0
  7. roms_tools/datasets/roms_dataset.py +767 -0
  8. roms_tools/datasets/utils.py +475 -0
  9. roms_tools/{setup/fill.py → fill.py} +110 -13
  10. roms_tools/plot.py +42 -34
  11. roms_tools/setup/boundary_forcing.py +52 -44
  12. roms_tools/setup/cdr_release.py +2 -4
  13. roms_tools/setup/grid.py +42 -17
  14. roms_tools/setup/initial_conditions.py +23 -23
  15. roms_tools/setup/nesting.py +270 -94
  16. roms_tools/setup/river_forcing.py +5 -5
  17. roms_tools/setup/surface_forcing.py +17 -12
  18. roms_tools/setup/tides.py +1 -1
  19. roms_tools/setup/topography.py +13 -7
  20. roms_tools/setup/utils.py +103 -294
  21. roms_tools/tests/test_analysis/test_cdr_ensemble.py +4 -6
  22. roms_tools/tests/test_analysis/test_roms_output.py +1 -220
  23. roms_tools/tests/{test_setup/test_datasets.py → test_datasets/test_lat_lon_datasets.py} +25 -64
  24. roms_tools/tests/test_datasets/test_river_datasets.py +48 -0
  25. roms_tools/tests/test_datasets/test_roms_dataset.py +539 -0
  26. roms_tools/tests/test_datasets/test_utils.py +527 -0
  27. roms_tools/tests/{test_setup/test_fill.py → test_fill.py} +72 -9
  28. roms_tools/tests/test_setup/test_boundary_forcing.py +57 -138
  29. roms_tools/tests/test_setup/test_cdr_release.py +4 -5
  30. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_east/c/0/0/0 +0 -0
  31. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_north/c/0/0/0 +0 -0
  32. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_east/c/0/0/0 +0 -0
  33. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_north/c/0/0/0 +0 -0
  34. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_east/c/0/0/0 +0 -0
  35. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_north/c/0/0/0 +0 -0
  36. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_east/c/0/0/0 +0 -0
  37. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_north/c/0/0/0 +0 -0
  38. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_east/c/0/0/0 +0 -0
  39. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_north/c/0/0/0 +0 -0
  40. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_east/c/0/0/0 +0 -0
  41. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_north/c/0/0/0 +0 -0
  42. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_east/c/0/0/0 +0 -0
  43. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_north/c/0/0/0 +0 -0
  44. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_east/c/0/0/0 +0 -0
  45. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_north/c/0/0/0 +0 -0
  46. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_east/c/0/0/0 +0 -0
  47. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_north/c/0/0/0 +0 -0
  48. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_east/c/0/0/0 +0 -0
  49. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_north/c/0/0/0 +0 -0
  50. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_east/c/0/0/0 +0 -0
  51. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_north/c/0/0/0 +0 -0
  52. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_east/c/0/0/0 +0 -0
  53. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_north/c/0/0/0 +0 -0
  54. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_east/c/0/0/0 +0 -0
  55. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_north/c/0/0/0 +0 -0
  56. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_east/c/0/0/0 +0 -0
  57. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_north/c/0/0/0 +0 -0
  58. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_east/c/0/0/0 +0 -0
  59. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_north/c/0/0/0 +0 -0
  60. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_east/c/0/0/0 +0 -0
  61. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_north/c/0/0/0 +0 -0
  62. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_east/c/0/0/0 +0 -0
  63. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_north/c/0/0/0 +0 -0
  64. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_east/c/0/0/0 +0 -0
  65. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_north/c/0/0/0 +0 -0
  66. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_east/c/0/0/0 +0 -0
  67. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_north/c/0/0/0 +0 -0
  68. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_east/c/0/0/0 +0 -0
  69. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_north/c/0/0/0 +0 -0
  70. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_east/c/0/0/0 +0 -0
  71. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_north/c/0/0/0 +0 -0
  72. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_east/c/0/0/0 +0 -0
  73. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_north/c/0/0/0 +0 -0
  74. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_east/c/0/0/0 +0 -0
  75. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_north/c/0/0/0 +0 -0
  76. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_east/c/0/0/0 +0 -0
  77. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_north/c/0/0/0 +0 -0
  78. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_east/c/0/0/0 +0 -0
  79. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_north/c/0/0/0 +0 -0
  80. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_east/c/0/0/0 +0 -0
  81. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_north/c/0/0/0 +0 -0
  82. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_east/c/0/0/0 +0 -0
  83. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_north/c/0/0/0 +0 -0
  84. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_east/c/0/0/0 +0 -0
  85. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_north/c/0/0/0 +0 -0
  86. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_east/c/0/0/0 +0 -0
  87. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_north/c/0/0/0 +0 -0
  88. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_east/c/0/0/0 +0 -0
  89. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_north/c/0/0/0 +0 -0
  90. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_east/c/0/0/0 +0 -0
  91. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_north/c/0/0/0 +0 -0
  92. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zarr.json +289 -2017
  93. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_east/c/0/0/0 +0 -0
  94. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_north/c/0/0/0 +0 -0
  95. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/zarr.json +294 -2022
  96. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_east/c/0/0/0 +0 -0
  97. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_north/c/0/0/0 +0 -0
  98. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_south/c/0/0/0 +0 -0
  99. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_west/c/0/0/0 +0 -0
  100. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_east/c/0/0/0 +0 -0
  101. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_north/c/0/0/0 +0 -0
  102. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_south/c/0/0/0 +0 -0
  103. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_west/c/0/0/0 +0 -0
  104. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_east/c/0/0/0 +0 -0
  105. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_north/c/0/0/0 +0 -0
  106. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_south/c/0/0/0 +0 -0
  107. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_west/c/0/0/0 +0 -0
  108. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_east/c/0/0 +0 -0
  109. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_north/c/0/0 +0 -0
  110. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_south/c/0/0 +0 -0
  111. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_west/c/0/0 +0 -0
  112. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_east/c/0/0/0 +0 -0
  113. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_north/c/0/0/0 +0 -0
  114. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_south/c/0/0/0 +0 -0
  115. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_west/c/0/0/0 +0 -0
  116. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_east/c/0/0 +0 -0
  117. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_north/c/0/0 +0 -0
  118. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_south/c/0/0 +0 -0
  119. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_west/c/0/0 +0 -0
  120. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zarr.json +182 -182
  121. roms_tools/tests/test_setup/test_data/grid.zarr/h/c/0/0 +0 -0
  122. roms_tools/tests/test_setup/test_data/grid.zarr/zarr.json +191 -191
  123. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/h/c/0/0 +0 -0
  124. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/zarr.json +210 -210
  125. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK/c/0/0/0/0 +0 -0
  126. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK_ALT_CO2/c/0/0/0/0 +0 -0
  127. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC/c/0/0/0/0 +0 -0
  128. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC_ALT_CO2/c/0/0/0/0 +0 -0
  129. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOC/c/0/0/0/0 +0 -0
  130. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOCr/c/0/0/0/0 +0 -0
  131. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DON/c/0/0/0/0 +0 -0
  132. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DONr/c/0/0/0/0 +0 -0
  133. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOP/c/0/0/0/0 +0 -0
  134. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOPr/c/0/0/0/0 +0 -0
  135. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Fe/c/0/0/0/0 +0 -0
  136. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Lig/c/0/0/0/0 +0 -0
  137. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NH4/c/0/0/0/0 +0 -0
  138. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NO3/c/0/0/0/0 +0 -0
  139. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/O2/c/0/0/0/0 +0 -0
  140. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/PO4/c/0/0/0/0 +0 -0
  141. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/SiO3/c/0/0/0/0 +0 -0
  142. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatC/c/0/0/0/0 +0 -0
  143. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatChl/c/0/0/0/0 +0 -0
  144. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatFe/c/0/0/0/0 +0 -0
  145. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatP/c/0/0/0/0 +0 -0
  146. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatSi/c/0/0/0/0 +0 -0
  147. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazC/c/0/0/0/0 +0 -0
  148. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazChl/c/0/0/0/0 +0 -0
  149. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazFe/c/0/0/0/0 +0 -0
  150. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazP/c/0/0/0/0 +0 -0
  151. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/salt/c/0/0/0/0 +0 -0
  152. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spC/c/0/0/0/0 +0 -0
  153. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spCaCO3/c/0/0/0/0 +0 -0
  154. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spChl/c/0/0/0/0 +0 -0
  155. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spFe/c/0/0/0/0 +0 -0
  156. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spP/c/0/0/0/0 +0 -0
  157. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/temp/c/0/0/0/0 +0 -0
  158. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/u/c/0/0/0/0 +0 -0
  159. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ubar/c/0/0/0 +0 -0
  160. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/v/c/0/0/0/0 +0 -0
  161. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/vbar/c/0/0/0 +0 -0
  162. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zarr.json +182 -182
  163. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zooC/c/0/0/0/0 +0 -0
  164. roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/salt/c/0/0/0/0 +0 -0
  165. roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/temp/c/0/0/0/0 +0 -0
  166. roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/u/c/0/0/0/0 +0 -0
  167. roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/ubar/c/0/0/0 +0 -0
  168. roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/v/c/0/0/0/0 +0 -0
  169. roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/vbar/c/0/0/0 +0 -0
  170. roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/zarr.json +187 -187
  171. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Im/c/0/0/0 +0 -0
  172. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Re/c/0/0/0 +0 -0
  173. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Im/c/0/0/0 +0 -0
  174. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Re/c/0/0/0 +0 -0
  175. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/zarr.json +66 -66
  176. roms_tools/tests/test_setup/test_grid.py +56 -1
  177. roms_tools/tests/test_setup/test_initial_conditions.py +3 -94
  178. roms_tools/tests/test_setup/test_nesting.py +119 -30
  179. roms_tools/tests/test_setup/test_surface_forcing.py +2 -2
  180. roms_tools/tests/test_setup/test_tides.py +1 -1
  181. roms_tools/tests/test_setup/test_utils.py +100 -15
  182. roms_tools/tests/test_tiling/test_partition.py +63 -15
  183. roms_tools/tests/test_utils.py +78 -0
  184. roms_tools/tiling/partition.py +81 -211
  185. roms_tools/utils.py +193 -0
  186. {roms_tools-3.2.0.dist-info → roms_tools-3.4.0.dist-info}/METADATA +1 -1
  187. {roms_tools-3.2.0.dist-info → roms_tools-3.4.0.dist-info}/RECORD +190 -312
  188. {roms_tools-3.2.0.dist-info → roms_tools-3.4.0.dist-info}/WHEEL +1 -1
  189. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_west/c/0/0/0 +0 -0
  190. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_west/zarr.json +0 -54
  191. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/c/0/0/0 +0 -0
  192. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/zarr.json +0 -54
  193. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_west/c/0/0/0 +0 -0
  194. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_west/zarr.json +0 -54
  195. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/c/0/0/0 +0 -0
  196. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/zarr.json +0 -54
  197. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/c/0/0/0 +0 -0
  198. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/zarr.json +0 -54
  199. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_west/c/0/0/0 +0 -0
  200. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_west/zarr.json +0 -54
  201. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/c/0/0/0 +0 -0
  202. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/zarr.json +0 -54
  203. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/c/0/0/0 +0 -0
  204. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/zarr.json +0 -54
  205. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/c/0/0/0 +0 -0
  206. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/zarr.json +0 -54
  207. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/c/0/0/0 +0 -0
  208. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/zarr.json +0 -54
  209. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/c/0/0/0 +0 -0
  210. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/zarr.json +0 -54
  211. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/c/0/0/0 +0 -0
  212. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/zarr.json +0 -54
  213. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/c/0/0/0 +0 -0
  214. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/zarr.json +0 -54
  215. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/c/0/0/0 +0 -0
  216. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/zarr.json +0 -54
  217. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/c/0/0/0 +0 -0
  218. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/zarr.json +0 -54
  219. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/c/0/0/0 +0 -0
  220. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/zarr.json +0 -54
  221. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/c/0/0/0 +0 -0
  222. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/zarr.json +0 -54
  223. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_west/c/0/0/0 +0 -0
  224. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_west/zarr.json +0 -54
  225. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_west/c/0/0/0 +0 -0
  226. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_west/zarr.json +0 -54
  227. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_west/c/0/0/0 +0 -0
  228. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_west/zarr.json +0 -54
  229. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_west/c/0/0/0 +0 -0
  230. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_west/zarr.json +0 -54
  231. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_west/c/0/0/0 +0 -0
  232. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_west/zarr.json +0 -54
  233. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_west/c/0/0/0 +0 -0
  234. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_west/zarr.json +0 -54
  235. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_west/c/0/0/0 +0 -0
  236. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_west/zarr.json +0 -54
  237. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_west/c/0/0/0 +0 -0
  238. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_west/zarr.json +0 -54
  239. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_west/c/0/0/0 +0 -0
  240. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_west/zarr.json +0 -54
  241. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_west/c/0/0/0 +0 -0
  242. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_west/zarr.json +0 -54
  243. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_west/c/0/0/0 +0 -0
  244. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_west/zarr.json +0 -54
  245. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_west/c/0/0/0 +0 -0
  246. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_west/zarr.json +0 -54
  247. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_west/c/0/0/0 +0 -0
  248. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_west/zarr.json +0 -54
  249. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_west/c/0/0/0 +0 -0
  250. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_west/zarr.json +0 -54
  251. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_west/c/0/0/0 +0 -0
  252. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_west/zarr.json +0 -54
  253. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/ALK_ALT_CO2_west/c/0/0/0 +0 -0
  254. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/ALK_ALT_CO2_west/zarr.json +0 -54
  255. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/ALK_west/c/0/0/0 +0 -0
  256. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/ALK_west/zarr.json +0 -54
  257. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DIC_ALT_CO2_west/c/0/0/0 +0 -0
  258. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DIC_ALT_CO2_west/zarr.json +0 -54
  259. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DIC_west/c/0/0/0 +0 -0
  260. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DIC_west/zarr.json +0 -54
  261. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOC_west/c/0/0/0 +0 -0
  262. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOC_west/zarr.json +0 -54
  263. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOCr_west/c/0/0/0 +0 -0
  264. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOCr_west/zarr.json +0 -54
  265. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DON_west/c/0/0/0 +0 -0
  266. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DON_west/zarr.json +0 -54
  267. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DONr_west/c/0/0/0 +0 -0
  268. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DONr_west/zarr.json +0 -54
  269. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOP_west/c/0/0/0 +0 -0
  270. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOP_west/zarr.json +0 -54
  271. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOPr_west/c/0/0/0 +0 -0
  272. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOPr_west/zarr.json +0 -54
  273. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/Fe_west/c/0/0/0 +0 -0
  274. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/Fe_west/zarr.json +0 -54
  275. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/Lig_west/c/0/0/0 +0 -0
  276. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/Lig_west/zarr.json +0 -54
  277. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/NH4_west/c/0/0/0 +0 -0
  278. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/NH4_west/zarr.json +0 -54
  279. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/NO3_west/c/0/0/0 +0 -0
  280. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/NO3_west/zarr.json +0 -54
  281. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/O2_west/c/0/0/0 +0 -0
  282. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/O2_west/zarr.json +0 -54
  283. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/PO4_west/c/0/0/0 +0 -0
  284. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/PO4_west/zarr.json +0 -54
  285. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/SiO3_west/c/0/0/0 +0 -0
  286. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/SiO3_west/zarr.json +0 -54
  287. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatC_west/c/0/0/0 +0 -0
  288. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatC_west/zarr.json +0 -54
  289. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatChl_west/c/0/0/0 +0 -0
  290. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatChl_west/zarr.json +0 -54
  291. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatFe_west/c/0/0/0 +0 -0
  292. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatFe_west/zarr.json +0 -54
  293. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatP_west/c/0/0/0 +0 -0
  294. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatP_west/zarr.json +0 -54
  295. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatSi_west/c/0/0/0 +0 -0
  296. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatSi_west/zarr.json +0 -54
  297. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazC_west/c/0/0/0 +0 -0
  298. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazC_west/zarr.json +0 -54
  299. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazChl_west/c/0/0/0 +0 -0
  300. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazChl_west/zarr.json +0 -54
  301. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazFe_west/c/0/0/0 +0 -0
  302. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazFe_west/zarr.json +0 -54
  303. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazP_west/c/0/0/0 +0 -0
  304. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazP_west/zarr.json +0 -54
  305. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spC_west/c/0/0/0 +0 -0
  306. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spC_west/zarr.json +0 -54
  307. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spCaCO3_west/c/0/0/0 +0 -0
  308. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spCaCO3_west/zarr.json +0 -54
  309. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spChl_west/c/0/0/0 +0 -0
  310. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spChl_west/zarr.json +0 -54
  311. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spFe_west/c/0/0/0 +0 -0
  312. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spFe_west/zarr.json +0 -54
  313. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spP_west/c/0/0/0 +0 -0
  314. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spP_west/zarr.json +0 -54
  315. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/zooC_west/c/0/0/0 +0 -0
  316. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/zooC_west/zarr.json +0 -54
  317. {roms_tools-3.2.0.dist-info → roms_tools-3.4.0.dist-info}/licenses/LICENSE +0 -0
  318. {roms_tools-3.2.0.dist-info → roms_tools-3.4.0.dist-info}/top_level.txt +0 -0
@@ -11,9 +11,11 @@ from roms_tools.setup.nesting import (
11
11
  compute_boundary_distance,
12
12
  interpolate_indices,
13
13
  map_child_boundaries_onto_parent_grid_indices,
14
- modify_child_topography_and_mask,
14
+ modify_child_mask,
15
+ modify_child_topography,
15
16
  )
16
17
  from roms_tools.setup.utils import get_boundary_coords
18
+ from roms_tools.utils import wrap_longitudes
17
19
 
18
20
 
19
21
  @pytest.fixture()
@@ -46,9 +48,7 @@ def big_grid_that_straddles():
46
48
 
47
49
  @pytest.fixture()
48
50
  def small_grid_that_straddles():
49
- return Grid(
50
- nx=10, ny=10, center_lon=10, center_lat=61, rot=-20, size_x=500, size_y=500
51
- )
51
+ return Grid(nx=10, ny=10, center_lon=0, center_lat=61, rot=0, size_x=50, size_y=200)
52
52
 
53
53
 
54
54
  @pytest.fixture()
@@ -71,11 +71,11 @@ def child_grid_that_straddles(big_grid_that_straddles):
71
71
  parent_grid=big_grid_that_straddles,
72
72
  nx=10,
73
73
  ny=10,
74
- center_lon=10,
74
+ center_lon=0,
75
75
  center_lat=61,
76
- rot=-20,
77
- size_x=500,
78
- size_y=500,
76
+ rot=0,
77
+ size_x=50,
78
+ size_y=200,
79
79
  )
80
80
 
81
81
 
@@ -100,13 +100,14 @@ class TestInterpolateIndices:
100
100
  mask = grid.ds[f"mask_{location}"].isel(**bdry_coords)
101
101
 
102
102
  with caplog.at_level(logging.WARNING):
103
- i_eta, i_xi = interpolate_indices(grid.ds, lon, lat, mask)
103
+ i_eta, i_xi = interpolate_indices(grid.ds, lon, lat, mask, direction)
104
104
 
105
- # Verify the warning message in the log
106
- assert (
107
- "Some boundary points of the child grid are very close to the boundary of the parent grid."
108
- in caplog.text
109
- )
105
+ if mask.sum() > 0:
106
+ # Verify the warning message in the log
107
+ assert (
108
+ "boundary of the child grid lie very close to the edges of the parent grid"
109
+ in caplog.text
110
+ )
110
111
 
111
112
  if direction == "south":
112
113
  expected_i_eta = -0.5 * xr.ones_like(grid.ds.xi_rho)
@@ -142,20 +143,27 @@ class TestInterpolateIndices:
142
143
  big_grid = request.getfixturevalue(big_grid_fixture)
143
144
  small_grid = request.getfixturevalue(small_grid_fixture)
144
145
 
146
+ big_grid_ds = wrap_longitudes(big_grid.ds.copy(), straddle=big_grid.straddle)
147
+ small_grid_ds = wrap_longitudes(
148
+ small_grid.ds.copy(), straddle=big_grid.straddle
149
+ )
150
+
145
151
  bdry_coords_dict = get_boundary_coords()
146
152
  for location in ["rho", "u", "v"]:
147
153
  for direction in ["south", "east", "north", "west"]:
148
154
  bdry_coords = bdry_coords_dict[location][direction]
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)
155
+ lon = small_grid_ds[f"lon_{location}"].isel(**bdry_coords)
156
+ lat = small_grid_ds[f"lat_{location}"].isel(**bdry_coords)
157
+ mask = small_grid_ds[f"mask_{location}"].isel(**bdry_coords)
152
158
 
153
- i_eta, i_xi = interpolate_indices(big_grid.ds, lon, lat, mask)
159
+ i_eta, i_xi = interpolate_indices(
160
+ big_grid_ds, lon, lat, mask, direction
161
+ )
154
162
 
155
163
  expected_i_eta_min = -0.5
156
- expected_i_eta_max = big_grid.ds.eta_rho[-1] - 0.5
164
+ expected_i_eta_max = big_grid_ds.eta_rho[-1] - 0.5
157
165
  expected_i_xi_min = -0.5
158
- expected_i_xi_max = big_grid.ds.xi_rho[-1] - 0.5
166
+ expected_i_xi_max = big_grid_ds.xi_rho[-1] - 0.5
159
167
 
160
168
  assert (i_eta >= expected_i_eta_min).all()
161
169
  assert (i_eta <= expected_i_eta_max).all()
@@ -166,11 +174,16 @@ class TestInterpolateIndices:
166
174
  class TestMapChildBoundaries:
167
175
  def test_update_indices_does_nothing_if_no_parent_land(self, small_grid, baby_grid):
168
176
  """Verify no change in indices when parent grid has no land at boundaries."""
177
+ small_grid_ds = wrap_longitudes(
178
+ small_grid.ds.copy(), straddle=small_grid.straddle
179
+ )
180
+ baby_grid_ds = wrap_longitudes(baby_grid.ds.copy(), straddle=baby_grid.straddle)
181
+
169
182
  ds_without_updated_indices = map_child_boundaries_onto_parent_grid_indices(
170
- small_grid.ds, baby_grid.ds, update_land_indices=False
183
+ small_grid_ds, baby_grid_ds, update_land_indices=False
171
184
  )
172
185
  ds_with_updated_indices = map_child_boundaries_onto_parent_grid_indices(
173
- small_grid.ds, baby_grid.ds, update_land_indices=True
186
+ small_grid_ds, baby_grid_ds, update_land_indices=True
174
187
  )
175
188
 
176
189
  xr.testing.assert_allclose(ds_without_updated_indices, ds_with_updated_indices)
@@ -189,7 +202,12 @@ class TestMapChildBoundaries:
189
202
  big_grid = request.getfixturevalue(big_grid_fixture)
190
203
  small_grid = request.getfixturevalue(small_grid_fixture)
191
204
 
192
- ds = map_child_boundaries_onto_parent_grid_indices(big_grid.ds, small_grid.ds)
205
+ big_grid_ds = wrap_longitudes(big_grid.ds.copy(), straddle=big_grid.straddle)
206
+ small_grid_ds = wrap_longitudes(
207
+ small_grid.ds.copy(), straddle=big_grid.straddle
208
+ )
209
+
210
+ ds = map_child_boundaries_onto_parent_grid_indices(big_grid_ds, small_grid_ds)
193
211
  for direction in ["south", "east", "north", "west"]:
194
212
  for location in ["rho", "u", "v"]:
195
213
  if location == "rho":
@@ -224,9 +242,14 @@ class TestMapChildBoundaries:
224
242
  big_grid = request.getfixturevalue(big_grid_fixture)
225
243
  small_grid = request.getfixturevalue(small_grid_fixture)
226
244
 
245
+ big_grid_ds = wrap_longitudes(big_grid.ds.copy(), straddle=big_grid.straddle)
246
+ small_grid_ds = wrap_longitudes(
247
+ small_grid.ds.copy(), straddle=big_grid.straddle
248
+ )
249
+
227
250
  for update_land_indices in [False, True]:
228
251
  ds = map_child_boundaries_onto_parent_grid_indices(
229
- big_grid.ds, small_grid.ds, update_land_indices=update_land_indices
252
+ big_grid_ds, small_grid_ds, update_land_indices=update_land_indices
230
253
  )
231
254
 
232
255
  for direction in ["south", "east", "north", "west"]:
@@ -292,9 +315,7 @@ class TestModifyChid:
292
315
  ):
293
316
  """Confirm child mask remains unchanged if no parent land is at boundaries."""
294
317
  mask_original = baby_grid.ds.mask_rho.copy()
295
- modified_baby_grid_ds = modify_child_topography_and_mask(
296
- small_grid.ds, baby_grid.ds
297
- )
318
+ modified_baby_grid_ds = modify_child_mask(small_grid.ds, baby_grid.ds)
298
319
  xr.testing.assert_allclose(modified_baby_grid_ds.mask_rho, mask_original)
299
320
 
300
321
  @pytest.mark.parametrize(
@@ -311,7 +332,8 @@ class TestModifyChid:
311
332
 
312
333
  h_original = grid.ds.h.copy()
313
334
  mask_original = grid.ds.mask_rho.copy()
314
- modified_grid_ds = modify_child_topography_and_mask(grid.ds, grid.ds)
335
+ modified_grid_ds = modify_child_mask(grid.ds, grid.ds)
336
+ modified_grid_ds = modify_child_topography(grid.ds, modified_grid_ds)
315
337
 
316
338
  xr.testing.assert_allclose(modified_grid_ds.h, h_original)
317
339
  xr.testing.assert_allclose(modified_grid_ds.mask_rho, mask_original)
@@ -325,7 +347,8 @@ class TestModifyChid:
325
347
  mask_original = small_grid.ds.mask_rho.copy()
326
348
 
327
349
  # Apply the modification function
328
- modified_ds = modify_child_topography_and_mask(big_grid.ds, small_grid.ds)
350
+ modified_ds = modify_child_mask(big_grid.ds, small_grid.ds)
351
+ modified_ds = modify_child_topography(big_grid.ds, modified_ds)
329
352
 
330
353
  # Calculate the center indices for the grid
331
354
  eta_center = h_original.sizes["eta_rho"] // 2
@@ -405,9 +428,75 @@ class TestNesting:
405
428
  params = dataclasses.asdict(small_grid)
406
429
  del params["ds"], params["straddle"]
407
430
 
408
- with pytest.raises(ValueError, match="Some points are outside the grid."):
431
+ with pytest.raises(
432
+ ValueError, match="boundary of the child grid lie outside the parent grid"
433
+ ):
409
434
  ChildGrid(parent_grid=big_grid, **params)
410
435
 
436
+ def test_no_error_if_land_child_points_beyond_parent_grid(self):
437
+ # coarse resolution Pacific domain
438
+ parent_grid = Grid(
439
+ nx=50,
440
+ ny=50,
441
+ size_x=23000,
442
+ size_y=12000,
443
+ center_lon=-161,
444
+ center_lat=14.4,
445
+ rot=-3,
446
+ )
447
+
448
+ # California Current System domain, where some land points extend beyond Pacific domain
449
+ child_grid_parameters = {
450
+ "nx": 50,
451
+ "ny": 50,
452
+ "size_x": 2688,
453
+ "size_y": 5280,
454
+ "center_lat": 39.6,
455
+ "center_lon": -134.5,
456
+ "rot": 33.3,
457
+ }
458
+
459
+ child_grid = ChildGrid(
460
+ **child_grid_parameters,
461
+ parent_grid=parent_grid,
462
+ boundaries={"north": True, "west": True, "south": True, "east": False},
463
+ )
464
+ assert isinstance(child_grid.ds, xr.Dataset)
465
+
466
+ def test_no_error_if_child_boundary_entirely_on_land(self):
467
+ parent_grid = Grid(
468
+ nx=7,
469
+ ny=7,
470
+ size_x=240,
471
+ size_y=240,
472
+ center_lon=-4.1,
473
+ center_lat=52.36,
474
+ rot=0,
475
+ )
476
+
477
+ child_grid_parameters = {
478
+ "nx": 5,
479
+ "ny": 5,
480
+ "size_x": 100,
481
+ "size_y": 100,
482
+ "center_lon": -4.1,
483
+ "center_lat": 52.36,
484
+ }
485
+
486
+ child_grid = ChildGrid(
487
+ **child_grid_parameters,
488
+ parent_grid=parent_grid,
489
+ boundaries={
490
+ "south": True,
491
+ "east": True,
492
+ "north": True,
493
+ "west": True,
494
+ },
495
+ )
496
+
497
+ assert isinstance(child_grid.ds, xr.Dataset)
498
+ assert isinstance(child_grid.ds_nesting, xr.Dataset)
499
+
411
500
  @pytest.mark.parametrize(
412
501
  "child_grid_fixture",
413
502
  ["child_grid", "child_grid_that_straddles"],
@@ -9,8 +9,8 @@ import xarray as xr
9
9
 
10
10
  from conftest import calculate_data_hash
11
11
  from roms_tools import Grid, SurfaceForcing
12
- from roms_tools.download import download_test_data
13
- from roms_tools.setup.datasets import RawDataSource
12
+ from roms_tools.datasets.download import download_test_data
13
+ from roms_tools.setup.utils import RawDataSource
14
14
 
15
15
 
16
16
  @pytest.fixture
@@ -6,7 +6,7 @@ import xarray as xr
6
6
 
7
7
  from conftest import calculate_data_hash
8
8
  from roms_tools import Grid, TidalForcing
9
- from roms_tools.download import download_test_data
9
+ from roms_tools.datasets.download import download_test_data
10
10
 
11
11
 
12
12
  @pytest.fixture(scope="session")
@@ -7,11 +7,11 @@ import pytest
7
7
  import xarray as xr
8
8
 
9
9
  from roms_tools import BoundaryForcing, Grid
10
- from roms_tools.download import download_test_data
11
- from roms_tools.setup.datasets import ERA5Correction
10
+ from roms_tools.datasets.download import download_test_data
12
11
  from roms_tools.setup.utils import (
12
+ _infer_valid_boundaries_from_mask,
13
+ check_and_set_boundaries,
13
14
  get_target_coords,
14
- interpolate_from_climatology,
15
15
  validate_names,
16
16
  )
17
17
 
@@ -101,18 +101,6 @@ class TestGetTargetCoords:
101
101
  assert "mask" in result
102
102
 
103
103
 
104
- def test_interpolate_from_climatology(use_dask):
105
- fname = download_test_data("ERA5_regional_test_data.nc")
106
- era5_times = xr.open_dataset(fname).time
107
-
108
- climatology = ERA5Correction(use_dask=use_dask)
109
- field = climatology.ds["ssr_corr"]
110
- field["time"] = field["time"].dt.days
111
-
112
- interpolated_field = interpolate_from_climatology(field, "time", era5_times)
113
- assert len(interpolated_field.time) == len(era5_times)
114
-
115
-
116
104
  # Test yaml roundtrip with multiple source files
117
105
  @pytest.fixture()
118
106
  def boundary_forcing_from_multiple_source_files(request, use_dask):
@@ -210,3 +198,100 @@ def test_non_string_elements_in_list_raises():
210
198
  def test_custom_label_in_errors():
211
199
  with pytest.raises(ValueError, match="Invalid foozs: z"):
212
200
  validate_names(["z"], VALID_NAMES, SENTINEL, MAX_TO_PLOT, label="fooz")
201
+
202
+
203
+ # test _infer_valid_boundaries_from_mask
204
+ @pytest.fixture
205
+ def simple_mask():
206
+ data = np.array(
207
+ [
208
+ [0, 0, 0, 0], # south
209
+ [1, 0, 0, 0],
210
+ [1, 0, 0, 0],
211
+ [1, 1, 1, 1], # north
212
+ ]
213
+ )
214
+ return xr.DataArray(data, dims=("eta_rho", "xi_rho"))
215
+
216
+
217
+ def test_infer_valid_boundaries_partial(simple_mask):
218
+ out = _infer_valid_boundaries_from_mask(simple_mask)
219
+
220
+ assert out == {
221
+ "south": False,
222
+ "north": True,
223
+ "west": True,
224
+ "east": True,
225
+ }
226
+
227
+
228
+ def test_infer_valid_boundaries_all_ocean():
229
+ mask = xr.DataArray(np.ones((3, 3)), dims=("eta_rho", "xi_rho"))
230
+
231
+ out = _infer_valid_boundaries_from_mask(mask)
232
+ assert all(out.values())
233
+
234
+
235
+ # test check_and_set_boundaries
236
+
237
+
238
+ def test_check_and_set_default_boundaries(simple_mask, monkeypatch):
239
+ monkeypatch.setattr(
240
+ "roms_tools.setup.utils._infer_valid_boundaries_from_mask",
241
+ lambda mask: {
242
+ "south": True,
243
+ "north": False,
244
+ "west": True,
245
+ "east": False,
246
+ },
247
+ )
248
+
249
+ result = check_and_set_boundaries(None, simple_mask)
250
+
251
+ assert result == {
252
+ "south": True,
253
+ "north": False,
254
+ "west": True,
255
+ "east": False,
256
+ }
257
+
258
+
259
+ def test_check_and_set_partial_boundaries(simple_mask, monkeypatch):
260
+ monkeypatch.setattr(
261
+ "roms_tools.setup.utils._infer_valid_boundaries_from_mask",
262
+ lambda mask: {
263
+ "south": True,
264
+ "north": False,
265
+ "west": True,
266
+ "east": False,
267
+ },
268
+ )
269
+
270
+ user = {"south": False} # user overrides south → False
271
+
272
+ result = check_and_set_boundaries(user, simple_mask)
273
+
274
+ assert result == {
275
+ "south": False, # user-preserved
276
+ "north": False, # inferred
277
+ "west": True, # inferred
278
+ "east": False, # inferred
279
+ }
280
+
281
+
282
+ def test_check_and_set_type_error(simple_mask):
283
+ with pytest.raises(TypeError):
284
+ check_and_set_boundaries({"south": "yes"}, simple_mask)
285
+
286
+
287
+ def test_check_and_set_invalid_key(simple_mask):
288
+ with pytest.raises(ValueError):
289
+ check_and_set_boundaries({"northeast": True}, simple_mask)
290
+
291
+
292
+ def test_check_and_set_full_user_boundaries(simple_mask):
293
+ boundaries = {"south": False, "north": True, "east": False, "west": True}
294
+
295
+ result = check_and_set_boundaries(boundaries, simple_mask)
296
+
297
+ assert result == boundaries # unchanged
@@ -1,6 +1,8 @@
1
1
  from pathlib import Path
2
2
 
3
+ import numpy as np
3
4
  import pytest
5
+ import xarray as xr
4
6
  import xarray.testing as xrt
5
7
 
6
8
  from roms_tools import Grid
@@ -18,7 +20,7 @@ class TestPartitionGrid:
18
20
  def test_partition_grid_along_x(self, grid):
19
21
  _, [ds1, ds2, ds3] = partition(grid.ds, np_eta=3, np_xi=1)
20
22
 
21
- assert ds1.sizes == {
23
+ assert dict(ds1.sizes) == {
22
24
  "eta_rho": 11,
23
25
  "xi_rho": 32,
24
26
  "xi_u": 31,
@@ -30,7 +32,7 @@ class TestPartitionGrid:
30
32
  "s_rho": 100,
31
33
  "s_w": 101,
32
34
  }
33
- assert ds2.sizes == {
35
+ assert dict(ds2.sizes) == {
34
36
  "eta_rho": 10,
35
37
  "xi_rho": 32,
36
38
  "xi_u": 31,
@@ -42,7 +44,7 @@ class TestPartitionGrid:
42
44
  "s_rho": 100,
43
45
  "s_w": 101,
44
46
  }
45
- assert ds3.sizes == {
47
+ assert dict(ds3.sizes) == {
46
48
  "eta_rho": 11,
47
49
  "xi_rho": 32,
48
50
  "xi_u": 31,
@@ -58,7 +60,7 @@ class TestPartitionGrid:
58
60
  def test_partition_grid_along_y(self, grid):
59
61
  _, [ds1, ds2, ds3] = partition(grid.ds, np_eta=1, np_xi=3)
60
62
 
61
- assert ds1.sizes == {
63
+ assert dict(ds1.sizes) == {
62
64
  "eta_rho": 32,
63
65
  "xi_rho": 11,
64
66
  "xi_u": 10,
@@ -70,7 +72,7 @@ class TestPartitionGrid:
70
72
  "s_rho": 100,
71
73
  "s_w": 101,
72
74
  }
73
- assert ds2.sizes == {
75
+ assert dict(ds2.sizes) == {
74
76
  "eta_rho": 32,
75
77
  "xi_rho": 10,
76
78
  "xi_u": 10,
@@ -82,7 +84,7 @@ class TestPartitionGrid:
82
84
  "s_rho": 100,
83
85
  "s_w": 101,
84
86
  }
85
- assert ds3.sizes == {
87
+ assert dict(ds3.sizes) == {
86
88
  "eta_rho": 32,
87
89
  "xi_rho": 11,
88
90
  "xi_u": 11,
@@ -103,7 +105,7 @@ class TestPartitionGrid:
103
105
  ds7, ds8, ds9] = partition(grid.ds, np_eta=3, np_xi=3)
104
106
  # fmt: on
105
107
 
106
- assert ds1.sizes == {
108
+ assert dict(ds1.sizes) == {
107
109
  "eta_rho": 11,
108
110
  "xi_rho": 11,
109
111
  "xi_u": 10,
@@ -115,7 +117,7 @@ class TestPartitionGrid:
115
117
  "s_rho": 100,
116
118
  "s_w": 101,
117
119
  }
118
- assert ds4.sizes == {
120
+ assert dict(ds4.sizes) == {
119
121
  "eta_rho": 10,
120
122
  "xi_rho": 11,
121
123
  "xi_u": 10,
@@ -127,7 +129,7 @@ class TestPartitionGrid:
127
129
  "s_rho": 100,
128
130
  "s_w": 101,
129
131
  }
130
- assert ds7.sizes == {
132
+ assert dict(ds7.sizes) == {
131
133
  "eta_rho": 11,
132
134
  "xi_rho": 11,
133
135
  "xi_u": 10,
@@ -139,7 +141,7 @@ class TestPartitionGrid:
139
141
  "s_rho": 100,
140
142
  "s_w": 101,
141
143
  }
142
- assert ds2.sizes == {
144
+ assert dict(ds2.sizes) == {
143
145
  "eta_rho": 11,
144
146
  "xi_rho": 10,
145
147
  "xi_u": 10,
@@ -151,7 +153,7 @@ class TestPartitionGrid:
151
153
  "s_rho": 100,
152
154
  "s_w": 101,
153
155
  }
154
- assert ds5.sizes == {
156
+ assert dict(ds5.sizes) == {
155
157
  "eta_rho": 10,
156
158
  "xi_rho": 10,
157
159
  "xi_u": 10,
@@ -163,7 +165,7 @@ class TestPartitionGrid:
163
165
  "s_rho": 100,
164
166
  "s_w": 101,
165
167
  }
166
- assert ds8.sizes == {
168
+ assert dict(ds8.sizes) == {
167
169
  "eta_rho": 11,
168
170
  "xi_rho": 10,
169
171
  "xi_u": 10,
@@ -175,7 +177,7 @@ class TestPartitionGrid:
175
177
  "s_rho": 100,
176
178
  "s_w": 101,
177
179
  }
178
- assert ds3.sizes == {
180
+ assert dict(ds3.sizes) == {
179
181
  "eta_rho": 11,
180
182
  "xi_rho": 11,
181
183
  "xi_u": 11,
@@ -187,7 +189,7 @@ class TestPartitionGrid:
187
189
  "s_rho": 100,
188
190
  "s_w": 101,
189
191
  }
190
- assert ds6.sizes == {
192
+ assert dict(ds6.sizes) == {
191
193
  "eta_rho": 10,
192
194
  "xi_rho": 11,
193
195
  "xi_u": 11,
@@ -199,7 +201,7 @@ class TestPartitionGrid:
199
201
  "s_rho": 100,
200
202
  "s_w": 101,
201
203
  }
202
- assert ds9.sizes == {
204
+ assert dict(ds9.sizes) == {
203
205
  "eta_rho": 11,
204
206
  "xi_rho": 11,
205
207
  "xi_u": 11,
@@ -246,6 +248,52 @@ class TestPartitionGrid:
246
248
  assert ds.sizes["xi_coarse"] == grid.ds.sizes["xi_coarse"]
247
249
 
248
250
 
251
+ class TestPartitionGridWithExtraDims:
252
+ @pytest.fixture
253
+ def ds_with_extra_dims(self):
254
+ # Base dims
255
+ eta_rho = 10
256
+ xi_rho = 12
257
+ s_rho = 5
258
+ eta_v = eta_rho - 1
259
+ xi_u = xi_rho - 1
260
+
261
+ # Extra dims
262
+ eta_u = eta_rho
263
+ xi_v = xi_rho
264
+
265
+ ds = xr.Dataset(
266
+ {
267
+ "zeta": (("eta_rho", "xi_rho"), np.zeros((eta_rho, xi_rho))),
268
+ "u": (("s_rho", "eta_u", "xi_u"), np.zeros((s_rho, eta_u, xi_u))),
269
+ "v": (("s_rho", "eta_v", "xi_v"), np.zeros((s_rho, eta_v, xi_v))),
270
+ },
271
+ coords={
272
+ "eta_rho": np.arange(eta_rho),
273
+ "eta_u": np.arange(eta_u),
274
+ "eta_v": np.arange(eta_v),
275
+ "xi_rho": np.arange(xi_rho),
276
+ "xi_u": np.arange(xi_u),
277
+ "xi_v": np.arange(xi_v),
278
+ "s_rho": np.arange(s_rho),
279
+ },
280
+ )
281
+
282
+ return ds
283
+
284
+ def test_partition_with_extra_dims(self, ds_with_extra_dims):
285
+ file_numbers, parts = partition(ds_with_extra_dims, np_eta=2, np_xi=2)
286
+
287
+ # Test that partitioned datasets contain eta_u and xi_v
288
+ for ds_part in parts:
289
+ assert "eta_u" in ds_part.dims
290
+ assert "xi_v" in ds_part.dims
291
+ assert ds_part.sizes["eta_u"] < ds_with_extra_dims.sizes["eta_u"]
292
+ assert ds_part.sizes["xi_v"] < ds_with_extra_dims.sizes["xi_v"]
293
+ assert ds_part.sizes["eta_u"] > 0
294
+ assert ds_part.sizes["xi_v"] > 0
295
+
296
+
249
297
  class TestPartitionMissingDims:
250
298
  def test_partition_missing_dims(self, grid):
251
299
  dims_to_drop = ["xi_u", "eta_v", "eta_coarse", "xi_coarse"]
@@ -3,9 +3,12 @@ from pathlib import Path
3
3
  from unittest import mock
4
4
 
5
5
  import numpy as np
6
+ import pandas as pd
6
7
  import pytest
7
8
  import xarray as xr
8
9
 
10
+ from roms_tools.datasets.download import download_test_data
11
+ from roms_tools.datasets.lat_lon_datasets import ERA5Correction
9
12
  from roms_tools.utils import (
10
13
  _path_list_from_input,
11
14
  generate_focused_coordinate_range,
@@ -13,6 +16,8 @@ from roms_tools.utils import (
13
16
  has_copernicus,
14
17
  has_dask,
15
18
  has_gcsfs,
19
+ interpolate_cyclic_time,
20
+ interpolate_from_climatology,
16
21
  load_data,
17
22
  )
18
23
 
@@ -241,3 +246,76 @@ def test_time_chunking_false_roms():
241
246
  dim_names = {"time": "ocean_time"}
242
247
  result = get_dask_chunks(dim_names, time_chunking=False)
243
248
  assert "ocean_time" not in result
249
+
250
+
251
+ # test interpolate_from_climatology
252
+
253
+
254
+ @pytest.fixture
255
+ def climatology_data():
256
+ """Create a simple annual cycle dataset with 12 time points."""
257
+ time_coord = np.arange(1, 13) # months as day_of_year approximation
258
+ da = xr.DataArray(np.arange(12), dims=("time",), coords={"time": time_coord})
259
+ ds = xr.Dataset({"var1": da, "var2": da * 2})
260
+ return da, ds, "time", "time"
261
+
262
+
263
+ def test_interpolate_dataarray_single_time(climatology_data):
264
+ da, _, time_dim, time_coord = climatology_data
265
+ target_time = pd.Timestamp("2000-03-15") # day_of_year ~ 75
266
+ interpolated = interpolate_from_climatology(da, time_dim, time_coord, target_time)
267
+ assert isinstance(interpolated, xr.DataArray)
268
+ assert interpolated.sizes[time_dim] == 1
269
+
270
+
271
+ def test_interpolate_dataset_multiple_times(climatology_data):
272
+ _, ds, time_dim, time_coord = climatology_data
273
+ target_times = pd.date_range("2000-01-01", periods=3, freq="ME")
274
+ interpolated = interpolate_from_climatology(ds, time_dim, time_coord, target_times)
275
+ assert isinstance(interpolated, xr.Dataset)
276
+ assert all(interpolated[var].sizes[time_dim] == 3 for var in interpolated.data_vars)
277
+
278
+
279
+ def test_interpolate_dataarray_time_dim_not_equal_time_coord():
280
+ time_values = np.arange(1, 13)
281
+ da = xr.DataArray(
282
+ np.arange(12),
283
+ dims=("time_dim",),
284
+ coords={"time_coord": ("time_dim", time_values)},
285
+ )
286
+ target_time = pd.Timestamp("2000-06-15")
287
+ interpolated = interpolate_from_climatology(
288
+ da, time_dim="time_dim", time_coord="time_coord", time=target_time
289
+ )
290
+ assert interpolated.sizes["time_dim"] == 1
291
+ assert np.issubdtype(interpolated.dtype, np.number)
292
+
293
+
294
+ def test_interpolate_cyclic_time_basic():
295
+ time_values = np.arange(1, 13)
296
+ da = xr.DataArray(np.arange(12), dims=("time",), coords={"time": time_values})
297
+ target_days = [0.5, 6.5, 12.5] # fractional days, include cyclic behavior
298
+ interpolated = interpolate_cyclic_time(
299
+ da, time_dim="time", time_coord="time", day_of_year=target_days
300
+ )
301
+ assert isinstance(interpolated, xr.DataArray)
302
+ assert interpolated.sizes["time"] == len(target_days)
303
+
304
+
305
+ def test_interpolate_from_climatology_invalid_input():
306
+ with pytest.raises(TypeError):
307
+ interpolate_from_climatology(
308
+ "not a dataset", "time", "time", pd.Timestamp("2000-01-01")
309
+ )
310
+
311
+
312
+ def test_interpolate_from_real_climatology(use_dask):
313
+ fname = download_test_data("ERA5_regional_test_data.nc")
314
+ era5_times = xr.open_dataset(fname).time
315
+
316
+ climatology = ERA5Correction(use_dask=use_dask)
317
+ field = climatology.ds["ssr_corr"]
318
+ field["time"] = field["time"].dt.days
319
+
320
+ interpolated_field = interpolate_from_climatology(field, "time", "time", era5_times)
321
+ assert len(interpolated_field.time) == len(era5_times)