roms-tools 1.3.0__py3-none-any.whl → 1.4.1__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 (348) hide show
  1. ci/environment.yml +1 -8
  2. roms_tools/_version.py +1 -1
  3. roms_tools/setup/boundary_forcing.py +1 -1
  4. roms_tools/setup/datasets.py +278 -105
  5. roms_tools/setup/download.py +5 -0
  6. roms_tools/setup/fill.py +266 -331
  7. roms_tools/setup/grid.py +92 -8
  8. roms_tools/setup/initial_conditions.py +10 -11
  9. roms_tools/setup/mixins.py +29 -21
  10. roms_tools/setup/surface_forcing.py +3 -5
  11. roms_tools/setup/tides.py +44 -46
  12. roms_tools/setup/topography.py +30 -4
  13. roms_tools/setup/utils.py +41 -23
  14. roms_tools/tests/test_setup/test_boundary_forcing.py +1 -1
  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/dust/0.0.0 +0 -0
  148. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/iron/0.0.0 +0 -0
  149. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nhy/0.0.0 +0 -0
  150. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nox/0.0.0 +0 -0
  151. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air/0.0.0 +0 -0
  152. roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air_alt/0.0.0 +0 -0
  153. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zattrs +1 -1
  154. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zmetadata +1 -1
  155. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/dust/0.0.0 +0 -0
  156. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/iron/0.0.0 +0 -0
  157. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nhy/0.0.0 +0 -0
  158. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nox/0.0.0 +0 -0
  159. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air/0.0.0 +0 -0
  160. roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air_alt/0.0.0 +0 -0
  161. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/.zattrs +1 -1
  162. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/.zmetadata +1 -1
  163. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_east/0.0.0 +0 -0
  164. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_north/0.0.0 +0 -0
  165. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_south/0.0.0 +0 -0
  166. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_west/0.0.0 +0 -0
  167. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_east/0.0.0 +0 -0
  168. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_north/0.0.0 +0 -0
  169. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_south/0.0.0 +0 -0
  170. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_west/0.0.0 +0 -0
  171. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_east/0.0.0 +0 -0
  172. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_north/0.0.0 +0 -0
  173. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_south/0.0.0 +0 -0
  174. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_west/0.0.0 +0 -0
  175. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_east/0.0 +0 -0
  176. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_north/0.0 +0 -0
  177. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_south/0.0 +0 -0
  178. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_west/0.0 +0 -0
  179. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_east/0.0.0 +0 -0
  180. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_north/0.0.0 +0 -0
  181. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_south/0.0.0 +0 -0
  182. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_west/0.0.0 +0 -0
  183. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_east/0.0 +0 -0
  184. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_north/0.0 +0 -0
  185. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_south/0.0 +0 -0
  186. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_west/0.0 +0 -0
  187. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_east/0.0 +0 -0
  188. roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/0.0 +0 -0
  189. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/.zattrs +1 -1
  190. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/.zmetadata +8 -8
  191. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/Tair/.zarray +1 -1
  192. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/Tair/0.0.0 +0 -0
  193. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/lwrad/.zarray +1 -1
  194. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/lwrad/0.0.0 +0 -0
  195. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/qair/.zarray +1 -1
  196. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/qair/0.0.0 +0 -0
  197. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/rain/.zarray +1 -1
  198. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/rain/0.0.0 +0 -0
  199. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/swrad/.zarray +1 -1
  200. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/swrad/0.0.0 +0 -0
  201. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/uwnd/.zarray +1 -1
  202. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/uwnd/0.0.0 +0 -0
  203. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/vwnd/.zarray +1 -1
  204. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/vwnd/0.0.0 +0 -0
  205. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/.zattrs +1 -1
  206. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/.zmetadata +8 -8
  207. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/Tair/.zarray +1 -1
  208. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/Tair/0.0.0 +0 -0
  209. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/lwrad/.zarray +1 -1
  210. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/lwrad/0.0.0 +0 -0
  211. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/qair/.zarray +1 -1
  212. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/qair/0.0.0 +0 -0
  213. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/rain/.zarray +1 -1
  214. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/rain/0.0.0 +0 -0
  215. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/swrad/.zarray +1 -1
  216. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/swrad/0.0.0 +0 -0
  217. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/uwnd/.zarray +1 -1
  218. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/uwnd/0.0.0 +0 -0
  219. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/vwnd/.zarray +1 -1
  220. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/vwnd/0.0.0 +0 -0
  221. roms_tools/tests/test_setup/test_data/grid.zarr/.zattrs +2 -2
  222. roms_tools/tests/test_setup/test_data/grid.zarr/.zmetadata +62 -2
  223. roms_tools/tests/test_setup/test_data/grid.zarr/lat_psi/.zarray +22 -0
  224. roms_tools/tests/test_setup/test_data/grid.zarr/lat_psi/.zattrs +8 -0
  225. roms_tools/tests/test_setup/test_data/grid.zarr/lat_psi/0.0 +0 -0
  226. roms_tools/tests/test_setup/test_data/grid.zarr/lat_u/0.0 +0 -0
  227. roms_tools/tests/test_setup/test_data/grid.zarr/lat_v/0.0 +0 -0
  228. roms_tools/tests/test_setup/test_data/grid.zarr/lon_psi/.zarray +22 -0
  229. roms_tools/tests/test_setup/test_data/grid.zarr/lon_psi/.zattrs +8 -0
  230. roms_tools/tests/test_setup/test_data/grid.zarr/lon_psi/0.0 +0 -0
  231. roms_tools/tests/test_setup/test_data/grid.zarr/lon_u/0.0 +0 -0
  232. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zattrs +2 -2
  233. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zmetadata +62 -2
  234. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_psi/.zarray +22 -0
  235. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_psi/.zattrs +8 -0
  236. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_psi/0.0 +0 -0
  237. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_u/0.0 +0 -0
  238. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_v/0.0 +0 -0
  239. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_psi/.zarray +22 -0
  240. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_psi/.zattrs +8 -0
  241. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_psi/0.0 +0 -0
  242. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_u/0.0 +0 -0
  243. roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_v/0.0 +0 -0
  244. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/.zattrs +1 -1
  245. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/.zmetadata +1 -1
  246. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK/0.0.0.0 +0 -0
  247. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK_ALT_CO2/0.0.0.0 +0 -0
  248. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC/0.0.0.0 +0 -0
  249. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC_ALT_CO2/0.0.0.0 +0 -0
  250. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOC/0.0.0.0 +0 -0
  251. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOCr/0.0.0.0 +0 -0
  252. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DON/0.0.0.0 +0 -0
  253. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DONr/0.0.0.0 +0 -0
  254. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOP/0.0.0.0 +0 -0
  255. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOPr/0.0.0.0 +0 -0
  256. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Fe/0.0.0.0 +0 -0
  257. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Lig/0.0.0.0 +0 -0
  258. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NH4/0.0.0.0 +0 -0
  259. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NO3/0.0.0.0 +0 -0
  260. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/O2/0.0.0.0 +0 -0
  261. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/PO4/0.0.0.0 +0 -0
  262. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/SiO3/0.0.0.0 +0 -0
  263. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatC/0.0.0.0 +0 -0
  264. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatChl/0.0.0.0 +0 -0
  265. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatFe/0.0.0.0 +0 -0
  266. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatP/0.0.0.0 +0 -0
  267. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatSi/0.0.0.0 +0 -0
  268. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazC/0.0.0.0 +0 -0
  269. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazChl/0.0.0.0 +0 -0
  270. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazFe/0.0.0.0 +0 -0
  271. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazP/0.0.0.0 +0 -0
  272. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/salt/0.0.0.0 +0 -0
  273. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spC/0.0.0.0 +0 -0
  274. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spCaCO3/0.0.0.0 +0 -0
  275. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spChl/0.0.0.0 +0 -0
  276. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spFe/0.0.0.0 +0 -0
  277. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spP/0.0.0.0 +0 -0
  278. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/temp/0.0.0.0 +0 -0
  279. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/u/0.0.0.0 +0 -0
  280. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ubar/0.0.0 +0 -0
  281. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/v/0.0.0.0 +0 -0
  282. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/vbar/0.0.0 +0 -0
  283. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zeta/0.0.0 +0 -0
  284. roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zooC/0.0.0.0 +0 -0
  285. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/.zattrs +1 -1
  286. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/.zmetadata +8 -8
  287. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/Tair/.zarray +1 -1
  288. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/Tair/0.0.0 +0 -0
  289. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/lwrad/.zarray +1 -1
  290. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/lwrad/0.0.0 +0 -0
  291. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/qair/.zarray +1 -1
  292. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/qair/0.0.0 +0 -0
  293. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/rain/.zarray +1 -1
  294. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/rain/0.0.0 +0 -0
  295. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/swrad/.zarray +1 -1
  296. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/swrad/0.0.0 +0 -0
  297. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/uwnd/.zarray +1 -1
  298. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/uwnd/0.0.0 +0 -0
  299. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/vwnd/.zarray +1 -1
  300. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/vwnd/0.0.0 +0 -0
  301. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/.zattrs +1 -1
  302. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/.zmetadata +2 -4
  303. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/omega/.zattrs +1 -3
  304. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/pot_Im/0.0.0 +0 -0
  305. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/pot_Re/0.0.0 +0 -0
  306. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/ssh_Im/0.0.0 +0 -0
  307. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/ssh_Re/0.0.0 +0 -0
  308. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Im/0.0.0 +0 -0
  309. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Re/0.0.0 +0 -0
  310. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Im/0.0.0 +0 -0
  311. roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Re/0.0.0 +0 -0
  312. roms_tools/tests/test_setup/test_datasets.py +280 -211
  313. roms_tools/tests/test_setup/test_fill.py +177 -0
  314. roms_tools/tests/test_setup/test_grid.py +56 -0
  315. roms_tools/tests/test_setup/test_initial_conditions.py +5 -3
  316. roms_tools/tests/test_setup/test_surface_forcing.py +4 -4
  317. roms_tools/tests/test_setup/test_tides.py +5 -2
  318. roms_tools/tests/test_setup/test_topography.py +40 -0
  319. roms_tools/tests/test_setup/test_validation.py +1 -1
  320. roms_tools/tests/test_utils.py +30 -0
  321. roms_tools/utils.py +39 -3
  322. roms_tools-1.4.1.dist-info/LICENSE +201 -0
  323. {roms_tools-1.3.0.dist-info → roms_tools-1.4.1.dist-info}/METADATA +13 -3
  324. {roms_tools-1.3.0.dist-info → roms_tools-1.4.1.dist-info}/RECORD +326 -334
  325. {roms_tools-1.3.0.dist-info → roms_tools-1.4.1.dist-info}/WHEEL +1 -1
  326. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/Tair/1.0.0 +0 -0
  327. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/lwrad/1.0.0 +0 -0
  328. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/qair/1.0.0 +0 -0
  329. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/rain/1.0.0 +0 -0
  330. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/swrad/1.0.0 +0 -0
  331. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/uwnd/1.0.0 +0 -0
  332. roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/vwnd/1.0.0 +0 -0
  333. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/Tair/1.0.0 +0 -0
  334. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/lwrad/1.0.0 +0 -0
  335. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/qair/1.0.0 +0 -0
  336. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/rain/1.0.0 +0 -0
  337. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/swrad/1.0.0 +0 -0
  338. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/uwnd/1.0.0 +0 -0
  339. roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/vwnd/1.0.0 +0 -0
  340. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/Tair/1.0.0 +0 -0
  341. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/lwrad/1.0.0 +0 -0
  342. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/qair/1.0.0 +0 -0
  343. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/rain/1.0.0 +0 -0
  344. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/swrad/1.0.0 +0 -0
  345. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/uwnd/1.0.0 +0 -0
  346. roms_tools/tests/test_setup/test_data/surface_forcing.zarr/vwnd/1.0.0 +0 -0
  347. roms_tools-1.3.0.dist-info/LICENSE +0 -674
  348. {roms_tools-1.3.0.dist-info → roms_tools-1.4.1.dist-info}/top_level.txt +0 -0
@@ -2,9 +2,14 @@ import pytest
2
2
  from datetime import datetime
3
3
  import numpy as np
4
4
  import xarray as xr
5
- from roms_tools.setup.datasets import Dataset, ERA5Correction
6
- import tempfile
7
- import os
5
+ from roms_tools.setup.datasets import (
6
+ Dataset,
7
+ GLORYSDataset,
8
+ ERA5Correction,
9
+ CESMBGCDataset,
10
+ )
11
+ from roms_tools.setup.download import download_test_data
12
+ from pathlib import Path
8
13
 
9
14
 
10
15
  @pytest.fixture
@@ -119,7 +124,7 @@ def non_global_dataset():
119
124
  ),
120
125
  ],
121
126
  )
122
- def test_select_times(data_fixture, expected_time_values, request, use_dask):
127
+ def test_select_times(data_fixture, expected_time_values, request, tmp_path, use_dask):
123
128
  """
124
129
  Test selecting times with different datasets.
125
130
  """
@@ -129,26 +134,20 @@ def test_select_times(data_fixture, expected_time_values, request, use_dask):
129
134
  # Get the fixture dynamically based on the parameter
130
135
  dataset = request.getfixturevalue(data_fixture)
131
136
 
132
- # Create a temporary file
133
- with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
134
- filepath = tmpfile.name
135
- dataset.to_netcdf(filepath)
136
- try:
137
- # Instantiate Dataset object using the temporary file
138
- dataset = Dataset(
139
- filename=filepath,
140
- var_names={"var": "var"},
141
- start_time=start_time,
142
- end_time=end_time,
143
- use_dask=use_dask,
144
- )
137
+ filepath = tmp_path / "test.nc"
138
+ dataset.to_netcdf(filepath)
139
+ dataset = Dataset(
140
+ filename=filepath,
141
+ var_names={"var": "var"},
142
+ start_time=start_time,
143
+ end_time=end_time,
144
+ use_dask=use_dask,
145
+ )
145
146
 
146
- assert dataset.ds is not None
147
- assert len(dataset.ds.time) == len(expected_time_values)
148
- for expected_time in expected_time_values:
149
- assert expected_time in dataset.ds.time.values
150
- finally:
151
- os.remove(filepath)
147
+ assert dataset.ds is not None
148
+ assert len(dataset.ds.time) == len(expected_time_values)
149
+ for expected_time in expected_time_values:
150
+ assert expected_time in dataset.ds.time.values
152
151
 
153
152
 
154
153
  @pytest.mark.parametrize(
@@ -158,8 +157,8 @@ def test_select_times(data_fixture, expected_time_values, request, use_dask):
158
157
  ("global_dataset_with_noon_times", [np.datetime64("2022-02-01T12:00:00")]),
159
158
  ],
160
159
  )
161
- def test_select_times_no_end_time(
162
- data_fixture, expected_time_values, request, use_dask
160
+ def test_select_times_valid_start_no_end_time(
161
+ data_fixture, expected_time_values, request, tmp_path, use_dask
163
162
  ):
164
163
  """
165
164
  Test selecting times with only start_time specified.
@@ -170,241 +169,224 @@ def test_select_times_no_end_time(
170
169
  dataset = request.getfixturevalue(data_fixture)
171
170
 
172
171
  # Create a temporary file
173
- with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
174
- filepath = tmpfile.name
175
- dataset.to_netcdf(filepath)
176
- try:
177
- # Instantiate Dataset object using the temporary file
172
+ filepath = tmp_path / "test.nc"
173
+ dataset.to_netcdf(filepath)
174
+
175
+ # Instantiate Dataset object using the temporary file
176
+ dataset = Dataset(
177
+ filename=filepath,
178
+ var_names={"var": "var"},
179
+ start_time=start_time,
180
+ use_dask=use_dask,
181
+ )
182
+
183
+ assert dataset.ds is not None
184
+ assert len(dataset.ds.time) == len(expected_time_values)
185
+ for expected_time in expected_time_values:
186
+ assert expected_time in dataset.ds.time.values
187
+
188
+
189
+ @pytest.mark.parametrize(
190
+ "data_fixture, expected_time_values",
191
+ [
192
+ ("global_dataset", [np.datetime64("2022-02-01T00:00:00")]),
193
+ ("global_dataset_with_noon_times", [np.datetime64("2022-02-01T12:00:00")]),
194
+ ],
195
+ )
196
+ def test_select_times_invalid_start_no_end_time(
197
+ data_fixture, expected_time_values, request, tmp_path, use_dask
198
+ ):
199
+ """
200
+ Test selecting times with only start_time specified.
201
+ """
202
+ # Get the fixture dynamically based on the parameter
203
+ dataset = request.getfixturevalue(data_fixture)
204
+
205
+ # Create a temporary file
206
+ filepath = tmp_path / "test.nc"
207
+ dataset.to_netcdf(filepath)
208
+
209
+ with pytest.raises(
210
+ ValueError,
211
+ match="The dataset does not contain any time entries between the specified start_time",
212
+ ):
178
213
  dataset = Dataset(
179
214
  filename=filepath,
180
215
  var_names={"var": "var"},
181
- start_time=start_time,
216
+ start_time=datetime(2022, 5, 1),
182
217
  use_dask=use_dask,
183
218
  )
184
219
 
185
- assert dataset.ds is not None
186
- assert len(dataset.ds.time) == len(expected_time_values)
187
- for expected_time in expected_time_values:
188
- assert expected_time in dataset.ds.time.values
189
- finally:
190
- os.remove(filepath)
191
-
192
220
 
193
- def test_multiple_matching_times(global_dataset_with_multiple_times_per_day, use_dask):
221
+ def test_multiple_matching_times(
222
+ global_dataset_with_multiple_times_per_day, tmp_path, use_dask
223
+ ):
194
224
  """
195
225
  Test handling when multiple matching times are found when end_time is not specified.
196
226
  """
197
- start_time = datetime(2022, 1, 1)
227
+ filepath = tmp_path / "test.nc"
228
+ global_dataset_with_multiple_times_per_day.to_netcdf(filepath)
229
+ dataset = Dataset(
230
+ filename=filepath,
231
+ var_names={"var": "var"},
232
+ start_time=datetime(2022, 1, 31, 22, 0),
233
+ use_dask=use_dask,
234
+ )
198
235
 
199
- # Create a temporary file
200
- with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
201
- filepath = tmpfile.name
202
- global_dataset_with_multiple_times_per_day.to_netcdf(filepath)
203
- try:
204
- # Instantiate Dataset object using the temporary file
205
- with pytest.raises(
206
- ValueError,
207
- match="There must be exactly one time matching the start_time. Found 2 matching times.",
208
- ):
209
- Dataset(
210
- filename=filepath,
211
- var_names={"var": "var"},
212
- start_time=start_time,
213
- use_dask=use_dask,
214
- )
215
- finally:
216
- os.remove(filepath)
217
-
218
-
219
- def test_warnings_times(global_dataset, use_dask):
236
+ assert dataset.ds["time"].values == np.datetime64(datetime(2022, 2, 1, 0, 0))
237
+
238
+
239
+ def test_warnings_times(global_dataset, tmp_path, use_dask):
220
240
  """
221
241
  Test handling when no matching times are found.
222
242
  """
223
243
  # Create a temporary file
224
- with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
225
- filepath = tmpfile.name
226
- global_dataset.to_netcdf(filepath)
227
- try:
228
- # Instantiate Dataset object using the temporary file
229
- with pytest.warns(
230
- Warning, match="No records found at or before the start_time."
231
- ):
232
- start_time = datetime(2021, 1, 1)
233
- end_time = datetime(2021, 2, 1)
234
-
235
- Dataset(
236
- filename=filepath,
237
- var_names={"var": "var"},
238
- start_time=start_time,
239
- end_time=end_time,
240
- use_dask=use_dask,
241
- )
242
-
243
- with pytest.warns(Warning, match="No records found at or after the end_time."):
244
- start_time = datetime(2024, 1, 1)
245
- end_time = datetime(2024, 2, 1)
246
-
247
- Dataset(
248
- filename=filepath,
249
- var_names={"var": "var"},
250
- start_time=start_time,
251
- end_time=end_time,
252
- use_dask=use_dask,
253
- )
254
- finally:
255
- os.remove(filepath)
256
-
257
-
258
- def test_reverse_latitude_choose_subdomain_negative_depth(global_dataset, use_dask):
259
- """
260
- Test reversing latitude when it is not ascending, the choose_subdomain method, and the convert_to_negative_depth method of the Dataset class.
261
- """
262
- start_time = datetime(2022, 1, 1)
244
+ filepath = tmp_path / "test.nc"
245
+ global_dataset.to_netcdf(filepath)
246
+ with pytest.warns(Warning, match="No records found at or before the start_time."):
247
+ start_time = datetime(2021, 1, 1)
248
+ end_time = datetime(2021, 2, 1)
263
249
 
264
- # Create a temporary file
265
- with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
266
- filepath = tmpfile.name
267
- global_dataset["latitude"] = global_dataset["latitude"][::-1]
268
- global_dataset.to_netcdf(filepath)
269
- try:
270
- # Instantiate Dataset object using the temporary file
271
- dataset = Dataset(
250
+ Dataset(
272
251
  filename=filepath,
273
252
  var_names={"var": "var"},
274
- dim_names={
275
- "latitude": "latitude",
276
- "longitude": "longitude",
277
- "time": "time",
278
- "depth": "depth",
279
- },
280
253
  start_time=start_time,
254
+ end_time=end_time,
281
255
  use_dask=use_dask,
282
256
  )
283
257
 
284
- assert np.all(np.diff(dataset.ds["latitude"]) > 0)
258
+ with pytest.warns(Warning, match="No records found at or after the end_time."):
259
+ start_time = datetime(2024, 1, 1)
260
+ end_time = datetime(2024, 2, 1)
285
261
 
286
- # test choosing subdomain for domain that straddles the dateline
287
- dataset.choose_subdomain(
288
- latitude_range=(-10, 10), longitude_range=(-10, 10), margin=1, straddle=True
289
- )
290
-
291
- assert -11 <= dataset.ds["latitude"].min() <= 11
292
- assert -11 <= dataset.ds["latitude"].max() <= 11
293
- assert -11 <= dataset.ds["longitude"].min() <= 11
294
- assert -11 <= dataset.ds["longitude"].max() <= 11
295
-
296
- # test choosing subdomain for domain that does not straddle the dateline
297
- dataset = Dataset(
262
+ Dataset(
298
263
  filename=filepath,
299
264
  var_names={"var": "var"},
300
- dim_names={
301
- "latitude": "latitude",
302
- "longitude": "longitude",
303
- "time": "time",
304
- "depth": "depth",
305
- },
306
265
  start_time=start_time,
266
+ end_time=end_time,
307
267
  use_dask=use_dask,
308
268
  )
309
- dataset.choose_subdomain(
310
- latitude_range=(-10, 10), longitude_range=(10, 20), margin=1, straddle=False
311
- )
312
269
 
313
- assert -11 <= dataset.ds["latitude"].min() <= 11
314
- assert -11 <= dataset.ds["latitude"].max() <= 11
315
- assert 9 <= dataset.ds["longitude"].min() <= 21
316
- assert 9 <= dataset.ds["longitude"].max() <= 21
317
270
 
318
- dataset.convert_to_negative_depth()
271
+ def test_reverse_latitude_reverse_depth_choose_subdomain(
272
+ global_dataset, tmp_path, use_dask
273
+ ):
274
+ """
275
+ Test reversing latitude when it is not ascending, the choose_subdomain method, and the convert_to_negative_depth method of the Dataset class.
276
+ """
277
+ start_time = datetime(2022, 1, 1)
319
278
 
320
- assert (dataset.ds["depth"] <= 0).all()
279
+ filepath = tmp_path / "test.nc"
280
+ global_dataset["latitude"] = global_dataset["latitude"][::-1]
281
+ global_dataset["depth"] = global_dataset["depth"][::-1]
282
+ global_dataset.to_netcdf(filepath)
283
+
284
+ dataset = Dataset(
285
+ filename=filepath,
286
+ var_names={"var": "var"},
287
+ dim_names={
288
+ "latitude": "latitude",
289
+ "longitude": "longitude",
290
+ "time": "time",
291
+ "depth": "depth",
292
+ },
293
+ start_time=start_time,
294
+ use_dask=use_dask,
295
+ )
321
296
 
322
- finally:
323
- os.remove(filepath)
297
+ assert np.all(np.diff(dataset.ds["latitude"]) > 0)
298
+ assert np.all(np.diff(dataset.ds["depth"]) > 0)
324
299
 
300
+ # test choosing subdomain for domain that straddles the dateline
301
+ ds = dataset.choose_subdomain(
302
+ latitude_range=(-10, 10),
303
+ longitude_range=(-10, 10),
304
+ margin=1,
305
+ straddle=True,
306
+ return_subdomain=True,
307
+ )
325
308
 
326
- def test_check_if_global_with_global_dataset(global_dataset, use_dask):
309
+ assert -11 <= ds["latitude"].min() <= 11
310
+ assert -11 <= ds["latitude"].max() <= 11
311
+ assert -11 <= ds["longitude"].min() <= 11
312
+ assert -11 <= ds["longitude"].max() <= 11
313
+
314
+ ds = dataset.choose_subdomain(
315
+ latitude_range=(-10, 10),
316
+ longitude_range=(10, 20),
317
+ margin=1,
318
+ straddle=False,
319
+ return_subdomain=True,
320
+ )
327
321
 
328
- with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
329
- filepath = tmpfile.name
330
- global_dataset.to_netcdf(filepath)
331
- try:
332
- dataset = Dataset(
333
- filename=filepath, var_names={"var": "var"}, use_dask=use_dask
334
- )
335
- is_global = dataset.check_if_global(dataset.ds)
336
- assert is_global
337
- finally:
338
- os.remove(filepath)
322
+ assert -11 <= ds["latitude"].min() <= 11
323
+ assert -11 <= ds["latitude"].max() <= 11
324
+ assert 9 <= ds["longitude"].min() <= 21
325
+ assert 9 <= ds["longitude"].max() <= 21
339
326
 
340
327
 
341
- def test_check_if_global_with_non_global_dataset(non_global_dataset, use_dask):
328
+ def test_check_if_global_with_global_dataset(global_dataset, tmp_path, use_dask):
342
329
 
343
- with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
344
- filepath = tmpfile.name
345
- non_global_dataset.to_netcdf(filepath)
346
- try:
347
- dataset = Dataset(
348
- filename=filepath, var_names={"var": "var"}, use_dask=use_dask
349
- )
350
- is_global = dataset.check_if_global(dataset.ds)
330
+ filepath = tmp_path / "test.nc"
331
+ global_dataset.to_netcdf(filepath)
332
+ dataset = Dataset(filename=filepath, var_names={"var": "var"}, use_dask=use_dask)
333
+ is_global = dataset.check_if_global(dataset.ds)
334
+ assert is_global
335
+
336
+
337
+ def test_check_if_global_with_non_global_dataset(
338
+ non_global_dataset, tmp_path, use_dask
339
+ ):
351
340
 
352
- assert not is_global
353
- finally:
354
- os.remove(filepath)
341
+ filepath = tmp_path / "test.nc"
342
+ non_global_dataset.to_netcdf(filepath)
343
+ dataset = Dataset(filename=filepath, var_names={"var": "var"}, use_dask=use_dask)
344
+ is_global = dataset.check_if_global(dataset.ds)
355
345
 
346
+ assert not is_global
356
347
 
357
- def test_check_dataset(global_dataset, use_dask):
348
+
349
+ def test_check_dataset(global_dataset, tmp_path, use_dask):
358
350
 
359
351
  ds = global_dataset.copy()
360
352
  ds = ds.drop_vars("var")
361
353
 
362
- # Create a temporary file
363
- with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
364
- filepath = tmpfile.name
365
- ds.to_netcdf(filepath)
366
- try:
367
- # Instantiate Dataset object using the temporary file
368
- start_time = datetime(2022, 2, 1)
369
- end_time = datetime(2022, 3, 1)
370
- with pytest.raises(
371
- ValueError, match="Dataset does not contain all required variables."
372
- ):
373
-
374
- Dataset(
375
- filename=filepath,
376
- var_names={"var": "var"},
377
- start_time=start_time,
378
- end_time=end_time,
379
- use_dask=use_dask,
380
- )
381
- finally:
382
- os.remove(filepath)
354
+ filepath = tmp_path / "test.nc"
355
+ ds.to_netcdf(filepath)
356
+
357
+ start_time = datetime(2022, 2, 1)
358
+ end_time = datetime(2022, 3, 1)
359
+ with pytest.raises(
360
+ ValueError, match="Dataset does not contain all required variables."
361
+ ):
362
+
363
+ Dataset(
364
+ filename=filepath,
365
+ var_names={"var": "var"},
366
+ start_time=start_time,
367
+ end_time=end_time,
368
+ use_dask=use_dask,
369
+ )
383
370
 
384
371
  ds = global_dataset.copy()
385
372
  ds = ds.rename({"latitude": "lat", "longitude": "long"})
386
373
 
387
- # Create a temporary file
388
- with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
389
- filepath = tmpfile.name
390
- ds.to_netcdf(filepath)
391
- try:
392
- # Instantiate Dataset object using the temporary file
393
- start_time = datetime(2022, 2, 1)
394
- end_time = datetime(2022, 3, 1)
395
- with pytest.raises(
396
- ValueError, match="Dataset does not contain all required dimensions."
397
- ):
398
-
399
- Dataset(
400
- filename=filepath,
401
- var_names={"var": "var"},
402
- start_time=start_time,
403
- end_time=end_time,
404
- use_dask=use_dask,
405
- )
406
- finally:
407
- os.remove(filepath)
374
+ filepath = tmp_path / "test2.nc"
375
+ ds.to_netcdf(filepath)
376
+
377
+ start_time = datetime(2022, 2, 1)
378
+ end_time = datetime(2022, 3, 1)
379
+ with pytest.raises(
380
+ ValueError, match="Dataset does not contain all required dimensions."
381
+ ):
382
+
383
+ Dataset(
384
+ filename=filepath,
385
+ var_names={"var": "var"},
386
+ start_time=start_time,
387
+ end_time=end_time,
388
+ use_dask=use_dask,
389
+ )
408
390
 
409
391
 
410
392
  def test_era5_correction_choose_subdomain(use_dask):
@@ -416,3 +398,90 @@ def test_era5_correction_choose_subdomain(use_dask):
416
398
  data.choose_subdomain(coords, straddle=False)
417
399
  assert (data.ds["latitude"] == lats).all()
418
400
  assert (data.ds["longitude"] == lons).all()
401
+
402
+
403
+ def test_data_concatenation(use_dask):
404
+
405
+ fname = download_test_data("GLORYS_NA_2012.nc")
406
+ data = GLORYSDataset(
407
+ filename=fname,
408
+ start_time=datetime(2012, 1, 1),
409
+ end_time=datetime(2013, 1, 1),
410
+ use_dask=use_dask,
411
+ )
412
+
413
+ # Concatenating the datasets at fname0 and fname1 should result in the dataset at fname
414
+ fname0 = download_test_data("GLORYS_NA_20120101.nc")
415
+ fname1 = download_test_data("GLORYS_NA_20121231.nc")
416
+
417
+ # Test concatenation based on wildcards
418
+ directory_path = Path(fname0).parent
419
+ data_concatenated = GLORYSDataset(
420
+ filename=str(directory_path) + "/GLORYS_NA_2012????.nc",
421
+ start_time=datetime(2012, 1, 1),
422
+ end_time=datetime(2013, 1, 1),
423
+ use_dask=use_dask,
424
+ )
425
+ assert data.ds.equals(data_concatenated.ds)
426
+
427
+ # Test concatenation based on lists
428
+ data_concatenated = GLORYSDataset(
429
+ filename=[fname0, fname1],
430
+ start_time=datetime(2012, 1, 1),
431
+ end_time=datetime(2013, 1, 1),
432
+ use_dask=use_dask,
433
+ )
434
+ assert data.ds.equals(data_concatenated.ds)
435
+
436
+
437
+ def test_time_validation(use_dask):
438
+
439
+ fname = download_test_data("GLORYS_NA_2012.nc")
440
+
441
+ with pytest.raises(TypeError, match="start_time must be a datetime object"):
442
+ GLORYSDataset(
443
+ filename=fname,
444
+ start_time="dummy",
445
+ end_time=datetime(2013, 1, 1),
446
+ use_dask=use_dask,
447
+ )
448
+ with pytest.raises(TypeError, match="end_time must be a datetime object"):
449
+
450
+ GLORYSDataset(
451
+ filename=fname,
452
+ start_time=datetime(2012, 1, 1),
453
+ end_time="dummy",
454
+ use_dask=use_dask,
455
+ )
456
+
457
+
458
+ def test_climatology_error(use_dask):
459
+
460
+ fname = download_test_data("GLORYS_NA_2012.nc")
461
+
462
+ with pytest.raises(
463
+ ValueError,
464
+ match="The dataset contains 2 time steps, but the climatology flag is set to True, which requires exactly 12 time steps.",
465
+ ):
466
+ GLORYSDataset(
467
+ filename=fname,
468
+ start_time=datetime(2012, 1, 1),
469
+ end_time=datetime(2013, 1, 1),
470
+ climatology=True,
471
+ use_dask=use_dask,
472
+ )
473
+
474
+ fname_bgc = download_test_data("CESM_regional_coarse_test_data_climatology.nc")
475
+
476
+ with pytest.raises(
477
+ ValueError,
478
+ match="The dataset contains integer time values, which are only supported when the climatology flag is set to True. However, your climatology flag is set to False.",
479
+ ):
480
+
481
+ CESMBGCDataset(
482
+ filename=fname_bgc,
483
+ start_time=datetime(2012, 1, 1),
484
+ end_time=datetime(2013, 1, 1),
485
+ climatology=False,
486
+ use_dask=use_dask,
487
+ )