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
roms_tools/setup/tides.py CHANGED
@@ -16,26 +16,34 @@ from roms_tools.setup.utils import (
16
16
  interpolate_from_rho_to_v,
17
17
  get_variable_metadata,
18
18
  save_datasets,
19
+ get_target_coords,
20
+ rotate_velocities,
21
+ get_vector_pairs,
19
22
  )
20
- from roms_tools.setup.mixins import ROMSToolsMixins
23
+ from roms_tools.setup.fill import _lateral_fill
24
+ from roms_tools.setup.regrid import _lateral_regrid
21
25
  import matplotlib.pyplot as plt
22
26
  from pathlib import Path
23
27
 
24
28
 
25
29
  @dataclass(frozen=True, kw_only=True)
26
- class TidalForcing(ROMSToolsMixins):
27
- """
28
- Represents tidal forcing data used in ocean modeling.
30
+ class TidalForcing:
31
+ """Represents tidal forcing for ROMS.
29
32
 
30
33
  Parameters
31
34
  ----------
32
35
  grid : Grid
33
36
  The grid object representing the ROMS grid associated with the tidal forcing data.
34
37
  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.
38
+ Dictionary specifying the source of the tidal data. Keys include:
39
+
40
+ - "name" (str): Name of the data source (e.g., "TPXO").
41
+ - "path" (Union[str, Path, List[Union[str, Path]]]): The path to the raw data file(s). This can be:
42
+
43
+ - A single string (with or without wildcards).
44
+ - A single Path object.
45
+ - A list of strings or Path objects containing multiple files.
46
+
39
47
  ntides : int, optional
40
48
  Number of constituents to consider. Maximum number is 14. Default is 10.
41
49
  allan_factor : float, optional
@@ -45,11 +53,6 @@ class TidalForcing(ROMSToolsMixins):
45
53
  use_dask: bool, optional
46
54
  Indicates whether to use dask for processing. If True, data is processed with dask; if False, data is processed eagerly. Defaults to False.
47
55
 
48
- Attributes
49
- ----------
50
- ds : xr.Dataset
51
- The xarray Dataset containing the tidal forcing data.
52
-
53
56
  Examples
54
57
  --------
55
58
  >>> tidal_forcing = TidalForcing(
@@ -69,49 +72,58 @@ class TidalForcing(ROMSToolsMixins):
69
72
  def __post_init__(self):
70
73
 
71
74
  self._input_checks()
72
- lon, lat, angle, straddle = super().get_target_lon_lat()
75
+ target_coords = get_target_coords(self.grid)
73
76
 
74
77
  data = self._get_data()
75
-
76
78
  data.check_number_constituents(self.ntides)
77
79
  data.choose_subdomain(
78
- latitude_range=[lat.min().values, lat.max().values],
79
- longitude_range=[lon.min().values, lon.max().values],
80
+ latitude_range=[
81
+ target_coords["lat"].min().values,
82
+ target_coords["lat"].max().values,
83
+ ],
84
+ longitude_range=[
85
+ target_coords["lon"].min().values,
86
+ target_coords["lon"].max().values,
87
+ ],
80
88
  margin=2,
81
- straddle=straddle,
89
+ straddle=target_coords["straddle"],
82
90
  )
83
-
84
91
  # select desired number of constituents
85
92
  object.__setattr__(data, "ds", data.ds.isel(ntides=slice(None, self.ntides)))
86
-
87
93
  self._correct_tides(data)
88
94
 
89
- vars_2d = [
90
- "ssh_Re",
91
- "ssh_Im",
92
- "pot_Re",
93
- "pot_Im",
94
- "u_Re",
95
- "u_Im",
96
- "v_Re",
97
- "v_Im",
98
- ]
99
- vars_3d = []
100
-
101
- data_vars = super().regrid_data(data, vars_2d, vars_3d, lon, lat)
102
-
103
- data_vars = super().process_velocities(
104
- data_vars, angle, "u_Re", "v_Re", interpolate=False
105
- )
106
- data_vars = super().process_velocities(
107
- data_vars, angle, "u_Im", "v_Im", interpolate=False
95
+ variable_info = self._set_variable_info()
96
+
97
+ data_vars = {}
98
+ for var_name in data.var_names:
99
+ data_vars[var_name] = data.ds[data.var_names[var_name]]
100
+
101
+ data_vars = _lateral_fill(data_vars, data)
102
+
103
+ # lateral regridding
104
+ var_names = variable_info.keys()
105
+ data_vars = _lateral_regrid(
106
+ data, target_coords["lon"], target_coords["lat"], data_vars, var_names
108
107
  )
109
108
 
110
- # Convert to barotropic velocity
109
+ # rotation of velocities and interpolation to u/v points
110
+ vector_pairs = get_vector_pairs(variable_info)
111
+ for pair in vector_pairs:
112
+ u_component = pair[0]
113
+ v_component = pair[1]
114
+ if u_component in data_vars and v_component in data_vars:
115
+ (data_vars[u_component], data_vars[v_component],) = rotate_velocities(
116
+ data_vars[u_component],
117
+ data_vars[v_component],
118
+ target_coords["angle"],
119
+ interpolate=False,
120
+ )
121
+
122
+ # convert to barotropic velocity
111
123
  for varname in ["u_Re", "v_Re", "u_Im", "v_Im"]:
112
124
  data_vars[varname] = data_vars[varname] / self.grid.ds.h
113
125
 
114
- # Interpolate from rho- to velocity points
126
+ # interpolate from rho- to velocity points
115
127
  for uname in ["u_Re", "u_Im"]:
116
128
  data_vars[uname] = interpolate_from_rho_to_u(data_vars[uname])
117
129
  for vname in ["v_Re", "v_Im"]:
@@ -148,6 +160,62 @@ class TidalForcing(ROMSToolsMixins):
148
160
  raise ValueError('Only "TPXO" is a valid option for source["name"].')
149
161
  return data
150
162
 
163
+ def _set_variable_info(self):
164
+ """Sets up a dictionary with metadata for variables based on the type.
165
+
166
+ The dictionary contains the following information:
167
+ - `location`: Where the variable resides in the grid (e.g., rho, u, or v points).
168
+ - `is_vector`: Whether the variable is part of a vector (True for velocity components like 'u' and 'v').
169
+ - `vector_pair`: For vector variables, this indicates the associated variable that forms the vector (e.g., 'u' and 'v').
170
+ - `is_3d`: Indicates whether the variable is 3D (True for variables like 'temp' and 'salt') or 2D (False for 'zeta').
171
+
172
+ Returns
173
+ -------
174
+ dict
175
+ A dictionary where the keys are variable names and the values are dictionaries of metadata
176
+ about each variable, including 'location', 'is_vector', 'vector_pair', and 'is_3d'.
177
+ """
178
+ default_info = {
179
+ "location": "rho",
180
+ "is_vector": False,
181
+ "vector_pair": None,
182
+ "is_3d": False,
183
+ }
184
+
185
+ # Define a dictionary for variable names and their associated information
186
+ variable_info = {
187
+ "ssh_Re": default_info,
188
+ "ssh_Im": default_info,
189
+ "pot_Re": default_info,
190
+ "pot_Im": default_info,
191
+ "u_Re": {
192
+ "location": "u",
193
+ "is_vector": True,
194
+ "vector_pair": "v_Re",
195
+ "is_3d": False,
196
+ },
197
+ "v_Re": {
198
+ "location": "v",
199
+ "is_vector": True,
200
+ "vector_pair": "u_Re",
201
+ "is_3d": False,
202
+ },
203
+ "u_Im": {
204
+ "location": "u",
205
+ "is_vector": True,
206
+ "vector_pair": "v_Im",
207
+ "is_3d": False,
208
+ },
209
+ "v_Im": {
210
+ "location": "v",
211
+ "is_vector": True,
212
+ "vector_pair": "u_Im",
213
+ "is_3d": False,
214
+ },
215
+ }
216
+
217
+ return variable_info
218
+
151
219
  def _write_into_dataset(self, data_vars, d_meta):
152
220
 
153
221
  # save in new dataset
@@ -180,13 +248,13 @@ class TidalForcing(ROMSToolsMixins):
180
248
  return ds
181
249
 
182
250
  def plot(self, varname, ntides=0) -> None:
183
- """
184
- Plot the specified tidal forcing variable for a given tidal constituent.
251
+ """Plot the specified tidal forcing variable for a given tidal constituent.
185
252
 
186
253
  Parameters
187
254
  ----------
188
255
  varname : str
189
256
  The tidal forcing variable to plot. Options include:
257
+
190
258
  - "ssh_Re": Real part of tidal elevation.
191
259
  - "ssh_Im": Imaginary part of tidal elevation.
192
260
  - "pot_Re": Real part of tidal potential.
@@ -195,6 +263,7 @@ class TidalForcing(ROMSToolsMixins):
195
263
  - "u_Im": Imaginary part of tidal velocity in the x-direction.
196
264
  - "v_Re": Real part of tidal velocity in the y-direction.
197
265
  - "v_Im": Imaginary part of tidal velocity in the y-direction.
266
+
198
267
  ntides : int, optional
199
268
  The index of the tidal constituent to plot. Default is 0, which corresponds
200
269
  to the first constituent.
@@ -258,17 +327,19 @@ class TidalForcing(ROMSToolsMixins):
258
327
  def save(
259
328
  self, filepath: Union[str, Path], np_eta: int = None, np_xi: int = None
260
329
  ) -> None:
261
- """
262
- Save the tidal forcing information to a netCDF4 file.
330
+ """Save the tidal forcing information to a netCDF4 file.
263
331
 
264
332
  This method supports saving the dataset in two modes:
265
333
 
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`.
334
+ 1. **Single File Mode (default)**:
335
+
336
+ If both `np_eta` and `np_xi` are `None`, the entire dataset is saved as a single netCDF4 file
337
+ with the base filename specified by `filepath.nc`.
268
338
 
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.
339
+ 2. **Partitioned Mode**:
340
+
341
+ - If either `np_eta` or `np_xi` is specified, the dataset is divided into spatial tiles along the eta-axis and xi-axis.
342
+ - Each spatial tile is saved as a separate netCDF4 file.
272
343
 
273
344
  Parameters
274
345
  ----------
@@ -302,8 +373,8 @@ class TidalForcing(ROMSToolsMixins):
302
373
  return saved_filenames
303
374
 
304
375
  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.
376
+ """Export the parameters of the class to a YAML file, including the version of
377
+ roms-tools.
307
378
 
308
379
  Parameters
309
380
  ----------
@@ -351,8 +422,7 @@ class TidalForcing(ROMSToolsMixins):
351
422
  def from_yaml(
352
423
  cls, filepath: Union[str, Path], use_dask: bool = False
353
424
  ) -> "TidalForcing":
354
- """
355
- Create an instance of the TidalForcing class from a YAML file.
425
+ """Create an instance of the TidalForcing class from a YAML file.
356
426
 
357
427
  Parameters
358
428
  ----------
@@ -400,10 +470,10 @@ class TidalForcing(ROMSToolsMixins):
400
470
  return cls(grid=grid, **tidal_forcing_params, use_dask=use_dask)
401
471
 
402
472
  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.
473
+ """Apply tidal corrections to the dataset. This method corrects the dataset for
474
+ equilibrium tides, self-attraction and loading (SAL) effects, and adjusts phases
475
+ and amplitudes of tidal elevations and transports using Egbert's correction.
476
+
407
477
  Parameters
408
478
  ----------
409
479
  data : Dataset
@@ -456,12 +526,14 @@ class TidalForcing(ROMSToolsMixins):
456
526
 
457
527
  # Update var_names dictionary
458
528
  var_names = {**data.var_names, "pot_Re": "pot_Re", "pot_Im": "pot_Im"}
529
+ var_names.pop("sal_Re", None) # Remove "sal_Re" if it exists
530
+ var_names.pop("sal_Im", None) # Remove "sal_Im" if it exists
531
+
459
532
  object.__setattr__(data, "var_names", var_names)
460
533
 
461
534
 
462
535
  def modified_julian_days(year, month, day, hour=0):
463
- """
464
- Calculate the Modified Julian Day (MJD) for a given date and time.
536
+ """Calculate the Modified Julian Day (MJD) for a given date and time.
465
537
 
466
538
  The Modified Julian Day (MJD) is a modified Julian day count starting from
467
539
  November 17, 1858 AD. It is commonly used in astronomy and geodesy.
@@ -519,9 +591,8 @@ def modified_julian_days(year, month, day, hour=0):
519
591
 
520
592
 
521
593
  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.
594
+ """Correct phases and amplitudes for real-time runs using parts of the post-
595
+ processing code from Egbert's & Erofeeva's (OSU) TPXO model.
525
596
 
526
597
  Parameters
527
598
  ----------
@@ -541,7 +612,6 @@ def egbert_correction(date):
541
612
  ----------
542
613
  - Egbert, G.D., and S.Y. Erofeeva. "Efficient inverse modeling of barotropic ocean
543
614
  tides." Journal of Atmospheric and Oceanic Technology 19, no. 2 (2002): 183-204.
544
-
545
615
  """
546
616
 
547
617
  year = date.year
@@ -676,8 +746,7 @@ def egbert_correction(date):
676
746
 
677
747
 
678
748
  def compute_equilibrium_tide(lon, lat):
679
- """
680
- Compute equilibrium tide for given longitudes and latitudes.
749
+ """Compute equilibrium tide for given longitudes and latitudes.
681
750
 
682
751
  Parameters
683
752
  ----------
@@ -699,7 +768,6 @@ def compute_equilibrium_tide(lon, lat):
699
768
  - 2: semidiurnal
700
769
  - 1: diurnal
701
770
  - 0: long-term
702
-
703
771
  """
704
772
 
705
773
  # 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.
@@ -86,9 +86,8 @@ def _add_topography_and_mask(
86
86
 
87
87
 
88
88
  def _make_raw_topography(lon, lat, topography_source) -> np.ndarray:
89
- """
90
- Given a grid of (lon, lat) points, fetch the topography file and interpolate height values onto the desired grid.
91
- """
89
+ """Given a grid of (lon, lat) points, fetch the topography file and interpolate
90
+ height values onto the desired grid."""
92
91
 
93
92
  topo_ds = fetch_topo(topography_source)
94
93
 
@@ -150,9 +149,7 @@ def _smooth_topography_globally(hraw, factor) -> xr.DataArray:
150
149
 
151
150
 
152
151
  def _fill_enclosed_basins(mask) -> np.ndarray:
153
- """
154
- Fills in enclosed basins with land
155
- """
152
+ """Fills in enclosed basins with land."""
156
153
 
157
154
  # Label connected regions in the mask
158
155
  reg, nreg = label(mask)
@@ -174,9 +171,7 @@ def _fill_enclosed_basins(mask) -> np.ndarray:
174
171
 
175
172
 
176
173
  def _smooth_topography_locally(h, hmin=5, rmax=0.2):
177
- """
178
- Smoothes topography locally to satisfy r < rmax
179
- """
174
+ """Smoothes topography locally to satisfy r < rmax."""
180
175
  # Compute rmax_log
181
176
  if rmax > 0.0:
182
177
  rmax_log = np.log((1.0 + rmax * 0.9) / (1.0 - rmax * 0.9))
@@ -254,8 +249,7 @@ def _smooth_topography_locally(h, hmin=5, rmax=0.2):
254
249
 
255
250
 
256
251
  def _handle_boundaries(field):
257
- """
258
- Adjust the boundaries of a 2D field by copying values from adjacent cells.
252
+ """Adjust the boundaries of a 2D field by copying values from adjacent cells.
259
253
 
260
254
  Parameters
261
255
  ----------
@@ -267,7 +261,6 @@ def _handle_boundaries(field):
267
261
  -------
268
262
  field : numpy.ndarray or xarray.DataArray
269
263
  The input field with adjusted boundary values.
270
-
271
264
  """
272
265
 
273
266
  field[0, :] = field[1, :]
@@ -279,9 +272,8 @@ def _handle_boundaries(field):
279
272
 
280
273
 
281
274
  def _compute_rfactor(h):
282
- """
283
- Computes slope parameter (or r-factor) r = |Delta h| / 2h in both horizontal grid directions.
284
- """
275
+ """Computes slope parameter (or r-factor) r = |Delta h| / 2h in both horizontal grid
276
+ directions."""
285
277
  # compute r_{i-1/2} = |h_i - h_{i-1}| / (h_i + h_{i+1})
286
278
  r_eta = np.abs(h.diff("eta_rho")) / (h + h.shift(eta_rho=1)).isel(
287
279
  eta_rho=slice(1, None)