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
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chunks": [
|
|
3
|
+
6
|
|
4
|
+
],
|
|
5
|
+
"compressor": {
|
|
6
|
+
"blocksize": 0,
|
|
7
|
+
"clevel": 5,
|
|
8
|
+
"cname": "lz4",
|
|
9
|
+
"id": "blosc",
|
|
10
|
+
"shuffle": 1
|
|
11
|
+
},
|
|
12
|
+
"dtype": "<i8",
|
|
13
|
+
"fill_value": null,
|
|
14
|
+
"filters": null,
|
|
15
|
+
"order": "C",
|
|
16
|
+
"shape": [
|
|
17
|
+
6
|
|
18
|
+
],
|
|
19
|
+
"zarr_format": 2
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chunks": [
|
|
3
|
+
20,
|
|
4
|
+
20
|
|
5
|
+
],
|
|
6
|
+
"compressor": {
|
|
7
|
+
"blocksize": 0,
|
|
8
|
+
"clevel": 5,
|
|
9
|
+
"cname": "lz4",
|
|
10
|
+
"id": "blosc",
|
|
11
|
+
"shuffle": 1
|
|
12
|
+
},
|
|
13
|
+
"dtype": "<f8",
|
|
14
|
+
"fill_value": "NaN",
|
|
15
|
+
"filters": null,
|
|
16
|
+
"order": "C",
|
|
17
|
+
"shape": [
|
|
18
|
+
20,
|
|
19
|
+
20
|
|
20
|
+
],
|
|
21
|
+
"zarr_format": 2
|
|
22
|
+
}
|
|
Binary file
|
|
@@ -90,7 +90,6 @@ def test_plot_save_methods(tmp_path):
|
|
|
90
90
|
str(tmp_path / file_str),
|
|
91
91
|
]: # test for Path object and str
|
|
92
92
|
|
|
93
|
-
# Test saving without partitioning
|
|
94
93
|
saved_filenames = grid.save(filepath)
|
|
95
94
|
# Check if the .nc file was created
|
|
96
95
|
filepath = Path(filepath).with_suffix(".nc")
|
|
@@ -100,18 +99,6 @@ def test_plot_save_methods(tmp_path):
|
|
|
100
99
|
# Clean up the .nc file
|
|
101
100
|
filepath.unlink()
|
|
102
101
|
|
|
103
|
-
# Test saving with partitioning
|
|
104
|
-
saved_filenames = grid.save(filepath, np_eta=2, np_xi=5)
|
|
105
|
-
|
|
106
|
-
filepath_str = str(filepath.with_suffix(""))
|
|
107
|
-
expected_filepath_list = [
|
|
108
|
-
Path(filepath_str + f".{index}.nc") for index in range(10)
|
|
109
|
-
]
|
|
110
|
-
assert saved_filenames == expected_filepath_list
|
|
111
|
-
for expected_filepath in expected_filepath_list:
|
|
112
|
-
assert expected_filepath.exists()
|
|
113
|
-
expected_filepath.unlink()
|
|
114
|
-
|
|
115
102
|
|
|
116
103
|
def test_raise_if_domain_too_large():
|
|
117
104
|
with pytest.raises(ValueError, match="Domain size exceeds"):
|
|
@@ -4,17 +4,20 @@ from roms_tools import InitialConditions, Grid
|
|
|
4
4
|
import xarray as xr
|
|
5
5
|
import numpy as np
|
|
6
6
|
import textwrap
|
|
7
|
+
import logging
|
|
7
8
|
from roms_tools.download import download_test_data
|
|
8
9
|
from roms_tools.setup.datasets import CESMBGCDataset
|
|
9
10
|
from pathlib import Path
|
|
10
|
-
from conftest import
|
|
11
|
+
from conftest import calculate_data_hash
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
@pytest.mark.parametrize(
|
|
14
15
|
"ic_fixture",
|
|
15
16
|
[
|
|
16
17
|
"initial_conditions",
|
|
18
|
+
"initial_conditions_adjusted_for_zeta",
|
|
17
19
|
"initial_conditions_with_bgc",
|
|
20
|
+
"initial_conditions_with_bgc_adjusted_for_zeta",
|
|
18
21
|
"initial_conditions_with_bgc_from_climatology",
|
|
19
22
|
],
|
|
20
23
|
)
|
|
@@ -29,6 +32,7 @@ def test_initial_conditions_creation(ic_fixture, request):
|
|
|
29
32
|
"path": Path(download_test_data("GLORYS_coarse_test_data.nc")),
|
|
30
33
|
"climatology": False,
|
|
31
34
|
}
|
|
35
|
+
assert hasattr(ic.ds, "adjust_depth_for_sea_surface_height")
|
|
32
36
|
assert isinstance(ic.ds, xr.Dataset)
|
|
33
37
|
assert "temp" in ic.ds
|
|
34
38
|
assert "salt" in ic.ds
|
|
@@ -112,6 +116,22 @@ def test_initial_conditions_missing_bgc_path(example_grid, use_dask):
|
|
|
112
116
|
)
|
|
113
117
|
|
|
114
118
|
|
|
119
|
+
# Test initialization with missing ini_time
|
|
120
|
+
def test_initial_conditions_missing_ini_time(example_grid, use_dask):
|
|
121
|
+
|
|
122
|
+
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
123
|
+
with pytest.raises(
|
|
124
|
+
ValueError,
|
|
125
|
+
match="`ini_time` must be a valid datetime object and cannot be None.",
|
|
126
|
+
):
|
|
127
|
+
InitialConditions(
|
|
128
|
+
grid=example_grid,
|
|
129
|
+
ini_time=None,
|
|
130
|
+
source={"name": "GLORYS", "path": fname},
|
|
131
|
+
use_dask=use_dask,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
|
|
115
135
|
# Test default climatology value
|
|
116
136
|
def test_initial_conditions_default_climatology(example_grid, use_dask):
|
|
117
137
|
|
|
@@ -144,6 +164,128 @@ def test_initial_conditions_default_bgc_climatology(example_grid, use_dask):
|
|
|
144
164
|
assert initial_conditions.bgc_source["climatology"] is False
|
|
145
165
|
|
|
146
166
|
|
|
167
|
+
def test_info_depth(caplog, use_dask):
|
|
168
|
+
|
|
169
|
+
grid = Grid(
|
|
170
|
+
nx=2,
|
|
171
|
+
ny=2,
|
|
172
|
+
size_x=500,
|
|
173
|
+
size_y=1000,
|
|
174
|
+
center_lon=0,
|
|
175
|
+
center_lat=55,
|
|
176
|
+
rot=10,
|
|
177
|
+
N=3, # number of vertical levels
|
|
178
|
+
theta_s=5.0, # surface control parameter
|
|
179
|
+
theta_b=2.0, # bottom control parameter
|
|
180
|
+
hc=250.0, # critical depth
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
184
|
+
|
|
185
|
+
with caplog.at_level(logging.INFO):
|
|
186
|
+
|
|
187
|
+
InitialConditions(
|
|
188
|
+
grid=grid,
|
|
189
|
+
ini_time=datetime(2021, 6, 29),
|
|
190
|
+
source={"path": fname, "name": "GLORYS"},
|
|
191
|
+
adjust_depth_for_sea_surface_height=True,
|
|
192
|
+
use_dask=use_dask,
|
|
193
|
+
)
|
|
194
|
+
# Verify the warning message in the log
|
|
195
|
+
assert "Sea surface height will be used to adjust depth coordinates." in caplog.text
|
|
196
|
+
|
|
197
|
+
# Clear the log before the next test
|
|
198
|
+
caplog.clear()
|
|
199
|
+
|
|
200
|
+
with caplog.at_level(logging.INFO):
|
|
201
|
+
|
|
202
|
+
InitialConditions(
|
|
203
|
+
grid=grid,
|
|
204
|
+
ini_time=datetime(2021, 6, 29),
|
|
205
|
+
source={"path": fname, "name": "GLORYS"},
|
|
206
|
+
adjust_depth_for_sea_surface_height=False,
|
|
207
|
+
use_dask=use_dask,
|
|
208
|
+
)
|
|
209
|
+
# Verify the warning message in the log
|
|
210
|
+
assert (
|
|
211
|
+
"Sea surface height will NOT be used to adjust depth coordinates."
|
|
212
|
+
in caplog.text
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
@pytest.mark.parametrize(
|
|
217
|
+
"initial_conditions_fixture",
|
|
218
|
+
[
|
|
219
|
+
"initial_conditions_adjusted_for_zeta",
|
|
220
|
+
"initial_conditions_with_bgc_adjusted_for_zeta",
|
|
221
|
+
],
|
|
222
|
+
)
|
|
223
|
+
def test_correct_depth_coords_adjusted_for_zeta(
|
|
224
|
+
initial_conditions_fixture, request, use_dask
|
|
225
|
+
):
|
|
226
|
+
|
|
227
|
+
initial_conditions = request.getfixturevalue(initial_conditions_fixture)
|
|
228
|
+
|
|
229
|
+
# compute interface depth at rho-points and write it into .ds_depth_coords
|
|
230
|
+
zeta = initial_conditions.ds.zeta
|
|
231
|
+
initial_conditions._get_depth_coordinates(
|
|
232
|
+
zeta, location="rho", depth_type="interface"
|
|
233
|
+
)
|
|
234
|
+
# Test that lowermost interface coincides with topography
|
|
235
|
+
assert np.allclose(
|
|
236
|
+
initial_conditions.ds_depth_coords["interface_depth_rho"]
|
|
237
|
+
.isel(s_w=0)
|
|
238
|
+
.squeeze()
|
|
239
|
+
.values, # Extract raw NumPy array
|
|
240
|
+
initial_conditions.grid.ds.h.values,
|
|
241
|
+
atol=1e-6, # Adjust tolerance as needed
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
# Test that uppermost interface coincides with sea surface height
|
|
245
|
+
assert np.allclose(
|
|
246
|
+
initial_conditions.ds_depth_coords["interface_depth_rho"]
|
|
247
|
+
.isel(s_w=-1)
|
|
248
|
+
.squeeze()
|
|
249
|
+
.values,
|
|
250
|
+
-zeta.values,
|
|
251
|
+
atol=1e-6,
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
@pytest.mark.parametrize(
|
|
256
|
+
"initial_conditions_fixture",
|
|
257
|
+
[
|
|
258
|
+
"initial_conditions",
|
|
259
|
+
"initial_conditions",
|
|
260
|
+
],
|
|
261
|
+
)
|
|
262
|
+
def test_correct_depth_coords_zero_zeta(initial_conditions_fixture, request, use_dask):
|
|
263
|
+
|
|
264
|
+
initial_conditions = request.getfixturevalue(initial_conditions_fixture)
|
|
265
|
+
|
|
266
|
+
# compute interface depth at rho-points and write it into .ds_depth_coords
|
|
267
|
+
initial_conditions._get_depth_coordinates(0, location="rho", depth_type="interface")
|
|
268
|
+
# Test that lowermost interface coincides with topography
|
|
269
|
+
assert np.allclose(
|
|
270
|
+
initial_conditions.ds_depth_coords["interface_depth_rho"]
|
|
271
|
+
.isel(s_w=0)
|
|
272
|
+
.squeeze()
|
|
273
|
+
.values, # Extract raw NumPy array
|
|
274
|
+
initial_conditions.grid.ds.h.values,
|
|
275
|
+
atol=1e-6, # Adjust tolerance as needed
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
# Test that uppermost interface coincides with sea surface height
|
|
279
|
+
assert np.allclose(
|
|
280
|
+
initial_conditions.ds_depth_coords["interface_depth_rho"]
|
|
281
|
+
.isel(s_w=-1)
|
|
282
|
+
.squeeze()
|
|
283
|
+
.values,
|
|
284
|
+
0 * initial_conditions.grid.ds.h.values,
|
|
285
|
+
atol=1e-6,
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
|
|
147
289
|
def test_interpolation_from_climatology(
|
|
148
290
|
initial_conditions_with_bgc_from_climatology, use_dask
|
|
149
291
|
):
|
|
@@ -176,47 +318,61 @@ def test_interpolation_from_climatology(
|
|
|
176
318
|
)
|
|
177
319
|
|
|
178
320
|
|
|
179
|
-
|
|
321
|
+
@pytest.mark.parametrize(
|
|
322
|
+
"initial_conditions_fixture",
|
|
323
|
+
[
|
|
324
|
+
"initial_conditions_with_bgc_adjusted_for_zeta",
|
|
325
|
+
"initial_conditions_with_bgc_from_climatology",
|
|
326
|
+
],
|
|
327
|
+
)
|
|
328
|
+
def test_initial_conditions_plot(initial_conditions_fixture, request):
|
|
180
329
|
"""Test plot method."""
|
|
181
330
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
var_name="
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
var_name="u",
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
331
|
+
initial_conditions = request.getfixturevalue(initial_conditions_fixture)
|
|
332
|
+
|
|
333
|
+
# horizontal slices plots
|
|
334
|
+
for depth_contours in [True, False]:
|
|
335
|
+
initial_conditions.plot(var_name="temp", s=0, depth_contours=depth_contours)
|
|
336
|
+
initial_conditions.plot(var_name="u", s=0, depth_contours=depth_contours)
|
|
337
|
+
initial_conditions.plot(var_name="v", s=0, depth_contours=depth_contours)
|
|
338
|
+
initial_conditions.plot(var_name="ALK", s=0, depth_contours=depth_contours)
|
|
339
|
+
|
|
340
|
+
# section plots
|
|
341
|
+
for layer_contours in [True, False]:
|
|
342
|
+
initial_conditions.plot(var_name="temp", eta=0, layer_contours=layer_contours)
|
|
343
|
+
initial_conditions.plot(var_name="temp", xi=0, layer_contours=layer_contours)
|
|
344
|
+
initial_conditions.plot(var_name="ALK", eta=0, layer_contours=layer_contours)
|
|
345
|
+
initial_conditions.plot(var_name="ALK", xi=0, layer_contours=layer_contours)
|
|
346
|
+
initial_conditions.plot(var_name="u", eta=0, layer_contours=layer_contours)
|
|
347
|
+
initial_conditions.plot(var_name="u", xi=0, layer_contours=layer_contours)
|
|
348
|
+
initial_conditions.plot(var_name="v", eta=0, layer_contours=layer_contours)
|
|
349
|
+
initial_conditions.plot(var_name="v", xi=0, layer_contours=layer_contours)
|
|
350
|
+
|
|
351
|
+
# 1D plot in horizontal
|
|
352
|
+
initial_conditions.plot(var_name="temp", s=0, xi=0)
|
|
353
|
+
initial_conditions.plot(var_name="ALK", s=0, xi=0)
|
|
354
|
+
|
|
355
|
+
# 1D plot in vertical
|
|
356
|
+
initial_conditions.plot(var_name="temp", eta=0, xi=0)
|
|
357
|
+
initial_conditions.plot(var_name="ALK", eta=0, xi=0)
|
|
358
|
+
|
|
359
|
+
initial_conditions.plot(var_name="zeta")
|
|
360
|
+
initial_conditions.plot(var_name="ubar")
|
|
361
|
+
initial_conditions.plot(var_name="vbar")
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
@pytest.mark.parametrize(
|
|
365
|
+
"initial_conditions_fixture",
|
|
366
|
+
[
|
|
367
|
+
"initial_conditions",
|
|
368
|
+
"initial_conditions_adjusted_for_zeta",
|
|
369
|
+
],
|
|
370
|
+
)
|
|
371
|
+
def test_initial_conditions_save(initial_conditions_fixture, request, tmp_path):
|
|
218
372
|
"""Test save method."""
|
|
219
373
|
|
|
374
|
+
initial_conditions = request.getfixturevalue(initial_conditions_fixture)
|
|
375
|
+
|
|
220
376
|
for file_str in ["test_ic", "test_ic.nc"]:
|
|
221
377
|
# Create a temporary filepath using the tmp_path fixture
|
|
222
378
|
for filepath in [
|
|
@@ -224,10 +380,7 @@ def test_initial_conditions_save(
|
|
|
224
380
|
str(tmp_path / file_str),
|
|
225
381
|
]: # test for Path object and str
|
|
226
382
|
|
|
227
|
-
|
|
228
|
-
saved_filenames = initial_conditions_with_bgc_from_climatology.save(
|
|
229
|
-
filepath
|
|
230
|
-
)
|
|
383
|
+
saved_filenames = initial_conditions.save(filepath)
|
|
231
384
|
# Check if the .nc file was created
|
|
232
385
|
filepath = Path(filepath).with_suffix(".nc")
|
|
233
386
|
assert saved_filenames == [filepath]
|
|
@@ -235,27 +388,20 @@ def test_initial_conditions_save(
|
|
|
235
388
|
# Clean up the .nc file
|
|
236
389
|
filepath.unlink()
|
|
237
390
|
|
|
238
|
-
# Test saving with partitioning
|
|
239
|
-
saved_filenames = initial_conditions_with_bgc_from_climatology.save(
|
|
240
|
-
filepath, np_eta=2
|
|
241
|
-
)
|
|
242
|
-
|
|
243
|
-
filepath_str = str(filepath.with_suffix(""))
|
|
244
|
-
expected_filepath_list = [
|
|
245
|
-
Path(filepath_str + f".{index}.nc") for index in range(2)
|
|
246
|
-
]
|
|
247
|
-
assert saved_filenames == expected_filepath_list
|
|
248
|
-
for expected_filepath in expected_filepath_list:
|
|
249
|
-
assert expected_filepath.exists()
|
|
250
|
-
expected_filepath.unlink()
|
|
251
|
-
|
|
252
391
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
392
|
+
@pytest.mark.parametrize(
|
|
393
|
+
"initial_conditions_fixture",
|
|
394
|
+
[
|
|
395
|
+
"initial_conditions",
|
|
396
|
+
"initial_conditions_adjusted_for_zeta",
|
|
397
|
+
],
|
|
398
|
+
)
|
|
399
|
+
def test_roundtrip_yaml(initial_conditions_fixture, request, tmp_path, use_dask):
|
|
256
400
|
"""Test that creating an InitialConditions object, saving its parameters to yaml
|
|
257
401
|
file, and re-opening yaml file creates the same object."""
|
|
258
402
|
|
|
403
|
+
initial_conditions = request.getfixturevalue(initial_conditions_fixture)
|
|
404
|
+
|
|
259
405
|
# Create a temporary filepath using the tmp_path fixture
|
|
260
406
|
file_str = "test_yaml"
|
|
261
407
|
for filepath in [
|
|
@@ -263,21 +409,28 @@ def test_roundtrip_yaml(
|
|
|
263
409
|
str(tmp_path / file_str),
|
|
264
410
|
]: # test for Path object and str
|
|
265
411
|
|
|
266
|
-
|
|
412
|
+
initial_conditions.to_yaml(filepath)
|
|
267
413
|
|
|
268
414
|
initial_conditions_from_file = InitialConditions.from_yaml(
|
|
269
415
|
filepath, use_dask=use_dask
|
|
270
416
|
)
|
|
271
417
|
|
|
272
|
-
assert
|
|
273
|
-
initial_conditions_with_bgc_from_climatology == initial_conditions_from_file
|
|
274
|
-
)
|
|
418
|
+
assert initial_conditions == initial_conditions_from_file
|
|
275
419
|
|
|
276
420
|
filepath = Path(filepath)
|
|
277
421
|
filepath.unlink()
|
|
278
422
|
|
|
279
423
|
|
|
280
|
-
|
|
424
|
+
@pytest.mark.parametrize(
|
|
425
|
+
"initial_conditions_fixture",
|
|
426
|
+
[
|
|
427
|
+
"initial_conditions",
|
|
428
|
+
"initial_conditions_adjusted_for_zeta",
|
|
429
|
+
],
|
|
430
|
+
)
|
|
431
|
+
def test_files_have_same_hash(initial_conditions_fixture, request, tmp_path, use_dask):
|
|
432
|
+
|
|
433
|
+
initial_conditions = request.getfixturevalue(initial_conditions_fixture)
|
|
281
434
|
|
|
282
435
|
yaml_filepath = tmp_path / "test_yaml.yaml"
|
|
283
436
|
filepath1 = tmp_path / "test1.nc"
|
|
@@ -288,8 +441,9 @@ def test_files_have_same_hash(initial_conditions, tmp_path, use_dask):
|
|
|
288
441
|
ic_from_file = InitialConditions.from_yaml(yaml_filepath, use_dask)
|
|
289
442
|
ic_from_file.save(filepath2)
|
|
290
443
|
|
|
291
|
-
|
|
292
|
-
|
|
444
|
+
# Only compare hash of datasets because metadata is non-deterministic with dask
|
|
445
|
+
hash1 = calculate_data_hash(filepath1)
|
|
446
|
+
hash2 = calculate_data_hash(filepath2)
|
|
293
447
|
|
|
294
448
|
assert hash1 == hash2, f"Hashes do not match: {hash1} != {hash2}"
|
|
295
449
|
|