roms-tools 1.6.2__py3-none-any.whl → 1.7.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 (221) hide show
  1. ci/environment.yml +1 -1
  2. roms_tools/__init__.py +1 -0
  3. roms_tools/_version.py +1 -1
  4. roms_tools/setup/boundary_forcing.py +13 -112
  5. roms_tools/setup/datasets.py +778 -191
  6. roms_tools/setup/download.py +30 -0
  7. roms_tools/setup/initial_conditions.py +14 -76
  8. roms_tools/setup/plot.py +77 -15
  9. roms_tools/setup/river_forcing.py +589 -0
  10. roms_tools/setup/surface_forcing.py +10 -112
  11. roms_tools/setup/tides.py +6 -67
  12. roms_tools/setup/utils.py +259 -1
  13. roms_tools/tests/test_setup/test_boundary_forcing.py +0 -2
  14. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zattrs +1 -1
  15. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zmetadata +157 -130
  16. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_east/.zattrs +1 -1
  17. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_north/.zattrs +1 -1
  18. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_south/.zattrs +1 -1
  19. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_west/.zattrs +1 -1
  20. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_east/.zattrs +1 -1
  21. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_north/.zattrs +1 -1
  22. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_south/.zattrs +1 -1
  23. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/.zattrs +1 -1
  24. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_east/.zattrs +1 -1
  25. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_north/.zattrs +1 -1
  26. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_south/.zattrs +1 -1
  27. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_west/.zattrs +1 -1
  28. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_east/.zattrs +1 -1
  29. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_north/.zattrs +1 -1
  30. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_south/.zattrs +1 -1
  31. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/.zattrs +1 -1
  32. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_east/.zattrs +1 -1
  33. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_north/.zattrs +1 -1
  34. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_south/.zattrs +1 -1
  35. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/.zattrs +1 -1
  36. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_east/.zattrs +1 -1
  37. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_north/.zattrs +1 -1
  38. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_south/.zattrs +1 -1
  39. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_west/.zattrs +1 -1
  40. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_east/.zattrs +1 -1
  41. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_north/.zattrs +1 -1
  42. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_south/.zattrs +1 -1
  43. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/.zattrs +1 -1
  44. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_east/.zattrs +1 -1
  45. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_north/.zattrs +1 -1
  46. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_south/.zattrs +1 -1
  47. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/.zattrs +1 -1
  48. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_east/.zattrs +1 -1
  49. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_north/.zattrs +1 -1
  50. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_south/.zattrs +1 -1
  51. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/.zattrs +1 -1
  52. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_east/.zattrs +1 -1
  53. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_north/.zattrs +1 -1
  54. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_south/.zattrs +1 -1
  55. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/.zattrs +1 -1
  56. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_east/.zattrs +1 -1
  57. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_north/.zattrs +1 -1
  58. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_south/.zattrs +1 -1
  59. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/.zattrs +1 -1
  60. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_east/.zattrs +1 -1
  61. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_north/.zattrs +1 -1
  62. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_south/.zattrs +1 -1
  63. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/.zattrs +1 -1
  64. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_east/.zattrs +1 -1
  65. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_north/.zattrs +1 -1
  66. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_south/.zattrs +1 -1
  67. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/.zattrs +1 -1
  68. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_east/.zattrs +1 -1
  69. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_north/.zattrs +1 -1
  70. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_south/.zattrs +1 -1
  71. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/.zattrs +1 -1
  72. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_east/.zattrs +1 -1
  73. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_north/.zattrs +1 -1
  74. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_south/.zattrs +1 -1
  75. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/.zattrs +1 -1
  76. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_east/.zattrs +1 -1
  77. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_north/.zattrs +1 -1
  78. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_south/.zattrs +1 -1
  79. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/.zattrs +1 -1
  80. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_east/.zattrs +1 -1
  81. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_north/.zattrs +1 -1
  82. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_south/.zattrs +1 -1
  83. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/.zattrs +1 -1
  84. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/abs_time/.zattrs +1 -0
  85. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/bry_time/.zattrs +1 -1
  86. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_east/.zattrs +1 -1
  87. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_north/.zattrs +1 -1
  88. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_south/.zattrs +1 -1
  89. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_west/.zattrs +1 -1
  90. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_east/.zattrs +1 -1
  91. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_north/.zattrs +1 -1
  92. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_south/.zattrs +1 -1
  93. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_west/.zattrs +1 -1
  94. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_east/.zattrs +1 -1
  95. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_north/.zattrs +1 -1
  96. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_south/.zattrs +1 -1
  97. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_west/.zattrs +1 -1
  98. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_east/.zattrs +1 -1
  99. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_north/.zattrs +1 -1
  100. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_south/.zattrs +1 -1
  101. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_west/.zattrs +1 -1
  102. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_east/.zattrs +1 -1
  103. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_north/.zattrs +1 -1
  104. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_south/.zattrs +1 -1
  105. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_west/.zattrs +1 -1
  106. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_east/.zattrs +1 -1
  107. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_north/.zattrs +1 -1
  108. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_south/.zattrs +1 -1
  109. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_west/.zattrs +1 -1
  110. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_east/.zattrs +1 -1
  111. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_north/.zattrs +1 -1
  112. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_south/.zattrs +1 -1
  113. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_west/.zattrs +1 -1
  114. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_east/.zattrs +1 -1
  115. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_north/.zattrs +1 -1
  116. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_south/.zattrs +1 -1
  117. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_west/.zattrs +1 -1
  118. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_east/.zattrs +1 -1
  119. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_north/.zattrs +1 -1
  120. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_south/.zattrs +1 -1
  121. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_west/.zattrs +1 -1
  122. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/month/.zarray +20 -0
  123. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/month/.zattrs +6 -0
  124. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/month/0 +0 -0
  125. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_east/.zattrs +1 -1
  126. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_north/.zattrs +1 -1
  127. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_south/.zattrs +1 -1
  128. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_west/.zattrs +1 -1
  129. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_east/.zattrs +1 -1
  130. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_north/.zattrs +1 -1
  131. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_south/.zattrs +1 -1
  132. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_west/.zattrs +1 -1
  133. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_east/.zattrs +1 -1
  134. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_north/.zattrs +1 -1
  135. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_south/.zattrs +1 -1
  136. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_west/.zattrs +1 -1
  137. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_east/.zattrs +1 -1
  138. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_north/.zattrs +1 -1
  139. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_south/.zattrs +1 -1
  140. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_west/.zattrs +1 -1
  141. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_east/.zattrs +1 -1
  142. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_north/.zattrs +1 -1
  143. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_south/.zattrs +1 -1
  144. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_west/.zattrs +1 -1
  145. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_east/.zattrs +1 -1
  146. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_north/.zattrs +1 -1
  147. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_south/.zattrs +1 -1
  148. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_west/.zattrs +1 -1
  149. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zattrs +1 -1
  150. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zmetadata +39 -12
  151. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/abs_time/.zattrs +1 -0
  152. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/dust/.zattrs +1 -1
  153. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/dust_time/.zattrs +1 -1
  154. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/iron/.zattrs +1 -1
  155. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/iron_time/.zattrs +1 -1
  156. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/month/.zarray +20 -0
  157. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/month/.zattrs +6 -0
  158. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/month/0 +0 -0
  159. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nhy/.zattrs +1 -1
  160. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nhy_time/.zattrs +1 -1
  161. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nox/.zattrs +1 -1
  162. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nox_time/.zattrs +1 -1
  163. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air/.zattrs +1 -1
  164. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air_alt/.zattrs +1 -1
  165. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_time/.zattrs +1 -1
  166. roms_tools/tests/test_setup/test_data/river_forcing.zarr/.zattrs +3 -0
  167. roms_tools/tests/test_setup/test_data/river_forcing.zarr/.zgroup +3 -0
  168. roms_tools/tests/test_setup/test_data/river_forcing.zarr/.zmetadata +214 -0
  169. roms_tools/tests/test_setup/test_data/river_forcing.zarr/abs_time/.zarray +20 -0
  170. roms_tools/tests/test_setup/test_data/river_forcing.zarr/abs_time/.zattrs +8 -0
  171. roms_tools/tests/test_setup/test_data/river_forcing.zarr/abs_time/0 +0 -0
  172. roms_tools/tests/test_setup/test_data/river_forcing.zarr/month/.zarray +20 -0
  173. roms_tools/tests/test_setup/test_data/river_forcing.zarr/month/.zattrs +6 -0
  174. roms_tools/tests/test_setup/test_data/river_forcing.zarr/month/0 +0 -0
  175. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_name/.zarray +24 -0
  176. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_name/.zattrs +6 -0
  177. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_name/0 +0 -0
  178. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_time/.zarray +20 -0
  179. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_time/.zattrs +8 -0
  180. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_time/0 +0 -0
  181. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_tracer/.zarray +24 -0
  182. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_tracer/.zattrs +10 -0
  183. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_tracer/0.0.0 +0 -0
  184. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_volume/.zarray +22 -0
  185. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_volume/.zattrs +9 -0
  186. roms_tools/tests/test_setup/test_data/river_forcing.zarr/river_volume/0.0 +0 -0
  187. roms_tools/tests/test_setup/test_data/river_forcing.zarr/tracer_name/.zarray +20 -0
  188. roms_tools/tests/test_setup/test_data/river_forcing.zarr/tracer_name/.zattrs +6 -0
  189. roms_tools/tests/test_setup/test_data/river_forcing.zarr/tracer_name/0 +0 -0
  190. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/.zattrs +1 -0
  191. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/.zgroup +3 -0
  192. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/.zmetadata +185 -0
  193. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/abs_time/.zarray +20 -0
  194. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/abs_time/.zattrs +8 -0
  195. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/abs_time/0 +0 -0
  196. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_name/.zarray +24 -0
  197. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_name/.zattrs +6 -0
  198. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_name/0 +0 -0
  199. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_time/.zarray +20 -0
  200. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_time/.zattrs +7 -0
  201. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_time/0 +0 -0
  202. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_tracer/.zarray +24 -0
  203. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_tracer/.zattrs +10 -0
  204. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_tracer/0.0.0 +0 -0
  205. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_volume/.zarray +22 -0
  206. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_volume/.zattrs +9 -0
  207. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_volume/0.0 +0 -0
  208. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/tracer_name/.zarray +20 -0
  209. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/tracer_name/.zattrs +6 -0
  210. roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/tracer_name/0 +0 -0
  211. roms_tools/tests/test_setup/test_initial_conditions.py +0 -2
  212. roms_tools/tests/test_setup/test_river_forcing.py +366 -0
  213. roms_tools/tests/test_setup/test_surface_forcing.py +0 -2
  214. roms_tools/tests/test_setup/test_tides.py +0 -2
  215. roms_tools/tests/test_setup/test_validation.py +4 -0
  216. roms_tools/utils.py +12 -10
  217. {roms_tools-1.6.2.dist-info → roms_tools-1.7.0.dist-info}/METADATA +5 -5
  218. {roms_tools-1.6.2.dist-info → roms_tools-1.7.0.dist-info}/RECORD +221 -168
  219. {roms_tools-1.6.2.dist-info → roms_tools-1.7.0.dist-info}/WHEEL +1 -1
  220. {roms_tools-1.6.2.dist-info → roms_tools-1.7.0.dist-info}/LICENSE +0 -0
  221. {roms_tools-1.6.2.dist-info → roms_tools-1.7.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,366 @@
1
+ from roms_tools import RiverForcing, Grid
2
+ import xarray as xr
3
+ import numpy as np
4
+ from datetime import datetime
5
+ import textwrap
6
+ from pathlib import Path
7
+ import pytest
8
+ from conftest import calculate_file_hash
9
+ from roms_tools.setup.download import download_river_data
10
+
11
+
12
+ @pytest.fixture
13
+ def river_forcing_climatology():
14
+ """Fixture for creating a RiverForcing object from the global Dai river dataset."""
15
+ grid = Grid(
16
+ nx=18, ny=18, size_x=800, size_y=800, center_lon=-18, center_lat=65, rot=20, N=3
17
+ )
18
+
19
+ start_time = datetime(1998, 1, 1)
20
+ end_time = datetime(1998, 3, 1)
21
+
22
+ return RiverForcing(
23
+ grid=grid,
24
+ start_time=start_time,
25
+ end_time=end_time,
26
+ convert_to_climatology="always",
27
+ )
28
+
29
+
30
+ @pytest.fixture
31
+ def river_forcing_for_grid_that_straddles_dateline():
32
+ """Fixture for creating a RiverForcing object from the global Dai river dataset for
33
+ a grid that straddles the dateline."""
34
+
35
+ grid = Grid(
36
+ nx=18,
37
+ ny=18,
38
+ size_x=1500,
39
+ size_y=1500,
40
+ center_lon=-0,
41
+ center_lat=65,
42
+ rot=20,
43
+ N=3,
44
+ )
45
+ start_time = datetime(1998, 1, 1)
46
+ end_time = datetime(1998, 3, 1)
47
+
48
+ return RiverForcing(
49
+ grid=grid,
50
+ start_time=start_time,
51
+ end_time=end_time,
52
+ )
53
+
54
+
55
+ def compare_dictionaries(dict1, dict2):
56
+ assert dict1.keys() == dict2.keys()
57
+
58
+ for key in dict1.keys():
59
+ assert np.array_equal(dict1[key], dict2[key])
60
+
61
+
62
+ @pytest.mark.parametrize(
63
+ "river_forcing_fixture",
64
+ ["river_forcing", "river_forcing_for_grid_that_straddles_dateline"],
65
+ )
66
+ def test_successful_initialization_with_climatological_dai_data(
67
+ river_forcing_fixture, request
68
+ ):
69
+
70
+ river_forcing = request.getfixturevalue(river_forcing_fixture)
71
+
72
+ assert isinstance(river_forcing.ds, xr.Dataset)
73
+ assert len(river_forcing.ds.nriver) > 0
74
+ assert len(river_forcing.original_indices["name"]) > 0
75
+ assert "river_volume" in river_forcing.ds
76
+ assert "river_tracer" in river_forcing.ds
77
+ assert river_forcing.climatology
78
+ assert "river_time" in river_forcing.ds
79
+ assert hasattr(
80
+ river_forcing.ds.river_time,
81
+ "cycle_length",
82
+ )
83
+ assert hasattr(river_forcing.ds, "climatology")
84
+
85
+
86
+ def test_successful_initialization_with_monthly_dai_data(river_forcing_no_climatology):
87
+
88
+ assert isinstance(river_forcing_no_climatology.ds, xr.Dataset)
89
+ assert "river_volume" in river_forcing_no_climatology.ds
90
+ assert "river_tracer" in river_forcing_no_climatology.ds
91
+ assert "river_time" in river_forcing_no_climatology.ds
92
+ assert not river_forcing_no_climatology.climatology
93
+ assert not hasattr(
94
+ river_forcing_no_climatology.ds.river_time,
95
+ "cycle_length",
96
+ )
97
+ assert not hasattr(river_forcing_no_climatology.ds, "climatology")
98
+
99
+
100
+ def test_reproducibility(river_forcing, river_forcing_climatology):
101
+
102
+ xr.testing.assert_allclose(river_forcing.ds, river_forcing_climatology.ds)
103
+
104
+ compare_dictionaries(
105
+ river_forcing.original_indices, river_forcing_climatology.original_indices
106
+ )
107
+ compare_dictionaries(
108
+ river_forcing.updated_indices, river_forcing_climatology.updated_indices
109
+ )
110
+
111
+
112
+ def test_reproducibility_indices(river_forcing, river_forcing_no_climatology):
113
+
114
+ compare_dictionaries(
115
+ river_forcing.original_indices, river_forcing_no_climatology.original_indices
116
+ )
117
+ compare_dictionaries(
118
+ river_forcing.updated_indices, river_forcing_no_climatology.updated_indices
119
+ )
120
+
121
+
122
+ @pytest.mark.parametrize(
123
+ "river_forcing_fixture",
124
+ ["river_forcing_climatology", "river_forcing_no_climatology"],
125
+ )
126
+ def test_constant_tracers(river_forcing_fixture, request):
127
+ river_forcing = request.getfixturevalue(river_forcing_fixture)
128
+
129
+ np.testing.assert_allclose(
130
+ river_forcing.ds.river_tracer.isel(ntracers=0).values, 17.0, atol=0
131
+ )
132
+ np.testing.assert_allclose(
133
+ river_forcing.ds.river_tracer.isel(ntracers=1).values, 1.0, atol=0
134
+ )
135
+
136
+
137
+ @pytest.mark.parametrize(
138
+ "river_forcing_fixture",
139
+ ["river_forcing_climatology", "river_forcing_no_climatology"],
140
+ )
141
+ def test_river_locations_are_along_coast(river_forcing_fixture, request):
142
+ river_forcing = request.getfixturevalue(river_forcing_fixture)
143
+
144
+ mask = river_forcing.grid.ds.mask_rho
145
+ faces = (
146
+ mask.shift(eta_rho=1)
147
+ + mask.shift(eta_rho=-1)
148
+ + mask.shift(xi_rho=1)
149
+ + mask.shift(xi_rho=-1)
150
+ )
151
+ coast = (1 - mask) * (faces > 0)
152
+
153
+ indices = river_forcing.updated_indices
154
+ for i in range(len(indices["station"])):
155
+ eta_rho = indices["eta_rho"][i]
156
+ xi_rho = indices["xi_rho"][i]
157
+ assert coast[eta_rho, xi_rho]
158
+ assert river_forcing.grid.ds["river_flux"][eta_rho, xi_rho] > 0
159
+
160
+
161
+ def test_missing_source_name():
162
+
163
+ grid = Grid(
164
+ nx=2,
165
+ ny=2,
166
+ size_x=500,
167
+ size_y=1000,
168
+ center_lon=0,
169
+ center_lat=55,
170
+ rot=10,
171
+ N=3, # number of vertical levels
172
+ )
173
+
174
+ with pytest.raises(ValueError, match="`source` must include a 'name'."):
175
+ RiverForcing(
176
+ grid=grid,
177
+ start_time=datetime(1998, 1, 1),
178
+ end_time=datetime(1998, 3, 1),
179
+ source={"path": "river_data.nc"},
180
+ )
181
+
182
+
183
+ def test_no_rivers_found():
184
+
185
+ # Create a grid over open ocean
186
+ grid = Grid(
187
+ nx=2, ny=2, size_x=50, size_y=50, center_lon=0, center_lat=55, rot=10, N=3
188
+ )
189
+ with pytest.raises(
190
+ ValueError,
191
+ match="No relevant rivers found.",
192
+ ):
193
+
194
+ RiverForcing(
195
+ grid=grid,
196
+ start_time=datetime(1998, 1, 1),
197
+ end_time=datetime(1998, 3, 1),
198
+ )
199
+
200
+
201
+ def test_reproducibility_same_grid(river_forcing):
202
+
203
+ the_same_river_forcing = RiverForcing(
204
+ grid=river_forcing.grid,
205
+ start_time=datetime(1998, 1, 1),
206
+ end_time=datetime(1998, 3, 1),
207
+ )
208
+
209
+ assert river_forcing == the_same_river_forcing
210
+
211
+
212
+ def test_update_river_flux_variable_without_conflicts(river_forcing, tmp_path):
213
+
214
+ fname = download_river_data("dai_trenberth_may2019.nc")
215
+ ds = xr.open_dataset(fname, decode_times=False)
216
+ # only keep the 300 biggest rivers, which will lower the total relevant river number
217
+ ds = ds.isel(station=slice(None, 300))
218
+ filepath = tmp_path / "test.nc"
219
+ ds.to_netcdf(filepath)
220
+
221
+ another_river_forcing = RiverForcing(
222
+ grid=river_forcing.grid,
223
+ start_time=datetime(1998, 1, 1),
224
+ end_time=datetime(1998, 3, 1),
225
+ source={"name": "DAI", "path": filepath},
226
+ )
227
+
228
+ assert isinstance(another_river_forcing.ds, xr.Dataset)
229
+
230
+
231
+ def test_river_forcing_plot(river_forcing):
232
+ """Test plot method."""
233
+
234
+ river_forcing.plot_locations()
235
+ river_forcing.plot("river_volume")
236
+ river_forcing.plot("river_temperature")
237
+ river_forcing.plot("river_salinity")
238
+
239
+
240
+ def test_river_forcing_save(river_forcing, tmp_path):
241
+ """Test save method."""
242
+
243
+ for file_str, grid_file_str in zip(
244
+ ["test_rivers", "test_rivers.nc"], ["test_grid", "test_grid.nc"]
245
+ ):
246
+ # Create a temporary filepath using the tmp_path fixture
247
+ for filepath, grid_filepath in zip(
248
+ [tmp_path / file_str, str(tmp_path / file_str)],
249
+ [tmp_path / grid_file_str, str(tmp_path / grid_file_str)],
250
+ ): # test for Path object and str
251
+
252
+ # Test saving without partitioning
253
+ saved_filenames = river_forcing.save(filepath, grid_filepath)
254
+ # Check if the .nc file was created
255
+ filepath = Path(filepath).with_suffix(".nc")
256
+ grid_filepath = Path(grid_filepath).with_suffix(".nc")
257
+ assert saved_filenames == [filepath, grid_filepath]
258
+ assert filepath.exists()
259
+ assert grid_filepath.exists()
260
+ # Clean up the .nc file
261
+ filepath.unlink()
262
+ grid_filepath.unlink()
263
+
264
+ # Test saving with partitioning
265
+ saved_filenames = river_forcing.save(
266
+ filepath, grid_filepath, np_eta=3, np_xi=3
267
+ )
268
+
269
+ filepath_str = str(filepath.with_suffix(""))
270
+ grid_filepath_str = str(grid_filepath.with_suffix(""))
271
+ expected_filepath_list = [
272
+ Path(filepath_str + f".{index}.nc") for index in range(9)
273
+ ] + [Path(grid_filepath_str + f".{index}.nc") for index in range(9)]
274
+ assert saved_filenames == expected_filepath_list
275
+ for expected_filepath in expected_filepath_list:
276
+ assert expected_filepath.exists()
277
+ expected_filepath.unlink()
278
+
279
+
280
+ def test_roundtrip_yaml(river_forcing, tmp_path):
281
+ """Test that creating an RiverForcing object, saving its parameters to yaml file,
282
+ and re-opening yaml file creates the same object."""
283
+
284
+ # Create a temporary filepath using the tmp_path fixture
285
+ file_str = "test_yaml"
286
+ for filepath in [
287
+ tmp_path / file_str,
288
+ str(tmp_path / file_str),
289
+ ]: # test for Path object and str
290
+
291
+ river_forcing.to_yaml(filepath)
292
+
293
+ river_forcing_from_file = RiverForcing.from_yaml(filepath)
294
+
295
+ assert river_forcing == river_forcing_from_file
296
+
297
+ filepath = Path(filepath)
298
+ filepath.unlink()
299
+
300
+
301
+ def test_files_have_same_hash(river_forcing, tmp_path):
302
+
303
+ yaml_filepath = tmp_path / "test_yaml.yaml"
304
+ filepath1 = tmp_path / "test1.nc"
305
+ filepath2 = tmp_path / "test2.nc"
306
+ grid_filepath1 = tmp_path / "grid_test1.nc"
307
+ grid_filepath2 = tmp_path / "grid_test2.nc"
308
+
309
+ river_forcing.to_yaml(yaml_filepath)
310
+ river_forcing.save(filepath1, grid_filepath1)
311
+ rf_from_file = RiverForcing.from_yaml(yaml_filepath)
312
+ rf_from_file.save(filepath2, grid_filepath2)
313
+
314
+ hash1 = calculate_file_hash(filepath1)
315
+ hash2 = calculate_file_hash(filepath2)
316
+
317
+ assert hash1 == hash2, f"Hashes do not match: {hash1} != {hash2}"
318
+
319
+ yaml_filepath.unlink()
320
+ filepath1.unlink()
321
+ filepath2.unlink()
322
+ grid_filepath1.unlink()
323
+ grid_filepath2.unlink()
324
+
325
+
326
+ def test_from_yaml_missing_initial_conditions(tmp_path):
327
+ yaml_content = textwrap.dedent(
328
+ """\
329
+ ---
330
+ roms_tools_version: 0.0.0
331
+ ---
332
+ Grid:
333
+ nx: 100
334
+ ny: 100
335
+ size_x: 1800
336
+ size_y: 2400
337
+ center_lon: -10
338
+ center_lat: 61
339
+ rot: -20
340
+ topography_source: ETOPO5
341
+ hmin: 5.0
342
+ """
343
+ )
344
+
345
+ # Create a temporary filepath using the tmp_path fixture
346
+ file_str = "test_yaml"
347
+ for yaml_filepath in [
348
+ tmp_path / file_str,
349
+ str(tmp_path / file_str),
350
+ ]: # test for Path object and str
351
+
352
+ # Write YAML content to file
353
+ if isinstance(yaml_filepath, Path):
354
+ yaml_filepath.write_text(yaml_content)
355
+ else:
356
+ with open(yaml_filepath, "w") as f:
357
+ f.write(yaml_content)
358
+
359
+ with pytest.raises(
360
+ ValueError,
361
+ match="No RiverForcing configuration found in the YAML file.",
362
+ ):
363
+ RiverForcing.from_yaml(yaml_filepath)
364
+
365
+ yaml_filepath = Path(yaml_filepath)
366
+ yaml_filepath.unlink()
@@ -748,9 +748,7 @@ def test_from_yaml_missing_surface_forcing(tmp_path, use_dask):
748
748
  center_lat: 61
749
749
  rot: -20
750
750
  topography_source: ETOPO5
751
- smooth_factor: 8
752
751
  hmin: 5.0
753
- rmax: 0.2
754
752
  """
755
753
  )
756
754
 
@@ -267,9 +267,7 @@ def test_from_yaml_missing_tidal_forcing(tmp_path, use_dask):
267
267
  center_lat: 61
268
268
  rot: -20
269
269
  topography_source: ETOPO5
270
- smooth_factor: 8
271
270
  hmin: 5.0
272
- rmax: 0.2
273
271
  """
274
272
  )
275
273
 
@@ -23,6 +23,8 @@ def _get_fname(name):
23
23
  "bgc_surface_forcing_from_climatology",
24
24
  "boundary_forcing",
25
25
  "bgc_boundary_forcing_from_climatology",
26
+ "river_forcing",
27
+ "river_forcing_no_climatology",
26
28
  ],
27
29
  )
28
30
  # this test will not be run by default
@@ -60,6 +62,8 @@ def test_save_results(forcing_fixture, request):
60
62
  "bgc_surface_forcing_from_climatology",
61
63
  "boundary_forcing",
62
64
  "bgc_boundary_forcing_from_climatology",
65
+ "river_forcing",
66
+ "river_forcing_no_climatology",
63
67
  ],
64
68
  )
65
69
  def test_check_results(forcing_fixture, request):
roms_tools/utils.py CHANGED
@@ -176,11 +176,12 @@ def partition(
176
176
  ]
177
177
 
178
178
  if np_eta > 1:
179
- partitioned_sizes["eta_rho"] = (
180
- [eta_rho_domain_size + n_eta_ghost_cells]
181
- + [eta_rho_domain_size] * (np_eta - 2)
182
- + [eta_rho_domain_size + n_eta_ghost_cells]
183
- )
179
+ if "eta_rho" in dims_to_partition:
180
+ partitioned_sizes["eta_rho"] = (
181
+ [eta_rho_domain_size + n_eta_ghost_cells]
182
+ + [eta_rho_domain_size] * (np_eta - 2)
183
+ + [eta_rho_domain_size + n_eta_ghost_cells]
184
+ )
184
185
  if "eta_psi" in dims_to_partition:
185
186
  partitioned_sizes["eta_psi"] = (
186
187
  [n_eta_ghost_cells + eta_psi_domain_size]
@@ -195,11 +196,12 @@ def partition(
195
196
  )
196
197
 
197
198
  if np_xi > 1:
198
- partitioned_sizes["xi_rho"] = (
199
- [xi_rho_domain_size + n_xi_ghost_cells]
200
- + [xi_rho_domain_size] * (np_xi - 2)
201
- + [xi_rho_domain_size + n_xi_ghost_cells]
202
- )
199
+ if "xi_rho" in dims_to_partition:
200
+ partitioned_sizes["xi_rho"] = (
201
+ [xi_rho_domain_size + n_xi_ghost_cells]
202
+ + [xi_rho_domain_size] * (np_xi - 2)
203
+ + [xi_rho_domain_size + n_xi_ghost_cells]
204
+ )
203
205
  if "xi_psi" in dims_to_partition:
204
206
  partitioned_sizes["xi_psi"] = (
205
207
  [n_xi_ghost_cells + xi_psi_domain_size]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: roms-tools
3
- Version: 1.6.2
3
+ Version: 1.7.0
4
4
  Summary: Tools for running and analysing UCLA-ROMS simulations
5
5
  Author-email: Nora Loose <nora.loose@gmail.com>, Thomas Nicholas <tom@cworthy.org>
6
6
  License: Apache-2
@@ -26,13 +26,13 @@ Requires-Dist: matplotlib
26
26
  Requires-Dist: cartopy
27
27
  Requires-Dist: packaging
28
28
  Requires-Dist: scipy
29
- Requires-Dist: gcm-filters
29
+ Requires-Dist: gcm_filters
30
30
  Requires-Dist: netcdf4
31
31
  Requires-Dist: PyYAML
32
32
  Requires-Dist: pyamg
33
33
  Requires-Dist: bottleneck
34
34
  Provides-Extra: dask
35
- Requires-Dist: dask; extra == "dask"
35
+ Requires-Dist: dask[diagnostics]; extra == "dask"
36
36
 
37
37
  # ROMS-Tools
38
38
  [![Conda version](https://img.shields.io/conda/vn/conda-forge/roms-tools.svg)](https://anaconda.org/conda-forge/roms-tools)
@@ -47,7 +47,7 @@ Requires-Dist: dask; extra == "dask"
47
47
 
48
48
  A suite of python tools for setting up a [ROMS](https://github.com/CESR-lab/ucla-roms) simulation.
49
49
 
50
- <mark>**DISCLAIMER**: This project is **ALPHA** and will be **EXPERIMENTAL** at least throughout Fall 2024. We do not recommend to use this software before this ALPHA development and test phase is completed.</mark>
50
+ <mark>**DISCLAIMER**: This project is **ALPHA** and will be **EXPERIMENTAL** at least throughout 2024. We do not recommend to use this software before this ALPHA development and test phase is completed.</mark>
51
51
 
52
52
  ## Installation
53
53
 
@@ -98,7 +98,7 @@ If you want to use `ROMS-Tools` together with dask (which we recommend), you can
98
98
  install `ROMS-Tools` along with the additional dependency via:
99
99
 
100
100
  ```bash
101
- pip install -e .[dask]
101
+ pip install -e ".[dask]"
102
102
  ```
103
103
 
104
104