roms-tools 1.5.0__py3-none-any.whl → 1.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 (238) hide show
  1. roms_tools/_version.py +1 -1
  2. roms_tools/setup/boundary_forcing.py +226 -85
  3. roms_tools/setup/datasets.py +169 -39
  4. roms_tools/setup/fill.py +0 -36
  5. roms_tools/setup/initial_conditions.py +90 -69
  6. roms_tools/setup/regrid.py +43 -98
  7. roms_tools/setup/surface_forcing.py +68 -67
  8. roms_tools/setup/tides.py +60 -45
  9. roms_tools/setup/utils.py +25 -53
  10. roms_tools/tests/test_setup/test_boundary_forcing.py +42 -32
  11. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_east/0.0.0 +0 -0
  12. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_south/0.0.0 +0 -0
  13. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_west/0.0.0 +0 -0
  14. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_east/0.0.0 +0 -0
  15. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_south/0.0.0 +0 -0
  16. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/0.0.0 +0 -0
  17. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_east/0.0.0 +0 -0
  18. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_south/0.0.0 +0 -0
  19. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_west/0.0.0 +0 -0
  20. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_east/0.0.0 +0 -0
  21. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_south/0.0.0 +0 -0
  22. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/0.0.0 +0 -0
  23. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_east/0.0.0 +0 -0
  24. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_south/0.0.0 +0 -0
  25. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/0.0.0 +0 -0
  26. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_east/0.0.0 +0 -0
  27. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_south/0.0.0 +0 -0
  28. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_west/0.0.0 +0 -0
  29. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_east/0.0.0 +0 -0
  30. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_south/0.0.0 +0 -0
  31. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/0.0.0 +0 -0
  32. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_east/0.0.0 +0 -0
  33. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_south/0.0.0 +0 -0
  34. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/0.0.0 +0 -0
  35. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_east/0.0.0 +0 -0
  36. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_south/0.0.0 +0 -0
  37. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/0.0.0 +0 -0
  38. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_east/0.0.0 +0 -0
  39. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_south/0.0.0 +0 -0
  40. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/0.0.0 +0 -0
  41. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_east/0.0.0 +0 -0
  42. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_south/0.0.0 +0 -0
  43. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/0.0.0 +0 -0
  44. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_east/0.0.0 +0 -0
  45. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_south/0.0.0 +0 -0
  46. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/0.0.0 +0 -0
  47. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_east/0.0.0 +0 -0
  48. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_south/0.0.0 +0 -0
  49. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/0.0.0 +0 -0
  50. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_east/0.0.0 +0 -0
  51. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_south/0.0.0 +0 -0
  52. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/0.0.0 +0 -0
  53. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_east/0.0.0 +0 -0
  54. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_south/0.0.0 +0 -0
  55. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/0.0.0 +0 -0
  56. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_east/0.0.0 +0 -0
  57. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_south/0.0.0 +0 -0
  58. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/0.0.0 +0 -0
  59. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_east/0.0.0 +0 -0
  60. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_south/0.0.0 +0 -0
  61. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/0.0.0 +0 -0
  62. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_east/0.0.0 +0 -0
  63. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_south/0.0.0 +0 -0
  64. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_west/0.0.0 +0 -0
  65. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_east/0.0.0 +0 -0
  66. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_south/0.0.0 +0 -0
  67. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_west/0.0.0 +0 -0
  68. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_east/0.0.0 +0 -0
  69. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_south/0.0.0 +0 -0
  70. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_west/0.0.0 +0 -0
  71. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_east/0.0.0 +0 -0
  72. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_south/0.0.0 +0 -0
  73. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_west/0.0.0 +0 -0
  74. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_east/0.0.0 +0 -0
  75. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_south/0.0.0 +0 -0
  76. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_west/0.0.0 +0 -0
  77. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_east/0.0.0 +0 -0
  78. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_south/0.0.0 +0 -0
  79. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_west/0.0.0 +0 -0
  80. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_east/0.0.0 +0 -0
  81. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_south/0.0.0 +0 -0
  82. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_west/0.0.0 +0 -0
  83. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_east/0.0.0 +0 -0
  84. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_south/0.0.0 +0 -0
  85. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_west/0.0.0 +0 -0
  86. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_east/0.0.0 +0 -0
  87. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_south/0.0.0 +0 -0
  88. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_west/0.0.0 +0 -0
  89. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_east/0.0.0 +0 -0
  90. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_south/0.0.0 +0 -0
  91. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_west/0.0.0 +0 -0
  92. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_east/0.0.0 +0 -0
  93. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_south/0.0.0 +0 -0
  94. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_west/0.0.0 +0 -0
  95. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_east/0.0.0 +0 -0
  96. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_south/0.0.0 +0 -0
  97. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_west/0.0.0 +0 -0
  98. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_east/0.0.0 +0 -0
  99. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_south/0.0.0 +0 -0
  100. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_west/0.0.0 +0 -0
  101. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_east/0.0.0 +0 -0
  102. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_south/0.0.0 +0 -0
  103. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_west/0.0.0 +0 -0
  104. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_east/0.0.0 +0 -0
  105. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_south/0.0.0 +0 -0
  106. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_west/0.0.0 +0 -0
  107. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/.zattrs +1 -1
  108. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/.zmetadata +1 -1
  109. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/dust/0.0.0 +0 -0
  110. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/iron/0.0.0 +0 -0
  111. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nhy/0.0.0 +0 -0
  112. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nox/0.0.0 +0 -0
  113. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air/0.0.0 +0 -0
  114. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air_alt/0.0.0 +0 -0
  115. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zattrs +1 -1
  116. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zmetadata +1 -1
  117. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/dust/0.0.0 +0 -0
  118. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/iron/0.0.0 +0 -0
  119. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nhy/0.0.0 +0 -0
  120. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nox/0.0.0 +0 -0
  121. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air/0.0.0 +0 -0
  122. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air_alt/0.0.0 +0 -0
  123. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/.zmetadata +7 -0
  124. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/abs_time/.zattrs +3 -0
  125. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_east/0.0.0 +0 -0
  126. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_south/0.0.0 +0 -0
  127. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_east/0.0.0 +0 -0
  128. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_south/0.0.0 +0 -0
  129. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_east/0.0.0 +0 -0
  130. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_north/0.0.0 +0 -0
  131. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_south/0.0.0 +0 -0
  132. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_west/0.0.0 +0 -0
  133. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_east/0.0 +0 -0
  134. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_north/0.0 +0 -0
  135. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_south/0.0 +0 -0
  136. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_west/0.0 +0 -0
  137. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_east/0.0.0 +0 -0
  138. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_north/0.0.0 +0 -0
  139. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_south/0.0.0 +0 -0
  140. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_west/0.0.0 +0 -0
  141. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_east/0.0 +0 -0
  142. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_north/0.0 +0 -0
  143. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_south/0.0 +0 -0
  144. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_west/0.0 +0 -0
  145. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_east/.zattrs +1 -0
  146. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_east/0.0 +0 -0
  147. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_north/.zattrs +1 -0
  148. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/.zattrs +1 -0
  149. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/0.0 +0 -0
  150. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_west/.zattrs +1 -0
  151. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/.zattrs +1 -1
  152. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/.zmetadata +1 -1
  153. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/Tair/0.0.0 +0 -0
  154. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/lwrad/0.0.0 +0 -0
  155. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/qair/0.0.0 +0 -0
  156. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/rain/0.0.0 +0 -0
  157. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/swrad/0.0.0 +0 -0
  158. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/uwnd/0.0.0 +0 -0
  159. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/vwnd/0.0.0 +0 -0
  160. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/.zattrs +1 -1
  161. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/.zmetadata +1 -1
  162. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/Tair/0.0.0 +0 -0
  163. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/lwrad/0.0.0 +0 -0
  164. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/qair/0.0.0 +0 -0
  165. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/rain/0.0.0 +0 -0
  166. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/swrad/0.0.0 +0 -0
  167. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/uwnd/0.0.0 +0 -0
  168. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/vwnd/0.0.0 +0 -0
  169. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK/0.0.0.0 +0 -0
  170. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK_ALT_CO2/0.0.0.0 +0 -0
  171. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC/0.0.0.0 +0 -0
  172. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC_ALT_CO2/0.0.0.0 +0 -0
  173. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOC/0.0.0.0 +0 -0
  174. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOCr/0.0.0.0 +0 -0
  175. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DON/0.0.0.0 +0 -0
  176. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DONr/0.0.0.0 +0 -0
  177. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOP/0.0.0.0 +0 -0
  178. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOPr/0.0.0.0 +0 -0
  179. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Fe/0.0.0.0 +0 -0
  180. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Lig/0.0.0.0 +0 -0
  181. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NH4/0.0.0.0 +0 -0
  182. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NO3/0.0.0.0 +0 -0
  183. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/O2/0.0.0.0 +0 -0
  184. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/PO4/0.0.0.0 +0 -0
  185. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/SiO3/0.0.0.0 +0 -0
  186. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatC/0.0.0.0 +0 -0
  187. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatChl/0.0.0.0 +0 -0
  188. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatFe/0.0.0.0 +0 -0
  189. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatP/0.0.0.0 +0 -0
  190. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatSi/0.0.0.0 +0 -0
  191. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazC/0.0.0.0 +0 -0
  192. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazChl/0.0.0.0 +0 -0
  193. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazFe/0.0.0.0 +0 -0
  194. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazP/0.0.0.0 +0 -0
  195. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/salt/0.0.0.0 +0 -0
  196. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spC/0.0.0.0 +0 -0
  197. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spCaCO3/0.0.0.0 +0 -0
  198. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spChl/0.0.0.0 +0 -0
  199. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spFe/0.0.0.0 +0 -0
  200. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spP/0.0.0.0 +0 -0
  201. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/temp/0.0.0.0 +0 -0
  202. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/u/0.0.0.0 +0 -0
  203. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ubar/0.0.0 +0 -0
  204. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/v/0.0.0.0 +0 -0
  205. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/vbar/0.0.0 +0 -0
  206. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zeta/0.0.0 +0 -0
  207. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zooC/0.0.0.0 +0 -0
  208. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/.zattrs +1 -1
  209. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/.zmetadata +1 -1
  210. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/Tair/0.0.0 +0 -0
  211. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/lwrad/0.0.0 +0 -0
  212. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/qair/0.0.0 +0 -0
  213. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/rain/0.0.0 +0 -0
  214. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/swrad/0.0.0 +0 -0
  215. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/uwnd/0.0.0 +0 -0
  216. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/vwnd/0.0.0 +0 -0
  217. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/.zattrs +1 -1
  218. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/.zmetadata +4 -2
  219. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/omega/.zattrs +3 -1
  220. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/pot_Im/0.0.0 +0 -0
  221. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/pot_Re/0.0.0 +0 -0
  222. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/ssh_Im/0.0.0 +0 -0
  223. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/ssh_Re/0.0.0 +0 -0
  224. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Im/0.0.0 +0 -0
  225. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Re/0.0.0 +0 -0
  226. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Im/0.0.0 +0 -0
  227. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Re/0.0.0 +0 -0
  228. roms_tools/tests/test_setup/test_datasets.py +79 -21
  229. roms_tools/tests/test_setup/test_fill.py +18 -105
  230. roms_tools/tests/test_setup/test_initial_conditions.py +21 -21
  231. roms_tools/tests/test_setup/test_regrid.py +2 -8
  232. roms_tools/tests/test_setup/test_surface_forcing.py +3 -3
  233. roms_tools/tests/test_setup/test_tides.py +1 -1
  234. {roms_tools-1.5.0.dist-info → roms_tools-1.6.0.dist-info}/METADATA +12 -3
  235. {roms_tools-1.5.0.dist-info → roms_tools-1.6.0.dist-info}/RECORD +238 -238
  236. {roms_tools-1.5.0.dist-info → roms_tools-1.6.0.dist-info}/WHEEL +1 -1
  237. {roms_tools-1.5.0.dist-info → roms_tools-1.6.0.dist-info}/LICENSE +0 -0
  238. {roms_tools-1.5.0.dist-info → roms_tools-1.6.0.dist-info}/top_level.txt +0 -0
roms_tools/setup/utils.py CHANGED
@@ -7,7 +7,7 @@ from roms_tools.utils import partition
7
7
  from pathlib import Path
8
8
 
9
9
 
10
- def nan_check(field, mask) -> None:
10
+ def nan_check(field, mask, error_message=None) -> None:
11
11
  """Checks for NaN values at wet points in the field.
12
12
 
13
13
  This function examines the interpolated input field for NaN values at positions indicated as wet points by the mask.
@@ -22,6 +22,10 @@ def nan_check(field, mask) -> None:
22
22
  A boolean mask or data array with the same shape as `field`. The wet points (usually ocean points)
23
23
  are indicated by `1` or `True`, and land points by `0` or `False`.
24
24
 
25
+ error_message : str, optional
26
+ A custom error message to be included in the ValueError if NaN values are detected. If not provided,
27
+ a default message will explain the potential cause and suggest ensuring the dataset's coverage.
28
+
25
29
  Raises
26
30
  ------
27
31
  ValueError
@@ -31,14 +35,15 @@ def nan_check(field, mask) -> None:
31
35
 
32
36
  # Replace values in field with 0 where mask is not 1
33
37
  da = xr.where(mask == 1, field, 0)
34
-
35
- # Check if any NaN values exist in the modified field
36
- if da.isnull().any().values:
37
- raise ValueError(
38
+ if error_message is None:
39
+ error_message = (
38
40
  "NaN values found in interpolated field. This likely occurs because the ROMS grid, including "
39
41
  "a small safety margin for interpolation, is not fully contained within the dataset's longitude/latitude range. Please ensure that the "
40
42
  "dataset covers the entire area required by the ROMS grid."
41
43
  )
44
+ # Check if any NaN values exist in the modified field
45
+ if da.isnull().any().values:
46
+ raise ValueError(error_message)
42
47
 
43
48
 
44
49
  def substitute_nans_by_fillvalue(field, fill_value=0.0) -> xr.DataArray:
@@ -156,63 +161,30 @@ def interpolate_from_rho_to_v(field, method="additive"):
156
161
  return field_interpolated
157
162
 
158
163
 
159
- def extrapolate_deepest_to_bottom(field: xr.DataArray, dim: str) -> xr.DataArray:
160
- """Extrapolates the deepest non-NaN values to the bottom along the specified
161
- dimension using forward fill.
162
-
163
- This function assumes that the specified dimension is ordered from top to bottom (e.g., a vertical dimension like 'depth').
164
- It fills `NaN` values below the deepest valid (non-NaN) entry along the given dimension by carrying forward the last valid value.
164
+ def one_dim_fill(da: xr.DataArray, dim: str, direction="forward") -> xr.DataArray:
165
+ """Fill NaN values in a DataArray along a specified dimension.
165
166
 
166
167
  Parameters
167
168
  ----------
168
- field : xr.DataArray
169
- The input `xarray.DataArray` containing potential `NaN` values to be filled.
170
- This array must have at least one dimension corresponding to `dim`, typically
171
- a vertical axis such as 'depth' or 'height'.
169
+ da : xr.DataArray
170
+ The input DataArray with NaN values to be filled, which must include the specified dimension.
172
171
  dim : str
173
- The name of the dimension along which to perform the forward fill operation.
174
- The function assumes that this dimension is ordered from top to bottom, with
175
- larger index values representing deeper or lower levels.
172
+ The name of the dimension along which to fill NaN values (e.g., 'depth' or 'time').
173
+ direction : str, optional
174
+ The filling direction; either "forward" to propagate non-NaN values downward or "backward" to propagate them upward.
175
+ Defaults to "forward".
176
176
 
177
177
  Returns
178
178
  -------
179
179
  xr.DataArray
180
- A new `xarray.DataArray` with the `NaN` values along the specified dimension
181
- filled by forward filling the deepest valid values down to the bottom.
182
- The original input data remains unmodified.
183
- """
184
- if dim in field.dims:
185
- return field.ffill(dim=dim)
186
- else:
187
- return field
188
-
189
-
190
- def _extrapolate_deepest_to_bottom(data_vars, data) -> dict:
191
- """Extrapolate the deepest value to the bottom for variables using the dataset's
192
- depth dimension.
193
-
194
- This function fills in missing values at the bottom of each variable by
195
- carrying forward the deepest available value, ensuring a complete depth profile.
196
-
197
- Parameters
198
- ----------
199
- data_vars : dict
200
- Existing dictionary of variables to be updated.
201
- data : Dataset
202
- Dataset containing variables and depth information.
203
-
204
- Returns
205
- -------
206
- dict of str : xarray.DataArray
207
- Dictionary of variables with the deepest value extrapolated to the bottom.
180
+ A new DataArray with NaN values filled in the specified direction, leaving the original data unchanged.
208
181
  """
209
-
210
- for var in data.var_names.keys():
211
- data_vars[var] = extrapolate_deepest_to_bottom(
212
- data.ds[data.var_names[var]], data.dim_names["depth"]
213
- )
214
-
215
- return data_vars
182
+ if dim in da.dims:
183
+ if direction == "forward":
184
+ return da.ffill(dim=dim)
185
+ elif direction == "backward":
186
+ return da.bfill(dim=dim)
187
+ return da
216
188
 
217
189
 
218
190
  def assign_dates_to_climatology(ds: xr.Dataset, time_dim: str) -> xr.Dataset:
@@ -7,11 +7,18 @@ from conftest import calculate_file_hash
7
7
  from pathlib import Path
8
8
 
9
9
 
10
- def test_boundary_forcing_creation(boundary_forcing):
10
+ @pytest.mark.parametrize(
11
+ "boundary_forcing_fixture",
12
+ [
13
+ "boundary_forcing",
14
+ "boundary_forcing_with_2d_fill",
15
+ ],
16
+ )
17
+ def test_boundary_forcing_creation(boundary_forcing_fixture, request):
11
18
  """Test the creation of the BoundaryForcing object."""
12
19
 
13
20
  fname = download_test_data("GLORYS_coarse_test_data.nc")
14
-
21
+ boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
15
22
  assert boundary_forcing.start_time == datetime(2021, 6, 29)
16
23
  assert boundary_forcing.end_time == datetime(2021, 6, 30)
17
24
  assert boundary_forcing.source == {
@@ -40,54 +47,57 @@ def test_boundary_forcing_creation(boundary_forcing):
40
47
  assert not hasattr(boundary_forcing.ds, "climatology")
41
48
 
42
49
 
43
- def test_boundary_forcing_creation_with_bgc(bgc_boundary_forcing_from_climatology):
50
+ @pytest.mark.parametrize(
51
+ "boundary_forcing_fixture",
52
+ [
53
+ "bgc_boundary_forcing_from_climatology",
54
+ "bgc_boundary_forcing_from_climatology_with_2d_fill",
55
+ ],
56
+ )
57
+ def test_boundary_forcing_creation_with_bgc(boundary_forcing_fixture, request):
44
58
  """Test the creation of the BoundaryForcing object."""
45
59
 
46
60
  fname_bgc = download_test_data("CESM_regional_coarse_test_data_climatology.nc")
61
+ boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
47
62
 
48
- assert bgc_boundary_forcing_from_climatology.start_time == datetime(2021, 6, 29)
49
- assert bgc_boundary_forcing_from_climatology.end_time == datetime(2021, 6, 30)
50
- assert bgc_boundary_forcing_from_climatology.source == {
63
+ assert boundary_forcing.start_time == datetime(2021, 6, 29)
64
+ assert boundary_forcing.end_time == datetime(2021, 6, 30)
65
+ assert boundary_forcing.source == {
51
66
  "path": fname_bgc,
52
67
  "name": "CESM_REGRIDDED",
53
68
  "climatology": True,
54
69
  }
55
- assert bgc_boundary_forcing_from_climatology.model_reference_date == datetime(
56
- 2000, 1, 1
57
- )
58
- assert bgc_boundary_forcing_from_climatology.boundaries == {
70
+ assert boundary_forcing.model_reference_date == datetime(2000, 1, 1)
71
+ assert boundary_forcing.boundaries == {
59
72
  "south": True,
60
73
  "east": True,
61
74
  "north": True,
62
75
  "west": True,
63
76
  }
64
77
 
65
- assert bgc_boundary_forcing_from_climatology.ds.source == "CESM_REGRIDDED"
78
+ assert boundary_forcing.ds.source == "CESM_REGRIDDED"
66
79
  for direction in ["south", "east", "north", "west"]:
67
80
  for var in ["ALK", "PO4"]:
68
- assert f"{var}_{direction}" in bgc_boundary_forcing_from_climatology.ds
81
+ assert f"{var}_{direction}" in boundary_forcing.ds
69
82
 
70
- assert len(bgc_boundary_forcing_from_climatology.ds.bry_time) == 12
71
- assert (
72
- bgc_boundary_forcing_from_climatology.ds.coords["bry_time"].attrs["units"]
73
- == "days"
74
- )
75
- assert hasattr(bgc_boundary_forcing_from_climatology.ds, "climatology")
83
+ assert len(boundary_forcing.ds.bry_time) == 12
84
+ assert boundary_forcing.ds.coords["bry_time"].attrs["units"] == "days"
85
+ assert hasattr(boundary_forcing.ds, "climatology")
76
86
 
77
87
 
78
88
  def test_boundary_forcing_plot_save(boundary_forcing, tmp_path):
79
89
  """Test plot and save methods."""
80
90
 
81
- boundary_forcing.plot(varname="temp_south", layer_contours=True)
82
- boundary_forcing.plot(varname="temp_east", layer_contours=True)
83
- boundary_forcing.plot(varname="temp_north", layer_contours=True)
84
- boundary_forcing.plot(varname="temp_west", layer_contours=True)
85
- boundary_forcing.plot(varname="zeta_south")
86
- boundary_forcing.plot(varname="zeta_east")
87
- boundary_forcing.plot(varname="zeta_north")
88
- boundary_forcing.plot(varname="zeta_west")
89
- boundary_forcing.plot(varname="vbar_north")
90
- boundary_forcing.plot(varname="ubar_west")
91
+ boundary_forcing.plot(var_name="temp_south", layer_contours=True)
92
+ boundary_forcing.plot(var_name="temp_east", layer_contours=True)
93
+ boundary_forcing.plot(var_name="temp_north", layer_contours=True)
94
+ boundary_forcing.plot(var_name="temp_west", layer_contours=True)
95
+ boundary_forcing.plot(var_name="zeta_south")
96
+ boundary_forcing.plot(var_name="zeta_east")
97
+ boundary_forcing.plot(var_name="zeta_north")
98
+ boundary_forcing.plot(var_name="zeta_west")
99
+ boundary_forcing.plot(var_name="vbar_north")
100
+ boundary_forcing.plot(var_name="ubar_west")
91
101
 
92
102
  for file_str in ["test_bf", "test_bf.nc"]:
93
103
  # Create a temporary filepath using the tmp_path fixture
@@ -124,10 +134,10 @@ def test_bgc_boundary_forcing_plot_save(
124
134
  ):
125
135
  """Test plot and save methods."""
126
136
 
127
- bgc_boundary_forcing_from_climatology.plot(varname="ALK_south")
128
- bgc_boundary_forcing_from_climatology.plot(varname="ALK_east")
129
- bgc_boundary_forcing_from_climatology.plot(varname="ALK_north")
130
- bgc_boundary_forcing_from_climatology.plot(varname="ALK_west")
137
+ bgc_boundary_forcing_from_climatology.plot(var_name="ALK_south")
138
+ bgc_boundary_forcing_from_climatology.plot(var_name="ALK_east")
139
+ bgc_boundary_forcing_from_climatology.plot(var_name="ALK_north")
140
+ bgc_boundary_forcing_from_climatology.plot(var_name="ALK_west")
131
141
 
132
142
  for file_str in ["test_bf", "test_bf.nc"]:
133
143
  # Create a temporary filepath using the tmp_path fixture
@@ -2,7 +2,7 @@
2
2
  "correct_radiation": "False",
3
3
  "end_time": "2020-02-01 00:00:00",
4
4
  "model_reference_date": "2000-01-01 00:00:00",
5
- "roms_tools_version": "0.1.dev138+dirty",
5
+ "roms_tools_version": "0.1.dev157+dirty",
6
6
  "source": "CESM_REGRIDDED",
7
7
  "start_time": "2020-02-01 00:00:00",
8
8
  "title": "ROMS surface forcing file created by ROMS-Tools",
@@ -4,7 +4,7 @@
4
4
  "correct_radiation": "False",
5
5
  "end_time": "2020-02-01 00:00:00",
6
6
  "model_reference_date": "2000-01-01 00:00:00",
7
- "roms_tools_version": "0.1.dev138+dirty",
7
+ "roms_tools_version": "0.1.dev157+dirty",
8
8
  "source": "CESM_REGRIDDED",
9
9
  "start_time": "2020-02-01 00:00:00",
10
10
  "title": "ROMS surface forcing file created by ROMS-Tools",
@@ -3,7 +3,7 @@
3
3
  "correct_radiation": "False",
4
4
  "end_time": "2020-02-01 00:00:00",
5
5
  "model_reference_date": "2000-01-01 00:00:00",
6
- "roms_tools_version": "0.1.dev138+dirty",
6
+ "roms_tools_version": "0.1.dev157+dirty",
7
7
  "source": "CESM_REGRIDDED",
8
8
  "start_time": "2020-02-01 00:00:00",
9
9
  "title": "ROMS surface forcing file created by ROMS-Tools",
@@ -5,7 +5,7 @@
5
5
  "correct_radiation": "False",
6
6
  "end_time": "2020-02-01 00:00:00",
7
7
  "model_reference_date": "2000-01-01 00:00:00",
8
- "roms_tools_version": "0.1.dev138+dirty",
8
+ "roms_tools_version": "0.1.dev157+dirty",
9
9
  "source": "CESM_REGRIDDED",
10
10
  "start_time": "2020-02-01 00:00:00",
11
11
  "title": "ROMS surface forcing file created by ROMS-Tools",
@@ -38,7 +38,10 @@
38
38
  "_ARRAY_DIMENSIONS": [
39
39
  "bry_time"
40
40
  ],
41
+ "axis": "T",
41
42
  "calendar": "gregorian",
43
+ "long_name": "Time",
44
+ "standard_name": "time",
42
45
  "units": "seconds since 1970-01-01"
43
46
  },
44
47
  "bry_time/.zarray": {
@@ -889,6 +892,7 @@
889
892
  ],
890
893
  "coordinates": "abs_time",
891
894
  "long_name": "eastern boundary sea surface height",
895
+ "standard_name": "sea_surface_height_above_geoid",
892
896
  "units": "m"
893
897
  },
894
898
  "zeta_north/.zarray": {
@@ -920,6 +924,7 @@
920
924
  ],
921
925
  "coordinates": "abs_time",
922
926
  "long_name": "northern boundary sea surface height",
927
+ "standard_name": "sea_surface_height_above_geoid",
923
928
  "units": "m"
924
929
  },
925
930
  "zeta_south/.zarray": {
@@ -951,6 +956,7 @@
951
956
  ],
952
957
  "coordinates": "abs_time",
953
958
  "long_name": "southern boundary sea surface height",
959
+ "standard_name": "sea_surface_height_above_geoid",
954
960
  "units": "m"
955
961
  },
956
962
  "zeta_west/.zarray": {
@@ -982,6 +988,7 @@
982
988
  ],
983
989
  "coordinates": "abs_time",
984
990
  "long_name": "western boundary sea surface height",
991
+ "standard_name": "sea_surface_height_above_geoid",
985
992
  "units": "m"
986
993
  }
987
994
  },