roms-tools 1.4.2__py3-none-any.whl → 1.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- roms_tools/_version.py +1 -1
- roms_tools/setup/boundary_forcing.py +448 -130
- roms_tools/setup/datasets.py +186 -52
- roms_tools/setup/fill.py +2 -2
- roms_tools/setup/initial_conditions.py +217 -70
- roms_tools/setup/regrid.py +143 -0
- roms_tools/setup/surface_forcing.py +159 -73
- roms_tools/setup/tides.py +141 -54
- roms_tools/setup/utils.py +229 -62
- roms_tools/tests/test_setup/test_boundary_forcing.py +42 -32
- 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 +8 -1
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/abs_time/.zattrs +3 -0
- 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_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_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/.zattrs +1 -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/.zattrs +1 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zeta_south/.zattrs +1 -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/.zattrs +1 -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 +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/0.0.0 +0 -0
- 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/0.0.0 +0 -0
- 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/0.0.0 +0 -0
- 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 +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/0.0.0 +0 -0
- 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/0.0.0 +0 -0
- 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/0.0.0 +0 -0
- roms_tools/tests/test_setup/test_data/corrected_surface_forcing.zarr/vwnd/0.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 +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/0.0.0 +0 -0
- 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/0.0.0 +0 -0
- 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/0.0.0 +0 -0
- 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 +4 -2
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/omega/.zattrs +3 -1
- 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 +79 -21
- roms_tools/tests/test_setup/test_fill.py +55 -113
- roms_tools/tests/test_setup/test_initial_conditions.py +21 -21
- roms_tools/tests/test_setup/test_regrid.py +53 -0
- roms_tools/tests/test_setup/test_surface_forcing.py +21 -3
- roms_tools/tests/test_setup/test_tides.py +1 -1
- {roms_tools-1.4.2.dist-info → roms_tools-1.6.0.dist-info}/METADATA +13 -4
- {roms_tools-1.4.2.dist-info → roms_tools-1.6.0.dist-info}/RECORD +277 -276
- {roms_tools-1.4.2.dist-info → roms_tools-1.6.0.dist-info}/WHEEL +1 -1
- roms_tools/setup/mixins.py +0 -227
- {roms_tools-1.4.2.dist-info → roms_tools-1.6.0.dist-info}/LICENSE +0 -0
- {roms_tools-1.4.2.dist-info → roms_tools-1.6.0.dist-info}/top_level.txt +0 -0
roms_tools/setup/datasets.py
CHANGED
|
@@ -12,8 +12,10 @@ from roms_tools.setup.utils import (
|
|
|
12
12
|
interpolate_from_climatology,
|
|
13
13
|
get_time_type,
|
|
14
14
|
convert_cftime_to_datetime,
|
|
15
|
+
one_dim_fill,
|
|
15
16
|
)
|
|
16
17
|
from roms_tools.setup.download import download_correction_data
|
|
18
|
+
from roms_tools.setup.fill import LateralFill
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
@dataclass(frozen=True, kw_only=True)
|
|
@@ -117,6 +119,8 @@ class Dataset:
|
|
|
117
119
|
# Make sure that depth is ascending
|
|
118
120
|
ds = self.ensure_dimension_is_ascending(ds, dim="depth")
|
|
119
121
|
|
|
122
|
+
self.infer_horizontal_resolution(ds)
|
|
123
|
+
|
|
120
124
|
# Check whether the data covers the entire globe
|
|
121
125
|
object.__setattr__(self, "is_global", self.check_if_global(ds))
|
|
122
126
|
|
|
@@ -487,6 +491,34 @@ class Dataset:
|
|
|
487
491
|
|
|
488
492
|
return ds
|
|
489
493
|
|
|
494
|
+
def infer_horizontal_resolution(self, ds: xr.Dataset):
|
|
495
|
+
"""Estimate and set the average horizontal resolution of a dataset based on
|
|
496
|
+
latitude and longitude spacing.
|
|
497
|
+
|
|
498
|
+
Parameters
|
|
499
|
+
----------
|
|
500
|
+
ds : xr.Dataset
|
|
501
|
+
Dataset containing latitude and longitude dimensions.
|
|
502
|
+
|
|
503
|
+
Sets
|
|
504
|
+
----
|
|
505
|
+
resolution : float
|
|
506
|
+
The average horizontal resolution, derived from the mean spacing
|
|
507
|
+
between points in latitude and longitude.
|
|
508
|
+
"""
|
|
509
|
+
lat_dim = self.dim_names["latitude"]
|
|
510
|
+
lon_dim = self.dim_names["longitude"]
|
|
511
|
+
|
|
512
|
+
# Calculate mean difference along latitude and longitude
|
|
513
|
+
lat_resolution = ds[lat_dim].diff(dim=lat_dim).mean(dim=lat_dim)
|
|
514
|
+
lon_resolution = ds[lon_dim].diff(dim=lon_dim).mean(dim=lon_dim)
|
|
515
|
+
|
|
516
|
+
# Compute the average horizontal resolution
|
|
517
|
+
resolution = np.mean([lat_resolution, lon_resolution])
|
|
518
|
+
|
|
519
|
+
# Set the computed resolution as an attribute
|
|
520
|
+
object.__setattr__(self, "resolution", resolution)
|
|
521
|
+
|
|
490
522
|
def check_if_global(self, ds) -> bool:
|
|
491
523
|
"""Checks if the dataset covers the entire globe in the longitude dimension.
|
|
492
524
|
|
|
@@ -569,40 +601,31 @@ class Dataset:
|
|
|
569
601
|
"""
|
|
570
602
|
pass
|
|
571
603
|
|
|
572
|
-
def choose_subdomain(
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
longitude conversions to accommodate different longitude ranges.
|
|
604
|
+
def choose_subdomain(self, target_coords, buffer_points=20, return_copy=False):
|
|
605
|
+
"""Selects a subdomain from the xarray Dataset based on specified target
|
|
606
|
+
coordinates, extending the selection by a defined buffer. Adjusts longitude
|
|
607
|
+
ranges as necessary to accommodate the dataset's expected range and handles
|
|
608
|
+
potential discontinuities.
|
|
578
609
|
|
|
579
610
|
Parameters
|
|
580
611
|
----------
|
|
581
|
-
|
|
582
|
-
A
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
straddle : bool
|
|
588
|
-
If True, target longitudes are expected in the range [-180, 180].
|
|
589
|
-
If False, target longitudes are expected in the range [0, 360].
|
|
612
|
+
target_coords : dict
|
|
613
|
+
A dictionary containing the target latitude and longitude coordinates, typically
|
|
614
|
+
with keys "lat", "lon", and "straddle".
|
|
615
|
+
buffer_points : int
|
|
616
|
+
The number of grid points to extend beyond the specified latitude and longitude
|
|
617
|
+
ranges when selecting the subdomain. Defaults to 20.
|
|
590
618
|
return_subdomain : bool, optional
|
|
591
|
-
If True, returns the subset of the original dataset
|
|
592
|
-
Defaults to False.
|
|
619
|
+
If True, returns the subset of the original dataset representing the chosen
|
|
620
|
+
subdomain. If False, assigns the subset to `self.ds`. Defaults to False.
|
|
593
621
|
|
|
594
622
|
Returns
|
|
595
623
|
-------
|
|
596
624
|
xr.Dataset or None
|
|
597
|
-
|
|
598
|
-
including an extended area
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
Notes
|
|
602
|
-
-----
|
|
603
|
-
This method adjusts the longitude range if necessary to ensure it matches the expected range for the dataset.
|
|
604
|
-
It also handles longitude discontinuities that can occur when converting to different longitude ranges.
|
|
605
|
-
This is important for avoiding artifacts in the interpolation process.
|
|
625
|
+
Returns the subset of the original dataset as an xarray Dataset if
|
|
626
|
+
`return_subdomain` is True, including an extended area covering additional
|
|
627
|
+
grid points beyond the specified ranges. Returns None if `return_subdomain`
|
|
628
|
+
is False, as the subset is assigned to `self.ds`.
|
|
606
629
|
|
|
607
630
|
Raises
|
|
608
631
|
------
|
|
@@ -610,13 +633,17 @@ class Dataset:
|
|
|
610
633
|
If the selected latitude or longitude range does not intersect with the dataset.
|
|
611
634
|
"""
|
|
612
635
|
|
|
613
|
-
lat_min
|
|
614
|
-
|
|
636
|
+
lat_min = target_coords["lat"].min().values
|
|
637
|
+
lat_max = target_coords["lat"].max().values
|
|
638
|
+
lon_min = target_coords["lon"].min().values
|
|
639
|
+
lon_max = target_coords["lon"].max().values
|
|
640
|
+
|
|
641
|
+
margin = self.resolution * buffer_points
|
|
615
642
|
|
|
616
643
|
if not self.is_global:
|
|
617
644
|
# Adjust longitude range if needed to match the expected range
|
|
618
645
|
lon = self.ds[self.dim_names["longitude"]]
|
|
619
|
-
if not straddle:
|
|
646
|
+
if not target_coords["straddle"]:
|
|
620
647
|
if lon.min() < -180:
|
|
621
648
|
if lon_max + margin > 0:
|
|
622
649
|
lon_min -= 360
|
|
@@ -626,7 +653,7 @@ class Dataset:
|
|
|
626
653
|
lon_min -= 360
|
|
627
654
|
lon_max -= 360
|
|
628
655
|
|
|
629
|
-
if straddle:
|
|
656
|
+
if target_coords["straddle"]:
|
|
630
657
|
if lon.max() > 360:
|
|
631
658
|
if lon_min - margin < 180:
|
|
632
659
|
lon_min += 360
|
|
@@ -637,6 +664,7 @@ class Dataset:
|
|
|
637
664
|
lon_max += 360
|
|
638
665
|
|
|
639
666
|
# Select the subdomain
|
|
667
|
+
|
|
640
668
|
subdomain = self.ds.sel(
|
|
641
669
|
**{
|
|
642
670
|
self.dim_names["latitude"]: slice(lat_min - margin, lat_max + margin),
|
|
@@ -655,16 +683,109 @@ class Dataset:
|
|
|
655
683
|
|
|
656
684
|
# Adjust longitudes to expected range if needed
|
|
657
685
|
lon = subdomain[self.dim_names["longitude"]]
|
|
658
|
-
if straddle:
|
|
686
|
+
if target_coords["straddle"]:
|
|
659
687
|
subdomain[self.dim_names["longitude"]] = xr.where(lon > 180, lon - 360, lon)
|
|
660
688
|
else:
|
|
661
689
|
subdomain[self.dim_names["longitude"]] = xr.where(lon < 0, lon + 360, lon)
|
|
662
690
|
|
|
663
|
-
if
|
|
664
|
-
return subdomain
|
|
691
|
+
if return_copy:
|
|
692
|
+
return Dataset.from_ds(self, subdomain)
|
|
665
693
|
else:
|
|
666
694
|
object.__setattr__(self, "ds", subdomain)
|
|
667
695
|
|
|
696
|
+
def apply_lateral_fill(self):
|
|
697
|
+
"""Apply lateral fill to variables using the dataset's mask and grid dimensions.
|
|
698
|
+
|
|
699
|
+
This method fills masked values in `self.ds` using `LateralFill` based on
|
|
700
|
+
the horizontal grid dimensions. A separate mask (`mask_vel`) is used for
|
|
701
|
+
velocity variables (e.g., `u`, `v`) if available in the dataset.
|
|
702
|
+
|
|
703
|
+
Notes
|
|
704
|
+
-----
|
|
705
|
+
Looping over `self.ds.data_vars` instead of `self.var_names` ensures that each
|
|
706
|
+
dataset variable is filled only once, even if multiple entries in `self.var_names`
|
|
707
|
+
point to the same variable in the dataset.
|
|
708
|
+
"""
|
|
709
|
+
lateral_fill = LateralFill(
|
|
710
|
+
self.ds["mask"],
|
|
711
|
+
[self.dim_names["latitude"], self.dim_names["longitude"]],
|
|
712
|
+
)
|
|
713
|
+
|
|
714
|
+
separate_fill_for_velocities = False
|
|
715
|
+
if "mask_vel" in self.ds.data_vars:
|
|
716
|
+
lateral_fill_vel = LateralFill(
|
|
717
|
+
self.ds["mask_vel"],
|
|
718
|
+
[self.dim_names["latitude"], self.dim_names["longitude"]],
|
|
719
|
+
)
|
|
720
|
+
separate_fill_for_velocities = True
|
|
721
|
+
|
|
722
|
+
for var_name in self.ds.data_vars:
|
|
723
|
+
if var_name.startswith("mask"):
|
|
724
|
+
# Skip variables that are mask types
|
|
725
|
+
continue
|
|
726
|
+
elif (
|
|
727
|
+
separate_fill_for_velocities
|
|
728
|
+
and "u" in self.var_names
|
|
729
|
+
and "v" in self.var_names
|
|
730
|
+
and var_name in [self.var_names["u"], self.var_names["v"]]
|
|
731
|
+
):
|
|
732
|
+
# Apply lateral fill with velocity mask for velocity variables if present
|
|
733
|
+
self.ds[var_name] = lateral_fill_vel.apply(self.ds[var_name])
|
|
734
|
+
else:
|
|
735
|
+
# Apply standard lateral fill for other variables
|
|
736
|
+
self.ds[var_name] = lateral_fill.apply(self.ds[var_name])
|
|
737
|
+
|
|
738
|
+
def extrapolate_deepest_to_bottom(self):
|
|
739
|
+
"""Extrapolate deepest non-NaN values to fill bottom NaNs along the depth
|
|
740
|
+
dimension.
|
|
741
|
+
|
|
742
|
+
For each variable with a depth dimension, fills missing values at the bottom by
|
|
743
|
+
propagating the deepest available data downward.
|
|
744
|
+
"""
|
|
745
|
+
|
|
746
|
+
if "depth" in self.dim_names:
|
|
747
|
+
for var_name in self.ds.data_vars:
|
|
748
|
+
if self.dim_names["depth"] in self.ds[var_name].dims:
|
|
749
|
+
self.ds[var_name] = one_dim_fill(
|
|
750
|
+
self.ds[var_name], self.dim_names["depth"], direction="forward"
|
|
751
|
+
)
|
|
752
|
+
|
|
753
|
+
@classmethod
|
|
754
|
+
def from_ds(cls, original_dataset: "Dataset", ds: xr.Dataset) -> "Dataset":
|
|
755
|
+
"""Substitute the internal dataset of a Dataset object with a new xarray
|
|
756
|
+
Dataset.
|
|
757
|
+
|
|
758
|
+
This method creates a new Dataset instance, bypassing the usual `__init__`
|
|
759
|
+
and `__post_init__` processes. It allows for the direct assignment of the
|
|
760
|
+
provided xarray Dataset (`ds`) to the new instance's `ds` attribute. All
|
|
761
|
+
other attributes from the original dataset instance are copied to the new one.
|
|
762
|
+
|
|
763
|
+
Parameters
|
|
764
|
+
----------
|
|
765
|
+
original_dataset : Dataset
|
|
766
|
+
The original Dataset instance from which attributes will be copied.
|
|
767
|
+
ds : xarray.Dataset
|
|
768
|
+
The new xarray Dataset to assign to the `ds` attribute of the new instance.
|
|
769
|
+
|
|
770
|
+
Returns
|
|
771
|
+
-------
|
|
772
|
+
Dataset
|
|
773
|
+
A new Dataset instance with the `ds` attribute set to the provided dataset
|
|
774
|
+
and other attributes copied from the original instance.
|
|
775
|
+
"""
|
|
776
|
+
# Create a new Dataset instance without calling __init__ or __post_init__
|
|
777
|
+
dataset = cls.__new__(cls)
|
|
778
|
+
|
|
779
|
+
# Directly set the provided dataset as the 'ds' attribute
|
|
780
|
+
object.__setattr__(dataset, "ds", ds)
|
|
781
|
+
|
|
782
|
+
# Copy all other attributes from the original data instance
|
|
783
|
+
for attr in vars(original_dataset):
|
|
784
|
+
if attr != "ds":
|
|
785
|
+
object.__setattr__(dataset, attr, getattr(original_dataset, attr))
|
|
786
|
+
|
|
787
|
+
return dataset
|
|
788
|
+
|
|
668
789
|
|
|
669
790
|
@dataclass(frozen=True, kw_only=True)
|
|
670
791
|
class TPXODataset(Dataset):
|
|
@@ -803,12 +924,17 @@ class TPXODataset(Dataset):
|
|
|
803
924
|
"""
|
|
804
925
|
|
|
805
926
|
if "depth" in self.var_names.keys():
|
|
927
|
+
ds = self.ds
|
|
806
928
|
mask = xr.where(self.ds["depth"] > 0, 1, 0)
|
|
929
|
+
ds["mask"] = mask
|
|
930
|
+
ds = ds.drop_vars(["depth"])
|
|
807
931
|
|
|
808
|
-
|
|
809
|
-
self.ds[var] = xr.where(mask == 1, self.ds[var], np.nan)
|
|
932
|
+
object.__setattr__(self, "ds", ds)
|
|
810
933
|
|
|
811
|
-
|
|
934
|
+
# Remove "depth" from var_names
|
|
935
|
+
updated_var_names = {**self.var_names} # Create a copy of the dictionary
|
|
936
|
+
updated_var_names.pop("depth", None) # Remove "depth" if it exists
|
|
937
|
+
object.__setattr__(self, "var_names", updated_var_names)
|
|
812
938
|
|
|
813
939
|
|
|
814
940
|
@dataclass(frozen=True, kw_only=True)
|
|
@@ -878,11 +1004,16 @@ class GLORYSDataset(Dataset):
|
|
|
878
1004
|
0,
|
|
879
1005
|
1,
|
|
880
1006
|
)
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
self.
|
|
1007
|
+
mask_vel = xr.where(
|
|
1008
|
+
self.ds[self.var_names["u"]]
|
|
1009
|
+
.isel({self.dim_names["time"]: 0, self.dim_names["depth"]: 0})
|
|
1010
|
+
.isnull(),
|
|
1011
|
+
0,
|
|
1012
|
+
1,
|
|
1013
|
+
)
|
|
884
1014
|
|
|
885
1015
|
self.ds["mask"] = mask
|
|
1016
|
+
self.ds["mask_vel"] = mask_vel
|
|
886
1017
|
|
|
887
1018
|
|
|
888
1019
|
@dataclass(frozen=True, kw_only=True)
|
|
@@ -1088,9 +1219,6 @@ class CESMBGCDataset(CESMDataset):
|
|
|
1088
1219
|
1,
|
|
1089
1220
|
)
|
|
1090
1221
|
|
|
1091
|
-
for var in self.ds.data_vars:
|
|
1092
|
-
self.ds[var] = xr.where(mask == 1, self.ds[var], np.nan)
|
|
1093
|
-
|
|
1094
1222
|
self.ds["mask"] = mask
|
|
1095
1223
|
|
|
1096
1224
|
|
|
@@ -1160,9 +1288,6 @@ class CESMBGCSurfaceForcingDataset(CESMDataset):
|
|
|
1160
1288
|
1,
|
|
1161
1289
|
)
|
|
1162
1290
|
|
|
1163
|
-
for var in self.ds.data_vars:
|
|
1164
|
-
self.ds[var] = xr.where(mask == 1, self.ds[var], np.nan)
|
|
1165
|
-
|
|
1166
1291
|
self.ds["mask"] = mask
|
|
1167
1292
|
|
|
1168
1293
|
|
|
@@ -1260,21 +1385,30 @@ class ERA5Dataset(Dataset):
|
|
|
1260
1385
|
)
|
|
1261
1386
|
)
|
|
1262
1387
|
cff = cff * qair
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1388
|
+
|
|
1389
|
+
ds = self.ds
|
|
1390
|
+
ds["qair"] = 0.62197 * (cff / (patm - 0.378 * cff))
|
|
1391
|
+
ds["qair"].attrs["long_name"] = "Absolute humidity at 2m"
|
|
1392
|
+
ds["qair"].attrs["units"] = "kg/kg"
|
|
1393
|
+
ds = ds.drop_vars([self.var_names["d2m"]])
|
|
1394
|
+
object.__setattr__(self, "ds", ds)
|
|
1266
1395
|
|
|
1267
1396
|
# Update var_names dictionary
|
|
1268
1397
|
var_names = {**self.var_names, "qair": "qair"}
|
|
1398
|
+
var_names.pop("d2m")
|
|
1269
1399
|
object.__setattr__(self, "var_names", var_names)
|
|
1270
1400
|
|
|
1271
1401
|
if "mask" in self.var_names.keys():
|
|
1402
|
+
ds = self.ds
|
|
1272
1403
|
mask = xr.where(self.ds[self.var_names["mask"]].isel(time=0).isnull(), 0, 1)
|
|
1404
|
+
ds["mask"] = mask
|
|
1405
|
+
ds = ds.drop_vars([self.var_names["mask"]])
|
|
1406
|
+
object.__setattr__(self, "ds", ds)
|
|
1273
1407
|
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
self
|
|
1408
|
+
# Remove mask from var_names dictionary
|
|
1409
|
+
var_names = self.var_names
|
|
1410
|
+
var_names.pop("mask")
|
|
1411
|
+
object.__setattr__(self, "var_names", var_names)
|
|
1278
1412
|
|
|
1279
1413
|
|
|
1280
1414
|
@dataclass(frozen=True, kw_only=True)
|
roms_tools/setup/fill.py
CHANGED
|
@@ -15,7 +15,7 @@ class LateralFill:
|
|
|
15
15
|
A 2D boolean mask indicating valid points (True) and land points (False).
|
|
16
16
|
Boundary points are automatically set to land (True).
|
|
17
17
|
dims : list of str
|
|
18
|
-
Dimensions along which to perform the lateral fill.
|
|
18
|
+
Dimensions along which to perform the lateral fill.
|
|
19
19
|
tol : float, optional
|
|
20
20
|
Tolerance for the iterative solver, determining convergence. Default is 1.0e-4.
|
|
21
21
|
|
|
@@ -65,7 +65,7 @@ class LateralFill:
|
|
|
65
65
|
non-NaN values.
|
|
66
66
|
"""
|
|
67
67
|
# Apply fill to anomaly field
|
|
68
|
-
mean = var.mean(dim=self.dims, skipna=True)
|
|
68
|
+
mean = var.where(self.mask).mean(dim=self.dims, skipna=True)
|
|
69
69
|
var = var - mean
|
|
70
70
|
|
|
71
71
|
# Setup the right-hand side (RHS): ocean points take their original values, land points are set to 0
|