roms-tools 1.4.1__py3-none-any.whl → 1.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. roms_tools/_version.py +1 -1
  2. roms_tools/setup/boundary_forcing.py +350 -166
  3. roms_tools/setup/datasets.py +57 -74
  4. roms_tools/setup/download.py +3 -6
  5. roms_tools/setup/fill.py +46 -18
  6. roms_tools/setup/grid.py +74 -113
  7. roms_tools/setup/initial_conditions.py +209 -76
  8. roms_tools/setup/regrid.py +198 -0
  9. roms_tools/setup/surface_forcing.py +167 -80
  10. roms_tools/setup/tides.py +135 -67
  11. roms_tools/setup/topography.py +9 -17
  12. roms_tools/setup/utils.py +251 -77
  13. roms_tools/setup/vertical_coordinate.py +4 -6
  14. roms_tools/tests/test_setup/test_boundary_forcing.py +6 -13
  15. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zattrs +1 -1
  16. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zmetadata +1 -1
  17. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_east/0.0.0 +0 -0
  18. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_north/0.0.0 +0 -0
  19. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_south/0.0.0 +0 -0
  20. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_west/0.0.0 +0 -0
  21. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_east/0.0.0 +0 -0
  22. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_north/0.0.0 +0 -0
  23. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_south/0.0.0 +0 -0
  24. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/0.0.0 +0 -0
  25. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_east/0.0.0 +0 -0
  26. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_north/0.0.0 +0 -0
  27. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_south/0.0.0 +0 -0
  28. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_west/0.0.0 +0 -0
  29. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_east/0.0.0 +0 -0
  30. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_north/0.0.0 +0 -0
  31. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_south/0.0.0 +0 -0
  32. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/0.0.0 +0 -0
  33. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_east/0.0.0 +0 -0
  34. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_north/0.0.0 +0 -0
  35. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_south/0.0.0 +0 -0
  36. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/0.0.0 +0 -0
  37. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_east/0.0.0 +0 -0
  38. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_north/0.0.0 +0 -0
  39. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_south/0.0.0 +0 -0
  40. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_west/0.0.0 +0 -0
  41. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_east/0.0.0 +0 -0
  42. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_north/0.0.0 +0 -0
  43. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_south/0.0.0 +0 -0
  44. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/0.0.0 +0 -0
  45. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_east/0.0.0 +0 -0
  46. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_north/0.0.0 +0 -0
  47. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_south/0.0.0 +0 -0
  48. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/0.0.0 +0 -0
  49. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_east/0.0.0 +0 -0
  50. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_north/0.0.0 +0 -0
  51. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_south/0.0.0 +0 -0
  52. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/0.0.0 +0 -0
  53. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_east/0.0.0 +0 -0
  54. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_north/0.0.0 +0 -0
  55. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_south/0.0.0 +0 -0
  56. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/0.0.0 +0 -0
  57. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_east/0.0.0 +0 -0
  58. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_north/0.0.0 +0 -0
  59. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_south/0.0.0 +0 -0
  60. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/0.0.0 +0 -0
  61. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_east/0.0.0 +0 -0
  62. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_north/0.0.0 +0 -0
  63. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_south/0.0.0 +0 -0
  64. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/0.0.0 +0 -0
  65. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_east/0.0.0 +0 -0
  66. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_north/0.0.0 +0 -0
  67. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_south/0.0.0 +0 -0
  68. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/0.0.0 +0 -0
  69. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_east/0.0.0 +0 -0
  70. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_north/0.0.0 +0 -0
  71. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_south/0.0.0 +0 -0
  72. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/0.0.0 +0 -0
  73. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_east/0.0.0 +0 -0
  74. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_north/0.0.0 +0 -0
  75. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_south/0.0.0 +0 -0
  76. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/0.0.0 +0 -0
  77. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_east/0.0.0 +0 -0
  78. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_north/0.0.0 +0 -0
  79. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_south/0.0.0 +0 -0
  80. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/0.0.0 +0 -0
  81. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_east/0.0.0 +0 -0
  82. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_north/0.0.0 +0 -0
  83. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_south/0.0.0 +0 -0
  84. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/0.0.0 +0 -0
  85. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_east/0.0.0 +0 -0
  86. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_north/0.0.0 +0 -0
  87. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_south/0.0.0 +0 -0
  88. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_west/0.0.0 +0 -0
  89. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_east/0.0.0 +0 -0
  90. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_north/0.0.0 +0 -0
  91. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_south/0.0.0 +0 -0
  92. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_west/0.0.0 +0 -0
  93. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_east/0.0.0 +0 -0
  94. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_north/0.0.0 +0 -0
  95. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_south/0.0.0 +0 -0
  96. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_west/0.0.0 +0 -0
  97. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_east/0.0.0 +0 -0
  98. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_north/0.0.0 +0 -0
  99. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_south/0.0.0 +0 -0
  100. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_west/0.0.0 +0 -0
  101. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_east/0.0.0 +0 -0
  102. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_north/0.0.0 +0 -0
  103. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_south/0.0.0 +0 -0
  104. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_west/0.0.0 +0 -0
  105. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_east/0.0.0 +0 -0
  106. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_north/0.0.0 +0 -0
  107. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_south/0.0.0 +0 -0
  108. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_west/0.0.0 +0 -0
  109. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_east/0.0.0 +0 -0
  110. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_north/0.0.0 +0 -0
  111. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_south/0.0.0 +0 -0
  112. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_west/0.0.0 +0 -0
  113. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_east/0.0.0 +0 -0
  114. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_north/0.0.0 +0 -0
  115. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_south/0.0.0 +0 -0
  116. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_west/0.0.0 +0 -0
  117. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_east/0.0.0 +0 -0
  118. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_north/0.0.0 +0 -0
  119. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_south/0.0.0 +0 -0
  120. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_west/0.0.0 +0 -0
  121. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_east/0.0.0 +0 -0
  122. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_north/0.0.0 +0 -0
  123. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_south/0.0.0 +0 -0
  124. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_west/0.0.0 +0 -0
  125. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_east/0.0.0 +0 -0
  126. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_north/0.0.0 +0 -0
  127. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_south/0.0.0 +0 -0
  128. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_west/0.0.0 +0 -0
  129. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_east/0.0.0 +0 -0
  130. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_north/0.0.0 +0 -0
  131. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_south/0.0.0 +0 -0
  132. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_west/0.0.0 +0 -0
  133. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_east/0.0.0 +0 -0
  134. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_north/0.0.0 +0 -0
  135. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_south/0.0.0 +0 -0
  136. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_west/0.0.0 +0 -0
  137. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_east/0.0.0 +0 -0
  138. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_north/0.0.0 +0 -0
  139. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_south/0.0.0 +0 -0
  140. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_west/0.0.0 +0 -0
  141. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_east/0.0.0 +0 -0
  142. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_north/0.0.0 +0 -0
  143. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_south/0.0.0 +0 -0
  144. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_west/0.0.0 +0 -0
  145. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/.zattrs +1 -1
  146. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/.zmetadata +1 -1
  147. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air_alt/0.0.0 +0 -0
  148. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zattrs +1 -1
  149. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zmetadata +1 -1
  150. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air_alt/0.0.0 +0 -0
  151. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/.zattrs +1 -1
  152. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/.zmetadata +1 -1
  153. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_east/0.0.0 +0 -0
  154. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_north/0.0.0 +0 -0
  155. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_south/0.0.0 +0 -0
  156. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_west/0.0.0 +0 -0
  157. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_east/0.0.0 +0 -0
  158. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_north/0.0.0 +0 -0
  159. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_south/0.0.0 +0 -0
  160. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_west/0.0.0 +0 -0
  161. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_east/0.0.0 +0 -0
  162. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_north/0.0.0 +0 -0
  163. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_south/0.0.0 +0 -0
  164. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_west/0.0.0 +0 -0
  165. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_east/0.0 +0 -0
  166. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_north/0.0 +0 -0
  167. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_south/0.0 +0 -0
  168. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_west/0.0 +0 -0
  169. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_east/0.0.0 +0 -0
  170. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_north/0.0.0 +0 -0
  171. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_south/0.0.0 +0 -0
  172. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_west/0.0.0 +0 -0
  173. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_east/0.0 +0 -0
  174. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_north/0.0 +0 -0
  175. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_south/0.0 +0 -0
  176. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_west/0.0 +0 -0
  177. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_east/0.0 +0 -0
  178. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/0.0 +0 -0
  179. roms_tools/tests/test_setup/test_data/grid.zarr/.zattrs +2 -2
  180. roms_tools/tests/test_setup/test_data/grid.zarr/.zmetadata +2 -62
  181. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zattrs +2 -2
  182. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zmetadata +2 -62
  183. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/.zattrs +1 -1
  184. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/.zmetadata +1 -1
  185. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK/0.0.0.0 +0 -0
  186. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK_ALT_CO2/0.0.0.0 +0 -0
  187. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC/0.0.0.0 +0 -0
  188. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC_ALT_CO2/0.0.0.0 +0 -0
  189. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOC/0.0.0.0 +0 -0
  190. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOCr/0.0.0.0 +0 -0
  191. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DON/0.0.0.0 +0 -0
  192. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DONr/0.0.0.0 +0 -0
  193. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOP/0.0.0.0 +0 -0
  194. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOPr/0.0.0.0 +0 -0
  195. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Fe/0.0.0.0 +0 -0
  196. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Lig/0.0.0.0 +0 -0
  197. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NH4/0.0.0.0 +0 -0
  198. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NO3/0.0.0.0 +0 -0
  199. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/O2/0.0.0.0 +0 -0
  200. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/PO4/0.0.0.0 +0 -0
  201. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/SiO3/0.0.0.0 +0 -0
  202. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatC/0.0.0.0 +0 -0
  203. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatChl/0.0.0.0 +0 -0
  204. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatFe/0.0.0.0 +0 -0
  205. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatP/0.0.0.0 +0 -0
  206. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatSi/0.0.0.0 +0 -0
  207. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazC/0.0.0.0 +0 -0
  208. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazChl/0.0.0.0 +0 -0
  209. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazFe/0.0.0.0 +0 -0
  210. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazP/0.0.0.0 +0 -0
  211. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/salt/0.0.0.0 +0 -0
  212. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spC/0.0.0.0 +0 -0
  213. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spCaCO3/0.0.0.0 +0 -0
  214. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spChl/0.0.0.0 +0 -0
  215. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spFe/0.0.0.0 +0 -0
  216. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spP/0.0.0.0 +0 -0
  217. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/temp/0.0.0.0 +0 -0
  218. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/u/0.0.0.0 +0 -0
  219. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ubar/0.0.0 +0 -0
  220. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/v/0.0.0.0 +0 -0
  221. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/vbar/0.0.0 +0 -0
  222. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zeta/0.0.0 +0 -0
  223. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zooC/0.0.0.0 +0 -0
  224. roms_tools/tests/test_setup/test_datasets.py +8 -18
  225. roms_tools/tests/test_setup/test_fill.py +43 -14
  226. roms_tools/tests/test_setup/test_grid.py +9 -9
  227. roms_tools/tests/test_setup/test_initial_conditions.py +4 -7
  228. roms_tools/tests/test_setup/test_regrid.py +59 -0
  229. roms_tools/tests/test_setup/test_surface_forcing.py +74 -56
  230. roms_tools/tests/test_setup/test_tides.py +6 -10
  231. roms_tools/tests/test_setup/test_topography.py +2 -4
  232. roms_tools/tests/test_setup/test_vertical_coordinate.py +2 -6
  233. roms_tools/tests/test_utils.py +30 -30
  234. roms_tools/utils.py +6 -7
  235. {roms_tools-1.4.1.dist-info → roms_tools-1.5.0.dist-info}/METADATA +2 -2
  236. {roms_tools-1.4.1.dist-info → roms_tools-1.5.0.dist-info}/RECORD +239 -250
  237. roms_tools/setup/mixins.py +0 -231
  238. roms_tools/tests/test_setup/test_data/grid.zarr/lat_psi/.zarray +0 -22
  239. roms_tools/tests/test_setup/test_data/grid.zarr/lat_psi/.zattrs +0 -8
  240. roms_tools/tests/test_setup/test_data/grid.zarr/lat_psi/0.0 +0 -0
  241. roms_tools/tests/test_setup/test_data/grid.zarr/lon_psi/.zarray +0 -22
  242. roms_tools/tests/test_setup/test_data/grid.zarr/lon_psi/.zattrs +0 -8
  243. roms_tools/tests/test_setup/test_data/grid.zarr/lon_psi/0.0 +0 -0
  244. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_psi/.zarray +0 -22
  245. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_psi/.zattrs +0 -8
  246. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_psi/0.0 +0 -0
  247. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_psi/.zarray +0 -22
  248. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_psi/.zattrs +0 -8
  249. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_psi/0.0 +0 -0
  250. {roms_tools-1.4.1.dist-info → roms_tools-1.5.0.dist-info}/LICENSE +0 -0
  251. {roms_tools-1.4.1.dist-info → roms_tools-1.5.0.dist-info}/WHEEL +0 -0
  252. {roms_tools-1.4.1.dist-info → roms_tools-1.5.0.dist-info}/top_level.txt +0 -0
@@ -7,7 +7,8 @@ from roms_tools.setup.grid import Grid
7
7
  from datetime import datetime
8
8
  import numpy as np
9
9
  from typing import Dict, Union, List
10
- from roms_tools.setup.mixins import ROMSToolsMixins
10
+ from roms_tools.setup.fill import _lateral_fill, LateralFill
11
+ from roms_tools.setup.regrid import _lateral_regrid, LateralRegrid
11
12
  from roms_tools.setup.datasets import (
12
13
  ERA5Dataset,
13
14
  ERA5Correction,
@@ -20,6 +21,8 @@ from roms_tools.setup.utils import (
20
21
  get_variable_metadata,
21
22
  group_dataset,
22
23
  save_datasets,
24
+ get_target_coords,
25
+ rotate_velocities,
23
26
  )
24
27
  from roms_tools.setup.plot import _plot
25
28
  import matplotlib.pyplot as plt
@@ -27,9 +30,8 @@ from pathlib import Path
27
30
 
28
31
 
29
32
  @dataclass(frozen=True, kw_only=True)
30
- class SurfaceForcing(ROMSToolsMixins):
31
- """
32
- Represents surface forcing input data for ROMS.
33
+ class SurfaceForcing:
34
+ """Represents surface forcing input data for ROMS.
33
35
 
34
36
  Parameters
35
37
  ----------
@@ -40,14 +42,22 @@ class SurfaceForcing(ROMSToolsMixins):
40
42
  end_time : datetime
41
43
  End time of the desired surface forcing data.
42
44
  source : Dict[str, Union[str, Path, List[Union[str, Path]]], bool]
43
- Dictionary specifying the source of the surface forcing data:
44
- - "name" (str): Name of the data source (e.g., "ERA5").
45
- - "path" (Union[str, Path, List[Union[str, Path]]]): The path to the raw data file(s). Can be a single string (with or without wildcards),
46
- a single Path object, or a list of strings or Path objects containing multiple files.
47
- - "climatology" (bool): Indicates if the data is climatology data. Defaults to False.
45
+ Dictionary specifying the source of the surface forcing data. Keys include:
46
+
47
+ - "name" (str): Name of the data source (e.g., "ERA5").
48
+ - "path" (Union[str, Path, List[Union[str, Path]]]): The path to the raw data file(s). This can be:
49
+
50
+ - A single string (with or without wildcards).
51
+ - A single Path object.
52
+ - A list of strings or Path objects containing multiple files.
53
+ - "climatology" (bool): Indicates if the data is climatology data. Defaults to False.
54
+
48
55
  type : str
49
- Specifies the type of forcing data, either "physics" for physical
50
- atmospheric forcing or "bgc" for biogeochemical forcing.
56
+ Specifies the type of forcing data. Options are:
57
+
58
+ - "physics": for physical atmospheric forcing.
59
+ - "bgc": for biogeochemical forcing.
60
+
51
61
  correct_radiation : bool
52
62
  Whether to correct shortwave radiation. Default is False.
53
63
  use_coarse_grid: bool
@@ -57,12 +67,6 @@ class SurfaceForcing(ROMSToolsMixins):
57
67
  use_dask: bool, optional
58
68
  Indicates whether to use dask for processing. If True, data is processed with dask; if False, data is processed eagerly. Defaults to False.
59
69
 
60
- Attributes
61
- ----------
62
- ds : xr.Dataset
63
- Xarray Dataset containing the surface forcing data.
64
-
65
-
66
70
  Examples
67
71
  --------
68
72
  >>> surface_forcing = SurfaceForcing(
@@ -90,63 +94,50 @@ class SurfaceForcing(ROMSToolsMixins):
90
94
  def __post_init__(self):
91
95
 
92
96
  self._input_checks()
93
- lon, lat, angle, straddle = super().get_target_lon_lat(self.use_coarse_grid)
94
- object.__setattr__(self, "target_lon", lon)
95
- object.__setattr__(self, "target_lat", lat)
97
+ target_coords = get_target_coords(self.grid, self.use_coarse_grid)
98
+ object.__setattr__(self, "target_coords", target_coords)
96
99
 
97
100
  data = self._get_data()
98
101
  data.choose_subdomain(
99
- latitude_range=[lat.min().values, lat.max().values],
100
- longitude_range=[lon.min().values, lon.max().values],
102
+ latitude_range=[
103
+ target_coords["lat"].min().values,
104
+ target_coords["lat"].max().values,
105
+ ],
106
+ longitude_range=[
107
+ target_coords["lon"].min().values,
108
+ target_coords["lon"].max().values,
109
+ ],
101
110
  margin=2,
102
- straddle=straddle,
111
+ straddle=target_coords["straddle"],
103
112
  )
104
- if self.type == "physics":
105
- vars_2d = ["uwnd", "vwnd", "swrad", "lwrad", "Tair", "qair", "rain"]
106
- elif self.type == "bgc":
107
- vars_2d = data.var_names.keys()
108
- vars_3d = []
109
113
 
110
- data_vars = super().regrid_data(data, vars_2d, vars_3d, lon, lat)
114
+ variable_info = self._set_variable_info(data)
111
115
 
112
- if self.type == "physics":
113
- data_vars = super().process_velocities(
114
- data_vars, angle, "uwnd", "vwnd", interpolate=False
116
+ data_vars = {}
117
+ for var_name in data.var_names:
118
+ if var_name != "mask":
119
+ data_vars[var_name] = data.ds[data.var_names[var_name]]
120
+
121
+ data_vars = _lateral_fill(data_vars, data)
122
+
123
+ # lateral regridding
124
+ var_names = variable_info.keys()
125
+ data_vars = _lateral_regrid(
126
+ data, target_coords["lon"], target_coords["lat"], data_vars, var_names
127
+ )
128
+
129
+ # rotation of velocities and interpolation to u/v points
130
+ if "uwnd" in variable_info and "vwnd" in variable_info:
131
+ data_vars["uwnd"], data_vars["vwnd"] = rotate_velocities(
132
+ data_vars["uwnd"],
133
+ data_vars["vwnd"],
134
+ target_coords["angle"],
135
+ interpolate=False,
115
136
  )
116
- if self.correct_radiation:
117
- correction_data = self._get_correction_data()
118
- # choose same subdomain as forcing data so that we can use same mask
119
- coords_correction = {
120
- correction_data.dim_names["latitude"]: data.ds[
121
- data.dim_names["latitude"]
122
- ],
123
- correction_data.dim_names["longitude"]: data.ds[
124
- data.dim_names["longitude"]
125
- ],
126
- }
127
- correction_data.choose_subdomain(coords_correction, straddle=straddle)
128
- # apply mask from ERA5 data
129
- if "mask" in data.var_names.keys():
130
- mask = data.ds["mask"]
131
- for var in correction_data.ds.data_vars:
132
- correction_data.ds[var] = xr.where(
133
- mask == 1, correction_data.ds[var], np.nan
134
- )
135
- correction_data.ds["mask"] = mask
136
- vars_2d = ["swr_corr"]
137
- vars_3d = []
138
- # spatial interpolation
139
- data_vars_corr = super().regrid_data(
140
- correction_data, vars_2d, vars_3d, lon, lat
141
- )
142
- # temporal interpolation
143
- corr_factor = interpolate_from_climatology(
144
- data_vars_corr["swr_corr"],
145
- correction_data.dim_names["time"],
146
- time=data_vars["swrad"].time,
147
- )
148
137
 
149
- data_vars["swrad"] = data_vars["swrad"] * corr_factor
138
+ # correct radiation
139
+ if self.type == "physics" and self.correct_radiation:
140
+ data_vars = self._apply_correction(data_vars, data)
150
141
 
151
142
  object.__setattr__(data, "data_vars", data_vars)
152
143
 
@@ -230,6 +221,99 @@ class SurfaceForcing(ROMSToolsMixins):
230
221
 
231
222
  return correction_data
232
223
 
224
+ def _set_variable_info(self, data):
225
+ """Sets up a dictionary with metadata for variables based on the type of data
226
+ (physics or BGC).
227
+
228
+ The dictionary contains the following information:
229
+ - `location`: Where the variable resides in the grid (e.g., rho, u, or v points).
230
+ - `is_vector`: Whether the variable is part of a vector (True for velocity components like 'u' and 'v').
231
+ - `vector_pair`: For vector variables, this indicates the associated variable that forms the vector (e.g., 'u' and 'v').
232
+ - `is_3d`: Indicates whether the variable is 3D (True for variables like 'temp' and 'salt') or 2D (False for 'zeta').
233
+
234
+ Returns
235
+ -------
236
+ dict
237
+ A dictionary where the keys are variable names and the values are dictionaries of metadata
238
+ about each variable, including 'location', 'is_vector', 'vector_pair', and 'is_3d'.
239
+ """
240
+ default_info = {
241
+ "location": "rho",
242
+ "is_vector": False,
243
+ "vector_pair": None,
244
+ "is_3d": False,
245
+ }
246
+
247
+ # Define a dictionary for variable names and their associated information
248
+ if self.type == "physics":
249
+ variable_info = {
250
+ "swrad": default_info,
251
+ "lwrad": default_info,
252
+ "Tair": default_info,
253
+ "qair": default_info,
254
+ "rain": default_info,
255
+ "uwnd": {
256
+ "location": "u",
257
+ "is_vector": True,
258
+ "vector_pair": "vwnd",
259
+ "is_3d": False,
260
+ },
261
+ "vwnd": {
262
+ "location": "v",
263
+ "is_vector": True,
264
+ "vector_pair": "uwnd",
265
+ "is_3d": False,
266
+ },
267
+ }
268
+ elif self.type == "bgc":
269
+ variable_info = {}
270
+ for var in data.var_names.keys():
271
+ variable_info[var] = default_info
272
+
273
+ return variable_info
274
+
275
+ def _apply_correction(self, data_vars, data):
276
+
277
+ correction_data = self._get_correction_data()
278
+ # choose same subdomain as forcing data so that we can use same mask
279
+ coords_correction = {
280
+ correction_data.dim_names["latitude"]: data.ds[data.dim_names["latitude"]],
281
+ correction_data.dim_names["longitude"]: data.ds[
282
+ data.dim_names["longitude"]
283
+ ],
284
+ }
285
+ correction_data.choose_subdomain(
286
+ coords_correction, straddle=self.target_coords["straddle"]
287
+ )
288
+
289
+ # regrid
290
+ lateral_fill = LateralFill(
291
+ data.ds["mask"], # use mask from ERA5 data
292
+ [
293
+ correction_data.dim_names["latitude"],
294
+ correction_data.dim_names["longitude"],
295
+ ],
296
+ )
297
+ lateral_regrid = LateralRegrid(
298
+ correction_data, self.target_coords["lon"], self.target_coords["lat"]
299
+ )
300
+
301
+ filled = lateral_fill.apply(
302
+ correction_data.ds[correction_data.var_names["swr_corr"]]
303
+ )
304
+ corr_factor = lateral_regrid.apply(filled)
305
+
306
+ # temporal interpolation
307
+ corr_factor = interpolate_from_climatology(
308
+ corr_factor,
309
+ correction_data.dim_names["time"],
310
+ time=data_vars["swrad"].time,
311
+ )
312
+
313
+ data_vars["swrad"] = data_vars["swrad"] * corr_factor
314
+
315
+ return data_vars
316
+
233
317
  def _write_into_dataset(self, data, d_meta):
234
318
 
235
319
  # save in new dataset
@@ -333,13 +417,13 @@ class SurfaceForcing(ROMSToolsMixins):
333
417
  return ds
334
418
 
335
419
  def plot(self, varname, time=0) -> None:
336
- """
337
- Plot the specified surface forcing field for a given time slice.
420
+ """Plot the specified surface forcing field for a given time slice.
338
421
 
339
422
  Parameters
340
423
  ----------
341
424
  varname : str
342
425
  The name of the surface forcing field to plot. Options include:
426
+
343
427
  - "uwnd": 10 meter wind in x-direction.
344
428
  - "vwnd": 10 meter wind in y-direction.
345
429
  - "swrad": Downward short-wave (solar) radiation.
@@ -353,6 +437,7 @@ class SurfaceForcing(ROMSToolsMixins):
353
437
  - "dust": Dust decomposition.
354
438
  - "nox": NOx decomposition.
355
439
  - "nhy": NHy decomposition.
440
+
356
441
  time : int, optional
357
442
  The time index to plot. Default is 0, which corresponds to the first
358
443
  time slice.
@@ -386,7 +471,9 @@ class SurfaceForcing(ROMSToolsMixins):
386
471
  else:
387
472
  field = field.where(self.grid.ds.mask_rho)
388
473
 
389
- field = field.assign_coords({"lon": self.target_lon, "lat": self.target_lat})
474
+ field = field.assign_coords(
475
+ {"lon": self.target_coords["lon"], "lat": self.target_coords["lat"]}
476
+ )
390
477
 
391
478
  # choose colorbar
392
479
  if varname in ["uwnd", "vwnd"]:
@@ -416,21 +503,22 @@ class SurfaceForcing(ROMSToolsMixins):
416
503
  def save(
417
504
  self, filepath: Union[str, Path], np_eta: int = None, np_xi: int = None
418
505
  ) -> None:
419
- """
420
- Save the surface forcing fields to netCDF4 files.
506
+ """Save the surface forcing fields to netCDF4 files.
421
507
 
422
508
  This method saves the dataset by grouping it into subsets based on the data frequency. The subsets are then written
423
509
  to one or more netCDF4 files. The filenames of the output files reflect the temporal coverage of the data.
424
510
 
425
511
  There are two modes of saving the dataset:
426
512
 
427
- 1. **Single File Mode (default)**:
428
- - If both `np_eta` and `np_xi` are `None`, the entire dataset, divided by temporal subsets, is saved as a single netCDF4 file
429
- with the base filename specified by `filepath.nc`.
513
+ 1. **Single File Mode (default)**:
514
+
515
+ If both `np_eta` and `np_xi` are `None`, the entire dataset, divided by temporal subsets, is saved as a single netCDF4 file
516
+ with the base filename specified by `filepath.nc`.
430
517
 
431
- 2. **Partitioned Mode**:
432
- - If either `np_eta` or `np_xi` is specified, the dataset is divided into spatial tiles along the eta-axis and xi-axis.
433
- - Each spatial tile is saved as a separate netCDF4 file.
518
+ 2. **Partitioned Mode**:
519
+
520
+ - If either `np_eta` or `np_xi` is specified, the dataset is divided into spatial tiles along the eta-axis and xi-axis.
521
+ - Each spatial tile is saved as a separate netCDF4 file.
434
522
 
435
523
  Parameters
436
524
  ----------
@@ -464,8 +552,8 @@ class SurfaceForcing(ROMSToolsMixins):
464
552
  return saved_filenames
465
553
 
466
554
  def to_yaml(self, filepath: Union[str, Path]) -> None:
467
- """
468
- Export the parameters of the class to a YAML file, including the version of roms-tools.
555
+ """Export the parameters of the class to a YAML file, including the version of
556
+ roms-tools.
469
557
 
470
558
  Parameters
471
559
  ----------
@@ -520,8 +608,7 @@ class SurfaceForcing(ROMSToolsMixins):
520
608
  def from_yaml(
521
609
  cls, filepath: Union[str, Path], use_dask: bool = False
522
610
  ) -> "SurfaceForcing":
523
- """
524
- Create an instance of the SurfaceForcing class from a YAML file.
611
+ """Create an instance of the SurfaceForcing class from a YAML file.
525
612
 
526
613
  Parameters
527
614
  ----------