roms-tools 2.4.0__py3-none-any.whl → 2.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- roms_tools/__init__.py +1 -1
- roms_tools/analysis/roms_output.py +77 -98
- roms_tools/plot.py +4 -2
- roms_tools/setup/boundary_forcing.py +29 -15
- roms_tools/setup/datasets.py +91 -32
- roms_tools/setup/grid.py +4 -5
- roms_tools/setup/initial_conditions.py +7 -6
- roms_tools/setup/nesting.py +237 -63
- roms_tools/setup/river_forcing.py +243 -72
- roms_tools/setup/surface_forcing.py +26 -15
- roms_tools/setup/tides.py +3 -6
- roms_tools/setup/topography.py +25 -2
- roms_tools/setup/utils.py +28 -12
- roms_tools/tests/test_analysis/test_roms_output.py +233 -70
- roms_tools/tests/test_setup/test_boundary_forcing.py +63 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zattrs +3 -1
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zmetadata +3 -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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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 +2 -2
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/.zmetadata +8 -7
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/abs_time/.zattrs +1 -0
- 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/dust_time/.zattrs +1 -1
- 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/iron_time/.zattrs +1 -1
- 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/nhy_time/.zattrs +1 -1
- 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/nox_time/.zattrs +1 -1
- 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.zarr/pco2_time/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zattrs +2 -2
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zmetadata +2 -2
- 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/grid.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/grid.zarr/.zmetadata +2 -2
- 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/.zattrs +1 -1
- 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/salt/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/river_forcing_no_climatology.zarr/.zmetadata +27 -1
- roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/nriver/.zarray +20 -0
- roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/nriver/.zattrs +6 -0
- roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/nriver/0 +0 -0
- roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_location/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/.zmetadata +27 -1
- roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/nriver/.zarray +20 -0
- roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/nriver/.zattrs +6 -0
- roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/nriver/0 +0 -0
- roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/river_location/.zattrs +1 -1
- roms_tools/tests/test_setup/test_initial_conditions.py +16 -0
- roms_tools/tests/test_setup/test_nesting.py +141 -104
- roms_tools/tests/test_setup/test_river_forcing.py +587 -269
- roms_tools/tests/test_setup/test_surface_forcing.py +47 -0
- roms_tools/tests/test_setup/test_validation.py +34 -2
- {roms_tools-2.4.0.dist-info → roms_tools-2.5.0.dist-info}/METADATA +1 -1
- {roms_tools-2.4.0.dist-info → roms_tools-2.5.0.dist-info}/RECORD +208 -202
- {roms_tools-2.4.0.dist-info → roms_tools-2.5.0.dist-info}/WHEEL +1 -1
- {roms_tools-2.4.0.dist-info → roms_tools-2.5.0.dist-info}/LICENSE +0 -0
- {roms_tools-2.4.0.dist-info → roms_tools-2.5.0.dist-info}/top_level.txt +0 -0
roms_tools/setup/utils.py
CHANGED
|
@@ -893,13 +893,9 @@ def _to_yaml(forcing_object, filepath: Union[str, Path]) -> None:
|
|
|
893
893
|
if hasattr(forcing_object, "grid") and forcing_object.grid is not None:
|
|
894
894
|
grid_data = asdict(forcing_object.grid)
|
|
895
895
|
grid_yaml_data = {"Grid": _pop_grid_data(grid_data)}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
child_grid_data = asdict(forcing_object.child_grid)
|
|
900
|
-
child_grid_yaml_data = {"ChildGrid": _pop_grid_data(child_grid_data)}
|
|
901
|
-
|
|
902
|
-
grid_yaml_data = {**parent_grid_yaml_data, **child_grid_yaml_data}
|
|
896
|
+
elif hasattr(forcing_object, "parent_grid"):
|
|
897
|
+
grid_data = asdict(forcing_object.parent_grid)
|
|
898
|
+
grid_yaml_data = {"ParentGrid": _pop_grid_data(grid_data)}
|
|
903
899
|
|
|
904
900
|
# Step 2: Ensure Paths are Strings
|
|
905
901
|
def ensure_paths_are_strings(obj, key):
|
|
@@ -933,11 +929,12 @@ def _to_yaml(forcing_object, filepath: Union[str, Path]) -> None:
|
|
|
933
929
|
not in (
|
|
934
930
|
"grid",
|
|
935
931
|
"parent_grid",
|
|
936
|
-
"child_grid",
|
|
937
932
|
"ds",
|
|
938
933
|
"use_dask",
|
|
939
|
-
"bypass_validation",
|
|
940
934
|
"climatology",
|
|
935
|
+
"verbose",
|
|
936
|
+
"straddle",
|
|
937
|
+
"indices",
|
|
941
938
|
)
|
|
942
939
|
]
|
|
943
940
|
|
|
@@ -952,18 +949,37 @@ def _to_yaml(forcing_object, filepath: Union[str, Path]) -> None:
|
|
|
952
949
|
# Add the field and its value to the forcing_data dictionary
|
|
953
950
|
forcing_data[field_name] = value
|
|
954
951
|
|
|
955
|
-
# Step 5:
|
|
952
|
+
# Step 5: Serialize `indices` data (conditionally)
|
|
953
|
+
indices_data = getattr(forcing_object, "indices", None)
|
|
954
|
+
if indices_data is not None:
|
|
955
|
+
serialized_indices = {
|
|
956
|
+
"_convention": "eta_rho, xi_rho"
|
|
957
|
+
} # Add convention metadata
|
|
958
|
+
|
|
959
|
+
for key, value in indices_data.items():
|
|
960
|
+
serialized_indices[key] = [
|
|
961
|
+
f"{tup[0]}, {tup[1]}" for tup in value
|
|
962
|
+
] # Comma-separated string
|
|
963
|
+
|
|
964
|
+
forcing_data["indices"] = serialized_indices
|
|
965
|
+
|
|
966
|
+
# Step 6: Combine Grid and Forcing Data into a single dictionary for the final YAML content
|
|
956
967
|
yaml_data = {
|
|
957
968
|
**grid_yaml_data, # Add the grid data to the final YAML structure
|
|
958
969
|
forcing_object.__class__.__name__: forcing_data, # Include the serialized forcing object data
|
|
959
970
|
}
|
|
960
971
|
|
|
961
|
-
# Step
|
|
972
|
+
# Step 7: Write to YAML file
|
|
962
973
|
with filepath.open("w") as file:
|
|
963
974
|
# Write the header first
|
|
964
975
|
file.write(header)
|
|
965
976
|
# Write the serialized YAML data
|
|
966
|
-
yaml.dump(
|
|
977
|
+
yaml.dump(
|
|
978
|
+
yaml_data,
|
|
979
|
+
file,
|
|
980
|
+
default_flow_style=False,
|
|
981
|
+
sort_keys=False,
|
|
982
|
+
)
|
|
967
983
|
|
|
968
984
|
|
|
969
985
|
def _pop_grid_data(grid_data):
|
|
@@ -18,7 +18,6 @@ def roms_output_from_restart_file(use_dask):
|
|
|
18
18
|
return ROMSOutput(
|
|
19
19
|
grid=grid,
|
|
20
20
|
path=Path(download_test_data("eastpac25km_rst.19980106000000.nc")),
|
|
21
|
-
type="restart",
|
|
22
21
|
use_dask=use_dask,
|
|
23
22
|
)
|
|
24
23
|
|
|
@@ -28,20 +27,6 @@ def test_load_model_output_file(roms_output_from_restart_file, use_dask):
|
|
|
28
27
|
assert isinstance(roms_output_from_restart_file.ds, xr.Dataset)
|
|
29
28
|
|
|
30
29
|
|
|
31
|
-
def test_load_model_output_directory(use_dask):
|
|
32
|
-
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
33
|
-
grid = Grid.from_file(fname_grid)
|
|
34
|
-
|
|
35
|
-
# Download at least two files, so these will be found within the pooch directory
|
|
36
|
-
_ = Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
37
|
-
_ = Path(download_test_data("eastpac25km_rst.19980126000000.nc"))
|
|
38
|
-
|
|
39
|
-
# Directory
|
|
40
|
-
directory = os.path.dirname(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
41
|
-
output = ROMSOutput(grid=grid, path=directory, type="restart", use_dask=use_dask)
|
|
42
|
-
assert isinstance(output.ds, xr.Dataset)
|
|
43
|
-
|
|
44
|
-
|
|
45
30
|
def test_load_model_output_file_list(use_dask):
|
|
46
31
|
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
47
32
|
grid = Grid.from_file(fname_grid)
|
|
@@ -49,24 +34,23 @@ def test_load_model_output_file_list(use_dask):
|
|
|
49
34
|
# List of files
|
|
50
35
|
file1 = Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
51
36
|
file2 = Path(download_test_data("eastpac25km_rst.19980126000000.nc"))
|
|
52
|
-
output = ROMSOutput(
|
|
53
|
-
grid=grid, path=[file1, file2], type="restart", use_dask=use_dask
|
|
54
|
-
)
|
|
37
|
+
output = ROMSOutput(grid=grid, path=[file1, file2], use_dask=use_dask)
|
|
55
38
|
assert isinstance(output.ds, xr.Dataset)
|
|
56
39
|
|
|
57
40
|
|
|
58
|
-
def
|
|
41
|
+
def test_load_model_output_with_wildcard(use_dask):
|
|
59
42
|
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
60
43
|
grid = Grid.from_file(fname_grid)
|
|
61
44
|
|
|
62
|
-
#
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
45
|
+
# Download at least two files, so these will be found within the pooch directory
|
|
46
|
+
Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
47
|
+
Path(download_test_data("eastpac25km_rst.19980126000000.nc"))
|
|
48
|
+
directory = Path(
|
|
49
|
+
os.path.dirname(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
output = ROMSOutput(grid=grid, path=directory / "*rst*.nc", use_dask=use_dask)
|
|
53
|
+
assert isinstance(output.ds, xr.Dataset)
|
|
70
54
|
|
|
71
55
|
|
|
72
56
|
def test_invalid_path(use_dask):
|
|
@@ -78,16 +62,6 @@ def test_invalid_path(use_dask):
|
|
|
78
62
|
ROMSOutput(
|
|
79
63
|
grid=grid,
|
|
80
64
|
path=Path("/path/to/nonexistent/file.nc"),
|
|
81
|
-
type="restart",
|
|
82
|
-
use_dask=use_dask,
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
# Non-existent directory
|
|
86
|
-
with pytest.raises(FileNotFoundError):
|
|
87
|
-
ROMSOutput(
|
|
88
|
-
grid=grid,
|
|
89
|
-
path=Path("/path/to/nonexistent/directory"),
|
|
90
|
-
type="restart",
|
|
91
65
|
use_dask=use_dask,
|
|
92
66
|
)
|
|
93
67
|
|
|
@@ -99,7 +73,6 @@ def test_set_correct_model_reference_date(use_dask):
|
|
|
99
73
|
output = ROMSOutput(
|
|
100
74
|
grid=grid,
|
|
101
75
|
path=Path(download_test_data("eastpac25km_rst.19980106000000.nc")),
|
|
102
|
-
type="restart",
|
|
103
76
|
use_dask=use_dask,
|
|
104
77
|
)
|
|
105
78
|
assert output.model_reference_date == datetime(1995, 1, 1)
|
|
@@ -117,7 +90,6 @@ def test_model_reference_date_mismatch(use_dask):
|
|
|
117
90
|
ROMSOutput(
|
|
118
91
|
grid=grid,
|
|
119
92
|
path=Path(download_test_data("eastpac25km_rst.19980106000000.nc")),
|
|
120
|
-
type="restart",
|
|
121
93
|
model_reference_date=model_ref_date,
|
|
122
94
|
use_dask=use_dask,
|
|
123
95
|
)
|
|
@@ -138,7 +110,7 @@ def test_model_reference_date_no_metadata(use_dask, tmp_path, caplog):
|
|
|
138
110
|
expected_exception,
|
|
139
111
|
match="Model reference date could not be inferred from the metadata",
|
|
140
112
|
):
|
|
141
|
-
ROMSOutput(grid=grid, path=fname_mod,
|
|
113
|
+
ROMSOutput(grid=grid, path=fname_mod, use_dask=use_dask)
|
|
142
114
|
|
|
143
115
|
# Test case 2: When a model reference date is explicitly set, verify the warning
|
|
144
116
|
with caplog.at_level(logging.WARNING):
|
|
@@ -146,7 +118,6 @@ def test_model_reference_date_no_metadata(use_dask, tmp_path, caplog):
|
|
|
146
118
|
grid=grid,
|
|
147
119
|
path=fname_mod,
|
|
148
120
|
model_reference_date=datetime(1995, 1, 1),
|
|
149
|
-
type="restart",
|
|
150
121
|
use_dask=use_dask,
|
|
151
122
|
)
|
|
152
123
|
|
|
@@ -175,20 +146,53 @@ def test_model_reference_date_no_metadata(use_dask, tmp_path, caplog):
|
|
|
175
146
|
def test_compute_depth_coordinates(use_dask):
|
|
176
147
|
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
177
148
|
grid = Grid.from_file(fname_grid)
|
|
149
|
+
fname_restart1 = Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
150
|
+
|
|
151
|
+
for adjust_depth_for_sea_surface_height in [True, False]:
|
|
152
|
+
output = ROMSOutput(
|
|
153
|
+
grid=grid,
|
|
154
|
+
path=fname_restart1,
|
|
155
|
+
use_dask=use_dask,
|
|
156
|
+
adjust_depth_for_sea_surface_height=adjust_depth_for_sea_surface_height,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
# Before calling get_vertical_coordinates, check if the dataset doesn't already have depth coordinates
|
|
160
|
+
assert "layer_depth_rho" not in output.ds_depth_coords.data_vars
|
|
161
|
+
|
|
162
|
+
# Call the method to get vertical coordinates
|
|
163
|
+
output._get_depth_coordinates(depth_type="layer")
|
|
164
|
+
|
|
165
|
+
# Check if the depth coordinates were added
|
|
166
|
+
assert "layer_depth_rho" in output.ds_depth_coords.data_vars
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def test_missing_zeta_gets_raised(use_dask):
|
|
170
|
+
"""Test that a ValueError is raised when `zeta` is missing from the dataset and
|
|
171
|
+
`adjust_depth_for_sea_surface_height` is enabled."""
|
|
172
|
+
# Load the grid
|
|
173
|
+
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
174
|
+
grid = Grid.from_file(fname_grid)
|
|
178
175
|
|
|
176
|
+
# Load the ROMS output
|
|
179
177
|
fname_restart1 = Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
180
|
-
|
|
181
|
-
grid=grid,
|
|
178
|
+
roms_output = ROMSOutput(
|
|
179
|
+
grid=grid,
|
|
180
|
+
path=fname_restart1,
|
|
181
|
+
use_dask=use_dask,
|
|
182
|
+
adjust_depth_for_sea_surface_height=True,
|
|
182
183
|
)
|
|
183
184
|
|
|
184
|
-
#
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
output.compute_depth_coordinates(depth_type="layer")
|
|
185
|
+
# Remove `zeta` from the dataset
|
|
186
|
+
object.__setattr__(
|
|
187
|
+
roms_output, "ds", roms_output.ds.drop_vars("zeta", errors="ignore")
|
|
188
|
+
)
|
|
189
189
|
|
|
190
|
-
#
|
|
191
|
-
|
|
190
|
+
# Expect ValueError when calling `_get_depth_coordinates`
|
|
191
|
+
with pytest.raises(
|
|
192
|
+
ValueError,
|
|
193
|
+
match="`zeta` is required in provided ROMS output when `adjust_depth_for_sea_surface_height` is enabled.",
|
|
194
|
+
):
|
|
195
|
+
roms_output._get_depth_coordinates()
|
|
192
196
|
|
|
193
197
|
|
|
194
198
|
def test_check_vertical_coordinate_mismatch(use_dask):
|
|
@@ -196,9 +200,7 @@ def test_check_vertical_coordinate_mismatch(use_dask):
|
|
|
196
200
|
grid = Grid.from_file(fname_grid)
|
|
197
201
|
|
|
198
202
|
fname_restart1 = Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
199
|
-
output = ROMSOutput(
|
|
200
|
-
grid=grid, path=fname_restart1, type="restart", use_dask=use_dask
|
|
201
|
-
)
|
|
203
|
+
output = ROMSOutput(grid=grid, path=fname_restart1, use_dask=use_dask)
|
|
202
204
|
|
|
203
205
|
# create a mock dataset with inconsistent vertical coordinate parameters
|
|
204
206
|
ds_mock = output.ds.copy()
|
|
@@ -226,9 +228,7 @@ def test_that_coordinates_are_added(use_dask):
|
|
|
226
228
|
grid = Grid.from_file(fname_grid)
|
|
227
229
|
|
|
228
230
|
fname_restart1 = Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
229
|
-
output = ROMSOutput(
|
|
230
|
-
grid=grid, path=fname_restart1, type="restart", use_dask=use_dask
|
|
231
|
-
)
|
|
231
|
+
output = ROMSOutput(grid=grid, path=fname_restart1, use_dask=use_dask)
|
|
232
232
|
|
|
233
233
|
assert "abs_time" in output.ds.coords
|
|
234
234
|
assert "lat_rho" in output.ds.coords
|
|
@@ -239,23 +239,186 @@ def test_plot(roms_output_from_restart_file, use_dask):
|
|
|
239
239
|
|
|
240
240
|
kwargs = {}
|
|
241
241
|
for var_name in ["temp", "u", "v"]:
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
242
|
+
for include_boundary in [False, True]:
|
|
243
|
+
roms_output_from_restart_file.plot(
|
|
244
|
+
var_name, time=0, s=-1, **kwargs, include_boundary=include_boundary
|
|
245
|
+
)
|
|
246
|
+
roms_output_from_restart_file.plot(
|
|
247
|
+
var_name, time=0, eta=0, **kwargs, include_boundary=include_boundary
|
|
248
|
+
)
|
|
249
|
+
roms_output_from_restart_file.plot(
|
|
250
|
+
var_name, time=0, eta=1, **kwargs, include_boundary=include_boundary
|
|
251
|
+
)
|
|
252
|
+
roms_output_from_restart_file.plot(
|
|
253
|
+
var_name, time=0, xi=0, **kwargs, include_boundary=include_boundary
|
|
254
|
+
)
|
|
255
|
+
roms_output_from_restart_file.plot(
|
|
256
|
+
var_name, time=0, xi=1, **kwargs, include_boundary=include_boundary
|
|
257
|
+
)
|
|
258
|
+
roms_output_from_restart_file.plot(
|
|
259
|
+
var_name,
|
|
260
|
+
time=0,
|
|
261
|
+
eta=0,
|
|
262
|
+
xi=0,
|
|
263
|
+
**kwargs,
|
|
264
|
+
include_boundary=include_boundary
|
|
265
|
+
)
|
|
266
|
+
roms_output_from_restart_file.plot(
|
|
267
|
+
var_name,
|
|
268
|
+
time=0,
|
|
269
|
+
eta=0,
|
|
270
|
+
xi=1,
|
|
271
|
+
**kwargs,
|
|
272
|
+
include_boundary=include_boundary
|
|
273
|
+
)
|
|
274
|
+
roms_output_from_restart_file.plot(
|
|
275
|
+
var_name,
|
|
276
|
+
time=0,
|
|
277
|
+
eta=1,
|
|
278
|
+
xi=0,
|
|
279
|
+
**kwargs,
|
|
280
|
+
include_boundary=include_boundary
|
|
281
|
+
)
|
|
282
|
+
roms_output_from_restart_file.plot(
|
|
283
|
+
var_name,
|
|
284
|
+
time=0,
|
|
285
|
+
eta=1,
|
|
286
|
+
xi=1,
|
|
287
|
+
**kwargs,
|
|
288
|
+
include_boundary=include_boundary
|
|
289
|
+
)
|
|
290
|
+
roms_output_from_restart_file.plot(
|
|
291
|
+
var_name,
|
|
292
|
+
time=0,
|
|
293
|
+
s=-1,
|
|
294
|
+
eta=0,
|
|
295
|
+
**kwargs,
|
|
296
|
+
include_boundary=include_boundary
|
|
297
|
+
)
|
|
298
|
+
roms_output_from_restart_file.plot(
|
|
299
|
+
var_name,
|
|
300
|
+
time=0,
|
|
301
|
+
s=-1,
|
|
302
|
+
eta=1,
|
|
303
|
+
**kwargs,
|
|
304
|
+
include_boundary=include_boundary
|
|
305
|
+
)
|
|
306
|
+
roms_output_from_restart_file.plot(
|
|
307
|
+
var_name,
|
|
308
|
+
time=0,
|
|
309
|
+
s=-1,
|
|
310
|
+
xi=0,
|
|
311
|
+
**kwargs,
|
|
312
|
+
include_boundary=include_boundary
|
|
313
|
+
)
|
|
314
|
+
roms_output_from_restart_file.plot(
|
|
315
|
+
var_name,
|
|
316
|
+
time=0,
|
|
317
|
+
s=-1,
|
|
318
|
+
xi=1,
|
|
319
|
+
**kwargs,
|
|
320
|
+
include_boundary=include_boundary
|
|
321
|
+
)
|
|
247
322
|
|
|
248
323
|
kwargs = {"depth_contours": True, "layer_contours": True}
|
|
249
324
|
for var_name in ["temp", "u", "v"]:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
325
|
+
for include_boundary in [False, True]:
|
|
326
|
+
roms_output_from_restart_file.plot(
|
|
327
|
+
var_name, time=0, s=-1, **kwargs, include_boundary=include_boundary
|
|
328
|
+
)
|
|
329
|
+
roms_output_from_restart_file.plot(
|
|
330
|
+
var_name, time=0, eta=0, **kwargs, include_boundary=include_boundary
|
|
331
|
+
)
|
|
332
|
+
roms_output_from_restart_file.plot(
|
|
333
|
+
var_name, time=0, eta=1, **kwargs, include_boundary=include_boundary
|
|
334
|
+
)
|
|
335
|
+
roms_output_from_restart_file.plot(
|
|
336
|
+
var_name, time=0, xi=0, **kwargs, include_boundary=include_boundary
|
|
337
|
+
)
|
|
338
|
+
roms_output_from_restart_file.plot(
|
|
339
|
+
var_name, time=0, xi=1, **kwargs, include_boundary=include_boundary
|
|
340
|
+
)
|
|
341
|
+
roms_output_from_restart_file.plot(
|
|
342
|
+
var_name,
|
|
343
|
+
time=0,
|
|
344
|
+
eta=0,
|
|
345
|
+
xi=0,
|
|
346
|
+
**kwargs,
|
|
347
|
+
include_boundary=include_boundary
|
|
348
|
+
)
|
|
349
|
+
roms_output_from_restart_file.plot(
|
|
350
|
+
var_name,
|
|
351
|
+
time=0,
|
|
352
|
+
eta=0,
|
|
353
|
+
xi=1,
|
|
354
|
+
**kwargs,
|
|
355
|
+
include_boundary=include_boundary
|
|
356
|
+
)
|
|
357
|
+
roms_output_from_restart_file.plot(
|
|
358
|
+
var_name,
|
|
359
|
+
time=0,
|
|
360
|
+
eta=1,
|
|
361
|
+
xi=0,
|
|
362
|
+
**kwargs,
|
|
363
|
+
include_boundary=include_boundary
|
|
364
|
+
)
|
|
365
|
+
roms_output_from_restart_file.plot(
|
|
366
|
+
var_name,
|
|
367
|
+
time=0,
|
|
368
|
+
eta=1,
|
|
369
|
+
xi=1,
|
|
370
|
+
**kwargs,
|
|
371
|
+
include_boundary=include_boundary
|
|
372
|
+
)
|
|
373
|
+
roms_output_from_restart_file.plot(
|
|
374
|
+
var_name,
|
|
375
|
+
time=0,
|
|
376
|
+
s=-1,
|
|
377
|
+
eta=0,
|
|
378
|
+
**kwargs,
|
|
379
|
+
include_boundary=include_boundary
|
|
380
|
+
)
|
|
381
|
+
roms_output_from_restart_file.plot(
|
|
382
|
+
var_name,
|
|
383
|
+
time=0,
|
|
384
|
+
s=-1,
|
|
385
|
+
eta=1,
|
|
386
|
+
**kwargs,
|
|
387
|
+
include_boundary=include_boundary
|
|
388
|
+
)
|
|
389
|
+
roms_output_from_restart_file.plot(
|
|
390
|
+
var_name,
|
|
391
|
+
time=0,
|
|
392
|
+
s=-1,
|
|
393
|
+
xi=0,
|
|
394
|
+
**kwargs,
|
|
395
|
+
include_boundary=include_boundary
|
|
396
|
+
)
|
|
397
|
+
roms_output_from_restart_file.plot(
|
|
398
|
+
var_name,
|
|
399
|
+
time=0,
|
|
400
|
+
s=-1,
|
|
401
|
+
xi=1,
|
|
402
|
+
**kwargs,
|
|
403
|
+
include_boundary=include_boundary
|
|
404
|
+
)
|
|
405
|
+
|
|
406
|
+
for include_boundary in [False, True]:
|
|
407
|
+
roms_output_from_restart_file.plot(
|
|
408
|
+
"zeta", time=0, **kwargs, include_boundary=include_boundary
|
|
409
|
+
)
|
|
410
|
+
roms_output_from_restart_file.plot(
|
|
411
|
+
"zeta", time=0, eta=0, **kwargs, include_boundary=include_boundary
|
|
412
|
+
)
|
|
413
|
+
roms_output_from_restart_file.plot(
|
|
414
|
+
"zeta", time=0, eta=1, **kwargs, include_boundary=include_boundary
|
|
415
|
+
)
|
|
416
|
+
roms_output_from_restart_file.plot(
|
|
417
|
+
"zeta", time=0, xi=0, **kwargs, include_boundary=include_boundary
|
|
418
|
+
)
|
|
419
|
+
roms_output_from_restart_file.plot(
|
|
420
|
+
"zeta", time=0, xi=1, **kwargs, include_boundary=include_boundary
|
|
421
|
+
)
|
|
259
422
|
|
|
260
423
|
|
|
261
424
|
def test_plot_errors(roms_output_from_restart_file, use_dask):
|
|
@@ -139,6 +139,69 @@ def test_unsuccessful_boundary_forcing_creation_with_1d_fill(use_dask):
|
|
|
139
139
|
)
|
|
140
140
|
|
|
141
141
|
|
|
142
|
+
def test_start_time_end_time_error(use_dask):
|
|
143
|
+
"""Test error when start_time and end_time are not both provided or both None."""
|
|
144
|
+
# Case 1: Only start_time provided
|
|
145
|
+
with pytest.raises(
|
|
146
|
+
ValueError, match="Both `start_time` and `end_time` must be provided together"
|
|
147
|
+
):
|
|
148
|
+
BoundaryForcing(
|
|
149
|
+
grid=None,
|
|
150
|
+
start_time=datetime(2022, 1, 1),
|
|
151
|
+
end_time=None, # end_time is None, should raise an error
|
|
152
|
+
source={"name": "GLORYS", "path": "glorys_data.nc"},
|
|
153
|
+
use_dask=use_dask,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
# Case 2: Only end_time provided
|
|
157
|
+
with pytest.raises(
|
|
158
|
+
ValueError, match="Both `start_time` and `end_time` must be provided together"
|
|
159
|
+
):
|
|
160
|
+
BoundaryForcing(
|
|
161
|
+
grid=None,
|
|
162
|
+
start_time=None, # start_time is None, should raise an error
|
|
163
|
+
end_time=datetime(2022, 1, 2),
|
|
164
|
+
source={"name": "GLORYS", "path": "glorys_data.nc"},
|
|
165
|
+
use_dask=use_dask,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def test_start_time_end_time_warning(use_dask, caplog):
|
|
170
|
+
"""Test that a warning is triggered when both start_time and end_time are None."""
|
|
171
|
+
# Catching the warning during test
|
|
172
|
+
grid = Grid(
|
|
173
|
+
nx=3,
|
|
174
|
+
ny=3,
|
|
175
|
+
size_x=400,
|
|
176
|
+
size_y=400,
|
|
177
|
+
center_lon=-8,
|
|
178
|
+
center_lat=58,
|
|
179
|
+
rot=0,
|
|
180
|
+
N=3, # number of vertical levels
|
|
181
|
+
theta_s=5.0, # surface control parameter
|
|
182
|
+
theta_b=2.0, # bottom control parameter
|
|
183
|
+
hc=250.0, # critical depth
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
fname1 = Path(download_test_data("GLORYS_NA_20120101.nc"))
|
|
187
|
+
fname2 = Path(download_test_data("GLORYS_NA_20121231.nc"))
|
|
188
|
+
|
|
189
|
+
with caplog.at_level(logging.INFO):
|
|
190
|
+
BoundaryForcing(
|
|
191
|
+
grid=grid,
|
|
192
|
+
start_time=None,
|
|
193
|
+
end_time=None,
|
|
194
|
+
source={"name": "GLORYS", "path": [fname1, fname2]},
|
|
195
|
+
use_dask=use_dask,
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
# Verify the warning message in the log
|
|
199
|
+
assert (
|
|
200
|
+
"Both `start_time` and `end_time` are None. No time filtering will be applied to the source data."
|
|
201
|
+
in caplog.text
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
|
|
142
205
|
def test_boundary_divided_by_land_warning(caplog, use_dask):
|
|
143
206
|
|
|
144
207
|
# Iceland intersects the western boundary of the following grid
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
+
"adjust_depth_for_sea_surface_height": "False",
|
|
3
|
+
"apply_2d_horizontal_fill": "True",
|
|
2
4
|
"climatology": "True",
|
|
3
5
|
"end_time": "2021-06-30 00:00:00",
|
|
4
6
|
"hc": 250.0,
|
|
5
7
|
"model_reference_date": "2000-01-01 00:00:00",
|
|
6
|
-
"roms_tools_version": "
|
|
8
|
+
"roms_tools_version": "2.1.1.dev3+gef240eb.d20250116",
|
|
7
9
|
"source": "CESM_REGRIDDED",
|
|
8
10
|
"start_time": "2021-06-29 00:00:00",
|
|
9
11
|
"theta_b": 2.0,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"metadata": {
|
|
3
3
|
".zattrs": {
|
|
4
|
+
"adjust_depth_for_sea_surface_height": "False",
|
|
5
|
+
"apply_2d_horizontal_fill": "True",
|
|
4
6
|
"climatology": "True",
|
|
5
7
|
"end_time": "2021-06-30 00:00:00",
|
|
6
8
|
"hc": 250.0,
|
|
7
9
|
"model_reference_date": "2000-01-01 00:00:00",
|
|
8
|
-
"roms_tools_version": "
|
|
10
|
+
"roms_tools_version": "2.1.1.dev3+gef240eb.d20250116",
|
|
9
11
|
"source": "CESM_REGRIDDED",
|
|
10
12
|
"start_time": "2021-06-29 00:00:00",
|
|
11
13
|
"theta_b": 2.0,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/0.0.0
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_south/0.0.0
CHANGED
|
Binary file
|