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/utils.py
CHANGED
|
@@ -7,7 +7,7 @@ from roms_tools.utils import partition
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def nan_check(field, mask) -> None:
|
|
10
|
+
def nan_check(field, mask, error_message=None) -> None:
|
|
11
11
|
"""Checks for NaN values at wet points in the field.
|
|
12
12
|
|
|
13
13
|
This function examines the interpolated input field for NaN values at positions indicated as wet points by the mask.
|
|
@@ -22,6 +22,10 @@ def nan_check(field, mask) -> None:
|
|
|
22
22
|
A boolean mask or data array with the same shape as `field`. The wet points (usually ocean points)
|
|
23
23
|
are indicated by `1` or `True`, and land points by `0` or `False`.
|
|
24
24
|
|
|
25
|
+
error_message : str, optional
|
|
26
|
+
A custom error message to be included in the ValueError if NaN values are detected. If not provided,
|
|
27
|
+
a default message will explain the potential cause and suggest ensuring the dataset's coverage.
|
|
28
|
+
|
|
25
29
|
Raises
|
|
26
30
|
------
|
|
27
31
|
ValueError
|
|
@@ -31,14 +35,15 @@ def nan_check(field, mask) -> None:
|
|
|
31
35
|
|
|
32
36
|
# Replace values in field with 0 where mask is not 1
|
|
33
37
|
da = xr.where(mask == 1, field, 0)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if da.isnull().any().values:
|
|
37
|
-
raise ValueError(
|
|
38
|
+
if error_message is None:
|
|
39
|
+
error_message = (
|
|
38
40
|
"NaN values found in interpolated field. This likely occurs because the ROMS grid, including "
|
|
39
41
|
"a small safety margin for interpolation, is not fully contained within the dataset's longitude/latitude range. Please ensure that the "
|
|
40
42
|
"dataset covers the entire area required by the ROMS grid."
|
|
41
43
|
)
|
|
44
|
+
# Check if any NaN values exist in the modified field
|
|
45
|
+
if da.isnull().any().values:
|
|
46
|
+
raise ValueError(error_message)
|
|
42
47
|
|
|
43
48
|
|
|
44
49
|
def substitute_nans_by_fillvalue(field, fill_value=0.0) -> xr.DataArray:
|
|
@@ -156,34 +161,30 @@ def interpolate_from_rho_to_v(field, method="additive"):
|
|
|
156
161
|
return field_interpolated
|
|
157
162
|
|
|
158
163
|
|
|
159
|
-
def
|
|
160
|
-
"""
|
|
161
|
-
dimension using forward fill.
|
|
162
|
-
|
|
163
|
-
This function assumes that the specified dimension is ordered from top to bottom (e.g., a vertical dimension like 'depth').
|
|
164
|
-
It fills `NaN` values below the deepest valid (non-NaN) entry along the given dimension by carrying forward the last valid value.
|
|
164
|
+
def one_dim_fill(da: xr.DataArray, dim: str, direction="forward") -> xr.DataArray:
|
|
165
|
+
"""Fill NaN values in a DataArray along a specified dimension.
|
|
165
166
|
|
|
166
167
|
Parameters
|
|
167
168
|
----------
|
|
168
|
-
|
|
169
|
-
The input
|
|
170
|
-
This array must have at least one dimension corresponding to `dim`, typically
|
|
171
|
-
a vertical axis such as 'depth' or 'height'.
|
|
169
|
+
da : xr.DataArray
|
|
170
|
+
The input DataArray with NaN values to be filled, which must include the specified dimension.
|
|
172
171
|
dim : str
|
|
173
|
-
The name of the dimension along which to
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
The name of the dimension along which to fill NaN values (e.g., 'depth' or 'time').
|
|
173
|
+
direction : str, optional
|
|
174
|
+
The filling direction; either "forward" to propagate non-NaN values downward or "backward" to propagate them upward.
|
|
175
|
+
Defaults to "forward".
|
|
176
176
|
|
|
177
177
|
Returns
|
|
178
178
|
-------
|
|
179
179
|
xr.DataArray
|
|
180
|
-
A new
|
|
181
|
-
filled by forward filling the deepest valid values down to the bottom.
|
|
182
|
-
The original input data remains unmodified.
|
|
180
|
+
A new DataArray with NaN values filled in the specified direction, leaving the original data unchanged.
|
|
183
181
|
"""
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
if dim in da.dims:
|
|
183
|
+
if direction == "forward":
|
|
184
|
+
return da.ffill(dim=dim)
|
|
185
|
+
elif direction == "backward":
|
|
186
|
+
return da.bfill(dim=dim)
|
|
187
|
+
return da
|
|
187
188
|
|
|
188
189
|
|
|
189
190
|
def assign_dates_to_climatology(ds: xr.Dataset, time_dim: str) -> xr.Dataset:
|
|
@@ -503,44 +504,6 @@ def get_variable_metadata():
|
|
|
503
504
|
return d
|
|
504
505
|
|
|
505
506
|
|
|
506
|
-
def get_boundary_info():
|
|
507
|
-
"""This function provides information about the boundary points for the rho, u, and
|
|
508
|
-
v variables on the grid, specifying the indices for the south, east, north, and west
|
|
509
|
-
boundaries.
|
|
510
|
-
|
|
511
|
-
Returns
|
|
512
|
-
-------
|
|
513
|
-
dict
|
|
514
|
-
A dictionary where keys are variable types ("rho", "u", "v"), and values
|
|
515
|
-
are nested dictionaries mapping directions ("south", "east", "north", "west")
|
|
516
|
-
to the corresponding boundary coordinates.
|
|
517
|
-
"""
|
|
518
|
-
|
|
519
|
-
# Boundary coordinates
|
|
520
|
-
bdry_coords = {
|
|
521
|
-
"rho": {
|
|
522
|
-
"south": {"eta_rho": 0},
|
|
523
|
-
"east": {"xi_rho": -1},
|
|
524
|
-
"north": {"eta_rho": -1},
|
|
525
|
-
"west": {"xi_rho": 0},
|
|
526
|
-
},
|
|
527
|
-
"u": {
|
|
528
|
-
"south": {"eta_rho": 0},
|
|
529
|
-
"east": {"xi_u": -1},
|
|
530
|
-
"north": {"eta_rho": -1},
|
|
531
|
-
"west": {"xi_u": 0},
|
|
532
|
-
},
|
|
533
|
-
"v": {
|
|
534
|
-
"south": {"eta_v": 0},
|
|
535
|
-
"east": {"xi_rho": -1},
|
|
536
|
-
"north": {"eta_v": -1},
|
|
537
|
-
"west": {"xi_rho": 0},
|
|
538
|
-
},
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
return bdry_coords
|
|
542
|
-
|
|
543
|
-
|
|
544
507
|
def extract_single_value(data):
|
|
545
508
|
"""Extracts a single value from an xarray.DataArray or numpy array.
|
|
546
509
|
|
|
@@ -745,3 +708,207 @@ def save_datasets(dataset_list, output_filenames, np_eta=None, np_xi=None):
|
|
|
745
708
|
saved_filenames.extend(Path(f) for f in partitioned_filenames)
|
|
746
709
|
|
|
747
710
|
return saved_filenames
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
def get_target_coords(grid, use_coarse_grid=False):
|
|
714
|
+
"""Retrieves longitude and latitude coordinates from the grid, adjusting them based
|
|
715
|
+
on longitude range.
|
|
716
|
+
|
|
717
|
+
Parameters
|
|
718
|
+
----------
|
|
719
|
+
grid : Grid
|
|
720
|
+
Object representing the grid information used for the model.
|
|
721
|
+
use_coarse_grid : bool, optional
|
|
722
|
+
Use coarse grid data if True. Defaults to False.
|
|
723
|
+
|
|
724
|
+
Returns
|
|
725
|
+
-------
|
|
726
|
+
dict
|
|
727
|
+
Dictionary containing the longitude, latitude, and angle arrays, along with a boolean indicating
|
|
728
|
+
if the grid straddles the meridian.
|
|
729
|
+
"""
|
|
730
|
+
# Select grid variables based on whether the coarse grid is used
|
|
731
|
+
if use_coarse_grid:
|
|
732
|
+
lat, lon, angle = (
|
|
733
|
+
grid.ds.lat_coarse,
|
|
734
|
+
grid.ds.lon_coarse,
|
|
735
|
+
grid.ds.angle_coarse,
|
|
736
|
+
)
|
|
737
|
+
lat_psi = grid.ds.get("lat_psi_coarse")
|
|
738
|
+
lon_psi = grid.ds.get("lon_psi_coarse")
|
|
739
|
+
else:
|
|
740
|
+
lat, lon, angle = (
|
|
741
|
+
grid.ds.lat_rho,
|
|
742
|
+
grid.ds.lon_rho,
|
|
743
|
+
grid.ds.angle,
|
|
744
|
+
)
|
|
745
|
+
lat_psi = grid.ds.get("lat_psi")
|
|
746
|
+
lon_psi = grid.ds.get("lon_psi")
|
|
747
|
+
|
|
748
|
+
# Operate on longitudes between -180 and 180 unless ROMS domain lies at least 5 degrees in lontitude away from Greenwich meridian
|
|
749
|
+
lon = xr.where(lon > 180, lon - 360, lon)
|
|
750
|
+
if lon_psi is not None:
|
|
751
|
+
lon_psi = xr.where(lon_psi > 180, lon_psi - 360, lon_psi)
|
|
752
|
+
|
|
753
|
+
straddle = True
|
|
754
|
+
if not grid.straddle and abs(lon).min() > 5:
|
|
755
|
+
lon = xr.where(lon < 0, lon + 360, lon)
|
|
756
|
+
if lon_psi is not None:
|
|
757
|
+
lon_psi = xr.where(lon_psi < 0, lon_psi + 360, lon_psi)
|
|
758
|
+
straddle = False
|
|
759
|
+
|
|
760
|
+
target_coords = {
|
|
761
|
+
"lat": lat,
|
|
762
|
+
"lon": lon,
|
|
763
|
+
"lat_psi": lat_psi,
|
|
764
|
+
"lon_psi": lon_psi,
|
|
765
|
+
"angle": angle,
|
|
766
|
+
"straddle": straddle,
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
return target_coords
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
def rotate_velocities(
|
|
773
|
+
u: xr.DataArray, v: xr.DataArray, angle: xr.DataArray, interpolate: bool = True
|
|
774
|
+
) -> tuple[xr.DataArray, xr.DataArray]:
|
|
775
|
+
"""Rotate and optionally interpolate velocity components to align with grid
|
|
776
|
+
orientation.
|
|
777
|
+
|
|
778
|
+
Parameters
|
|
779
|
+
----------
|
|
780
|
+
u : xarray.DataArray
|
|
781
|
+
Zonal (east-west) velocity component at u-points.
|
|
782
|
+
v : xarray.DataArray
|
|
783
|
+
Meridional (north-south) velocity component at v-points.
|
|
784
|
+
angle : xarray.DataArray
|
|
785
|
+
Grid angle values for rotation.
|
|
786
|
+
interpolate : bool, optional
|
|
787
|
+
If True, interpolates rotated velocities to grid points (default is True).
|
|
788
|
+
|
|
789
|
+
Returns
|
|
790
|
+
-------
|
|
791
|
+
tuple of xarray.DataArray
|
|
792
|
+
Rotated velocity components (u_rot, v_rot).
|
|
793
|
+
|
|
794
|
+
Notes
|
|
795
|
+
-----
|
|
796
|
+
- Rotation formulas:
|
|
797
|
+
- u_rot = u * cos(angle) + v * sin(angle)
|
|
798
|
+
- v_rot = v * cos(angle) - u * sin(angle)
|
|
799
|
+
"""
|
|
800
|
+
|
|
801
|
+
# Rotate velocities to grid orientation
|
|
802
|
+
u_rot = u * np.cos(angle) + v * np.sin(angle)
|
|
803
|
+
v_rot = v * np.cos(angle) - u * np.sin(angle)
|
|
804
|
+
|
|
805
|
+
# Interpolate to u- and v-points
|
|
806
|
+
if interpolate:
|
|
807
|
+
u_rot = interpolate_from_rho_to_u(u_rot)
|
|
808
|
+
v_rot = interpolate_from_rho_to_v(v_rot)
|
|
809
|
+
|
|
810
|
+
return u_rot, v_rot
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
def compute_barotropic_velocity(
|
|
814
|
+
vel: xr.DataArray, interface_depth: xr.DataArray
|
|
815
|
+
) -> xr.DataArray:
|
|
816
|
+
"""Compute barotropic (depth-averaged) velocity from 3D velocity.
|
|
817
|
+
|
|
818
|
+
Assumes `vel` and `interface_depth` are at the same horizontal grid location.
|
|
819
|
+
|
|
820
|
+
Parameters
|
|
821
|
+
----------
|
|
822
|
+
vel : xarray.DataArray
|
|
823
|
+
Velocity components (zonal and meridional) at u- and v-points.
|
|
824
|
+
interface_depth : xarray.DataArray
|
|
825
|
+
Depth values for computing layer thickness.
|
|
826
|
+
|
|
827
|
+
Returns
|
|
828
|
+
-------
|
|
829
|
+
xarray.DataArray
|
|
830
|
+
Depth-averaged velocity (`vel_bar`).
|
|
831
|
+
|
|
832
|
+
Notes
|
|
833
|
+
-----
|
|
834
|
+
Computed as:
|
|
835
|
+
- `vel_bar` = sum(dz * vel) / sum(dz)
|
|
836
|
+
"""
|
|
837
|
+
|
|
838
|
+
# Layer thickness
|
|
839
|
+
dz = -interface_depth.diff(dim="s_w")
|
|
840
|
+
dz = dz.rename({"s_w": "s_rho"})
|
|
841
|
+
|
|
842
|
+
vel_bar = (dz * vel).sum(dim="s_rho") / dz.sum(dim="s_rho")
|
|
843
|
+
|
|
844
|
+
return vel_bar
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
def transpose_dimensions(da: xr.DataArray) -> xr.DataArray:
|
|
848
|
+
"""Transpose the dimensions of an xarray.DataArray to ensure that 'time', any
|
|
849
|
+
dimension starting with 's_', 'eta_', and 'xi_' are ordered first, followed by the
|
|
850
|
+
remaining dimensions in their original order.
|
|
851
|
+
|
|
852
|
+
Parameters
|
|
853
|
+
----------
|
|
854
|
+
da : xarray.DataArray
|
|
855
|
+
The input DataArray whose dimensions are to be reordered.
|
|
856
|
+
|
|
857
|
+
Returns
|
|
858
|
+
-------
|
|
859
|
+
xarray.DataArray
|
|
860
|
+
The DataArray with dimensions reordered so that 'time', 's_*', 'eta_*',
|
|
861
|
+
and 'xi_*' are first, in that order, if they exist.
|
|
862
|
+
"""
|
|
863
|
+
|
|
864
|
+
# List of preferred dimension patterns
|
|
865
|
+
preferred_order = ["time", "s_", "eta_", "xi_"]
|
|
866
|
+
|
|
867
|
+
# Get the existing dimensions in the DataArray
|
|
868
|
+
dims = list(da.dims)
|
|
869
|
+
|
|
870
|
+
# Collect dimensions that match any of the preferred patterns
|
|
871
|
+
matched_dims = []
|
|
872
|
+
for pattern in preferred_order:
|
|
873
|
+
# Find dimensions that start with the pattern
|
|
874
|
+
matched_dims += [dim for dim in dims if dim.startswith(pattern)]
|
|
875
|
+
|
|
876
|
+
# Create a new order: first the matched dimensions, then the rest
|
|
877
|
+
remaining_dims = [dim for dim in dims if dim not in matched_dims]
|
|
878
|
+
new_order = matched_dims + remaining_dims
|
|
879
|
+
|
|
880
|
+
# Transpose the DataArray to the new order
|
|
881
|
+
transposed_da = da.transpose(*new_order)
|
|
882
|
+
|
|
883
|
+
return transposed_da
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
def get_vector_pairs(variable_info):
|
|
887
|
+
"""Extracts all unique vector pairs from the variable_info dictionary.
|
|
888
|
+
|
|
889
|
+
Parameters
|
|
890
|
+
----------
|
|
891
|
+
variable_info : dict
|
|
892
|
+
Dictionary containing variable information, including location,
|
|
893
|
+
whether it's a vector, and its vector pair.
|
|
894
|
+
|
|
895
|
+
Returns
|
|
896
|
+
-------
|
|
897
|
+
list of tuples
|
|
898
|
+
List of unique vector pairs, where each tuple contains the names of
|
|
899
|
+
the two vector components (e.g., ("u", "v")).
|
|
900
|
+
"""
|
|
901
|
+
vector_pairs = []
|
|
902
|
+
processed = set() # Track variables that have already been paired
|
|
903
|
+
|
|
904
|
+
for var_name, var_info in variable_info.items():
|
|
905
|
+
if var_info["is_vector"] and var_name not in processed:
|
|
906
|
+
vector_pair = var_info["vector_pair"]
|
|
907
|
+
|
|
908
|
+
# Ensure the vector_pair exists in the dictionary and has not been processed
|
|
909
|
+
if vector_pair and vector_pair in variable_info:
|
|
910
|
+
vector_pairs.append((var_name, vector_pair))
|
|
911
|
+
# Mark both the variable and its pair as processed
|
|
912
|
+
processed.update([var_name, vector_pair])
|
|
913
|
+
|
|
914
|
+
return vector_pairs
|
|
@@ -7,11 +7,18 @@ from conftest import calculate_file_hash
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
@pytest.mark.parametrize(
|
|
11
|
+
"boundary_forcing_fixture",
|
|
12
|
+
[
|
|
13
|
+
"boundary_forcing",
|
|
14
|
+
"boundary_forcing_with_2d_fill",
|
|
15
|
+
],
|
|
16
|
+
)
|
|
17
|
+
def test_boundary_forcing_creation(boundary_forcing_fixture, request):
|
|
11
18
|
"""Test the creation of the BoundaryForcing object."""
|
|
12
19
|
|
|
13
20
|
fname = download_test_data("GLORYS_coarse_test_data.nc")
|
|
14
|
-
|
|
21
|
+
boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
15
22
|
assert boundary_forcing.start_time == datetime(2021, 6, 29)
|
|
16
23
|
assert boundary_forcing.end_time == datetime(2021, 6, 30)
|
|
17
24
|
assert boundary_forcing.source == {
|
|
@@ -40,54 +47,57 @@ def test_boundary_forcing_creation(boundary_forcing):
|
|
|
40
47
|
assert not hasattr(boundary_forcing.ds, "climatology")
|
|
41
48
|
|
|
42
49
|
|
|
43
|
-
|
|
50
|
+
@pytest.mark.parametrize(
|
|
51
|
+
"boundary_forcing_fixture",
|
|
52
|
+
[
|
|
53
|
+
"bgc_boundary_forcing_from_climatology",
|
|
54
|
+
"bgc_boundary_forcing_from_climatology_with_2d_fill",
|
|
55
|
+
],
|
|
56
|
+
)
|
|
57
|
+
def test_boundary_forcing_creation_with_bgc(boundary_forcing_fixture, request):
|
|
44
58
|
"""Test the creation of the BoundaryForcing object."""
|
|
45
59
|
|
|
46
60
|
fname_bgc = download_test_data("CESM_regional_coarse_test_data_climatology.nc")
|
|
61
|
+
boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
47
62
|
|
|
48
|
-
assert
|
|
49
|
-
assert
|
|
50
|
-
assert
|
|
63
|
+
assert boundary_forcing.start_time == datetime(2021, 6, 29)
|
|
64
|
+
assert boundary_forcing.end_time == datetime(2021, 6, 30)
|
|
65
|
+
assert boundary_forcing.source == {
|
|
51
66
|
"path": fname_bgc,
|
|
52
67
|
"name": "CESM_REGRIDDED",
|
|
53
68
|
"climatology": True,
|
|
54
69
|
}
|
|
55
|
-
assert
|
|
56
|
-
|
|
57
|
-
)
|
|
58
|
-
assert bgc_boundary_forcing_from_climatology.boundaries == {
|
|
70
|
+
assert boundary_forcing.model_reference_date == datetime(2000, 1, 1)
|
|
71
|
+
assert boundary_forcing.boundaries == {
|
|
59
72
|
"south": True,
|
|
60
73
|
"east": True,
|
|
61
74
|
"north": True,
|
|
62
75
|
"west": True,
|
|
63
76
|
}
|
|
64
77
|
|
|
65
|
-
assert
|
|
78
|
+
assert boundary_forcing.ds.source == "CESM_REGRIDDED"
|
|
66
79
|
for direction in ["south", "east", "north", "west"]:
|
|
67
80
|
for var in ["ALK", "PO4"]:
|
|
68
|
-
assert f"{var}_{direction}" in
|
|
81
|
+
assert f"{var}_{direction}" in boundary_forcing.ds
|
|
69
82
|
|
|
70
|
-
assert len(
|
|
71
|
-
assert
|
|
72
|
-
|
|
73
|
-
== "days"
|
|
74
|
-
)
|
|
75
|
-
assert hasattr(bgc_boundary_forcing_from_climatology.ds, "climatology")
|
|
83
|
+
assert len(boundary_forcing.ds.bry_time) == 12
|
|
84
|
+
assert boundary_forcing.ds.coords["bry_time"].attrs["units"] == "days"
|
|
85
|
+
assert hasattr(boundary_forcing.ds, "climatology")
|
|
76
86
|
|
|
77
87
|
|
|
78
88
|
def test_boundary_forcing_plot_save(boundary_forcing, tmp_path):
|
|
79
89
|
"""Test plot and save methods."""
|
|
80
90
|
|
|
81
|
-
boundary_forcing.plot(
|
|
82
|
-
boundary_forcing.plot(
|
|
83
|
-
boundary_forcing.plot(
|
|
84
|
-
boundary_forcing.plot(
|
|
85
|
-
boundary_forcing.plot(
|
|
86
|
-
boundary_forcing.plot(
|
|
87
|
-
boundary_forcing.plot(
|
|
88
|
-
boundary_forcing.plot(
|
|
89
|
-
boundary_forcing.plot(
|
|
90
|
-
boundary_forcing.plot(
|
|
91
|
+
boundary_forcing.plot(var_name="temp_south", layer_contours=True)
|
|
92
|
+
boundary_forcing.plot(var_name="temp_east", layer_contours=True)
|
|
93
|
+
boundary_forcing.plot(var_name="temp_north", layer_contours=True)
|
|
94
|
+
boundary_forcing.plot(var_name="temp_west", layer_contours=True)
|
|
95
|
+
boundary_forcing.plot(var_name="zeta_south")
|
|
96
|
+
boundary_forcing.plot(var_name="zeta_east")
|
|
97
|
+
boundary_forcing.plot(var_name="zeta_north")
|
|
98
|
+
boundary_forcing.plot(var_name="zeta_west")
|
|
99
|
+
boundary_forcing.plot(var_name="vbar_north")
|
|
100
|
+
boundary_forcing.plot(var_name="ubar_west")
|
|
91
101
|
|
|
92
102
|
for file_str in ["test_bf", "test_bf.nc"]:
|
|
93
103
|
# Create a temporary filepath using the tmp_path fixture
|
|
@@ -124,10 +134,10 @@ def test_bgc_boundary_forcing_plot_save(
|
|
|
124
134
|
):
|
|
125
135
|
"""Test plot and save methods."""
|
|
126
136
|
|
|
127
|
-
bgc_boundary_forcing_from_climatology.plot(
|
|
128
|
-
bgc_boundary_forcing_from_climatology.plot(
|
|
129
|
-
bgc_boundary_forcing_from_climatology.plot(
|
|
130
|
-
bgc_boundary_forcing_from_climatology.plot(
|
|
137
|
+
bgc_boundary_forcing_from_climatology.plot(var_name="ALK_south")
|
|
138
|
+
bgc_boundary_forcing_from_climatology.plot(var_name="ALK_east")
|
|
139
|
+
bgc_boundary_forcing_from_climatology.plot(var_name="ALK_north")
|
|
140
|
+
bgc_boundary_forcing_from_climatology.plot(var_name="ALK_west")
|
|
131
141
|
|
|
132
142
|
for file_str in ["test_bf", "test_bf.nc"]:
|
|
133
143
|
# Create a temporary filepath using the tmp_path fixture
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"end_time": "2021-06-30 00:00:00",
|
|
4
4
|
"hc": 250.0,
|
|
5
5
|
"model_reference_date": "2000-01-01 00:00:00",
|
|
6
|
-
"roms_tools_version": "0.1.
|
|
6
|
+
"roms_tools_version": "0.1.dev157+dirty",
|
|
7
7
|
"source": "CESM_REGRIDDED",
|
|
8
8
|
"start_time": "2021-06-29 00:00:00",
|
|
9
9
|
"theta_b": 2.0,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"end_time": "2021-06-30 00:00:00",
|
|
6
6
|
"hc": 250.0,
|
|
7
7
|
"model_reference_date": "2000-01-01 00:00:00",
|
|
8
|
-
"roms_tools_version": "0.1.
|
|
8
|
+
"roms_tools_version": "0.1.dev157+dirty",
|
|
9
9
|
"source": "CESM_REGRIDDED",
|
|
10
10
|
"start_time": "2021-06-29 00:00:00",
|
|
11
11
|
"theta_b": 2.0,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/0.0.0
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_north/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_south/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_east/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_north/0.0.0
CHANGED
|
Binary file
|