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
ci/environment.yml
CHANGED
roms_tools/__init__.py
CHANGED
|
@@ -14,7 +14,8 @@ from roms_tools.setup.surface_forcing import SurfaceForcing # noqa: F401
|
|
|
14
14
|
from roms_tools.setup.initial_conditions import InitialConditions # noqa: F401
|
|
15
15
|
from roms_tools.setup.boundary_forcing import BoundaryForcing # noqa: F401
|
|
16
16
|
from roms_tools.setup.river_forcing import RiverForcing # noqa: F401
|
|
17
|
-
from roms_tools.setup.nesting import
|
|
17
|
+
from roms_tools.setup.nesting import ChildGrid # noqa: F401
|
|
18
|
+
from roms_tools.tiling.partition import partition_netcdf # noqa: F401
|
|
18
19
|
from roms_tools.analysis.roms_output import ROMSOutput # noqa: F401
|
|
19
20
|
|
|
20
21
|
# Configure logging when the package is imported
|
|
@@ -5,14 +5,12 @@ from roms_tools.utils import _load_data
|
|
|
5
5
|
from dataclasses import dataclass, field
|
|
6
6
|
from typing import Union, Optional
|
|
7
7
|
from pathlib import Path
|
|
8
|
-
import os
|
|
9
8
|
import re
|
|
10
9
|
import logging
|
|
11
10
|
from datetime import datetime, timedelta
|
|
12
11
|
from roms_tools import Grid
|
|
13
12
|
from roms_tools.plot import _plot, _section_plot, _profile_plot, _line_plot
|
|
14
13
|
from roms_tools.vertical_coordinate import (
|
|
15
|
-
add_depth_coordinates_to_dataset,
|
|
16
14
|
compute_depth_coordinates,
|
|
17
15
|
)
|
|
18
16
|
|
|
@@ -26,34 +24,25 @@ class ROMSOutput:
|
|
|
26
24
|
grid : Grid
|
|
27
25
|
Object representing the grid information.
|
|
28
26
|
path : Union[str, Path, List[Union[str, Path]]]
|
|
29
|
-
|
|
30
|
-
type : str
|
|
31
|
-
Specifies the type of model output. Options are:
|
|
32
|
-
|
|
33
|
-
- "restart": for restart files.
|
|
34
|
-
- "average": for time-averaged files.
|
|
35
|
-
- "snapshot": for snapshot files.
|
|
36
|
-
|
|
27
|
+
Filename, or list of filenames with model output.
|
|
37
28
|
model_reference_date : datetime, optional
|
|
38
29
|
If not specified, this is inferred from metadata of the model output
|
|
39
30
|
If specified and does not coincide with metadata, a warning is raised.
|
|
31
|
+
adjust_depth_for_sea_surface_height : bool, optional
|
|
32
|
+
Whether to account for sea surface height variations when computing depth coordinates.
|
|
33
|
+
Defaults to `False`.
|
|
40
34
|
use_dask: bool, optional
|
|
41
35
|
Indicates whether to use dask for processing. If True, data is processed with dask; if False, data is processed eagerly. Defaults to False.
|
|
42
36
|
"""
|
|
43
37
|
|
|
44
38
|
grid: Grid
|
|
45
39
|
path: Union[str, Path]
|
|
46
|
-
type: Union[str, Path]
|
|
47
40
|
use_dask: bool = False
|
|
48
41
|
model_reference_date: Optional[datetime] = None
|
|
42
|
+
adjust_depth_for_sea_surface_height: Optional[bool] = False
|
|
49
43
|
ds: xr.Dataset = field(init=False, repr=False)
|
|
50
44
|
|
|
51
45
|
def __post_init__(self):
|
|
52
|
-
# Validate `type`
|
|
53
|
-
if self.type not in {"restart", "average", "snapshot"}:
|
|
54
|
-
raise ValueError(
|
|
55
|
-
f"Invalid type '{self.type}'. Must be one of 'restart', 'average', or 'snapshot'."
|
|
56
|
-
)
|
|
57
46
|
|
|
58
47
|
ds = self._load_model_output()
|
|
59
48
|
self._infer_model_reference_date_from_metadata(ds)
|
|
@@ -62,6 +51,9 @@ class ROMSOutput:
|
|
|
62
51
|
ds = self._add_lat_lon_coords(ds)
|
|
63
52
|
object.__setattr__(self, "ds", ds)
|
|
64
53
|
|
|
54
|
+
# Dataset for depth coordinates
|
|
55
|
+
object.__setattr__(self, "ds_depth_coords", xr.Dataset())
|
|
56
|
+
|
|
65
57
|
def plot(
|
|
66
58
|
self,
|
|
67
59
|
var_name,
|
|
@@ -69,6 +61,7 @@ class ROMSOutput:
|
|
|
69
61
|
s=None,
|
|
70
62
|
eta=None,
|
|
71
63
|
xi=None,
|
|
64
|
+
include_boundary=False,
|
|
72
65
|
depth_contours=False,
|
|
73
66
|
layer_contours=False,
|
|
74
67
|
ax=None,
|
|
@@ -95,6 +88,11 @@ class ROMSOutput:
|
|
|
95
88
|
xi : int, optional
|
|
96
89
|
The xi-index to plot. Used for vertical sections or horizontal slices.
|
|
97
90
|
Default is None.
|
|
91
|
+
include_boundary : bool, optional
|
|
92
|
+
Whether to include the outermost grid cells along the `eta`- and `xi`-boundaries in the plot.
|
|
93
|
+
In diagnostic ROMS output fields, these boundary cells are set to zero, so excluding them can improve visualization.
|
|
94
|
+
This option is only relevant for 2D horizontal plots (`eta=None`, `xi=None`).
|
|
95
|
+
Default is False.
|
|
98
96
|
depth_contours : bool, optional
|
|
99
97
|
If True, depth contours will be overlaid on the plot, showing lines of constant
|
|
100
98
|
depth. This is typically used for plots that show a single vertical layer.
|
|
@@ -184,26 +182,36 @@ class ROMSOutput:
|
|
|
184
182
|
compute_layer_depth = (depth_contours or s is None) and len(field.dims) > 2
|
|
185
183
|
compute_interface_depth = layer_contours and s is None
|
|
186
184
|
|
|
185
|
+
# Compute depth coordinates directly instead of using .ds_depth_coords.
|
|
186
|
+
# Many cases below require only a 1D or 2D slice, making direct computation
|
|
187
|
+
# more efficient than triggering a full 3D depth computation just to extract a subset.
|
|
188
|
+
# This is especially beneficial when using Dask or if .ds_depth_coords is precomputed.
|
|
189
|
+
if self.adjust_depth_for_sea_surface_height:
|
|
190
|
+
zeta = self.ds.zeta.isel(time=time)
|
|
191
|
+
else:
|
|
192
|
+
zeta = 0
|
|
187
193
|
if compute_layer_depth:
|
|
188
194
|
layer_depth = compute_depth_coordinates(
|
|
189
|
-
self.ds.isel(time=time),
|
|
190
195
|
self.grid.ds,
|
|
196
|
+
zeta,
|
|
191
197
|
depth_type="layer",
|
|
192
198
|
location=loc,
|
|
193
|
-
s=s,
|
|
194
199
|
eta=eta,
|
|
195
200
|
xi=xi,
|
|
196
201
|
)
|
|
202
|
+
if s is not None:
|
|
203
|
+
layer_depth = layer_depth.isel(s_rho=s)
|
|
197
204
|
if compute_interface_depth:
|
|
198
205
|
interface_depth = compute_depth_coordinates(
|
|
199
|
-
self.ds.isel(time=time),
|
|
200
206
|
self.grid.ds,
|
|
207
|
+
zeta,
|
|
201
208
|
depth_type="interface",
|
|
202
209
|
location=loc,
|
|
203
|
-
s=s,
|
|
204
210
|
eta=eta,
|
|
205
211
|
xi=xi,
|
|
206
212
|
)
|
|
213
|
+
if s is not None:
|
|
214
|
+
interface_depth = interface_depth.isel(s_w=s)
|
|
207
215
|
|
|
208
216
|
# Slice the field as desired
|
|
209
217
|
title = field.long_name
|
|
@@ -251,6 +259,32 @@ class ROMSOutput:
|
|
|
251
259
|
if compute_layer_depth:
|
|
252
260
|
field = field.assign_coords({"layer_depth": layer_depth})
|
|
253
261
|
|
|
262
|
+
if not include_boundary:
|
|
263
|
+
slice_dict = None
|
|
264
|
+
|
|
265
|
+
if eta is None and xi is None:
|
|
266
|
+
slice_dict = {
|
|
267
|
+
"rho": {"eta_rho": slice(1, -1), "xi_rho": slice(1, -1)},
|
|
268
|
+
"u": {"eta_rho": slice(1, -1), "xi_u": slice(1, -1)},
|
|
269
|
+
"v": {"eta_v": slice(1, -1), "xi_rho": slice(1, -1)},
|
|
270
|
+
}
|
|
271
|
+
elif eta is None:
|
|
272
|
+
slice_dict = {
|
|
273
|
+
"rho": {"eta_rho": slice(1, -1)},
|
|
274
|
+
"u": {"eta_rho": slice(1, -1)},
|
|
275
|
+
"v": {"eta_v": slice(1, -1)},
|
|
276
|
+
}
|
|
277
|
+
elif xi is None:
|
|
278
|
+
slice_dict = {
|
|
279
|
+
"rho": {"xi_rho": slice(1, -1)},
|
|
280
|
+
"u": {"xi_u": slice(1, -1)},
|
|
281
|
+
"v": {"xi_rho": slice(1, -1)},
|
|
282
|
+
}
|
|
283
|
+
if slice_dict is not None:
|
|
284
|
+
if loc in slice_dict:
|
|
285
|
+
field = field.isel(**slice_dict[loc])
|
|
286
|
+
mask = mask.isel(**slice_dict[loc])
|
|
287
|
+
|
|
254
288
|
# Choose colorbar
|
|
255
289
|
if var_name in ["u", "v", "w", "ubar", "vbar", "zeta"]:
|
|
256
290
|
vmax = max(field.where(mask).max().values, -field.where(mask).min().values)
|
|
@@ -299,8 +333,8 @@ class ROMSOutput:
|
|
|
299
333
|
else:
|
|
300
334
|
_line_plot(field.where(mask), title=title, ax=ax)
|
|
301
335
|
|
|
302
|
-
def
|
|
303
|
-
"""
|
|
336
|
+
def _get_depth_coordinates(self, depth_type="layer", locations=["rho"]):
|
|
337
|
+
"""Ensure depth coordinates are stored for a given location and depth type.
|
|
304
338
|
|
|
305
339
|
Calculates vertical depth coordinates (layer or interface) for specified locations (e.g., rho, u, v points)
|
|
306
340
|
and updates them in the dataset (`self.ds`).
|
|
@@ -320,58 +354,44 @@ class ROMSOutput:
|
|
|
320
354
|
|
|
321
355
|
Updates
|
|
322
356
|
-------
|
|
323
|
-
self.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
357
|
+
self.ds_depth_coords : xarray.Dataset
|
|
358
|
+
|
|
359
|
+
Raises
|
|
360
|
+
------
|
|
361
|
+
ValueError
|
|
362
|
+
If `adjust_depth_for_sea_surface_height` is enabled but `zeta` is missing from `self.ds`.
|
|
328
363
|
|
|
329
364
|
Notes
|
|
330
365
|
-----
|
|
331
|
-
This method
|
|
366
|
+
- This method relies on the `compute_depth_coordinates` function to perform calculations.
|
|
367
|
+
- If `adjust_depth_for_sea_surface_height` is `True`, the method accounts for variations
|
|
368
|
+
in sea surface height (`zeta`).
|
|
332
369
|
"""
|
|
333
370
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if isinstance(self.path, list):
|
|
339
|
-
filetype = "list"
|
|
340
|
-
force_combine_nested = True
|
|
341
|
-
# Check if all items in the list are files
|
|
342
|
-
if not all(Path(item).is_file() for item in self.path):
|
|
343
|
-
raise FileNotFoundError(
|
|
344
|
-
"All items in the provided list must be valid files."
|
|
371
|
+
if self.adjust_depth_for_sea_surface_height:
|
|
372
|
+
if "zeta" not in self.ds:
|
|
373
|
+
raise ValueError(
|
|
374
|
+
"`zeta` is required in provided ROMS output when `adjust_depth_for_sea_surface_height` is enabled."
|
|
345
375
|
)
|
|
346
|
-
|
|
347
|
-
filetype = "file"
|
|
348
|
-
force_combine_nested = False
|
|
349
|
-
elif Path(self.path).is_dir():
|
|
350
|
-
filetype = "dir"
|
|
351
|
-
force_combine_nested = True
|
|
376
|
+
zeta = self.ds.zeta
|
|
352
377
|
else:
|
|
353
|
-
|
|
354
|
-
f"The specified path '{self.path}' is neither a file, nor a list of files, nor a directory."
|
|
355
|
-
)
|
|
378
|
+
zeta = 0
|
|
356
379
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
filename = _validate_and_set_filenames(self.path, filetype, "his")
|
|
365
|
-
else:
|
|
366
|
-
raise ValueError(f"Unsupported type '{self.type}'.")
|
|
380
|
+
for location in locations:
|
|
381
|
+
self.ds_depth_coords[
|
|
382
|
+
f"{depth_type}_depth_{location}"
|
|
383
|
+
] = compute_depth_coordinates(self.grid.ds, zeta, depth_type, location)
|
|
384
|
+
|
|
385
|
+
def _load_model_output(self) -> xr.Dataset:
|
|
386
|
+
"""Load the model output."""
|
|
367
387
|
|
|
368
388
|
# Load the dataset
|
|
369
389
|
ds = _load_data(
|
|
370
|
-
|
|
390
|
+
self.path,
|
|
371
391
|
dim_names={"time": "time"},
|
|
372
392
|
use_dask=self.use_dask,
|
|
373
|
-
time_chunking=
|
|
374
|
-
force_combine_nested=
|
|
393
|
+
time_chunking=True,
|
|
394
|
+
force_combine_nested=True,
|
|
375
395
|
)
|
|
376
396
|
|
|
377
397
|
return ds
|
|
@@ -547,40 +567,3 @@ class ROMSOutput:
|
|
|
547
567
|
)
|
|
548
568
|
|
|
549
569
|
return ds
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
def _validate_and_set_filenames(
|
|
553
|
-
filenames: Union[str, list], filetype: str, string: str
|
|
554
|
-
) -> Union[str, list]:
|
|
555
|
-
"""Validates and adjusts the filename or list of filenames based on the specified
|
|
556
|
-
type and checks for the presence of a string in the filename.
|
|
557
|
-
|
|
558
|
-
Parameters
|
|
559
|
-
----------
|
|
560
|
-
filenames : Union[str, list]
|
|
561
|
-
A single filename (str), a list of filenames, or a directory path.
|
|
562
|
-
filetype : str
|
|
563
|
-
The type of input: 'file' for a single file, 'list' for a list of files, or 'dir' for a directory.
|
|
564
|
-
string : str
|
|
565
|
-
The string that should be present in each filename.
|
|
566
|
-
|
|
567
|
-
Returns
|
|
568
|
-
-------
|
|
569
|
-
Union[str, list]
|
|
570
|
-
The validated filename(s). If a directory is provided, the function returns the adjusted file pattern.
|
|
571
|
-
"""
|
|
572
|
-
if filetype == "file":
|
|
573
|
-
if string not in os.path.basename(filenames):
|
|
574
|
-
logging.warning(
|
|
575
|
-
f"The file '{filenames}' does not appear to contain '{string}' in the name."
|
|
576
|
-
)
|
|
577
|
-
elif filetype == "list":
|
|
578
|
-
for file in filenames:
|
|
579
|
-
if string not in os.path.basename(file):
|
|
580
|
-
logging.warning(
|
|
581
|
-
f"The file '{file}' does not appear to contain '{string}' in the name."
|
|
582
|
-
)
|
|
583
|
-
elif filetype == "dir":
|
|
584
|
-
filenames = os.path.join(filenames, f"*{string}.*.nc")
|
|
585
|
-
|
|
586
|
-
return filenames
|
roms_tools/plot.py
CHANGED
|
@@ -19,8 +19,8 @@ def _plot(
|
|
|
19
19
|
|
|
20
20
|
Parameters
|
|
21
21
|
----------
|
|
22
|
-
field : xarray.DataArray
|
|
23
|
-
The field to plot.
|
|
22
|
+
field : xarray.DataArray
|
|
23
|
+
The field to plot.
|
|
24
24
|
depth_contours : bool, optional
|
|
25
25
|
If True, adds depth contours to the plot.
|
|
26
26
|
c : str, optional
|
|
@@ -284,6 +284,7 @@ def _section_plot(field, interface_depth=None, title="", kwargs={}, ax=None):
|
|
|
284
284
|
)
|
|
285
285
|
|
|
286
286
|
ax.set_title(title)
|
|
287
|
+
ax.set_ylabel("Depth [m]")
|
|
287
288
|
|
|
288
289
|
|
|
289
290
|
def _profile_plot(field, title="", ax=None):
|
|
@@ -324,6 +325,7 @@ def _profile_plot(field, title="", ax=None):
|
|
|
324
325
|
kwargs = {"y": depth_label, "yincrease": False}
|
|
325
326
|
field.plot(**kwargs)
|
|
326
327
|
ax.set_title(title)
|
|
328
|
+
ax.set_ylabel("Depth [m]")
|
|
327
329
|
ax.grid()
|
|
328
330
|
|
|
329
331
|
|