roms-tools 1.4.0__py3-none-any.whl → 1.4.2__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 (250) hide show
  1. ci/environment.yml +1 -8
  2. roms_tools/_version.py +1 -1
  3. roms_tools/setup/boundary_forcing.py +77 -70
  4. roms_tools/setup/datasets.py +38 -59
  5. roms_tools/setup/download.py +3 -6
  6. roms_tools/setup/fill.py +8 -16
  7. roms_tools/setup/grid.py +147 -102
  8. roms_tools/setup/initial_conditions.py +43 -36
  9. roms_tools/setup/mixins.py +10 -14
  10. roms_tools/setup/surface_forcing.py +35 -33
  11. roms_tools/setup/tides.py +37 -41
  12. roms_tools/setup/topography.py +36 -18
  13. roms_tools/setup/utils.py +19 -40
  14. roms_tools/setup/vertical_coordinate.py +4 -6
  15. roms_tools/tests/test_setup/test_boundary_forcing.py +6 -13
  16. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_east/0.0.0 +0 -0
  17. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_north/0.0.0 +0 -0
  18. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_south/0.0.0 +0 -0
  19. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_west/0.0.0 +0 -0
  20. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_east/0.0.0 +0 -0
  21. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_north/0.0.0 +0 -0
  22. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_south/0.0.0 +0 -0
  23. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/0.0.0 +0 -0
  24. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_east/0.0.0 +0 -0
  25. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_north/0.0.0 +0 -0
  26. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_south/0.0.0 +0 -0
  27. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_west/0.0.0 +0 -0
  28. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_east/0.0.0 +0 -0
  29. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_north/0.0.0 +0 -0
  30. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_south/0.0.0 +0 -0
  31. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/0.0.0 +0 -0
  32. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_east/0.0.0 +0 -0
  33. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_north/0.0.0 +0 -0
  34. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_south/0.0.0 +0 -0
  35. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/0.0.0 +0 -0
  36. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_east/0.0.0 +0 -0
  37. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_north/0.0.0 +0 -0
  38. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_south/0.0.0 +0 -0
  39. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_west/0.0.0 +0 -0
  40. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_east/0.0.0 +0 -0
  41. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_north/0.0.0 +0 -0
  42. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_south/0.0.0 +0 -0
  43. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/0.0.0 +0 -0
  44. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_east/0.0.0 +0 -0
  45. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_north/0.0.0 +0 -0
  46. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_south/0.0.0 +0 -0
  47. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/0.0.0 +0 -0
  48. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_east/0.0.0 +0 -0
  49. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_north/0.0.0 +0 -0
  50. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_south/0.0.0 +0 -0
  51. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/0.0.0 +0 -0
  52. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_east/0.0.0 +0 -0
  53. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_north/0.0.0 +0 -0
  54. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_south/0.0.0 +0 -0
  55. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/0.0.0 +0 -0
  56. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_east/0.0.0 +0 -0
  57. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_north/0.0.0 +0 -0
  58. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_south/0.0.0 +0 -0
  59. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/0.0.0 +0 -0
  60. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_east/0.0.0 +0 -0
  61. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_north/0.0.0 +0 -0
  62. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_south/0.0.0 +0 -0
  63. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/0.0.0 +0 -0
  64. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_east/0.0.0 +0 -0
  65. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_north/0.0.0 +0 -0
  66. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_south/0.0.0 +0 -0
  67. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/0.0.0 +0 -0
  68. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_east/0.0.0 +0 -0
  69. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_north/0.0.0 +0 -0
  70. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_south/0.0.0 +0 -0
  71. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/0.0.0 +0 -0
  72. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_east/0.0.0 +0 -0
  73. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_north/0.0.0 +0 -0
  74. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_south/0.0.0 +0 -0
  75. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/0.0.0 +0 -0
  76. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_east/0.0.0 +0 -0
  77. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_north/0.0.0 +0 -0
  78. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_south/0.0.0 +0 -0
  79. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/0.0.0 +0 -0
  80. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_east/0.0.0 +0 -0
  81. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_north/0.0.0 +0 -0
  82. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_south/0.0.0 +0 -0
  83. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/0.0.0 +0 -0
  84. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_east/0.0.0 +0 -0
  85. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_north/0.0.0 +0 -0
  86. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_south/0.0.0 +0 -0
  87. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_west/0.0.0 +0 -0
  88. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_east/0.0.0 +0 -0
  89. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_north/0.0.0 +0 -0
  90. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_south/0.0.0 +0 -0
  91. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_west/0.0.0 +0 -0
  92. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_east/0.0.0 +0 -0
  93. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_north/0.0.0 +0 -0
  94. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_south/0.0.0 +0 -0
  95. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_west/0.0.0 +0 -0
  96. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_east/0.0.0 +0 -0
  97. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_north/0.0.0 +0 -0
  98. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_south/0.0.0 +0 -0
  99. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_west/0.0.0 +0 -0
  100. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_east/0.0.0 +0 -0
  101. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_north/0.0.0 +0 -0
  102. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_south/0.0.0 +0 -0
  103. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_west/0.0.0 +0 -0
  104. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_east/0.0.0 +0 -0
  105. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_north/0.0.0 +0 -0
  106. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_south/0.0.0 +0 -0
  107. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_west/0.0.0 +0 -0
  108. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_east/0.0.0 +0 -0
  109. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_north/0.0.0 +0 -0
  110. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_south/0.0.0 +0 -0
  111. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_west/0.0.0 +0 -0
  112. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_east/0.0.0 +0 -0
  113. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_north/0.0.0 +0 -0
  114. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_south/0.0.0 +0 -0
  115. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_west/0.0.0 +0 -0
  116. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_east/0.0.0 +0 -0
  117. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_north/0.0.0 +0 -0
  118. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_south/0.0.0 +0 -0
  119. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_west/0.0.0 +0 -0
  120. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_east/0.0.0 +0 -0
  121. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_north/0.0.0 +0 -0
  122. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_south/0.0.0 +0 -0
  123. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_west/0.0.0 +0 -0
  124. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_east/0.0.0 +0 -0
  125. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_north/0.0.0 +0 -0
  126. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_south/0.0.0 +0 -0
  127. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_west/0.0.0 +0 -0
  128. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_east/0.0.0 +0 -0
  129. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_north/0.0.0 +0 -0
  130. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_south/0.0.0 +0 -0
  131. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_west/0.0.0 +0 -0
  132. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_east/0.0.0 +0 -0
  133. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_north/0.0.0 +0 -0
  134. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_south/0.0.0 +0 -0
  135. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_west/0.0.0 +0 -0
  136. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_east/0.0.0 +0 -0
  137. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_north/0.0.0 +0 -0
  138. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_south/0.0.0 +0 -0
  139. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_west/0.0.0 +0 -0
  140. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_east/0.0.0 +0 -0
  141. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_north/0.0.0 +0 -0
  142. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_south/0.0.0 +0 -0
  143. roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_west/0.0.0 +0 -0
  144. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_east/0.0.0 +0 -0
  145. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_north/0.0.0 +0 -0
  146. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_south/0.0.0 +0 -0
  147. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_west/0.0.0 +0 -0
  148. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_east/0.0.0 +0 -0
  149. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_north/0.0.0 +0 -0
  150. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_south/0.0.0 +0 -0
  151. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_west/0.0.0 +0 -0
  152. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_east/0.0.0 +0 -0
  153. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_north/0.0.0 +0 -0
  154. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_west/0.0.0 +0 -0
  155. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_east/0.0 +0 -0
  156. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_north/0.0 +0 -0
  157. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_west/0.0 +0 -0
  158. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_east/0.0.0 +0 -0
  159. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_north/0.0.0 +0 -0
  160. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_south/0.0.0 +0 -0
  161. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_west/0.0.0 +0 -0
  162. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_east/0.0 +0 -0
  163. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_north/0.0 +0 -0
  164. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_south/0.0 +0 -0
  165. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_west/0.0 +0 -0
  166. roms_tools/tests/test_setup/test_data/grid.zarr/.zattrs +1 -1
  167. roms_tools/tests/test_setup/test_data/grid.zarr/.zmetadata +1 -1
  168. roms_tools/tests/test_setup/test_data/grid.zarr/angle/0.0 +0 -0
  169. roms_tools/tests/test_setup/test_data/grid.zarr/angle_coarse/0.0 +0 -0
  170. roms_tools/tests/test_setup/test_data/grid.zarr/f/0.0 +0 -0
  171. roms_tools/tests/test_setup/test_data/grid.zarr/h/0.0 +0 -0
  172. roms_tools/tests/test_setup/test_data/grid.zarr/lat_coarse/0.0 +0 -0
  173. roms_tools/tests/test_setup/test_data/grid.zarr/lat_rho/0.0 +0 -0
  174. roms_tools/tests/test_setup/test_data/grid.zarr/lat_u/0.0 +0 -0
  175. roms_tools/tests/test_setup/test_data/grid.zarr/lat_v/0.0 +0 -0
  176. roms_tools/tests/test_setup/test_data/grid.zarr/lon_u/0.0 +0 -0
  177. roms_tools/tests/test_setup/test_data/grid.zarr/pm/0.0 +0 -0
  178. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zattrs +1 -1
  179. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zmetadata +1 -1
  180. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/angle/0.0 +0 -0
  181. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/angle_coarse/0.0 +0 -0
  182. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/f/0.0 +0 -0
  183. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/h/0.0 +0 -0
  184. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_coarse/0.0 +0 -0
  185. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_rho/0.0 +0 -0
  186. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_u/0.0 +0 -0
  187. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_v/0.0 +0 -0
  188. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_coarse/0.0 +0 -0
  189. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_rho/0.0 +0 -0
  190. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_u/0.0 +0 -0
  191. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_v/0.0 +0 -0
  192. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/pm/0.0 +0 -0
  193. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/pn/0.0 +0 -0
  194. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK/0.0.0.0 +0 -0
  195. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK_ALT_CO2/0.0.0.0 +0 -0
  196. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC/0.0.0.0 +0 -0
  197. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC_ALT_CO2/0.0.0.0 +0 -0
  198. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOC/0.0.0.0 +0 -0
  199. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOCr/0.0.0.0 +0 -0
  200. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DON/0.0.0.0 +0 -0
  201. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DONr/0.0.0.0 +0 -0
  202. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOP/0.0.0.0 +0 -0
  203. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOPr/0.0.0.0 +0 -0
  204. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Fe/0.0.0.0 +0 -0
  205. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Lig/0.0.0.0 +0 -0
  206. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NH4/0.0.0.0 +0 -0
  207. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NO3/0.0.0.0 +0 -0
  208. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/O2/0.0.0.0 +0 -0
  209. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/PO4/0.0.0.0 +0 -0
  210. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/SiO3/0.0.0.0 +0 -0
  211. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatC/0.0.0.0 +0 -0
  212. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatChl/0.0.0.0 +0 -0
  213. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatFe/0.0.0.0 +0 -0
  214. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatP/0.0.0.0 +0 -0
  215. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatSi/0.0.0.0 +0 -0
  216. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazC/0.0.0.0 +0 -0
  217. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazChl/0.0.0.0 +0 -0
  218. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazFe/0.0.0.0 +0 -0
  219. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazP/0.0.0.0 +0 -0
  220. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/salt/0.0.0.0 +0 -0
  221. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spC/0.0.0.0 +0 -0
  222. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spCaCO3/0.0.0.0 +0 -0
  223. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spChl/0.0.0.0 +0 -0
  224. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spFe/0.0.0.0 +0 -0
  225. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spP/0.0.0.0 +0 -0
  226. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/temp/0.0.0.0 +0 -0
  227. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/u/0.0.0.0 +0 -0
  228. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ubar/0.0.0 +0 -0
  229. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/v/0.0.0.0 +0 -0
  230. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/vbar/0.0.0 +0 -0
  231. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zooC/0.0.0.0 +0 -0
  232. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Im/0.0.0 +0 -0
  233. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Re/0.0.0 +0 -0
  234. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Im/0.0.0 +0 -0
  235. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Re/0.0.0 +0 -0
  236. roms_tools/tests/test_setup/test_datasets.py +8 -18
  237. roms_tools/tests/test_setup/test_grid.py +58 -2
  238. roms_tools/tests/test_setup/test_initial_conditions.py +4 -7
  239. roms_tools/tests/test_setup/test_surface_forcing.py +58 -58
  240. roms_tools/tests/test_setup/test_tides.py +6 -10
  241. roms_tools/tests/test_setup/test_topography.py +38 -0
  242. roms_tools/tests/test_setup/test_vertical_coordinate.py +2 -6
  243. roms_tools/tests/test_utils.py +30 -0
  244. roms_tools/utils.py +45 -10
  245. roms_tools-1.4.2.dist-info/LICENSE +201 -0
  246. {roms_tools-1.4.0.dist-info → roms_tools-1.4.2.dist-info}/METADATA +3 -1
  247. {roms_tools-1.4.0.dist-info → roms_tools-1.4.2.dist-info}/RECORD +249 -249
  248. {roms_tools-1.4.0.dist-info → roms_tools-1.4.2.dist-info}/WHEEL +1 -1
  249. roms_tools-1.4.0.dist-info/LICENSE +0 -674
  250. {roms_tools-1.4.0.dist-info → roms_tools-1.4.2.dist-info}/top_level.txt +0 -0
@@ -12,22 +12,20 @@ import numpy as np
12
12
 
13
13
  @dataclass(frozen=True, kw_only=True)
14
14
  class ROMSToolsMixins:
15
- """
16
- Represents a mixin tool for ROMS-Tools with capabilities shared by the various
15
+ """Represents a mixin tool for ROMS-Tools with capabilities shared by the various
17
16
  ROMS-Tools dataclasses.
18
17
 
19
18
  Parameters
20
19
  ----------
21
20
  grid : Grid
22
21
  Object representing the grid information used for the model.
23
-
24
22
  """
25
23
 
26
24
  grid: Grid
27
25
 
28
- def get_target_lon_lat(self, use_coarse_grid=False):
29
- """
30
- Retrieves the longitude and latitude arrays from the grid and adjusts them based on the grid's orientation.
26
+ def _get_target_lon_lat(self, use_coarse_grid=False):
27
+ """Retrieves the longitude and latitude arrays from the grid and adjusts them
28
+ based on the grid's orientation.
31
29
 
32
30
  This method provides longitude and latitude coordinates, with options for using a coarse grid
33
31
  if specified. It also handles longitudes to ensure they are between -180 and 180 degrees and adjusts
@@ -67,10 +65,9 @@ class ROMSToolsMixins:
67
65
 
68
66
  return lon, lat, angle, straddle
69
67
 
70
- def regrid_data(self, data, vars_2d, vars_3d, lon, lat):
71
-
72
- """
73
- Interpolates data onto the desired grid and processes it for 2D and 3D variables.
68
+ def _regrid_data(self, data, vars_2d, vars_3d, lon, lat):
69
+ """Interpolates data onto the desired grid and processes it for 2D and 3D
70
+ variables.
74
71
 
75
72
  This method interpolates the specified 2D and 3D variables onto a new grid defined by the provided
76
73
  longitude and latitude coordinates. It handles both 2D and 3D data, performing extrapolation for 3D
@@ -164,10 +161,9 @@ class ROMSToolsMixins:
164
161
 
165
162
  return data_vars
166
163
 
167
- def process_velocities(self, data_vars, angle, uname, vname, interpolate=True):
168
- """
169
- Process and rotate velocity components to align with the grid orientation and optionally interpolate
170
- them to the appropriate grid points.
164
+ def _process_velocities(self, data_vars, angle, uname, vname, interpolate=True):
165
+ """Process and rotate velocity components to align with the grid orientation and
166
+ optionally interpolate them to the appropriate grid points.
171
167
 
172
168
  This method performs the following steps:
173
169
 
@@ -28,8 +28,7 @@ from pathlib import Path
28
28
 
29
29
  @dataclass(frozen=True, kw_only=True)
30
30
  class SurfaceForcing(ROMSToolsMixins):
31
- """
32
- Represents surface forcing input data for ROMS.
31
+ """Represents surface forcing input data for ROMS.
33
32
 
34
33
  Parameters
35
34
  ----------
@@ -40,14 +39,22 @@ class SurfaceForcing(ROMSToolsMixins):
40
39
  end_time : datetime
41
40
  End time of the desired surface forcing data.
42
41
  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.
42
+ Dictionary specifying the source of the surface forcing data. Keys include:
43
+
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). This can be:
46
+
47
+ - A single string (with or without wildcards).
48
+ - A single Path object.
49
+ - A list of strings or Path objects containing multiple files.
50
+ - "climatology" (bool): Indicates if the data is climatology data. Defaults to False.
51
+
48
52
  type : str
49
- Specifies the type of forcing data, either "physics" for physical
50
- atmospheric forcing or "bgc" for biogeochemical forcing.
53
+ Specifies the type of forcing data. Options are:
54
+
55
+ - "physics": for physical atmospheric forcing.
56
+ - "bgc": for biogeochemical forcing.
57
+
51
58
  correct_radiation : bool
52
59
  Whether to correct shortwave radiation. Default is False.
53
60
  use_coarse_grid: bool
@@ -57,12 +64,6 @@ class SurfaceForcing(ROMSToolsMixins):
57
64
  use_dask: bool, optional
58
65
  Indicates whether to use dask for processing. If True, data is processed with dask; if False, data is processed eagerly. Defaults to False.
59
66
 
60
- Attributes
61
- ----------
62
- ds : xr.Dataset
63
- Xarray Dataset containing the surface forcing data.
64
-
65
-
66
67
  Examples
67
68
  --------
68
69
  >>> surface_forcing = SurfaceForcing(
@@ -90,7 +91,7 @@ class SurfaceForcing(ROMSToolsMixins):
90
91
  def __post_init__(self):
91
92
 
92
93
  self._input_checks()
93
- lon, lat, angle, straddle = super().get_target_lon_lat(self.use_coarse_grid)
94
+ lon, lat, angle, straddle = super()._get_target_lon_lat(self.use_coarse_grid)
94
95
  object.__setattr__(self, "target_lon", lon)
95
96
  object.__setattr__(self, "target_lat", lat)
96
97
 
@@ -107,10 +108,10 @@ class SurfaceForcing(ROMSToolsMixins):
107
108
  vars_2d = data.var_names.keys()
108
109
  vars_3d = []
109
110
 
110
- data_vars = super().regrid_data(data, vars_2d, vars_3d, lon, lat)
111
+ data_vars = super()._regrid_data(data, vars_2d, vars_3d, lon, lat)
111
112
 
112
113
  if self.type == "physics":
113
- data_vars = super().process_velocities(
114
+ data_vars = super()._process_velocities(
114
115
  data_vars, angle, "uwnd", "vwnd", interpolate=False
115
116
  )
116
117
  if self.correct_radiation:
@@ -136,7 +137,7 @@ class SurfaceForcing(ROMSToolsMixins):
136
137
  vars_2d = ["swr_corr"]
137
138
  vars_3d = []
138
139
  # spatial interpolation
139
- data_vars_corr = super().regrid_data(
140
+ data_vars_corr = super()._regrid_data(
140
141
  correction_data, vars_2d, vars_3d, lon, lat
141
142
  )
142
143
  # temporal interpolation
@@ -333,13 +334,13 @@ class SurfaceForcing(ROMSToolsMixins):
333
334
  return ds
334
335
 
335
336
  def plot(self, varname, time=0) -> None:
336
- """
337
- Plot the specified surface forcing field for a given time slice.
337
+ """Plot the specified surface forcing field for a given time slice.
338
338
 
339
339
  Parameters
340
340
  ----------
341
341
  varname : str
342
342
  The name of the surface forcing field to plot. Options include:
343
+
343
344
  - "uwnd": 10 meter wind in x-direction.
344
345
  - "vwnd": 10 meter wind in y-direction.
345
346
  - "swrad": Downward short-wave (solar) radiation.
@@ -353,6 +354,7 @@ class SurfaceForcing(ROMSToolsMixins):
353
354
  - "dust": Dust decomposition.
354
355
  - "nox": NOx decomposition.
355
356
  - "nhy": NHy decomposition.
357
+
356
358
  time : int, optional
357
359
  The time index to plot. Default is 0, which corresponds to the first
358
360
  time slice.
@@ -416,21 +418,22 @@ class SurfaceForcing(ROMSToolsMixins):
416
418
  def save(
417
419
  self, filepath: Union[str, Path], np_eta: int = None, np_xi: int = None
418
420
  ) -> None:
419
- """
420
- Save the surface forcing fields to netCDF4 files.
421
+ """Save the surface forcing fields to netCDF4 files.
421
422
 
422
423
  This method saves the dataset by grouping it into subsets based on the data frequency. The subsets are then written
423
424
  to one or more netCDF4 files. The filenames of the output files reflect the temporal coverage of the data.
424
425
 
425
426
  There are two modes of saving the dataset:
426
427
 
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`.
428
+ 1. **Single File Mode (default)**:
430
429
 
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.
430
+ If both `np_eta` and `np_xi` are `None`, the entire dataset, divided by temporal subsets, is saved as a single netCDF4 file
431
+ with the base filename specified by `filepath.nc`.
432
+
433
+ 2. **Partitioned Mode**:
434
+
435
+ - If either `np_eta` or `np_xi` is specified, the dataset is divided into spatial tiles along the eta-axis and xi-axis.
436
+ - Each spatial tile is saved as a separate netCDF4 file.
434
437
 
435
438
  Parameters
436
439
  ----------
@@ -464,8 +467,8 @@ class SurfaceForcing(ROMSToolsMixins):
464
467
  return saved_filenames
465
468
 
466
469
  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.
470
+ """Export the parameters of the class to a YAML file, including the version of
471
+ roms-tools.
469
472
 
470
473
  Parameters
471
474
  ----------
@@ -520,8 +523,7 @@ class SurfaceForcing(ROMSToolsMixins):
520
523
  def from_yaml(
521
524
  cls, filepath: Union[str, Path], use_dask: bool = False
522
525
  ) -> "SurfaceForcing":
523
- """
524
- Create an instance of the SurfaceForcing class from a YAML file.
526
+ """Create an instance of the SurfaceForcing class from a YAML file.
525
527
 
526
528
  Parameters
527
529
  ----------
roms_tools/setup/tides.py CHANGED
@@ -24,18 +24,22 @@ from pathlib import Path
24
24
 
25
25
  @dataclass(frozen=True, kw_only=True)
26
26
  class TidalForcing(ROMSToolsMixins):
27
- """
28
- Represents tidal forcing data used in ocean modeling.
27
+ """Represents tidal forcing data used in ocean modeling.
29
28
 
30
29
  Parameters
31
30
  ----------
32
31
  grid : Grid
33
32
  The grid object representing the ROMS grid associated with the tidal forcing data.
34
33
  source : Dict[str, Union[str, Path, List[Union[str, Path]]]]
35
- Dictionary specifying the source of the tidal data:
36
- - "name" (str): Name of the data source (e.g., "TPXO").
37
- - "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),
38
- a single Path object, or a list of strings or Path objects containing multiple files.
34
+ Dictionary specifying the source of the tidal data. Keys include:
35
+
36
+ - "name" (str): Name of the data source (e.g., "TPXO").
37
+ - "path" (Union[str, Path, List[Union[str, Path]]]): The path to the raw data file(s). This can be:
38
+
39
+ - A single string (with or without wildcards).
40
+ - A single Path object.
41
+ - A list of strings or Path objects containing multiple files.
42
+
39
43
  ntides : int, optional
40
44
  Number of constituents to consider. Maximum number is 14. Default is 10.
41
45
  allan_factor : float, optional
@@ -45,11 +49,6 @@ class TidalForcing(ROMSToolsMixins):
45
49
  use_dask: bool, optional
46
50
  Indicates whether to use dask for processing. If True, data is processed with dask; if False, data is processed eagerly. Defaults to False.
47
51
 
48
- Attributes
49
- ----------
50
- ds : xr.Dataset
51
- The xarray Dataset containing the tidal forcing data.
52
-
53
52
  Examples
54
53
  --------
55
54
  >>> tidal_forcing = TidalForcing(
@@ -69,7 +68,7 @@ class TidalForcing(ROMSToolsMixins):
69
68
  def __post_init__(self):
70
69
 
71
70
  self._input_checks()
72
- lon, lat, angle, straddle = super().get_target_lon_lat()
71
+ lon, lat, angle, straddle = super()._get_target_lon_lat()
73
72
 
74
73
  data = self._get_data()
75
74
 
@@ -98,12 +97,12 @@ class TidalForcing(ROMSToolsMixins):
98
97
  ]
99
98
  vars_3d = []
100
99
 
101
- data_vars = super().regrid_data(data, vars_2d, vars_3d, lon, lat)
100
+ data_vars = super()._regrid_data(data, vars_2d, vars_3d, lon, lat)
102
101
 
103
- data_vars = super().process_velocities(
102
+ data_vars = super()._process_velocities(
104
103
  data_vars, angle, "u_Re", "v_Re", interpolate=False
105
104
  )
106
- data_vars = super().process_velocities(
105
+ data_vars = super()._process_velocities(
107
106
  data_vars, angle, "u_Im", "v_Im", interpolate=False
108
107
  )
109
108
 
@@ -180,13 +179,13 @@ class TidalForcing(ROMSToolsMixins):
180
179
  return ds
181
180
 
182
181
  def plot(self, varname, ntides=0) -> None:
183
- """
184
- Plot the specified tidal forcing variable for a given tidal constituent.
182
+ """Plot the specified tidal forcing variable for a given tidal constituent.
185
183
 
186
184
  Parameters
187
185
  ----------
188
186
  varname : str
189
187
  The tidal forcing variable to plot. Options include:
188
+
190
189
  - "ssh_Re": Real part of tidal elevation.
191
190
  - "ssh_Im": Imaginary part of tidal elevation.
192
191
  - "pot_Re": Real part of tidal potential.
@@ -195,6 +194,7 @@ class TidalForcing(ROMSToolsMixins):
195
194
  - "u_Im": Imaginary part of tidal velocity in the x-direction.
196
195
  - "v_Re": Real part of tidal velocity in the y-direction.
197
196
  - "v_Im": Imaginary part of tidal velocity in the y-direction.
197
+
198
198
  ntides : int, optional
199
199
  The index of the tidal constituent to plot. Default is 0, which corresponds
200
200
  to the first constituent.
@@ -258,17 +258,19 @@ class TidalForcing(ROMSToolsMixins):
258
258
  def save(
259
259
  self, filepath: Union[str, Path], np_eta: int = None, np_xi: int = None
260
260
  ) -> None:
261
- """
262
- Save the tidal forcing information to a netCDF4 file.
261
+ """Save the tidal forcing information to a netCDF4 file.
263
262
 
264
263
  This method supports saving the dataset in two modes:
265
264
 
266
- 1. **Single File Mode (default)**:
267
- - If both `np_eta` and `np_xi` are `None`, the entire dataset is saved as a single file at the specified `filepath.nc`.
265
+ 1. **Single File Mode (default)**:
266
+
267
+ If both `np_eta` and `np_xi` are `None`, the entire dataset is saved as a single netCDF4 file
268
+ with the base filename specified by `filepath.nc`.
268
269
 
269
- 2. **Partitioned Mode**:
270
- - If either `np_eta` or `np_xi` is specified, the dataset is divided into spatial tiles along the eta-axis and xi-axis.
271
- - The files are saved as `filepath.0.nc`, `filepath.1.nc`, ..., where the numbering corresponds to the partition index.
270
+ 2. **Partitioned Mode**:
271
+
272
+ - If either `np_eta` or `np_xi` is specified, the dataset is divided into spatial tiles along the eta-axis and xi-axis.
273
+ - Each spatial tile is saved as a separate netCDF4 file.
272
274
 
273
275
  Parameters
274
276
  ----------
@@ -302,8 +304,8 @@ class TidalForcing(ROMSToolsMixins):
302
304
  return saved_filenames
303
305
 
304
306
  def to_yaml(self, filepath: Union[str, Path]) -> None:
305
- """
306
- Export the parameters of the class to a YAML file, including the version of roms-tools.
307
+ """Export the parameters of the class to a YAML file, including the version of
308
+ roms-tools.
307
309
 
308
310
  Parameters
309
311
  ----------
@@ -351,8 +353,7 @@ class TidalForcing(ROMSToolsMixins):
351
353
  def from_yaml(
352
354
  cls, filepath: Union[str, Path], use_dask: bool = False
353
355
  ) -> "TidalForcing":
354
- """
355
- Create an instance of the TidalForcing class from a YAML file.
356
+ """Create an instance of the TidalForcing class from a YAML file.
356
357
 
357
358
  Parameters
358
359
  ----------
@@ -400,10 +401,10 @@ class TidalForcing(ROMSToolsMixins):
400
401
  return cls(grid=grid, **tidal_forcing_params, use_dask=use_dask)
401
402
 
402
403
  def _correct_tides(self, data):
403
- """
404
- Apply tidal corrections to the dataset.
405
- This method corrects the dataset for equilibrium tides, self-attraction and loading (SAL) effects, and
406
- adjusts phases and amplitudes of tidal elevations and transports using Egbert's correction.
404
+ """Apply tidal corrections to the dataset. This method corrects the dataset for
405
+ equilibrium tides, self-attraction and loading (SAL) effects, and adjusts phases
406
+ and amplitudes of tidal elevations and transports using Egbert's correction.
407
+
407
408
  Parameters
408
409
  ----------
409
410
  data : Dataset
@@ -460,8 +461,7 @@ class TidalForcing(ROMSToolsMixins):
460
461
 
461
462
 
462
463
  def modified_julian_days(year, month, day, hour=0):
463
- """
464
- Calculate the Modified Julian Day (MJD) for a given date and time.
464
+ """Calculate the Modified Julian Day (MJD) for a given date and time.
465
465
 
466
466
  The Modified Julian Day (MJD) is a modified Julian day count starting from
467
467
  November 17, 1858 AD. It is commonly used in astronomy and geodesy.
@@ -519,9 +519,8 @@ def modified_julian_days(year, month, day, hour=0):
519
519
 
520
520
 
521
521
  def egbert_correction(date):
522
- """
523
- Correct phases and amplitudes for real-time runs using parts of the
524
- post-processing code from Egbert's & Erofeeva's (OSU) TPXO model.
522
+ """Correct phases and amplitudes for real-time runs using parts of the post-
523
+ processing code from Egbert's & Erofeeva's (OSU) TPXO model.
525
524
 
526
525
  Parameters
527
526
  ----------
@@ -541,7 +540,6 @@ def egbert_correction(date):
541
540
  ----------
542
541
  - Egbert, G.D., and S.Y. Erofeeva. "Efficient inverse modeling of barotropic ocean
543
542
  tides." Journal of Atmospheric and Oceanic Technology 19, no. 2 (2002): 183-204.
544
-
545
543
  """
546
544
 
547
545
  year = date.year
@@ -676,8 +674,7 @@ def egbert_correction(date):
676
674
 
677
675
 
678
676
  def compute_equilibrium_tide(lon, lat):
679
- """
680
- Compute equilibrium tide for given longitudes and latitudes.
677
+ """Compute equilibrium tide for given longitudes and latitudes.
681
678
 
682
679
  Parameters
683
680
  ----------
@@ -699,7 +696,6 @@ def compute_equilibrium_tide(lon, lat):
699
696
  - 2: semidiurnal
700
697
  - 1: diurnal
701
698
  - 0: long-term
702
-
703
699
  """
704
700
 
705
701
  # Amplitudes and elasticity factors for 15 tidal constituents
@@ -12,8 +12,8 @@ from itertools import count
12
12
  def _add_topography_and_mask(
13
13
  ds, topography_source, hmin, smooth_factor=8.0, rmax=0.2
14
14
  ) -> xr.Dataset:
15
- """
16
- Adds topography and a land/water mask to the dataset based on the provided topography source.
15
+ """Adds topography and a land/water mask to the dataset based on the provided
16
+ topography source.
17
17
 
18
18
  This function performs the following operations:
19
19
  1. Interpolates topography data onto the desired grid.
@@ -61,6 +61,10 @@ def _add_topography_and_mask(
61
61
 
62
62
  # fill enclosed basins with land
63
63
  mask = _fill_enclosed_basins(mask.values)
64
+
65
+ # adjust mask boundaries by copying values from adjacent cells
66
+ mask = _handle_boundaries(mask)
67
+
64
68
  ds["mask_rho"] = xr.DataArray(mask.astype(np.int32), dims=("eta_rho", "xi_rho"))
65
69
  ds["mask_rho"].attrs = {
66
70
  "long_name": "Mask at rho-points",
@@ -82,9 +86,8 @@ def _add_topography_and_mask(
82
86
 
83
87
 
84
88
  def _make_raw_topography(lon, lat, topography_source) -> np.ndarray:
85
- """
86
- Given a grid of (lon, lat) points, fetch the topography file and interpolate height values onto the desired grid.
87
- """
89
+ """Given a grid of (lon, lat) points, fetch the topography file and interpolate
90
+ height values onto the desired grid."""
88
91
 
89
92
  topo_ds = fetch_topo(topography_source)
90
93
 
@@ -146,9 +149,7 @@ def _smooth_topography_globally(hraw, factor) -> xr.DataArray:
146
149
 
147
150
 
148
151
  def _fill_enclosed_basins(mask) -> np.ndarray:
149
- """
150
- Fills in enclosed basins with land
151
- """
152
+ """Fills in enclosed basins with land."""
152
153
 
153
154
  # Label connected regions in the mask
154
155
  reg, nreg = label(mask)
@@ -170,9 +171,7 @@ def _fill_enclosed_basins(mask) -> np.ndarray:
170
171
 
171
172
 
172
173
  def _smooth_topography_locally(h, hmin=5, rmax=0.2):
173
- """
174
- Smoothes topography locally to satisfy r < rmax
175
- """
174
+ """Smoothes topography locally to satisfy r < rmax."""
176
175
  # Compute rmax_log
177
176
  if rmax > 0.0:
178
177
  rmax_log = np.log((1.0 + rmax * 0.9) / (1.0 - rmax * 0.9))
@@ -233,10 +232,7 @@ def _smooth_topography_locally(h, hmin=5, rmax=0.2):
233
232
  )
234
233
 
235
234
  # No gradient at the domain boundaries
236
- h_log[0, :] = h_log[1, :]
237
- h_log[-1, :] = h_log[-2, :]
238
- h_log[:, 0] = h_log[:, 1]
239
- h_log[:, -1] = h_log[:, -2]
235
+ h_log = _handle_boundaries(h_log)
240
236
 
241
237
  # Update h
242
238
  h = hmin * np.exp(h_log)
@@ -252,10 +248,32 @@ def _smooth_topography_locally(h, hmin=5, rmax=0.2):
252
248
  return h
253
249
 
254
250
 
255
- def _compute_rfactor(h):
256
- """
257
- Computes slope parameter (or r-factor) r = |Delta h| / 2h in both horizontal grid directions.
251
+ def _handle_boundaries(field):
252
+ """Adjust the boundaries of a 2D field by copying values from adjacent cells.
253
+
254
+ Parameters
255
+ ----------
256
+ field : numpy.ndarray or xarray.DataArray
257
+ A 2D array representing a field (e.g., topography or mask) whose boundary values
258
+ need to be adjusted.
259
+
260
+ Returns
261
+ -------
262
+ field : numpy.ndarray or xarray.DataArray
263
+ The input field with adjusted boundary values.
258
264
  """
265
+
266
+ field[0, :] = field[1, :]
267
+ field[-1, :] = field[-2, :]
268
+ field[:, 0] = field[:, 1]
269
+ field[:, -1] = field[:, -2]
270
+
271
+ return field
272
+
273
+
274
+ def _compute_rfactor(h):
275
+ """Computes slope parameter (or r-factor) r = |Delta h| / 2h in both horizontal grid
276
+ directions."""
259
277
  # compute r_{i-1/2} = |h_i - h_{i-1}| / (h_i + h_{i+1})
260
278
  r_eta = np.abs(h.diff("eta_rho")) / (h + h.shift(eta_rho=1)).isel(
261
279
  eta_rho=slice(1, None)