roms-tools 2.3.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.
- ci/environment.yml +1 -0
- roms_tools/__init__.py +2 -1
- roms_tools/analysis/roms_output.py +81 -98
- roms_tools/plot.py +4 -2
- roms_tools/setup/boundary_forcing.py +207 -208
- roms_tools/setup/datasets.py +149 -33
- roms_tools/setup/grid.py +35 -102
- roms_tools/setup/initial_conditions.py +179 -132
- roms_tools/setup/nesting.py +239 -86
- roms_tools/setup/river_forcing.py +266 -128
- roms_tools/setup/surface_forcing.py +137 -76
- roms_tools/setup/tides.py +10 -36
- roms_tools/setup/topography.py +25 -2
- roms_tools/setup/utils.py +52 -82
- roms_tools/tests/test_analysis/test_roms_output.py +233 -70
- roms_tools/tests/test_setup/test_boundary_forcing.py +283 -57
- 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/boundary_forcing.zarr/.zattrs +5 -3
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/.zmetadata +156 -121
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/abs_time/.zarray +2 -2
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/abs_time/.zattrs +2 -1
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/abs_time/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/bry_time/.zarray +2 -2
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/bry_time/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/bry_time/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_east/.zarray +4 -4
- 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_north/.zarray +4 -4
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_north/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_south/.zarray +4 -4
- 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/.zarray +4 -4
- 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/.zarray +4 -4
- 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_north/.zarray +4 -4
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_north/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_south/.zarray +4 -4
- 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/.zarray +4 -4
- 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/.zarray +4 -4
- 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_north/.zarray +4 -4
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_north/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_south/.zarray +4 -4
- 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/.zarray +4 -4
- 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/.zarray +4 -4
- 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_north/.zarray +4 -4
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_north/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_south/.zarray +4 -4
- 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/.zarray +4 -4
- 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/.zarray +4 -4
- 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/.zarray +4 -4
- 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/.zarray +4 -4
- 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/.zarray +4 -4
- 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/.zarray +4 -4
- 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/.zarray +4 -4
- 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/.zarray +4 -4
- 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/.zarray +4 -4
- 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/.zarray +4 -4
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_east/.zattrs +8 -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_north/.zarray +4 -4
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_north/.zattrs +8 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_north/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/.zarray +4 -4
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/.zattrs +8 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_west/.zarray +4 -4
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_west/.zattrs +8 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_west/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 +4 -4
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zmetadata +4 -4
- 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/mask_coarse/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_rho/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_u/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/mask_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 +2 -1
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/.zmetadata +6 -4
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Cs_r/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Cs_w/.zattrs +1 -1
- 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/PO4/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/abs_time/.zattrs +1 -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/ocean_time/.zattrs +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/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/spFe/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 +56 -0
- 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/.zarray +22 -0
- roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_location/.zattrs +8 -0
- roms_tools/tests/test_setup/test_data/river_forcing_no_climatology.zarr/river_location/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/.zmetadata +56 -0
- 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/.zarray +22 -0
- roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/river_location/.zattrs +8 -0
- roms_tools/tests/test_setup/test_data/river_forcing_with_bgc.zarr/river_location/0.0 +0 -0
- roms_tools/tests/test_setup/test_grid.py +0 -13
- roms_tools/tests/test_setup/test_initial_conditions.py +220 -66
- roms_tools/tests/test_setup/test_nesting.py +139 -118
- roms_tools/tests/test_setup/test_river_forcing.py +583 -293
- roms_tools/tests/test_setup/test_surface_forcing.py +149 -73
- roms_tools/tests/test_setup/test_tides.py +4 -16
- roms_tools/tests/test_setup/test_utils.py +1 -0
- roms_tools/tests/test_setup/test_validation.py +34 -2
- roms_tools/tests/{test_utils.py → test_tiling/test_partition.py} +1 -1
- roms_tools/tiling/partition.py +338 -0
- roms_tools/utils.py +66 -333
- roms_tools/vertical_coordinate.py +54 -133
- {roms_tools-2.3.0.dist-info → roms_tools-2.5.0.dist-info}/METADATA +1 -1
- {roms_tools-2.3.0.dist-info → roms_tools-2.5.0.dist-info}/RECORD +303 -290
- {roms_tools-2.3.0.dist-info → roms_tools-2.5.0.dist-info}/WHEEL +1 -1
- {roms_tools-2.3.0.dist-info → roms_tools-2.5.0.dist-info}/LICENSE +0 -0
- {roms_tools-2.3.0.dist-info → roms_tools-2.5.0.dist-info}/top_level.txt +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
import xarray as xr
|
|
4
|
+
import numpy as np
|
|
4
5
|
from roms_tools import Grid, BoundaryForcing
|
|
5
6
|
import textwrap
|
|
6
7
|
from roms_tools.download import download_test_data
|
|
7
|
-
from conftest import
|
|
8
|
+
from conftest import calculate_data_hash
|
|
8
9
|
from pathlib import Path
|
|
9
10
|
import logging
|
|
10
11
|
|
|
@@ -13,19 +14,23 @@ import logging
|
|
|
13
14
|
"boundary_forcing_fixture",
|
|
14
15
|
[
|
|
15
16
|
"boundary_forcing",
|
|
16
|
-
|
|
17
|
+
"boundary_forcing_adjusted_for_zeta",
|
|
18
|
+
"boundary_forcing_with_2d_fill",
|
|
19
|
+
"boundary_forcing_with_2d_fill_adjusted_for_zeta",
|
|
17
20
|
],
|
|
18
21
|
)
|
|
19
22
|
def test_boundary_forcing_creation(boundary_forcing_fixture, request):
|
|
20
23
|
"""Test the creation of the BoundaryForcing object."""
|
|
21
24
|
|
|
22
|
-
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
23
25
|
boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
|
|
27
|
+
fname1 = Path(download_test_data("GLORYS_NA_20120101.nc"))
|
|
28
|
+
fname2 = Path(download_test_data("GLORYS_NA_20121231.nc"))
|
|
29
|
+
assert boundary_forcing.start_time == datetime(2012, 1, 1)
|
|
30
|
+
assert boundary_forcing.end_time == datetime(2012, 12, 31)
|
|
26
31
|
assert boundary_forcing.source == {
|
|
27
32
|
"name": "GLORYS",
|
|
28
|
-
"path":
|
|
33
|
+
"path": [fname1, fname2],
|
|
29
34
|
"climatology": False,
|
|
30
35
|
}
|
|
31
36
|
assert boundary_forcing.model_reference_date == datetime(2000, 1, 1)
|
|
@@ -44,16 +49,17 @@ def test_boundary_forcing_creation(boundary_forcing_fixture, request):
|
|
|
44
49
|
assert f"v_{direction}" in boundary_forcing.ds
|
|
45
50
|
assert f"zeta_{direction}" in boundary_forcing.ds
|
|
46
51
|
|
|
47
|
-
assert len(boundary_forcing.ds.bry_time) ==
|
|
52
|
+
assert len(boundary_forcing.ds.bry_time) == 2
|
|
48
53
|
assert boundary_forcing.ds.coords["bry_time"].attrs["units"] == "days"
|
|
49
54
|
assert not hasattr(boundary_forcing.ds, "climatology")
|
|
55
|
+
assert hasattr(boundary_forcing.ds, "adjust_depth_for_sea_surface_height")
|
|
56
|
+
assert hasattr(boundary_forcing.ds, "apply_2d_horizontal_fill")
|
|
50
57
|
|
|
51
58
|
|
|
52
59
|
@pytest.mark.parametrize(
|
|
53
60
|
"boundary_forcing_fixture",
|
|
54
61
|
[
|
|
55
62
|
"bgc_boundary_forcing_from_climatology",
|
|
56
|
-
# "bgc_boundary_forcing_from_climatology_with_2d_fill",
|
|
57
63
|
],
|
|
58
64
|
)
|
|
59
65
|
def test_boundary_forcing_creation_with_bgc(boundary_forcing_fixture, request):
|
|
@@ -133,6 +139,69 @@ def test_unsuccessful_boundary_forcing_creation_with_1d_fill(use_dask):
|
|
|
133
139
|
)
|
|
134
140
|
|
|
135
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
|
+
|
|
136
205
|
def test_boundary_divided_by_land_warning(caplog, use_dask):
|
|
137
206
|
|
|
138
207
|
# Iceland intersects the western boundary of the following grid
|
|
@@ -155,6 +224,113 @@ def test_boundary_divided_by_land_warning(caplog, use_dask):
|
|
|
155
224
|
assert "the western boundary is divided by land" in caplog.text
|
|
156
225
|
|
|
157
226
|
|
|
227
|
+
def test_info_depth(caplog, use_dask):
|
|
228
|
+
|
|
229
|
+
grid = Grid(
|
|
230
|
+
nx=3,
|
|
231
|
+
ny=3,
|
|
232
|
+
size_x=400,
|
|
233
|
+
size_y=400,
|
|
234
|
+
center_lon=-8,
|
|
235
|
+
center_lat=58,
|
|
236
|
+
rot=0,
|
|
237
|
+
N=3, # number of vertical levels
|
|
238
|
+
theta_s=5.0, # surface control parameter
|
|
239
|
+
theta_b=2.0, # bottom control parameter
|
|
240
|
+
hc=250.0, # critical depth
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
fname1 = Path(download_test_data("GLORYS_NA_20120101.nc"))
|
|
244
|
+
fname2 = Path(download_test_data("GLORYS_NA_20121231.nc"))
|
|
245
|
+
|
|
246
|
+
with caplog.at_level(logging.INFO):
|
|
247
|
+
BoundaryForcing(
|
|
248
|
+
grid=grid,
|
|
249
|
+
start_time=datetime(2012, 1, 1),
|
|
250
|
+
end_time=datetime(2012, 12, 31),
|
|
251
|
+
source={"name": "GLORYS", "path": [fname1, fname2]},
|
|
252
|
+
adjust_depth_for_sea_surface_height=True,
|
|
253
|
+
use_dask=use_dask,
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
# Verify the warning message in the log
|
|
257
|
+
assert "Sea surface height will be used to adjust depth coordinates." in caplog.text
|
|
258
|
+
|
|
259
|
+
# Clear the log before the next test
|
|
260
|
+
caplog.clear()
|
|
261
|
+
|
|
262
|
+
with caplog.at_level(logging.INFO):
|
|
263
|
+
|
|
264
|
+
BoundaryForcing(
|
|
265
|
+
grid=grid,
|
|
266
|
+
start_time=datetime(2012, 1, 1),
|
|
267
|
+
end_time=datetime(2012, 12, 31),
|
|
268
|
+
source={"name": "GLORYS", "path": [fname1, fname2]},
|
|
269
|
+
adjust_depth_for_sea_surface_height=False,
|
|
270
|
+
use_dask=use_dask,
|
|
271
|
+
)
|
|
272
|
+
# Verify the warning message in the log
|
|
273
|
+
assert (
|
|
274
|
+
"Sea surface height will NOT be used to adjust depth coordinates."
|
|
275
|
+
in caplog.text
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
def test_info_fill(caplog, use_dask):
|
|
280
|
+
|
|
281
|
+
grid = Grid(
|
|
282
|
+
nx=3,
|
|
283
|
+
ny=3,
|
|
284
|
+
size_x=400,
|
|
285
|
+
size_y=400,
|
|
286
|
+
center_lon=-8,
|
|
287
|
+
center_lat=58,
|
|
288
|
+
rot=0,
|
|
289
|
+
N=3, # number of vertical levels
|
|
290
|
+
theta_s=5.0, # surface control parameter
|
|
291
|
+
theta_b=2.0, # bottom control parameter
|
|
292
|
+
hc=250.0, # critical depth
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
fname1 = Path(download_test_data("GLORYS_NA_20120101.nc"))
|
|
296
|
+
fname2 = Path(download_test_data("GLORYS_NA_20121231.nc"))
|
|
297
|
+
|
|
298
|
+
with caplog.at_level(logging.INFO):
|
|
299
|
+
BoundaryForcing(
|
|
300
|
+
grid=grid,
|
|
301
|
+
start_time=datetime(2012, 1, 1),
|
|
302
|
+
end_time=datetime(2012, 12, 31),
|
|
303
|
+
source={"name": "GLORYS", "path": [fname1, fname2]},
|
|
304
|
+
apply_2d_horizontal_fill=True,
|
|
305
|
+
use_dask=use_dask,
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
# Verify the warning message in the log
|
|
309
|
+
assert (
|
|
310
|
+
"Applying 2D horizontal fill to the source data before regridding."
|
|
311
|
+
in caplog.text
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
# Clear the log before the next test
|
|
315
|
+
caplog.clear()
|
|
316
|
+
|
|
317
|
+
with caplog.at_level(logging.INFO):
|
|
318
|
+
|
|
319
|
+
BoundaryForcing(
|
|
320
|
+
grid=grid,
|
|
321
|
+
start_time=datetime(2012, 1, 1),
|
|
322
|
+
end_time=datetime(2012, 12, 31),
|
|
323
|
+
source={"name": "GLORYS", "path": [fname1, fname2]},
|
|
324
|
+
apply_2d_horizontal_fill=False,
|
|
325
|
+
use_dask=use_dask,
|
|
326
|
+
)
|
|
327
|
+
# Verify the warning message in the log
|
|
328
|
+
assert (
|
|
329
|
+
"Applying 1D horizontal fill separately to each regridded boundary."
|
|
330
|
+
in caplog.text
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
|
|
158
334
|
def test_1d_and_2d_fill_coincide_if_no_land(use_dask):
|
|
159
335
|
|
|
160
336
|
# this grid lies entirely over open ocean
|
|
@@ -182,23 +358,95 @@ def test_1d_and_2d_fill_coincide_if_no_land(use_dask):
|
|
|
182
358
|
xr.testing.assert_allclose(bf_1d_fill.ds, bf_2d_fill.ds, rtol=1.0e-4)
|
|
183
359
|
|
|
184
360
|
|
|
185
|
-
|
|
361
|
+
@pytest.mark.parametrize(
|
|
362
|
+
"boundary_forcing_fixture",
|
|
363
|
+
[
|
|
364
|
+
"boundary_forcing_adjusted_for_zeta",
|
|
365
|
+
"boundary_forcing_with_2d_fill_adjusted_for_zeta",
|
|
366
|
+
],
|
|
367
|
+
)
|
|
368
|
+
def test_correct_depth_coords_adjusted_for_zeta(
|
|
369
|
+
boundary_forcing_fixture, request, use_dask
|
|
370
|
+
):
|
|
371
|
+
|
|
372
|
+
boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
373
|
+
|
|
374
|
+
for direction in ["south", "east", "north", "west"]:
|
|
375
|
+
|
|
376
|
+
# Test that uppermost interface coincides with sea surface height
|
|
377
|
+
assert np.allclose(
|
|
378
|
+
boundary_forcing.ds_depth_coords[f"interface_depth_rho_{direction}"]
|
|
379
|
+
.isel(s_w=-1)
|
|
380
|
+
.values,
|
|
381
|
+
-boundary_forcing.ds[f"zeta_{direction}"].values,
|
|
382
|
+
atol=1e-6,
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
@pytest.mark.parametrize(
|
|
387
|
+
"boundary_forcing_fixture",
|
|
388
|
+
[
|
|
389
|
+
"boundary_forcing",
|
|
390
|
+
"boundary_forcing_with_2d_fill",
|
|
391
|
+
],
|
|
392
|
+
)
|
|
393
|
+
def test_correct_depth_coords_zero_zeta(boundary_forcing_fixture, request, use_dask):
|
|
394
|
+
|
|
395
|
+
boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
396
|
+
|
|
397
|
+
for direction in ["south", "east", "north", "west"]:
|
|
398
|
+
|
|
399
|
+
# Test that uppermost interface coincides with sea surface height
|
|
400
|
+
assert np.allclose(
|
|
401
|
+
boundary_forcing.ds_depth_coords[f"interface_depth_rho_{direction}"]
|
|
402
|
+
.isel(s_w=-1)
|
|
403
|
+
.values,
|
|
404
|
+
0 * boundary_forcing.ds[f"zeta_{direction}"].values,
|
|
405
|
+
atol=1e-6,
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
@pytest.mark.parametrize(
|
|
410
|
+
"boundary_forcing_fixture",
|
|
411
|
+
[
|
|
412
|
+
"boundary_forcing",
|
|
413
|
+
"boundary_forcing_with_2d_fill",
|
|
414
|
+
"boundary_forcing_adjusted_for_zeta",
|
|
415
|
+
"boundary_forcing_with_2d_fill_adjusted_for_zeta",
|
|
416
|
+
],
|
|
417
|
+
)
|
|
418
|
+
def test_boundary_forcing_plot(boundary_forcing_fixture, request):
|
|
186
419
|
"""Test plot."""
|
|
420
|
+
boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
187
421
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
422
|
+
for direction in ["south", "east", "north", "west"]:
|
|
423
|
+
for layer_contours in [False, True]:
|
|
424
|
+
boundary_forcing.plot(
|
|
425
|
+
var_name=f"temp_{direction}", layer_contours=layer_contours
|
|
426
|
+
)
|
|
427
|
+
boundary_forcing.plot(
|
|
428
|
+
var_name=f"u_{direction}", layer_contours=layer_contours
|
|
429
|
+
)
|
|
430
|
+
boundary_forcing.plot(
|
|
431
|
+
var_name=f"v_{direction}", layer_contours=layer_contours
|
|
432
|
+
)
|
|
433
|
+
boundary_forcing.plot(var_name=f"zeta_{direction}")
|
|
434
|
+
boundary_forcing.plot(var_name=f"vbar_{direction}")
|
|
435
|
+
boundary_forcing.plot(var_name=f"ubar_{direction}")
|
|
198
436
|
|
|
199
437
|
|
|
200
|
-
|
|
438
|
+
@pytest.mark.parametrize(
|
|
439
|
+
"boundary_forcing_fixture",
|
|
440
|
+
[
|
|
441
|
+
"boundary_forcing",
|
|
442
|
+
"boundary_forcing_with_2d_fill",
|
|
443
|
+
"boundary_forcing_adjusted_for_zeta",
|
|
444
|
+
"boundary_forcing_with_2d_fill_adjusted_for_zeta",
|
|
445
|
+
],
|
|
446
|
+
)
|
|
447
|
+
def test_boundary_forcing_save(boundary_forcing_fixture, request, tmp_path):
|
|
201
448
|
"""Test save method."""
|
|
449
|
+
boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
202
450
|
|
|
203
451
|
for file_str in ["test_bf", "test_bf.nc"]:
|
|
204
452
|
# Create a temporary filepath using the tmp_path fixture
|
|
@@ -207,8 +455,8 @@ def test_boundary_forcing_save(boundary_forcing, tmp_path):
|
|
|
207
455
|
str(tmp_path / file_str),
|
|
208
456
|
]: # test for Path object and str
|
|
209
457
|
|
|
210
|
-
# Test saving without
|
|
211
|
-
saved_filenames = boundary_forcing.save(filepath)
|
|
458
|
+
# Test saving without grouping
|
|
459
|
+
saved_filenames = boundary_forcing.save(filepath, group=False)
|
|
212
460
|
|
|
213
461
|
filepath_str = str(Path(filepath).with_suffix(""))
|
|
214
462
|
expected_filepath = Path(f"{filepath_str}.nc")
|
|
@@ -217,28 +465,16 @@ def test_boundary_forcing_save(boundary_forcing, tmp_path):
|
|
|
217
465
|
assert expected_filepath.exists()
|
|
218
466
|
expected_filepath.unlink()
|
|
219
467
|
|
|
220
|
-
# Test saving
|
|
468
|
+
# Test saving with grouping
|
|
221
469
|
saved_filenames = boundary_forcing.save(filepath, group=True)
|
|
222
470
|
|
|
223
471
|
filepath_str = str(Path(filepath).with_suffix(""))
|
|
224
|
-
expected_filepath = Path(f"{filepath_str}
|
|
472
|
+
expected_filepath = Path(f"{filepath_str}_2012.nc")
|
|
225
473
|
|
|
226
474
|
assert saved_filenames == [expected_filepath]
|
|
227
475
|
assert expected_filepath.exists()
|
|
228
476
|
expected_filepath.unlink()
|
|
229
477
|
|
|
230
|
-
# Test saving with partitioning and grouping
|
|
231
|
-
saved_filenames = boundary_forcing.save(filepath, np_eta=2, group=True)
|
|
232
|
-
expected_filepath_list = [
|
|
233
|
-
Path(filepath_str + f"_202106.{index}.nc") for index in range(2)
|
|
234
|
-
]
|
|
235
|
-
|
|
236
|
-
assert saved_filenames == expected_filepath_list
|
|
237
|
-
|
|
238
|
-
for expected_filepath in expected_filepath_list:
|
|
239
|
-
assert expected_filepath.exists()
|
|
240
|
-
expected_filepath.unlink()
|
|
241
|
-
|
|
242
478
|
|
|
243
479
|
def test_bgc_boundary_forcing_plot(bgc_boundary_forcing_from_climatology):
|
|
244
480
|
"""Test plot method."""
|
|
@@ -264,7 +500,9 @@ def test_bgc_boundary_forcing_save(bgc_boundary_forcing_from_climatology, tmp_pa
|
|
|
264
500
|
]: # test for Path object and str
|
|
265
501
|
|
|
266
502
|
# Test saving without partitioning and grouping
|
|
267
|
-
saved_filenames = bgc_boundary_forcing_from_climatology.save(
|
|
503
|
+
saved_filenames = bgc_boundary_forcing_from_climatology.save(
|
|
504
|
+
filepath, group=False
|
|
505
|
+
)
|
|
268
506
|
|
|
269
507
|
filepath_str = str(Path(filepath).with_suffix(""))
|
|
270
508
|
expected_filepath = Path(f"{filepath_str}.nc")
|
|
@@ -283,20 +521,6 @@ def test_bgc_boundary_forcing_save(bgc_boundary_forcing_from_climatology, tmp_pa
|
|
|
283
521
|
assert expected_filepath.exists()
|
|
284
522
|
expected_filepath.unlink()
|
|
285
523
|
|
|
286
|
-
# Test saving with partitioning
|
|
287
|
-
saved_filenames = bgc_boundary_forcing_from_climatology.save(
|
|
288
|
-
filepath, np_xi=2, group=True
|
|
289
|
-
)
|
|
290
|
-
|
|
291
|
-
expected_filepath_list = [
|
|
292
|
-
Path(filepath_str + f"_clim.{index}.nc") for index in range(2)
|
|
293
|
-
]
|
|
294
|
-
assert saved_filenames == expected_filepath_list
|
|
295
|
-
|
|
296
|
-
for expected_filepath in expected_filepath_list:
|
|
297
|
-
assert expected_filepath.exists()
|
|
298
|
-
expected_filepath.unlink()
|
|
299
|
-
|
|
300
524
|
|
|
301
525
|
@pytest.mark.parametrize(
|
|
302
526
|
"bdry_forcing_fixture",
|
|
@@ -341,11 +565,12 @@ def test_files_have_same_hash(boundary_forcing, tmp_path, use_dask):
|
|
|
341
565
|
|
|
342
566
|
filepath_str1 = str(Path(filepath1).with_suffix(""))
|
|
343
567
|
filepath_str2 = str(Path(filepath2).with_suffix(""))
|
|
344
|
-
expected_filepath1 = f"{filepath_str1}
|
|
345
|
-
expected_filepath2 = f"{filepath_str2}
|
|
568
|
+
expected_filepath1 = f"{filepath_str1}_2012.nc"
|
|
569
|
+
expected_filepath2 = f"{filepath_str2}_2012.nc"
|
|
346
570
|
|
|
347
|
-
|
|
348
|
-
|
|
571
|
+
# Only compare hash of datasets because metadata is non-deterministic with dask
|
|
572
|
+
hash1 = calculate_data_hash(expected_filepath1)
|
|
573
|
+
hash2 = calculate_data_hash(expected_filepath2)
|
|
349
574
|
|
|
350
575
|
assert hash1 == hash2, f"Hashes do not match: {hash1} != {hash2}"
|
|
351
576
|
|
|
@@ -372,8 +597,9 @@ def test_files_have_same_hash_clim(
|
|
|
372
597
|
expected_filepath1 = f"{filepath_str1}_clim.nc"
|
|
373
598
|
expected_filepath2 = f"{filepath_str2}_clim.nc"
|
|
374
599
|
|
|
375
|
-
|
|
376
|
-
|
|
600
|
+
# Only compare hash of datasets because metadata is non-deterministic with dask
|
|
601
|
+
hash1 = calculate_data_hash(expected_filepath1)
|
|
602
|
+
hash2 = calculate_data_hash(expected_filepath2)
|
|
377
603
|
|
|
378
604
|
assert hash1 == hash2, f"Hashes do not match: {hash1} != {hash2}"
|
|
379
605
|
|
|
@@ -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
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_south/0.0.0
CHANGED
|
Binary file
|