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/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spP/0.0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/temp/0.0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/u/0.0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ubar/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/v/0.0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/vbar/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zeta/0.0.0
CHANGED
|
Binary file
|
roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zooC/0.0.0.0
CHANGED
|
Binary file
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"correct_radiation": "False",
|
|
3
3
|
"end_time": "2020-02-02 00:00:00",
|
|
4
4
|
"model_reference_date": "2000-01-01 00:00:00",
|
|
5
|
-
"roms_tools_version": "0.1.
|
|
5
|
+
"roms_tools_version": "0.1.dev157+dirty",
|
|
6
6
|
"source": "ERA5",
|
|
7
7
|
"start_time": "2020-01-31 00:00:00",
|
|
8
8
|
"title": "ROMS surface forcing file created by ROMS-Tools",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"correct_radiation": "False",
|
|
5
5
|
"end_time": "2020-02-02 00:00:00",
|
|
6
6
|
"model_reference_date": "2000-01-01 00:00:00",
|
|
7
|
-
"roms_tools_version": "0.1.
|
|
7
|
+
"roms_tools_version": "0.1.dev157+dirty",
|
|
8
8
|
"source": "ERA5",
|
|
9
9
|
"start_time": "2020-01-31 00:00:00",
|
|
10
10
|
"title": "ROMS surface forcing file created by ROMS-Tools",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
".zattrs": {
|
|
4
4
|
"allan_factor": 2.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": "TPXO",
|
|
8
8
|
"title": "ROMS tidal forcing created by ROMS-Tools"
|
|
9
9
|
},
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
"omega/.zattrs": {
|
|
34
34
|
"_ARRAY_DIMENSIONS": [
|
|
35
35
|
"ntides"
|
|
36
|
-
]
|
|
36
|
+
],
|
|
37
|
+
"long_name": "Tidal frequencies",
|
|
38
|
+
"units": "1/s"
|
|
37
39
|
},
|
|
38
40
|
"pot_Im/.zarray": {
|
|
39
41
|
"chunks": [
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -259,6 +259,42 @@ def test_warnings_times(global_dataset, tmp_path, use_dask):
|
|
|
259
259
|
)
|
|
260
260
|
|
|
261
261
|
|
|
262
|
+
def test_from_ds(global_dataset, global_dataset_with_noon_times, use_dask, tmp_path):
|
|
263
|
+
"""Test the from_ds method of the Dataset class."""
|
|
264
|
+
|
|
265
|
+
start_time = datetime(2022, 1, 1)
|
|
266
|
+
|
|
267
|
+
filepath = tmp_path / "test.nc"
|
|
268
|
+
global_dataset.to_netcdf(filepath)
|
|
269
|
+
|
|
270
|
+
dataset = Dataset(
|
|
271
|
+
filename=filepath,
|
|
272
|
+
var_names={"var": "var"},
|
|
273
|
+
dim_names={
|
|
274
|
+
"latitude": "latitude",
|
|
275
|
+
"longitude": "longitude",
|
|
276
|
+
"time": "time",
|
|
277
|
+
"depth": "depth",
|
|
278
|
+
},
|
|
279
|
+
start_time=start_time,
|
|
280
|
+
use_dask=use_dask,
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
new_dataset = Dataset.from_ds(dataset, global_dataset_with_noon_times)
|
|
284
|
+
|
|
285
|
+
assert isinstance(new_dataset, Dataset) # Check that the new instance is a Dataset
|
|
286
|
+
assert new_dataset.ds.equals(
|
|
287
|
+
global_dataset_with_noon_times
|
|
288
|
+
) # Verify the new ds attribute is set correctly
|
|
289
|
+
|
|
290
|
+
# Ensure other attributes are copied correctly
|
|
291
|
+
for attr in vars(dataset):
|
|
292
|
+
if attr != "ds":
|
|
293
|
+
assert getattr(new_dataset, attr) == getattr(
|
|
294
|
+
dataset, attr
|
|
295
|
+
), f"Attribute {attr} not copied correctly."
|
|
296
|
+
|
|
297
|
+
|
|
262
298
|
def test_reverse_latitude_reverse_depth_choose_subdomain(
|
|
263
299
|
global_dataset, tmp_path, use_dask
|
|
264
300
|
):
|
|
@@ -288,31 +324,37 @@ def test_reverse_latitude_reverse_depth_choose_subdomain(
|
|
|
288
324
|
assert np.all(np.diff(dataset.ds["depth"]) > 0)
|
|
289
325
|
|
|
290
326
|
# test choosing subdomain for domain that straddles the dateline
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
327
|
+
target_coords = {
|
|
328
|
+
"lat": xr.DataArray(np.linspace(-10, 10, 100)),
|
|
329
|
+
"lon": xr.DataArray(np.linspace(-10, 10, 100)),
|
|
330
|
+
"straddle": True,
|
|
331
|
+
}
|
|
332
|
+
sub_dataset = dataset.choose_subdomain(
|
|
333
|
+
target_coords,
|
|
334
|
+
buffer_points=1,
|
|
335
|
+
return_copy=True,
|
|
297
336
|
)
|
|
298
337
|
|
|
299
|
-
assert -11 <= ds["latitude"].min() <= 11
|
|
300
|
-
assert -11 <= ds["latitude"].max() <= 11
|
|
301
|
-
assert -11 <= ds["longitude"].min() <= 11
|
|
302
|
-
assert -11 <= ds["longitude"].max() <= 11
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
338
|
+
assert -11 <= sub_dataset.ds["latitude"].min() <= 11
|
|
339
|
+
assert -11 <= sub_dataset.ds["latitude"].max() <= 11
|
|
340
|
+
assert -11 <= sub_dataset.ds["longitude"].min() <= 11
|
|
341
|
+
assert -11 <= sub_dataset.ds["longitude"].max() <= 11
|
|
342
|
+
|
|
343
|
+
target_coords = {
|
|
344
|
+
"lat": xr.DataArray(np.linspace(-10, 10, 100)),
|
|
345
|
+
"lon": xr.DataArray(np.linspace(10, 20, 100)),
|
|
346
|
+
"straddle": False,
|
|
347
|
+
}
|
|
348
|
+
sub_dataset = dataset.choose_subdomain(
|
|
349
|
+
target_coords,
|
|
350
|
+
buffer_points=1,
|
|
351
|
+
return_copy=True,
|
|
310
352
|
)
|
|
311
353
|
|
|
312
|
-
assert -11 <= ds["latitude"].min() <= 11
|
|
313
|
-
assert -11 <= ds["latitude"].max() <= 11
|
|
314
|
-
assert 9 <= ds["longitude"].min() <= 21
|
|
315
|
-
assert 9 <= ds["longitude"].max() <= 21
|
|
354
|
+
assert -11 <= sub_dataset.ds["latitude"].min() <= 11
|
|
355
|
+
assert -11 <= sub_dataset.ds["latitude"].max() <= 11
|
|
356
|
+
assert 9 <= sub_dataset.ds["longitude"].min() <= 21
|
|
357
|
+
assert 9 <= sub_dataset.ds["longitude"].max() <= 21
|
|
316
358
|
|
|
317
359
|
|
|
318
360
|
def test_check_if_global_with_global_dataset(global_dataset, tmp_path, use_dask):
|
|
@@ -475,3 +517,19 @@ def test_climatology_error(use_dask):
|
|
|
475
517
|
climatology=False,
|
|
476
518
|
use_dask=use_dask,
|
|
477
519
|
)
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
@pytest.mark.parametrize(
|
|
523
|
+
"data_fixture, expected_resolution",
|
|
524
|
+
[
|
|
525
|
+
("era5_data", 0.25),
|
|
526
|
+
("glorys_data", 1 / 12),
|
|
527
|
+
("tpxo_data", 1 / 6),
|
|
528
|
+
("cesm_bgc_data", 1.0),
|
|
529
|
+
("cesm_surface_bgc_data", 1.0),
|
|
530
|
+
],
|
|
531
|
+
)
|
|
532
|
+
def test_horizontal_resolution(data_fixture, expected_resolution, request):
|
|
533
|
+
|
|
534
|
+
data = request.getfixturevalue(data_fixture)
|
|
535
|
+
assert np.isclose(data.resolution, expected_resolution)
|
|
@@ -1,134 +1,58 @@
|
|
|
1
1
|
import pytest
|
|
2
|
-
from roms_tools.setup.datasets import (
|
|
3
|
-
GLORYSDataset,
|
|
4
|
-
ERA5Dataset,
|
|
5
|
-
CESMBGCDataset,
|
|
6
|
-
CESMBGCSurfaceForcingDataset,
|
|
7
|
-
TPXODataset,
|
|
8
|
-
)
|
|
9
|
-
from roms_tools.setup.download import download_test_data
|
|
10
2
|
from roms_tools.setup.fill import LateralFill
|
|
11
|
-
from roms_tools.setup.utils import extrapolate_deepest_to_bottom
|
|
12
|
-
from datetime import datetime
|
|
13
3
|
import numpy as np
|
|
14
4
|
import xarray as xr
|
|
15
5
|
|
|
16
6
|
|
|
17
|
-
@pytest.fixture()
|
|
18
|
-
def era5_data(request, use_dask):
|
|
19
|
-
fname = download_test_data("ERA5_regional_test_data.nc")
|
|
20
|
-
data = ERA5Dataset(
|
|
21
|
-
filename=fname,
|
|
22
|
-
start_time=datetime(2020, 1, 31),
|
|
23
|
-
end_time=datetime(2020, 2, 2),
|
|
24
|
-
use_dask=use_dask,
|
|
25
|
-
)
|
|
26
|
-
data.post_process()
|
|
27
|
-
|
|
28
|
-
return data
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
@pytest.fixture()
|
|
32
|
-
def glorys_data(request, use_dask):
|
|
33
|
-
fname = download_test_data("GLORYS_NA_2012.nc")
|
|
34
|
-
|
|
35
|
-
data = GLORYSDataset(
|
|
36
|
-
filename=fname,
|
|
37
|
-
start_time=datetime(2012, 1, 1),
|
|
38
|
-
end_time=datetime(2013, 1, 1),
|
|
39
|
-
use_dask=use_dask,
|
|
40
|
-
)
|
|
41
|
-
data.post_process()
|
|
42
|
-
|
|
43
|
-
# extrapolate deepest value to bottom so all levels can use the same surface mask
|
|
44
|
-
for var in data.var_names:
|
|
45
|
-
if var != "zeta":
|
|
46
|
-
data.ds[data.var_names[var]] = extrapolate_deepest_to_bottom(
|
|
47
|
-
data.ds[data.var_names[var]], data.dim_names["depth"]
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
return data
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@pytest.fixture()
|
|
54
|
-
def tpxo_data(request, use_dask):
|
|
55
|
-
fname = download_test_data("TPXO_regional_test_data.nc")
|
|
56
|
-
|
|
57
|
-
data = TPXODataset(
|
|
58
|
-
filename=fname,
|
|
59
|
-
use_dask=use_dask,
|
|
60
|
-
)
|
|
61
|
-
data.post_process()
|
|
62
|
-
|
|
63
|
-
return data
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
@pytest.fixture()
|
|
67
|
-
def cesm_bgc_data(request, use_dask):
|
|
68
|
-
fname = download_test_data("CESM_BGC_2012.nc")
|
|
69
|
-
|
|
70
|
-
data = CESMBGCDataset(
|
|
71
|
-
filename=fname,
|
|
72
|
-
start_time=datetime(2012, 1, 1),
|
|
73
|
-
end_time=datetime(2013, 1, 1),
|
|
74
|
-
climatology=False,
|
|
75
|
-
use_dask=use_dask,
|
|
76
|
-
)
|
|
77
|
-
data.post_process()
|
|
78
|
-
|
|
79
|
-
# extrapolate deepest value to bottom so all levels can use the same surface mask
|
|
80
|
-
for var in data.var_names:
|
|
81
|
-
data.ds[data.var_names[var]] = extrapolate_deepest_to_bottom(
|
|
82
|
-
data.ds[data.var_names[var]], data.dim_names["depth"]
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
return data
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
@pytest.fixture()
|
|
89
|
-
def cesm_surface_bgc_data(request, use_dask):
|
|
90
|
-
fname = download_test_data("CESM_BGC_SURFACE_2012.nc")
|
|
91
|
-
|
|
92
|
-
data = CESMBGCSurfaceForcingDataset(
|
|
93
|
-
filename=fname,
|
|
94
|
-
start_time=datetime(2012, 1, 1),
|
|
95
|
-
end_time=datetime(2013, 1, 1),
|
|
96
|
-
climatology=False,
|
|
97
|
-
use_dask=use_dask,
|
|
98
|
-
)
|
|
99
|
-
data.post_process()
|
|
100
|
-
|
|
101
|
-
return data
|
|
102
|
-
|
|
103
|
-
|
|
104
7
|
@pytest.mark.parametrize(
|
|
105
8
|
"data_fixture",
|
|
106
|
-
[
|
|
9
|
+
[
|
|
10
|
+
"era5_data",
|
|
11
|
+
"glorys_data",
|
|
12
|
+
"tpxo_data",
|
|
13
|
+
"coarsened_cesm_bgc_data",
|
|
14
|
+
"cesm_surface_bgc_data",
|
|
15
|
+
],
|
|
107
16
|
)
|
|
108
|
-
def test_lateral_fill_no_nans(data_fixture, request
|
|
17
|
+
def test_lateral_fill_no_nans(data_fixture, request):
|
|
109
18
|
data = request.getfixturevalue(data_fixture)
|
|
110
19
|
lateral_fill = LateralFill(
|
|
111
20
|
data.ds["mask"],
|
|
112
21
|
[data.dim_names["latitude"], data.dim_names["longitude"]],
|
|
113
22
|
)
|
|
23
|
+
if "mask_vel" in data.ds.data_vars:
|
|
24
|
+
lateral_fill_vel = LateralFill(
|
|
25
|
+
data.ds["mask_vel"],
|
|
26
|
+
[data.dim_names["latitude"], data.dim_names["longitude"]],
|
|
27
|
+
)
|
|
114
28
|
|
|
115
29
|
for var in data.var_names:
|
|
116
|
-
|
|
30
|
+
if var in ["u", "v"]:
|
|
31
|
+
filled = lateral_fill_vel.apply(
|
|
32
|
+
data.ds[data.var_names[var]].astype(np.float64)
|
|
33
|
+
)
|
|
34
|
+
else:
|
|
35
|
+
filled = lateral_fill.apply(data.ds[data.var_names[var]].astype(np.float64))
|
|
117
36
|
assert not filled.isnull().any()
|
|
118
37
|
|
|
119
38
|
|
|
120
|
-
def test_lateral_fill_correct_order_of_magnitude(
|
|
39
|
+
def test_lateral_fill_correct_order_of_magnitude(coarsened_cesm_bgc_data):
|
|
121
40
|
|
|
122
41
|
lateral_fill = LateralFill(
|
|
123
|
-
|
|
124
|
-
[
|
|
42
|
+
coarsened_cesm_bgc_data.ds["mask"],
|
|
43
|
+
[
|
|
44
|
+
coarsened_cesm_bgc_data.dim_names["latitude"],
|
|
45
|
+
coarsened_cesm_bgc_data.dim_names["longitude"],
|
|
46
|
+
],
|
|
125
47
|
)
|
|
126
48
|
|
|
127
|
-
ALK =
|
|
49
|
+
ALK = coarsened_cesm_bgc_data.ds["ALK"]
|
|
128
50
|
|
|
129
51
|
# zero out alkalinity field in all depth levels but the uppermost
|
|
130
|
-
ALK = xr.where(
|
|
131
|
-
|
|
52
|
+
ALK = xr.where(
|
|
53
|
+
coarsened_cesm_bgc_data.ds.ALK.depth > 25, 0, coarsened_cesm_bgc_data.ds.ALK
|
|
54
|
+
)
|
|
55
|
+
ALK = ALK.where(coarsened_cesm_bgc_data.ds.mask)
|
|
132
56
|
|
|
133
57
|
filled = lateral_fill.apply(ALK.astype(np.float64))
|
|
134
58
|
|
|
@@ -150,28 +74,46 @@ def test_lateral_fill_correct_order_of_magnitude(cesm_bgc_data):
|
|
|
150
74
|
"glorys_data",
|
|
151
75
|
],
|
|
152
76
|
)
|
|
153
|
-
def test_lateral_fill_reproducibility(data_fixture, request
|
|
77
|
+
def test_lateral_fill_reproducibility(data_fixture, request):
|
|
154
78
|
|
|
155
79
|
data = request.getfixturevalue(data_fixture)
|
|
156
80
|
lateral_fill0 = LateralFill(
|
|
157
81
|
data.ds["mask"],
|
|
158
82
|
[data.dim_names["latitude"], data.dim_names["longitude"]],
|
|
159
83
|
)
|
|
84
|
+
if "mask_vel" in data.ds.data_vars:
|
|
85
|
+
lateral_fill_vel0 = LateralFill(
|
|
86
|
+
data.ds["mask_vel"],
|
|
87
|
+
[data.dim_names["latitude"], data.dim_names["longitude"]],
|
|
88
|
+
)
|
|
160
89
|
lateral_fill1 = LateralFill(
|
|
161
90
|
data.ds["mask"],
|
|
162
91
|
[data.dim_names["latitude"], data.dim_names["longitude"]],
|
|
163
92
|
)
|
|
93
|
+
if "mask_vel" in data.ds.data_vars:
|
|
94
|
+
lateral_fill_vel1 = LateralFill(
|
|
95
|
+
data.ds["mask_vel"],
|
|
96
|
+
[data.dim_names["latitude"], data.dim_names["longitude"]],
|
|
97
|
+
)
|
|
164
98
|
|
|
165
99
|
ds0 = data.ds.copy()
|
|
166
100
|
ds1 = data.ds.copy()
|
|
167
101
|
|
|
168
102
|
for var in data.var_names:
|
|
103
|
+
if var in ["u", "v"]:
|
|
104
|
+
ds0[data.var_names[var]] = lateral_fill_vel0.apply(
|
|
105
|
+
ds0[data.var_names[var]].astype(np.float64)
|
|
106
|
+
)
|
|
107
|
+
ds1[data.var_names[var]] = lateral_fill_vel1.apply(
|
|
108
|
+
ds1[data.var_names[var]].astype(np.float64)
|
|
109
|
+
)
|
|
169
110
|
|
|
170
|
-
|
|
171
|
-
ds0[data.var_names[var]].
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
ds1[data.var_names[var]].
|
|
175
|
-
|
|
111
|
+
else:
|
|
112
|
+
ds0[data.var_names[var]] = lateral_fill0.apply(
|
|
113
|
+
ds0[data.var_names[var]].astype(np.float64)
|
|
114
|
+
)
|
|
115
|
+
ds1[data.var_names[var]] = lateral_fill1.apply(
|
|
116
|
+
ds1[data.var_names[var]].astype(np.float64)
|
|
117
|
+
)
|
|
176
118
|
|
|
177
119
|
assert ds0.equals(ds1)
|
|
@@ -181,37 +181,37 @@ def test_initial_conditions_plot_save(
|
|
|
181
181
|
):
|
|
182
182
|
"""Test plot and save methods."""
|
|
183
183
|
|
|
184
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
184
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="temp", s=0)
|
|
185
185
|
initial_conditions_with_bgc_from_climatology.plot(
|
|
186
|
-
|
|
186
|
+
var_name="temp", s=0, depth_contours=True
|
|
187
187
|
)
|
|
188
188
|
initial_conditions_with_bgc_from_climatology.plot(
|
|
189
|
-
|
|
189
|
+
var_name="temp", eta=0, layer_contours=True
|
|
190
190
|
)
|
|
191
191
|
initial_conditions_with_bgc_from_climatology.plot(
|
|
192
|
-
|
|
192
|
+
var_name="temp", xi=0, layer_contours=True
|
|
193
193
|
)
|
|
194
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
195
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
196
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
197
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
194
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="temp", eta=0)
|
|
195
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="temp", xi=0)
|
|
196
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="temp", s=0, xi=0)
|
|
197
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="temp", eta=0, xi=0)
|
|
198
198
|
initial_conditions_with_bgc_from_climatology.plot(
|
|
199
|
-
|
|
199
|
+
var_name="u", s=0, layer_contours=True
|
|
200
200
|
)
|
|
201
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
202
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
203
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
201
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="u", s=0)
|
|
202
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="u", eta=0)
|
|
203
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="u", xi=0)
|
|
204
204
|
initial_conditions_with_bgc_from_climatology.plot(
|
|
205
|
-
|
|
205
|
+
var_name="v", s=0, layer_contours=True
|
|
206
206
|
)
|
|
207
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
208
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
209
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
210
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
211
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
212
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
213
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
214
|
-
initial_conditions_with_bgc_from_climatology.plot(
|
|
207
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="v", s=0)
|
|
208
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="v", eta=0)
|
|
209
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="v", xi=0)
|
|
210
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="zeta")
|
|
211
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="ubar")
|
|
212
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="vbar")
|
|
213
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="ALK", s=0, xi=0)
|
|
214
|
+
initial_conditions_with_bgc_from_climatology.plot(var_name="ALK", eta=0, xi=0)
|
|
215
215
|
|
|
216
216
|
for file_str in ["test_ic", "test_ic.nc"]:
|
|
217
217
|
# Create a temporary filepath using the tmp_path fixture
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import numpy as np
|
|
3
|
+
import xarray as xr
|
|
4
|
+
from roms_tools.setup.regrid import VerticalRegrid
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def vertical_regridder(depth_values, layer_depth_rho_values):
|
|
8
|
+
class DataContainer:
|
|
9
|
+
"""Mock class for holding data and dimension names."""
|
|
10
|
+
|
|
11
|
+
def __init__(self, ds):
|
|
12
|
+
self.ds = ds
|
|
13
|
+
self.dim_names = {"depth": "depth"}
|
|
14
|
+
|
|
15
|
+
class Grid:
|
|
16
|
+
"""Mock class representing the grid object with layer depth information."""
|
|
17
|
+
|
|
18
|
+
def __init__(self, ds):
|
|
19
|
+
self.ds = ds
|
|
20
|
+
|
|
21
|
+
target_depth = xr.DataArray(data=layer_depth_rho_values, dims=["s_rho"])
|
|
22
|
+
source_depth = xr.DataArray(data=depth_values, dims=["depth"])
|
|
23
|
+
|
|
24
|
+
return VerticalRegrid(target_depth, source_depth)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@pytest.mark.parametrize(
|
|
28
|
+
"depth_values, layer_depth_rho_values, temp_data",
|
|
29
|
+
[
|
|
30
|
+
([5, 50, 100, 150], [130, 100, 70, 30, 10], [30, 25, 10, 2]),
|
|
31
|
+
([5, 50, 100, 150], [130, 100, 70, 30, 2], [30, 25, 10, 2]),
|
|
32
|
+
([5, 50, 100, 150], [200, 100, 70, 30, 10], [30, 25, 10, 2]),
|
|
33
|
+
([5, 50, 100, 150], [200, 100, 70, 30, 1], [30, 25, 10, 2]),
|
|
34
|
+
],
|
|
35
|
+
)
|
|
36
|
+
def test_vertical_regrid(request, depth_values, layer_depth_rho_values, temp_data):
|
|
37
|
+
|
|
38
|
+
vertical_regrid = vertical_regridder(
|
|
39
|
+
depth_values=depth_values, layer_depth_rho_values=layer_depth_rho_values
|
|
40
|
+
)
|
|
41
|
+
data = xr.Dataset({"temp_data": (["depth"], temp_data)})
|
|
42
|
+
|
|
43
|
+
# without filling in NaNs
|
|
44
|
+
regridded = vertical_regrid.apply(data.temp_data, fill_nans=False)
|
|
45
|
+
expected = np.interp(
|
|
46
|
+
layer_depth_rho_values, depth_values, temp_data, left=np.nan, right=np.nan
|
|
47
|
+
)
|
|
48
|
+
assert np.allclose(expected, regridded.data, equal_nan=True)
|
|
49
|
+
|
|
50
|
+
# with filling in NaNs
|
|
51
|
+
regridded = vertical_regrid.apply(data.temp_data, fill_nans=True)
|
|
52
|
+
expected = np.interp(layer_depth_rho_values, depth_values, temp_data)
|
|
53
|
+
assert np.allclose(expected, regridded.data, equal_nan=True)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
from datetime import datetime
|
|
3
|
+
import xarray as xr
|
|
3
4
|
from roms_tools import Grid, SurfaceForcing
|
|
4
5
|
from roms_tools.setup.download import download_test_data
|
|
5
6
|
import textwrap
|
|
@@ -487,6 +488,23 @@ def test_surface_forcing_creation(
|
|
|
487
488
|
sfc_forcing.plot("pco2_air", time=0)
|
|
488
489
|
|
|
489
490
|
|
|
491
|
+
@pytest.mark.parametrize(
|
|
492
|
+
"sfc_forcing_fixture",
|
|
493
|
+
[
|
|
494
|
+
"bgc_surface_forcing",
|
|
495
|
+
"bgc_surface_forcing_from_climatology",
|
|
496
|
+
],
|
|
497
|
+
)
|
|
498
|
+
def test_surface_forcing_pco2_replication(sfc_forcing_fixture, request):
|
|
499
|
+
"""Test whether pco2_air and pco2_air_alt is the same after processing."""
|
|
500
|
+
|
|
501
|
+
sfc_forcing = request.getfixturevalue(sfc_forcing_fixture)
|
|
502
|
+
|
|
503
|
+
xr.testing.assert_allclose(
|
|
504
|
+
sfc_forcing.ds.pco2_air, sfc_forcing.ds.pco2_air_alt, rtol=1.0e-5
|
|
505
|
+
)
|
|
506
|
+
|
|
507
|
+
|
|
490
508
|
@pytest.mark.parametrize(
|
|
491
509
|
"sfc_forcing_fixture",
|
|
492
510
|
[
|
|
@@ -498,7 +516,7 @@ def test_surface_forcing_creation(
|
|
|
498
516
|
def test_surface_forcing_plot_save(sfc_forcing_fixture, request, tmp_path):
|
|
499
517
|
"""Test plot and save methods."""
|
|
500
518
|
sfc_forcing = request.getfixturevalue(sfc_forcing_fixture)
|
|
501
|
-
sfc_forcing.plot(
|
|
519
|
+
sfc_forcing.plot(var_name="uwnd", time=0)
|
|
502
520
|
|
|
503
521
|
for file_str in ["test_sf", "test_sf.nc"]:
|
|
504
522
|
# Create a temporary filepath using the tmp_path fixture
|
|
@@ -531,7 +549,7 @@ def test_surface_forcing_bgc_plot_save(bgc_surface_forcing, tmp_path):
|
|
|
531
549
|
"""Test plot and save methods."""
|
|
532
550
|
|
|
533
551
|
# Check the values in the dataset
|
|
534
|
-
bgc_surface_forcing.plot(
|
|
552
|
+
bgc_surface_forcing.plot(var_name="pco2_air", time=0)
|
|
535
553
|
|
|
536
554
|
for file_str in ["test_sf", "test_sf.nc"]:
|
|
537
555
|
# Create a temporary filepath using the tmp_path fixture
|
|
@@ -566,7 +584,7 @@ def test_surface_forcing_bgc_from_clim_plot_save(
|
|
|
566
584
|
"""Test plot and save methods."""
|
|
567
585
|
|
|
568
586
|
# Check the values in the dataset
|
|
569
|
-
bgc_surface_forcing_from_climatology.plot(
|
|
587
|
+
bgc_surface_forcing_from_climatology.plot(var_name="pco2_air", time=0)
|
|
570
588
|
|
|
571
589
|
for file_str in ["test_sf", "test_sf.nc"]:
|
|
572
590
|
# Create a temporary filepath using the tmp_path fixture
|
|
@@ -174,7 +174,7 @@ def test_tidal_forcing_plot_save(tidal_forcing, tmp_path):
|
|
|
174
174
|
computed."""
|
|
175
175
|
tidal_forcing.ds.load()
|
|
176
176
|
|
|
177
|
-
tidal_forcing.plot(
|
|
177
|
+
tidal_forcing.plot(var_name="ssh_Re", ntides=0)
|
|
178
178
|
|
|
179
179
|
for file_str in ["test_tides", "test_tides.nc"]:
|
|
180
180
|
# Create a temporary filepath using the tmp_path fixture
|