roms-tools 1.3.0__py3-none-any.whl → 1.4.1__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 -8
- roms_tools/_version.py +1 -1
- roms_tools/setup/boundary_forcing.py +1 -1
- roms_tools/setup/datasets.py +278 -105
- roms_tools/setup/download.py +5 -0
- roms_tools/setup/fill.py +266 -331
- roms_tools/setup/grid.py +92 -8
- roms_tools/setup/initial_conditions.py +10 -11
- roms_tools/setup/mixins.py +29 -21
- roms_tools/setup/surface_forcing.py +3 -5
- roms_tools/setup/tides.py +44 -46
- roms_tools/setup/topography.py +30 -4
- roms_tools/setup/utils.py +41 -23
- roms_tools/tests/test_setup/test_boundary_forcing.py +1 -1
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/.zmetadata +1 -1
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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_north/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 +1 -1
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/.zmetadata +1 -1
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/dust/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/iron/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nhy/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/nox/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing.zarr/pco2_air_alt/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/.zmetadata +1 -1
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/dust/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/iron/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nhy/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/nox/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_surface_forcing_from_climatology.zarr/pco2_air_alt/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/.zmetadata +1 -1
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_north/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_north/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_north/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_east/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_north/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_south/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_west/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_east/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_north/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_south/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_west/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_east/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_north/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_south/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_west/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_east/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/.zmetadata +8 -8
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/Tair/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/Tair/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/lwrad/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/lwrad/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/qair/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/qair/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/rain/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/rain/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/swrad/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/swrad/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/uwnd/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/uwnd/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/vwnd/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/vwnd/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/.zmetadata +8 -8
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/Tair/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/Tair/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/lwrad/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/lwrad/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/qair/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/qair/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/rain/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/rain/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/swrad/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/swrad/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/uwnd/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/uwnd/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/vwnd/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/vwnd/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/.zattrs +2 -2
- roms_tools/tests/test_setup/test_data/grid.zarr/.zmetadata +62 -2
- roms_tools/tests/test_setup/test_data/grid.zarr/lat_psi/.zarray +22 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/lat_psi/.zattrs +8 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/lat_psi/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/lon_psi/.zarray +22 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/lon_psi/.zattrs +8 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/lon_psi/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/lon_u/0.0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zattrs +2 -2
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/.zmetadata +62 -2
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_psi/.zarray +22 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_psi/.zattrs +8 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lat_psi/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_psi/.zarray +22 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_psi/.zattrs +8 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/lon_psi/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/initial_conditions_with_bgc_from_climatology.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/.zmetadata +1 -1
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK_ALT_CO2/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC_ALT_CO2/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOC/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOCr/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DON/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DONr/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOP/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOPr/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Fe/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Lig/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NH4/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NO3/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/O2/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/PO4/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/SiO3/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatC/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatChl/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatFe/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatP/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatSi/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazC/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazChl/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazFe/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazP/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/salt/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spC/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spCaCO3/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spChl/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spFe/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spP/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/temp/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/u/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ubar/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/v/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/vbar/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zeta/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zooC/0.0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/.zmetadata +8 -8
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/Tair/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/Tair/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/lwrad/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/lwrad/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/qair/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/qair/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/rain/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/rain/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/swrad/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/swrad/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/uwnd/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/uwnd/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/vwnd/.zarray +1 -1
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/vwnd/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/.zattrs +1 -1
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/.zmetadata +2 -4
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/omega/.zattrs +1 -3
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/pot_Im/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/pot_Re/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/ssh_Im/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/ssh_Re/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Im/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Re/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Im/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Re/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_datasets.py +280 -211
- roms_tools/tests/test_setup/test_fill.py +177 -0
- roms_tools/tests/test_setup/test_grid.py +56 -0
- roms_tools/tests/test_setup/test_initial_conditions.py +5 -3
- roms_tools/tests/test_setup/test_surface_forcing.py +4 -4
- roms_tools/tests/test_setup/test_tides.py +5 -2
- roms_tools/tests/test_setup/test_topography.py +40 -0
- roms_tools/tests/test_setup/test_validation.py +1 -1
- roms_tools/tests/test_utils.py +30 -0
- roms_tools/utils.py +39 -3
- roms_tools-1.4.1.dist-info/LICENSE +201 -0
- {roms_tools-1.3.0.dist-info → roms_tools-1.4.1.dist-info}/METADATA +13 -3
- {roms_tools-1.3.0.dist-info → roms_tools-1.4.1.dist-info}/RECORD +326 -334
- {roms_tools-1.3.0.dist-info → roms_tools-1.4.1.dist-info}/WHEEL +1 -1
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/Tair/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/lwrad/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/qair/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/rain/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/swrad/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/uwnd/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/coarse_surface_forcing.zarr/vwnd/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/Tair/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/lwrad/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/qair/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/rain/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/swrad/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/uwnd/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/vwnd/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/Tair/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/lwrad/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/qair/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/rain/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/swrad/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/uwnd/1.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/surface_forcing.zarr/vwnd/1.0.0 +0 -0
- roms_tools-1.3.0.dist-info/LICENSE +0 -674
- {roms_tools-1.3.0.dist-info → roms_tools-1.4.1.dist-info}/top_level.txt +0 -0
roms_tools/setup/grid.py
CHANGED
|
@@ -137,7 +137,6 @@ class Grid:
|
|
|
137
137
|
# Check if the Greenwich meridian goes through the domain.
|
|
138
138
|
self._straddle()
|
|
139
139
|
|
|
140
|
-
ds = _add_lat_lon_at_velocity_points(self.ds, self.straddle)
|
|
141
140
|
object.__setattr__(self, "ds", ds)
|
|
142
141
|
|
|
143
142
|
# Update the grid by adding grid variables that are coarsened versions of the original grid variables
|
|
@@ -805,7 +804,6 @@ def _make_grid_ds(
|
|
|
805
804
|
|
|
806
805
|
# rotate coordinate system
|
|
807
806
|
rotated_lon_lat_vars = _rotate(*initial_lon_lat_vars, rot)
|
|
808
|
-
lon, *_ = rotated_lon_lat_vars
|
|
809
807
|
|
|
810
808
|
# translate coordinate system
|
|
811
809
|
translated_lon_lat_vars = _translate(*rotated_lon_lat_vars, center_lat, center_lon)
|
|
@@ -817,7 +815,28 @@ def _make_grid_ds(
|
|
|
817
815
|
# compute angle of local grid positive x-axis relative to east
|
|
818
816
|
ang = _compute_angle(lon, lonu, latu, lonq)
|
|
819
817
|
|
|
820
|
-
|
|
818
|
+
# make sure lons are in [0, 360] range
|
|
819
|
+
lon[lon < 0] = lon[lon < 0] + 2 * np.pi
|
|
820
|
+
lonu[lonu < 0] = lonu[lonu < 0] + 2 * np.pi
|
|
821
|
+
lonv[lonv < 0] = lonv[lonv < 0] + 2 * np.pi
|
|
822
|
+
lonq[lonq < 0] = lonq[lonq < 0] + 2 * np.pi
|
|
823
|
+
|
|
824
|
+
ds = _create_grid_ds(
|
|
825
|
+
lon,
|
|
826
|
+
lat,
|
|
827
|
+
lonu,
|
|
828
|
+
latu,
|
|
829
|
+
lonv,
|
|
830
|
+
latv,
|
|
831
|
+
lonq,
|
|
832
|
+
latq,
|
|
833
|
+
pm,
|
|
834
|
+
pn,
|
|
835
|
+
ang,
|
|
836
|
+
rot,
|
|
837
|
+
center_lon,
|
|
838
|
+
center_lat,
|
|
839
|
+
)
|
|
821
840
|
|
|
822
841
|
ds = _add_global_metadata(ds, size_x, size_y, center_lon, center_lat, rot)
|
|
823
842
|
|
|
@@ -1096,15 +1115,18 @@ def _compute_angle(lon, lonu, latu, lonq):
|
|
|
1096
1115
|
ang[:, 0] = ang[:, 1]
|
|
1097
1116
|
ang[:, -1] = ang[:, -2]
|
|
1098
1117
|
|
|
1099
|
-
lon[lon < 0] = lon[lon < 0] + 2 * np.pi
|
|
1100
|
-
lonq[lonq < 0] = lonq[lonq < 0] + 2 * np.pi
|
|
1101
|
-
|
|
1102
1118
|
return ang
|
|
1103
1119
|
|
|
1104
1120
|
|
|
1105
1121
|
def _create_grid_ds(
|
|
1106
1122
|
lon,
|
|
1107
1123
|
lat,
|
|
1124
|
+
lonu,
|
|
1125
|
+
latu,
|
|
1126
|
+
lonv,
|
|
1127
|
+
latv,
|
|
1128
|
+
lonq,
|
|
1129
|
+
latq,
|
|
1108
1130
|
pm,
|
|
1109
1131
|
pn,
|
|
1110
1132
|
angle,
|
|
@@ -1124,8 +1146,49 @@ def _create_grid_ds(
|
|
|
1124
1146
|
dims=["eta_rho", "xi_rho"],
|
|
1125
1147
|
attrs={"long_name": "latitude of rho-points", "units": "degrees North"},
|
|
1126
1148
|
)
|
|
1149
|
+
lon_u = xr.Variable(
|
|
1150
|
+
data=lonu * 180 / np.pi,
|
|
1151
|
+
dims=["eta_rho", "xi_u"],
|
|
1152
|
+
attrs={"long_name": "longitude of u-points", "units": "degrees East"},
|
|
1153
|
+
)
|
|
1154
|
+
lat_u = xr.Variable(
|
|
1155
|
+
data=latu * 180 / np.pi,
|
|
1156
|
+
dims=["eta_rho", "xi_u"],
|
|
1157
|
+
attrs={"long_name": "latitude of u-points", "units": "degrees North"},
|
|
1158
|
+
)
|
|
1159
|
+
lon_v = xr.Variable(
|
|
1160
|
+
data=lonv * 180 / np.pi,
|
|
1161
|
+
dims=["eta_v", "xi_rho"],
|
|
1162
|
+
attrs={"long_name": "longitude of v-points", "units": "degrees East"},
|
|
1163
|
+
)
|
|
1164
|
+
lat_v = xr.Variable(
|
|
1165
|
+
data=latv * 180 / np.pi,
|
|
1166
|
+
dims=["eta_v", "xi_rho"],
|
|
1167
|
+
attrs={"long_name": "latitude of v-points", "units": "degrees North"},
|
|
1168
|
+
)
|
|
1169
|
+
lon_q = xr.Variable(
|
|
1170
|
+
data=lonq * 180 / np.pi,
|
|
1171
|
+
dims=["eta_psi", "xi_psi"],
|
|
1172
|
+
attrs={"long_name": "longitude of psi-points", "units": "degrees East"},
|
|
1173
|
+
)
|
|
1174
|
+
lat_q = xr.Variable(
|
|
1175
|
+
data=latq * 180 / np.pi,
|
|
1176
|
+
dims=["eta_psi", "xi_psi"],
|
|
1177
|
+
attrs={"long_name": "latitude of psi-points", "units": "degrees North"},
|
|
1178
|
+
)
|
|
1127
1179
|
|
|
1128
|
-
ds = ds.assign_coords(
|
|
1180
|
+
ds = ds.assign_coords(
|
|
1181
|
+
{
|
|
1182
|
+
"lat_rho": lat_rho,
|
|
1183
|
+
"lon_rho": lon_rho,
|
|
1184
|
+
"lat_u": lat_u,
|
|
1185
|
+
"lon_u": lon_u,
|
|
1186
|
+
"lat_v": lat_v,
|
|
1187
|
+
"lon_v": lon_v,
|
|
1188
|
+
"lat_psi": lat_q,
|
|
1189
|
+
"lon_psi": lon_q,
|
|
1190
|
+
}
|
|
1191
|
+
)
|
|
1129
1192
|
|
|
1130
1193
|
ds["angle"] = xr.Variable(
|
|
1131
1194
|
data=angle,
|
|
@@ -1242,7 +1305,28 @@ def _f2c_xdir(f):
|
|
|
1242
1305
|
|
|
1243
1306
|
|
|
1244
1307
|
def _add_lat_lon_at_velocity_points(ds, straddle):
|
|
1245
|
-
|
|
1308
|
+
"""
|
|
1309
|
+
Adds latitude and longitude coordinates at velocity points (u and v points) to the dataset.
|
|
1310
|
+
This function computes approximate latitude and longitude values at u and v velocity points
|
|
1311
|
+
based on the rho points (cell centers). If the grid straddles the Greenwich meridian, it adjusts
|
|
1312
|
+
the longitudes to avoid jumps from 360 to 0 degrees. The computed coordinates are added to the
|
|
1313
|
+
dataset as new variables with appropriate metadata.
|
|
1314
|
+
Parameters
|
|
1315
|
+
----------
|
|
1316
|
+
ds : xarray.Dataset
|
|
1317
|
+
The input dataset containing rho point coordinates ("lat_rho", "lon_rho").
|
|
1318
|
+
straddle : bool
|
|
1319
|
+
Indicates whether the grid straddles the Greenwich meridian. If True, longitudes are adjusted
|
|
1320
|
+
to avoid discontinuities.
|
|
1321
|
+
Returns
|
|
1322
|
+
-------
|
|
1323
|
+
ds : xarray.Dataset
|
|
1324
|
+
The dataset with added coordinates for u and v points ("lat_u", "lon_u", "lat_v", "lon_v").
|
|
1325
|
+
Notes
|
|
1326
|
+
-----
|
|
1327
|
+
This function only computes approximate latitude and longitude values. It should only be used if
|
|
1328
|
+
more accurate values are not available from grid generation.
|
|
1329
|
+
"""
|
|
1246
1330
|
if straddle:
|
|
1247
1331
|
# avoid jump from 360 to 0 in interpolation
|
|
1248
1332
|
lon_rho = xr.where(ds["lon_rho"] > 180, ds["lon_rho"] - 360, ds["lon_rho"])
|
|
@@ -30,6 +30,7 @@ class InitialConditions(ROMSToolsMixins):
|
|
|
30
30
|
Object representing the grid information used for the model.
|
|
31
31
|
ini_time : datetime
|
|
32
32
|
The date and time at which the initial conditions are set.
|
|
33
|
+
If no exact match is found, the closest time entry to `ini_time` within the time range [ini_time, ini_time + 24 hours] is selected.
|
|
33
34
|
source : Dict[str, Union[str, Path, List[Union[str, Path]]], bool]
|
|
34
35
|
Dictionary specifying the source of the physical initial condition data:
|
|
35
36
|
- "name" (str): Name of the data source (e.g., "GLORYS").
|
|
@@ -41,7 +42,7 @@ class InitialConditions(ROMSToolsMixins):
|
|
|
41
42
|
- "name" (str): Name of the BGC data source (e.g., "CESM_REGRIDDED").
|
|
42
43
|
- "path" (Union[str, Path, List[Union[str, Path]]]): The path to the raw data file(s). Can be a single string (with or without wildcards),
|
|
43
44
|
a single Path object, or a list of strings or Path objects containing multiple files.
|
|
44
|
-
- "climatology" (bool): Indicates if the BGC data is climatology data. Defaults to
|
|
45
|
+
- "climatology" (bool): Indicates if the BGC data is climatology data. Defaults to False.
|
|
45
46
|
model_reference_date : datetime, optional
|
|
46
47
|
The reference date for the model. Defaults to January 1, 2000.
|
|
47
48
|
use_dask: bool, optional
|
|
@@ -61,7 +62,7 @@ class InitialConditions(ROMSToolsMixins):
|
|
|
61
62
|
... bgc_source={
|
|
62
63
|
... "name": "CESM_REGRIDDED",
|
|
63
64
|
... "path": "bgc_data.nc",
|
|
64
|
-
... "climatology":
|
|
65
|
+
... "climatology": False,
|
|
65
66
|
... },
|
|
66
67
|
... )
|
|
67
68
|
"""
|
|
@@ -106,12 +107,11 @@ class InitialConditions(ROMSToolsMixins):
|
|
|
106
107
|
vars_3d = bgc_data.var_names.keys()
|
|
107
108
|
bgc_data_vars = super().regrid_data(bgc_data, vars_2d, vars_3d, lon, lat)
|
|
108
109
|
|
|
109
|
-
# Ensure time coordinate matches
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
)
|
|
110
|
+
# Ensure time coordinate matches that of physical variables
|
|
111
|
+
for var in bgc_data_vars.keys():
|
|
112
|
+
bgc_data_vars[var] = bgc_data_vars[var].assign_coords(
|
|
113
|
+
{"time": data_vars["temp"]["time"]}
|
|
114
|
+
)
|
|
115
115
|
|
|
116
116
|
# Combine data variables from physical and biogeochemical sources
|
|
117
117
|
data_vars.update(bgc_data_vars)
|
|
@@ -155,13 +155,13 @@ class InitialConditions(ROMSToolsMixins):
|
|
|
155
155
|
raise ValueError(
|
|
156
156
|
"`bgc_source` must include a 'path' if it is provided."
|
|
157
157
|
)
|
|
158
|
-
# set self.bgc_source["climatology"] to
|
|
158
|
+
# set self.bgc_source["climatology"] to False if not provided
|
|
159
159
|
object.__setattr__(
|
|
160
160
|
self,
|
|
161
161
|
"bgc_source",
|
|
162
162
|
{
|
|
163
163
|
**self.bgc_source,
|
|
164
|
-
"climatology": self.bgc_source.get("climatology",
|
|
164
|
+
"climatology": self.bgc_source.get("climatology", False),
|
|
165
165
|
},
|
|
166
166
|
)
|
|
167
167
|
|
|
@@ -188,7 +188,6 @@ class InitialConditions(ROMSToolsMixins):
|
|
|
188
188
|
climatology=self.bgc_source["climatology"],
|
|
189
189
|
use_dask=self.use_dask,
|
|
190
190
|
)
|
|
191
|
-
data.post_process()
|
|
192
191
|
else:
|
|
193
192
|
raise ValueError(
|
|
194
193
|
'Only "CESM_REGRIDDED" is a valid option for bgc_source["name"].'
|
roms_tools/setup/mixins.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from roms_tools.setup.grid import Grid
|
|
3
|
-
from roms_tools.setup.fill import
|
|
3
|
+
from roms_tools.setup.fill import LateralFill
|
|
4
4
|
from roms_tools.setup.utils import (
|
|
5
5
|
extrapolate_deepest_to_bottom,
|
|
6
6
|
interpolate_from_rho_to_u,
|
|
@@ -106,18 +106,25 @@ class ROMSToolsMixins:
|
|
|
106
106
|
# interpolate onto desired grid
|
|
107
107
|
data_vars = {}
|
|
108
108
|
|
|
109
|
+
# Set up solver that does lateral fill
|
|
110
|
+
lateral_fill = LateralFill(
|
|
111
|
+
data.ds["mask"],
|
|
112
|
+
[data.dim_names["latitude"], data.dim_names["longitude"]],
|
|
113
|
+
)
|
|
114
|
+
|
|
109
115
|
# 2d interpolation
|
|
110
|
-
fill_dims = [data.dim_names["latitude"], data.dim_names["longitude"]]
|
|
111
116
|
coords = {data.dim_names["latitude"]: lat, data.dim_names["longitude"]: lon}
|
|
112
117
|
for var in vars_2d:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
# Propagate ocean values into land via lateral fill
|
|
119
|
+
data.ds[data.var_names[var]] = lateral_fill.apply(
|
|
120
|
+
data.ds[data.var_names[var]].astype(np.float64)
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
# Regrid
|
|
124
|
+
data_vars[var] = (
|
|
125
|
+
data.ds[data.var_names[var]]
|
|
126
|
+
.interp(coords, method="linear")
|
|
127
|
+
.drop_vars(list(coords.keys()))
|
|
121
128
|
)
|
|
122
129
|
|
|
123
130
|
if vars_3d:
|
|
@@ -127,25 +134,26 @@ class ROMSToolsMixins:
|
|
|
127
134
|
data.dim_names["latitude"]: lat,
|
|
128
135
|
data.dim_names["longitude"]: lon,
|
|
129
136
|
}
|
|
130
|
-
# extrapolate deepest value all the way to bottom
|
|
137
|
+
# extrapolate deepest value all the way to bottom
|
|
131
138
|
for var in vars_3d:
|
|
132
139
|
data.ds[data.var_names[var]] = extrapolate_deepest_to_bottom(
|
|
133
140
|
data.ds[data.var_names[var]], data.dim_names["depth"]
|
|
134
141
|
)
|
|
135
|
-
|
|
142
|
+
# Propagate ocean values into land via lateral fill
|
|
143
|
+
data.ds[data.var_names[var]] = lateral_fill.apply(
|
|
144
|
+
data.ds[data.var_names[var]].astype(np.float64)
|
|
145
|
+
)
|
|
136
146
|
|
|
137
|
-
#
|
|
147
|
+
# Regrid
|
|
148
|
+
# setting the fill value to None means that we allow extrapolation in the
|
|
138
149
|
# interpolation step to avoid NaNs at the surface if the lowest depth in original
|
|
139
150
|
# data is greater than zero
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
fill_dims=fill_dims,
|
|
145
|
-
coords=coords,
|
|
146
|
-
method="linear",
|
|
147
|
-
fillvalue_interp=None,
|
|
151
|
+
data_vars[var] = (
|
|
152
|
+
data.ds[data.var_names[var]]
|
|
153
|
+
.interp(coords, method="linear", kwargs={"fill_value": None})
|
|
154
|
+
.drop_vars(list(coords.keys()))
|
|
148
155
|
)
|
|
156
|
+
|
|
149
157
|
if data.dim_names["time"] != "time":
|
|
150
158
|
data_vars[var] = data_vars[var].rename({data.dim_names["time"]: "time"})
|
|
151
159
|
|
|
@@ -127,13 +127,12 @@ class SurfaceForcing(ROMSToolsMixins):
|
|
|
127
127
|
correction_data.choose_subdomain(coords_correction, straddle=straddle)
|
|
128
128
|
# apply mask from ERA5 data
|
|
129
129
|
if "mask" in data.var_names.keys():
|
|
130
|
-
mask =
|
|
131
|
-
data.ds[data.var_names["mask"]].isel(time=0).isnull(), 0, 1
|
|
132
|
-
)
|
|
130
|
+
mask = data.ds["mask"]
|
|
133
131
|
for var in correction_data.ds.data_vars:
|
|
134
132
|
correction_data.ds[var] = xr.where(
|
|
135
133
|
mask == 1, correction_data.ds[var], np.nan
|
|
136
134
|
)
|
|
135
|
+
correction_data.ds["mask"] = mask
|
|
137
136
|
vars_2d = ["swr_corr"]
|
|
138
137
|
vars_3d = []
|
|
139
138
|
# spatial interpolation
|
|
@@ -203,7 +202,6 @@ class SurfaceForcing(ROMSToolsMixins):
|
|
|
203
202
|
if self.type == "physics":
|
|
204
203
|
if self.source["name"] == "ERA5":
|
|
205
204
|
data = ERA5Dataset(**data_dict)
|
|
206
|
-
data.post_process()
|
|
207
205
|
else:
|
|
208
206
|
raise ValueError(
|
|
209
207
|
'Only "ERA5" is a valid option for source["name"] when type is "physics".'
|
|
@@ -213,7 +211,6 @@ class SurfaceForcing(ROMSToolsMixins):
|
|
|
213
211
|
if self.source["name"] == "CESM_REGRIDDED":
|
|
214
212
|
|
|
215
213
|
data = CESMBGCSurfaceForcingDataset(**data_dict)
|
|
216
|
-
data.post_process()
|
|
217
214
|
else:
|
|
218
215
|
raise ValueError(
|
|
219
216
|
'Only "CESM_REGRIDDED" is a valid option for source["name"] when type is "bgc".'
|
|
@@ -301,6 +298,7 @@ class SurfaceForcing(ROMSToolsMixins):
|
|
|
301
298
|
ds[time_coord].attrs["units"] = "days"
|
|
302
299
|
if data.climatology:
|
|
303
300
|
ds[time_coord].attrs["cycle_length"] = 365.25
|
|
301
|
+
ds.encoding["unlimited_dims"] = "time"
|
|
304
302
|
|
|
305
303
|
if self.type == "bgc":
|
|
306
304
|
ds = ds.drop_vars(["time"])
|
roms_tools/setup/tides.py
CHANGED
|
@@ -8,7 +8,6 @@ from typing import Dict, Union, List
|
|
|
8
8
|
from dataclasses import dataclass, field, asdict
|
|
9
9
|
from roms_tools.setup.grid import Grid
|
|
10
10
|
from roms_tools.setup.plot import _plot
|
|
11
|
-
from roms_tools.setup.fill import fill_and_interpolate
|
|
12
11
|
from roms_tools.setup.datasets import TPXODataset
|
|
13
12
|
from roms_tools.setup.utils import (
|
|
14
13
|
nan_check,
|
|
@@ -82,17 +81,12 @@ class TidalForcing(ROMSToolsMixins):
|
|
|
82
81
|
straddle=straddle,
|
|
83
82
|
)
|
|
84
83
|
|
|
85
|
-
tides = self._get_corrected_tides(data)
|
|
86
|
-
|
|
87
84
|
# select desired number of constituents
|
|
88
|
-
|
|
89
|
-
tides[k] = tides[k].isel(ntides=slice(None, self.ntides))
|
|
85
|
+
object.__setattr__(data, "ds", data.ds.isel(ntides=slice(None, self.ntides)))
|
|
90
86
|
|
|
91
|
-
|
|
92
|
-
coords = {"latitude": lat, "longitude": lon}
|
|
93
|
-
mask = xr.where(data.ds.depth > 0, 1, 0)
|
|
87
|
+
self._correct_tides(data)
|
|
94
88
|
|
|
95
|
-
|
|
89
|
+
vars_2d = [
|
|
96
90
|
"ssh_Re",
|
|
97
91
|
"ssh_Im",
|
|
98
92
|
"pot_Re",
|
|
@@ -102,16 +96,9 @@ class TidalForcing(ROMSToolsMixins):
|
|
|
102
96
|
"v_Re",
|
|
103
97
|
"v_Im",
|
|
104
98
|
]
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
data_vars[var] = fill_and_interpolate(
|
|
109
|
-
tides[var],
|
|
110
|
-
mask,
|
|
111
|
-
list(coords.keys()),
|
|
112
|
-
coords,
|
|
113
|
-
method="linear",
|
|
114
|
-
)
|
|
99
|
+
vars_3d = []
|
|
100
|
+
|
|
101
|
+
data_vars = super().regrid_data(data, vars_2d, vars_3d, lon, lat)
|
|
115
102
|
|
|
116
103
|
data_vars = super().process_velocities(
|
|
117
104
|
data_vars, angle, "u_Re", "v_Re", interpolate=False
|
|
@@ -132,7 +119,7 @@ class TidalForcing(ROMSToolsMixins):
|
|
|
132
119
|
|
|
133
120
|
d_meta = get_variable_metadata()
|
|
134
121
|
ds = self._write_into_dataset(data_vars, d_meta)
|
|
135
|
-
ds["omega"] =
|
|
122
|
+
ds["omega"] = data.ds["omega"]
|
|
136
123
|
|
|
137
124
|
ds = self._add_global_metadata(ds)
|
|
138
125
|
|
|
@@ -412,13 +399,28 @@ class TidalForcing(ROMSToolsMixins):
|
|
|
412
399
|
# Create and return an instance of TidalForcing
|
|
413
400
|
return cls(grid=grid, **tidal_forcing_params, use_dask=use_dask)
|
|
414
401
|
|
|
415
|
-
def
|
|
402
|
+
def _correct_tides(self, data):
|
|
403
|
+
"""
|
|
404
|
+
Apply tidal corrections to the dataset.
|
|
405
|
+
This method corrects the dataset for equilibrium tides, self-attraction and loading (SAL) effects, and
|
|
406
|
+
adjusts phases and amplitudes of tidal elevations and transports using Egbert's correction.
|
|
407
|
+
Parameters
|
|
408
|
+
----------
|
|
409
|
+
data : Dataset
|
|
410
|
+
The dataset containing tidal data, including variables for sea surface height (ssh), zonal and meridional
|
|
411
|
+
currents (u, v), and self-attraction and loading corrections (sal).
|
|
412
|
+
Returns
|
|
413
|
+
-------
|
|
414
|
+
None
|
|
415
|
+
The dataset is modified in-place with corrected real and imaginary components for ssh, u, v, and the
|
|
416
|
+
potential field ('pot_Re', 'pot_Im').
|
|
417
|
+
"""
|
|
416
418
|
|
|
417
419
|
# Get equilibrium tides
|
|
418
420
|
tpc = compute_equilibrium_tide(
|
|
419
421
|
data.ds[data.dim_names["longitude"]], data.ds[data.dim_names["latitude"]]
|
|
420
422
|
)
|
|
421
|
-
tpc = tpc.isel(
|
|
423
|
+
tpc = tpc.isel(ntides=data.ds["ntides"])
|
|
422
424
|
# Correct for SAL
|
|
423
425
|
tsc = self.allan_factor * (
|
|
424
426
|
data.ds[data.var_names["sal_Re"]] + 1j * data.ds[data.var_names["sal_Im"]]
|
|
@@ -432,9 +434,9 @@ class TidalForcing(ROMSToolsMixins):
|
|
|
432
434
|
|
|
433
435
|
# Apply correction for phases and amplitudes
|
|
434
436
|
pf, pu, aa = egbert_correction(self.model_reference_date)
|
|
435
|
-
pf = pf.isel(
|
|
436
|
-
pu = pu.isel(
|
|
437
|
-
aa = aa.isel(
|
|
437
|
+
pf = pf.isel(ntides=data.ds["ntides"])
|
|
438
|
+
pu = pu.isel(ntides=data.ds["ntides"])
|
|
439
|
+
aa = aa.isel(ntides=data.ds["ntides"])
|
|
438
440
|
|
|
439
441
|
dt = (self.model_reference_date - data.reference_date).days * 3600 * 24
|
|
440
442
|
|
|
@@ -443,22 +445,18 @@ class TidalForcing(ROMSToolsMixins):
|
|
|
443
445
|
tvc = pf * tvc * np.exp(1j * (data.ds["omega"] * dt + pu + aa))
|
|
444
446
|
tpc = pf * tpc * np.exp(1j * (data.ds["omega"] * dt + pu + aa))
|
|
445
447
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
"pot_Im": tpc.imag,
|
|
455
|
-
"omega": data.ds["omega"],
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
for k in tides.keys():
|
|
459
|
-
tides[k] = tides[k].rename({data.dim_names["ntides"]: "ntides"})
|
|
448
|
+
data.ds[data.var_names["ssh_Re"]] = thc.real
|
|
449
|
+
data.ds[data.var_names["ssh_Im"]] = thc.imag
|
|
450
|
+
data.ds[data.var_names["u_Re"]] = tuc.real
|
|
451
|
+
data.ds[data.var_names["u_Im"]] = tuc.imag
|
|
452
|
+
data.ds[data.var_names["v_Re"]] = tvc.real
|
|
453
|
+
data.ds[data.var_names["v_Im"]] = tvc.imag
|
|
454
|
+
data.ds["pot_Re"] = tpc.real
|
|
455
|
+
data.ds["pot_Im"] = tpc.imag
|
|
460
456
|
|
|
461
|
-
|
|
457
|
+
# Update var_names dictionary
|
|
458
|
+
var_names = {**data.var_names, "pot_Re": "pot_Re", "pot_Im": "pot_Im"}
|
|
459
|
+
object.__setattr__(data, "var_names", var_names)
|
|
462
460
|
|
|
463
461
|
|
|
464
462
|
def modified_julian_days(year, month, day, hour=0):
|
|
@@ -611,7 +609,7 @@ def egbert_correction(date):
|
|
|
611
609
|
pf[12] = pftmp**2 # Ms4
|
|
612
610
|
pf[13] = pftmp # 2n2
|
|
613
611
|
pf[14] = 1.0 # S1
|
|
614
|
-
pf = xr.DataArray(pf, dims="
|
|
612
|
+
pf = xr.DataArray(pf, dims="ntides")
|
|
615
613
|
|
|
616
614
|
putmp = (
|
|
617
615
|
np.arctan(
|
|
@@ -647,7 +645,7 @@ def egbert_correction(date):
|
|
|
647
645
|
pu[12] = putmp # Ms4
|
|
648
646
|
pu[13] = putmp # 2n2
|
|
649
647
|
pu[14] = 0.0 # S1
|
|
650
|
-
pu = xr.DataArray(pu, dims="
|
|
648
|
+
pu = xr.DataArray(pu, dims="ntides")
|
|
651
649
|
# convert from degrees to radians
|
|
652
650
|
pu = pu * rad
|
|
653
651
|
|
|
@@ -671,7 +669,7 @@ def egbert_correction(date):
|
|
|
671
669
|
0.0, # S1
|
|
672
670
|
]
|
|
673
671
|
),
|
|
674
|
-
dims="
|
|
672
|
+
dims="ntides",
|
|
675
673
|
)
|
|
676
674
|
|
|
677
675
|
return pf, pu, aa
|
|
@@ -725,7 +723,7 @@ def compute_equilibrium_tide(lon, lat):
|
|
|
725
723
|
0.000764, # S1
|
|
726
724
|
]
|
|
727
725
|
),
|
|
728
|
-
dims="
|
|
726
|
+
dims="ntides",
|
|
729
727
|
)
|
|
730
728
|
B = xr.DataArray(
|
|
731
729
|
data=np.array(
|
|
@@ -747,12 +745,12 @@ def compute_equilibrium_tide(lon, lat):
|
|
|
747
745
|
0.693, # S1
|
|
748
746
|
]
|
|
749
747
|
),
|
|
750
|
-
dims="
|
|
748
|
+
dims="ntides",
|
|
751
749
|
)
|
|
752
750
|
|
|
753
751
|
# types: 2 = semidiurnal, 1 = diurnal, 0 = long-term
|
|
754
752
|
ityp = xr.DataArray(
|
|
755
|
-
data=np.array([2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 2, 1]), dims="
|
|
753
|
+
data=np.array([2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 2, 1]), dims="ntides"
|
|
756
754
|
)
|
|
757
755
|
|
|
758
756
|
d2r = np.pi / 180
|
roms_tools/setup/topography.py
CHANGED
|
@@ -61,6 +61,10 @@ def _add_topography_and_mask(
|
|
|
61
61
|
|
|
62
62
|
# fill enclosed basins with land
|
|
63
63
|
mask = _fill_enclosed_basins(mask.values)
|
|
64
|
+
|
|
65
|
+
# adjust mask boundaries by copying values from adjacent cells
|
|
66
|
+
mask = _handle_boundaries(mask)
|
|
67
|
+
|
|
64
68
|
ds["mask_rho"] = xr.DataArray(mask.astype(np.int32), dims=("eta_rho", "xi_rho"))
|
|
65
69
|
ds["mask_rho"].attrs = {
|
|
66
70
|
"long_name": "Mask at rho-points",
|
|
@@ -233,10 +237,7 @@ def _smooth_topography_locally(h, hmin=5, rmax=0.2):
|
|
|
233
237
|
)
|
|
234
238
|
|
|
235
239
|
# No gradient at the domain boundaries
|
|
236
|
-
h_log
|
|
237
|
-
h_log[-1, :] = h_log[-2, :]
|
|
238
|
-
h_log[:, 0] = h_log[:, 1]
|
|
239
|
-
h_log[:, -1] = h_log[:, -2]
|
|
240
|
+
h_log = _handle_boundaries(h_log)
|
|
240
241
|
|
|
241
242
|
# Update h
|
|
242
243
|
h = hmin * np.exp(h_log)
|
|
@@ -252,6 +253,31 @@ def _smooth_topography_locally(h, hmin=5, rmax=0.2):
|
|
|
252
253
|
return h
|
|
253
254
|
|
|
254
255
|
|
|
256
|
+
def _handle_boundaries(field):
|
|
257
|
+
"""
|
|
258
|
+
Adjust the boundaries of a 2D field by copying values from adjacent cells.
|
|
259
|
+
|
|
260
|
+
Parameters
|
|
261
|
+
----------
|
|
262
|
+
field : numpy.ndarray or xarray.DataArray
|
|
263
|
+
A 2D array representing a field (e.g., topography or mask) whose boundary values
|
|
264
|
+
need to be adjusted.
|
|
265
|
+
|
|
266
|
+
Returns
|
|
267
|
+
-------
|
|
268
|
+
field : numpy.ndarray or xarray.DataArray
|
|
269
|
+
The input field with adjusted boundary values.
|
|
270
|
+
|
|
271
|
+
"""
|
|
272
|
+
|
|
273
|
+
field[0, :] = field[1, :]
|
|
274
|
+
field[-1, :] = field[-2, :]
|
|
275
|
+
field[:, 0] = field[:, 1]
|
|
276
|
+
field[:, -1] = field[:, -2]
|
|
277
|
+
|
|
278
|
+
return field
|
|
279
|
+
|
|
280
|
+
|
|
255
281
|
def _compute_rfactor(h):
|
|
256
282
|
"""
|
|
257
283
|
Computes slope parameter (or r-factor) r = |Delta h| / 2h in both horizontal grid directions.
|