roms-tools 1.3.0__py3-none-any.whl → 1.4.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.
- roms_tools/_version.py +1 -1
- roms_tools/setup/boundary_forcing.py +1 -1
- roms_tools/setup/datasets.py +278 -105
- roms_tools/setup/download.py +5 -0
- roms_tools/setup/fill.py +266 -331
- roms_tools/setup/initial_conditions.py +10 -11
- roms_tools/setup/mixins.py +29 -21
- roms_tools/setup/surface_forcing.py +3 -5
- roms_tools/setup/tides.py +44 -46
- roms_tools/setup/utils.py +41 -23
- roms_tools/tests/test_setup/test_boundary_forcing.py +1 -1
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zmetadata +1 -1
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/.zmetadata +1 -1
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/dust/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/iron/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nhy/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nox/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air_alt/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zmetadata +1 -1
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/dust/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/iron/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nhy/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nox/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air_alt/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/.zmetadata +1 -1
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_east/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_south/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_west/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_north/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_east/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_north/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_south/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_west/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_east/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/.zmetadata +8 -8
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/Tair/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/Tair/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/lwrad/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/lwrad/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/qair/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/qair/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/rain/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/rain/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/swrad/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/swrad/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/uwnd/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/uwnd/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/vwnd/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/vwnd/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/.zmetadata +8 -8
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/Tair/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/Tair/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/lwrad/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/lwrad/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/qair/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/qair/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/rain/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/rain/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/swrad/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/swrad/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/uwnd/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/uwnd/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/vwnd/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/vwnd/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/grid.zarr/.zmetadata +1 -1
- roms_tools/tests/test_setup/test_data/grid.zarr/angle/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/angle_coarse/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/f/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/h/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/lat_coarse/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/lat_rho/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/lat_u/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/lat_v/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/pm/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zmetadata +1 -1
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/angle/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/angle_coarse/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/f/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/h/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_coarse/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_rho/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_u/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_v/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_coarse/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_rho/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_u/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_v/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/pm/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/pn/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/.zmetadata +1 -1
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK_ALT_CO2/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC_ALT_CO2/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOC/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOCr/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DON/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DONr/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOP/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOPr/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Fe/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Lig/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NH4/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NO3/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/O2/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/PO4/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/SiO3/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatC/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatChl/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatFe/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatP/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatSi/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazC/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazChl/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazFe/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazP/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/salt/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spC/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spCaCO3/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spChl/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spFe/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spP/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/temp/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/u/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ubar/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/v/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/vbar/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zeta/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zooC/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/.zmetadata +8 -8
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/Tair/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/Tair/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/lwrad/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/lwrad/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/qair/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/qair/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/rain/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/rain/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/swrad/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/swrad/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/uwnd/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/uwnd/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/vwnd/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/vwnd/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/.zmetadata +2 -4
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/omega/.zattrs +1 -3
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/pot_Im/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/pot_Re/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/ssh_Im/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/ssh_Re/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Im/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Re/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Im/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Re/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_datasets.py +280 -211
- roms_tools/tests/test_setup/test_fill.py +177 -0
- roms_tools/tests/test_setup/test_initial_conditions.py +5 -3
- roms_tools/tests/test_setup/test_surface_forcing.py +2 -2
- roms_tools/tests/test_setup/test_tides.py +5 -2
- roms_tools/tests/test_setup/test_validation.py +1 -1
- {roms_tools-1.3.0.dist-info → roms_tools-1.4.0.dist-info}/METADATA +11 -3
- {roms_tools-1.3.0.dist-info → roms_tools-1.4.0.dist-info}/RECORD +287 -307
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/Tair/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/lwrad/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/qair/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/rain/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/swrad/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/uwnd/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/vwnd/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/Tair/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/lwrad/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/qair/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/rain/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/swrad/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/uwnd/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/vwnd/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/Tair/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/lwrad/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/qair/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/rain/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/swrad/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/uwnd/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/vwnd/1.0.0 +0 -0
- {roms_tools-1.3.0.dist-info → roms_tools-1.4.0.dist-info}/LICENSE +0 -0
- {roms_tools-1.3.0.dist-info → roms_tools-1.4.0.dist-info}/WHEEL +0 -0
- {roms_tools-1.3.0.dist-info → roms_tools-1.4.0.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
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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=
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
323
|
-
|
|
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
|
-
|
|
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
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
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
|
|
328
|
+
def test_check_if_global_with_global_dataset(global_dataset, tmp_path, use_dask):
|
|
342
329
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
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
|
-
|
|
353
|
-
|
|
354
|
-
|
|
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
|
-
|
|
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
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
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
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
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
|
+
)
|