roms-tools 3.3.0__py3-none-any.whl → 3.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- roms_tools/__init__.py +1 -1
- roms_tools/analysis/cdr_ensemble.py +10 -13
- roms_tools/analysis/roms_output.py +5 -304
- roms_tools/{download.py → datasets/download.py} +1 -0
- roms_tools/{setup → datasets}/lat_lon_datasets.py +88 -64
- roms_tools/{setup → datasets}/river_datasets.py +9 -4
- roms_tools/datasets/roms_dataset.py +854 -0
- roms_tools/datasets/utils.py +487 -0
- roms_tools/{setup/fill.py → fill.py} +110 -13
- roms_tools/plot.py +4 -4
- roms_tools/regrid.py +76 -0
- roms_tools/setup/boundary_forcing.py +53 -45
- roms_tools/setup/cdr_release.py +2 -4
- roms_tools/setup/grid.py +46 -15
- roms_tools/setup/initial_conditions.py +330 -71
- roms_tools/setup/mask.py +2 -5
- roms_tools/setup/nesting.py +13 -6
- roms_tools/setup/river_forcing.py +4 -4
- roms_tools/setup/surface_forcing.py +15 -11
- roms_tools/setup/tides.py +7 -6
- roms_tools/setup/topography.py +10 -2
- roms_tools/setup/utils.py +292 -666
- roms_tools/tests/test_analysis/test_cdr_ensemble.py +4 -6
- roms_tools/tests/test_analysis/test_roms_output.py +1 -220
- roms_tools/tests/{test_setup → test_datasets}/test_lat_lon_datasets.py +4 -4
- roms_tools/tests/{test_setup → test_datasets}/test_river_datasets.py +1 -1
- roms_tools/tests/test_datasets/test_roms_dataset.py +743 -0
- roms_tools/tests/test_datasets/test_utils.py +527 -0
- roms_tools/tests/{test_setup/test_fill.py → test_fill.py} +72 -9
- roms_tools/tests/test_regrid.py +120 -1
- roms_tools/tests/test_setup/test_boundary_forcing.py +57 -138
- roms_tools/tests/test_setup/test_cdr_release.py +4 -5
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zarr.json +293 -2021
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/zarr.json +294 -2022
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/ALK/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/ALK_west → initial_conditions_from_roms.zarr/ALK}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/ALK_ALT_CO2/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_west → initial_conditions_from_roms.zarr/ALK_ALT_CO2}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/Cs_r/c/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_unified_climatology.zarr/diatFe_west → initial_conditions_from_roms.zarr/Cs_r}/zarr.json +5 -12
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/Cs_w/c/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/diatFe_west → initial_conditions_from_roms.zarr/Cs_w}/zarr.json +3 -10
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DIC/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/DOCr_west → initial_conditions_from_roms.zarr/DIC}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DIC_ALT_CO2/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DIC_ALT_CO2/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DOC/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DOC/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DOCr/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_west → initial_conditions_from_roms.zarr/DOCr}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DON/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DON/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DONr/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DONr/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DOP/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DOP/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DOPr/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/DOPr/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/Fe/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/Fe/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/Lig/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/DOP_west → initial_conditions_from_roms.zarr/Lig}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/NH4/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/DON_west → initial_conditions_from_roms.zarr/NH4}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/NO3/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/NO3/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/O2/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/Lig_west → initial_conditions_from_roms.zarr/O2}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/PO4/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/PO4/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/SiO3/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/SiO3/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/abs_time/zarr.json +47 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/diatC/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/diatC_west → initial_conditions_from_roms.zarr/diatC}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/diatChl/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/diatChl_west → initial_conditions_from_roms.zarr/diatChl}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/diatFe/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/O2_west → initial_conditions_from_roms.zarr/diatFe}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/diatP/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/DIC_west → initial_conditions_from_roms.zarr/diatP}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/diatSi/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/DOC_west → initial_conditions_from_roms.zarr/diatSi}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/diazC/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/diazC/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/diazChl/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/diazChl_west → initial_conditions_from_roms.zarr/diazChl}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/diazFe/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/Fe_west → initial_conditions_from_roms.zarr/diazFe}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/diazP/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/diazP/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/ocean_time/c/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/ocean_time/zarr.json +47 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/salt/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_unified_climatology.zarr/ALK_west → initial_conditions_from_roms.zarr/salt}/zarr.json +12 -9
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/spC/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/spC/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/spCaCO3/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/spCaCO3/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/spChl/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/spChl_west → initial_conditions_from_roms.zarr/spChl}/zarr.json +11 -8
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/spFe/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/spFe/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/spP/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/spP/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/temp/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/temp/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/u/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/{bgc_boundary_forcing_from_climatology.zarr/NH4_west → initial_conditions_from_roms.zarr/u}/zarr.json +12 -9
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/ubar/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/ubar/zarr.json +54 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/v/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/v/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/vbar/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/vbar/zarr.json +54 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/w/zarr.json +57 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/zarr.json +2481 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/zeta/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/zeta/zarr.json +54 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/zooC/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_from_roms.zarr/zooC/zarr.json +57 -0
- roms_tools/tests/test_setup/test_grid.py +66 -1
- roms_tools/tests/test_setup/test_initial_conditions.py +130 -104
- roms_tools/tests/test_setup/test_nesting.py +2 -1
- roms_tools/tests/test_setup/test_surface_forcing.py +1 -1
- roms_tools/tests/test_setup/test_tides.py +1 -1
- roms_tools/tests/test_setup/test_utils.py +100 -15
- roms_tools/tests/test_setup/test_validation.py +15 -0
- roms_tools/tests/test_tiling/test_partition.py +63 -15
- roms_tools/tests/test_utils.py +365 -0
- roms_tools/tiling/partition.py +81 -211
- roms_tools/utils.py +360 -62
- {roms_tools-3.3.0.dist-info → roms_tools-3.5.0.dist-info}/METADATA +2 -3
- {roms_tools-3.3.0.dist-info → roms_tools-3.5.0.dist-info}/RECORD +137 -174
- {roms_tools-3.3.0.dist-info → roms_tools-3.5.0.dist-info}/WHEEL +1 -1
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/ALK_ALT_CO2_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/ALK_ALT_CO2_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/ALK_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DIC_ALT_CO2_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DIC_ALT_CO2_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DIC_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DIC_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOC_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOC_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOCr_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOCr_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DON_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DON_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DONr_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DONr_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOP_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOP_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOPr_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/DOPr_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/Fe_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/Fe_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/Lig_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/Lig_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/NH4_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/NH4_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/NO3_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/NO3_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/O2_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/O2_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/PO4_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/PO4_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/SiO3_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/SiO3_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatC_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatC_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatChl_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatChl_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatFe_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatP_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatP_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatSi_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diatSi_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazC_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazC_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazChl_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazChl_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazFe_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazFe_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazP_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/diazP_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spC_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spC_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spCaCO3_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spCaCO3_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spChl_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spChl_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spFe_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spFe_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spP_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/spP_west/zarr.json +0 -54
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/zooC_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/zooC_west/zarr.json +0 -54
- {roms_tools-3.3.0.dist-info → roms_tools-3.5.0.dist-info}/licenses/LICENSE +0 -0
- {roms_tools-3.3.0.dist-info → roms_tools-3.5.0.dist-info}/top_level.txt +0 -0
roms_tools/tests/test_regrid.py
CHANGED
|
@@ -2,7 +2,7 @@ import numpy as np
|
|
|
2
2
|
import pytest
|
|
3
3
|
import xarray as xr
|
|
4
4
|
|
|
5
|
-
from roms_tools.regrid import VerticalRegridToROMS
|
|
5
|
+
from roms_tools.regrid import VerticalRegrid, VerticalRegridToROMS
|
|
6
6
|
|
|
7
7
|
try:
|
|
8
8
|
import xesmf # type: ignore
|
|
@@ -134,3 +134,122 @@ def test_vertical_regrid(request, depth_values, layer_depth_rho_values, temp_dat
|
|
|
134
134
|
regridded = vertical_regrid.apply(data.temp_data, fill_nans=True)
|
|
135
135
|
expected = np.interp(layer_depth_rho_values, depth_values, temp_data)
|
|
136
136
|
assert np.allclose(expected, regridded.data, equal_nan=True)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# Test VerticalRegrid
|
|
140
|
+
def test_vertical_regrid_2d_depths_different_vertical_levels():
|
|
141
|
+
"""
|
|
142
|
+
Vertical regridding with 2D (eta, xi) depth coordinates where
|
|
143
|
+
source and target have different numbers of vertical levels.
|
|
144
|
+
"""
|
|
145
|
+
# --- dimensions ---
|
|
146
|
+
time = xr.DataArray(
|
|
147
|
+
np.array(["2000-01-01", "2000-01-02"], dtype="datetime64[ns]"),
|
|
148
|
+
dims="time",
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
s_rho_src = xr.DataArray(np.arange(6), dims="s_rho") # source: 6 levels
|
|
152
|
+
s_rho_tgt = xr.DataArray(np.arange(10), dims="s_rho") # target: 10 levels
|
|
153
|
+
|
|
154
|
+
eta = xr.DataArray(np.arange(3), dims="eta")
|
|
155
|
+
xi = xr.DataArray(np.arange(4), dims="xi")
|
|
156
|
+
|
|
157
|
+
# --- source depth coords: 2D + s_rho ---
|
|
158
|
+
base_depth = -(100 + 10 * eta.values[:, None] + 5 * xi.values[None, :])
|
|
159
|
+
|
|
160
|
+
source_depth = xr.DataArray(
|
|
161
|
+
base_depth,
|
|
162
|
+
dims=("eta", "xi"),
|
|
163
|
+
coords={"eta": eta, "xi": xi},
|
|
164
|
+
).expand_dims(time=time, s_rho=s_rho_src)
|
|
165
|
+
|
|
166
|
+
source_depth = source_depth + 20 * s_rho_src
|
|
167
|
+
|
|
168
|
+
# --- target depth coords: 2D + different s_rho ---
|
|
169
|
+
target_depth = xr.DataArray(
|
|
170
|
+
base_depth,
|
|
171
|
+
dims=("eta", "xi"),
|
|
172
|
+
coords={"eta": eta, "xi": xi},
|
|
173
|
+
).expand_dims(s_rho=s_rho_tgt)
|
|
174
|
+
|
|
175
|
+
target_depth = target_depth + 20 * s_rho_tgt
|
|
176
|
+
|
|
177
|
+
# --- synthetic temperature field: varies linearly with depth ---
|
|
178
|
+
temp_data = xr.DataArray(
|
|
179
|
+
np.broadcast_to(
|
|
180
|
+
s_rho_src.values[None, :, None, None] * 2.0,
|
|
181
|
+
(len(time), len(s_rho_src), len(eta), len(xi)),
|
|
182
|
+
),
|
|
183
|
+
dims=("time", "s_rho", "eta", "xi"),
|
|
184
|
+
coords={
|
|
185
|
+
"time": time,
|
|
186
|
+
"s_rho": s_rho_src,
|
|
187
|
+
"eta": eta,
|
|
188
|
+
"xi": xi,
|
|
189
|
+
},
|
|
190
|
+
name="temp",
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
ds = xr.Dataset(
|
|
194
|
+
{
|
|
195
|
+
"temp": temp_data,
|
|
196
|
+
},
|
|
197
|
+
coords={
|
|
198
|
+
"time": time,
|
|
199
|
+
"s_rho": s_rho_src,
|
|
200
|
+
"eta": eta,
|
|
201
|
+
"xi": xi,
|
|
202
|
+
},
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
# --- regrid ---
|
|
206
|
+
regridder = VerticalRegrid(ds)
|
|
207
|
+
out = regridder.apply(
|
|
208
|
+
temp_data,
|
|
209
|
+
source_depth_coords=source_depth,
|
|
210
|
+
target_depth_coords=target_depth,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
# --- assertions ---
|
|
214
|
+
assert isinstance(out, xr.DataArray)
|
|
215
|
+
|
|
216
|
+
# vertical dimension changed to target resolution
|
|
217
|
+
assert out.sizes["s_rho"] == s_rho_tgt.size
|
|
218
|
+
|
|
219
|
+
# horizontal + time preserved
|
|
220
|
+
assert out.sizes["time"] == time.size
|
|
221
|
+
assert out.sizes["eta"] == eta.size
|
|
222
|
+
assert out.sizes["xi"] == xi.size
|
|
223
|
+
|
|
224
|
+
# output contains finite values
|
|
225
|
+
assert np.isfinite(out).any()
|
|
226
|
+
|
|
227
|
+
# interpolation stays within source bounds
|
|
228
|
+
assert out.min() >= temp_data.min()
|
|
229
|
+
assert out.max() <= temp_data.max()
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def test_vertical_regrid_mask_edges():
|
|
233
|
+
"""Values outside source depth range should be masked when mask_edges=True."""
|
|
234
|
+
s_rho = xr.DataArray(np.linspace(-1, 0, 5), dims="s_rho")
|
|
235
|
+
source_depth = xr.DataArray([-100, -75, -50, -25, 0], dims="s_rho")
|
|
236
|
+
|
|
237
|
+
target_depth = xr.DataArray([-200, -50, 10], dims="s_rho")
|
|
238
|
+
|
|
239
|
+
data = xr.DataArray(
|
|
240
|
+
source_depth.values,
|
|
241
|
+
dims="s_rho",
|
|
242
|
+
coords={"s_rho": s_rho},
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
ds = xr.Dataset(
|
|
246
|
+
{"data": data, "depth": source_depth},
|
|
247
|
+
coords={"s_rho": s_rho},
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
regridder = VerticalRegrid(ds)
|
|
251
|
+
out = regridder.apply(data, source_depth, target_depth, mask_edges=True)
|
|
252
|
+
|
|
253
|
+
assert np.isnan(out[0])
|
|
254
|
+
assert np.isnan(out[-1])
|
|
255
|
+
assert not np.isnan(out[1])
|
|
@@ -12,7 +12,7 @@ import xarray as xr
|
|
|
12
12
|
|
|
13
13
|
from conftest import calculate_data_hash
|
|
14
14
|
from roms_tools import BoundaryForcing, Grid
|
|
15
|
-
from roms_tools.download import download_test_data
|
|
15
|
+
from roms_tools.datasets.download import download_test_data
|
|
16
16
|
from roms_tools.tests.test_setup.utils import download_regional_and_bigger
|
|
17
17
|
|
|
18
18
|
try:
|
|
@@ -25,9 +25,7 @@ except ImportError:
|
|
|
25
25
|
"boundary_forcing_fixture",
|
|
26
26
|
[
|
|
27
27
|
"boundary_forcing",
|
|
28
|
-
"boundary_forcing_adjusted_for_zeta",
|
|
29
28
|
"boundary_forcing_with_2d_fill",
|
|
30
|
-
"boundary_forcing_with_2d_fill_adjusted_for_zeta",
|
|
31
29
|
],
|
|
32
30
|
)
|
|
33
31
|
def test_boundary_forcing_creation(boundary_forcing_fixture, request):
|
|
@@ -44,25 +42,24 @@ def test_boundary_forcing_creation(boundary_forcing_fixture, request):
|
|
|
44
42
|
"climatology": False,
|
|
45
43
|
}
|
|
46
44
|
assert boundary_forcing.model_reference_date == datetime(2000, 1, 1)
|
|
47
|
-
assert
|
|
48
|
-
"south"
|
|
49
|
-
|
|
50
|
-
"north": True,
|
|
51
|
-
"west": True,
|
|
52
|
-
}
|
|
45
|
+
assert all(
|
|
46
|
+
k in boundary_forcing.boundaries for k in ["south", "east", "north", "west"]
|
|
47
|
+
)
|
|
53
48
|
|
|
54
49
|
assert boundary_forcing.ds.source == "GLORYS"
|
|
55
50
|
for direction in ["south", "east", "north", "west"]:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
if boundary_forcing.boundaries[direction]:
|
|
52
|
+
assert f"temp_{direction}" in boundary_forcing.ds
|
|
53
|
+
assert f"salt_{direction}" in boundary_forcing.ds
|
|
54
|
+
assert f"u_{direction}" in boundary_forcing.ds
|
|
55
|
+
assert f"v_{direction}" in boundary_forcing.ds
|
|
56
|
+
assert f"zeta_{direction}" in boundary_forcing.ds
|
|
61
57
|
|
|
62
58
|
assert len(boundary_forcing.ds.bry_time) == 2
|
|
63
59
|
assert boundary_forcing.ds.coords["bry_time"].attrs["units"] == "days"
|
|
64
60
|
assert not hasattr(boundary_forcing.ds, "climatology")
|
|
65
61
|
assert hasattr(boundary_forcing.ds, "adjust_depth_for_sea_surface_height")
|
|
62
|
+
assert boundary_forcing.ds.attrs["adjust_depth_for_sea_surface_height"] == "False"
|
|
66
63
|
assert hasattr(boundary_forcing.ds, "apply_2d_horizontal_fill")
|
|
67
64
|
|
|
68
65
|
|
|
@@ -104,12 +101,9 @@ def test_bgc_boundary_forcing_creation(boundary_forcing_fixture, request):
|
|
|
104
101
|
assert boundary_forcing.end_time == datetime(2021, 6, 30)
|
|
105
102
|
assert boundary_forcing.source["climatology"]
|
|
106
103
|
assert boundary_forcing.model_reference_date == datetime(2000, 1, 1)
|
|
107
|
-
assert
|
|
108
|
-
"south"
|
|
109
|
-
|
|
110
|
-
"north": True,
|
|
111
|
-
"west": True,
|
|
112
|
-
}
|
|
104
|
+
assert all(
|
|
105
|
+
k in boundary_forcing.boundaries for k in ["south", "east", "north", "west"]
|
|
106
|
+
)
|
|
113
107
|
|
|
114
108
|
expected_bgc_variables = [
|
|
115
109
|
"PO4",
|
|
@@ -147,8 +141,9 @@ def test_bgc_boundary_forcing_creation(boundary_forcing_fixture, request):
|
|
|
147
141
|
]
|
|
148
142
|
|
|
149
143
|
for direction in ["south", "east", "north", "west"]:
|
|
150
|
-
|
|
151
|
-
|
|
144
|
+
if boundary_forcing.boundaries[direction]:
|
|
145
|
+
for var in expected_bgc_variables:
|
|
146
|
+
assert f"{var}_{direction}" in boundary_forcing.ds
|
|
152
147
|
|
|
153
148
|
assert len(boundary_forcing.ds.bry_time) == 12
|
|
154
149
|
assert boundary_forcing.ds.coords["bry_time"].attrs["units"] == "days"
|
|
@@ -280,56 +275,6 @@ def test_boundary_divided_by_land_warning(caplog, use_dask):
|
|
|
280
275
|
assert "divided by land" in caplog.text
|
|
281
276
|
|
|
282
277
|
|
|
283
|
-
def test_info_depth(caplog, use_dask):
|
|
284
|
-
grid = Grid(
|
|
285
|
-
nx=3,
|
|
286
|
-
ny=3,
|
|
287
|
-
size_x=400,
|
|
288
|
-
size_y=400,
|
|
289
|
-
center_lon=-8,
|
|
290
|
-
center_lat=58,
|
|
291
|
-
rot=0,
|
|
292
|
-
N=3, # number of vertical levels
|
|
293
|
-
theta_s=5.0, # surface control parameter
|
|
294
|
-
theta_b=2.0, # bottom control parameter
|
|
295
|
-
hc=250.0, # critical depth
|
|
296
|
-
)
|
|
297
|
-
|
|
298
|
-
fname1 = Path(download_test_data("GLORYS_NA_20120101.nc"))
|
|
299
|
-
fname2 = Path(download_test_data("GLORYS_NA_20121231.nc"))
|
|
300
|
-
|
|
301
|
-
with caplog.at_level(logging.INFO):
|
|
302
|
-
BoundaryForcing(
|
|
303
|
-
grid=grid,
|
|
304
|
-
start_time=datetime(2012, 1, 1),
|
|
305
|
-
end_time=datetime(2012, 12, 31),
|
|
306
|
-
source={"name": "GLORYS", "path": [fname1, fname2]},
|
|
307
|
-
adjust_depth_for_sea_surface_height=True,
|
|
308
|
-
use_dask=use_dask,
|
|
309
|
-
)
|
|
310
|
-
|
|
311
|
-
# Verify the warning message in the log
|
|
312
|
-
assert "Sea surface height will be used to adjust depth coordinates." in caplog.text
|
|
313
|
-
|
|
314
|
-
# Clear the log before the next test
|
|
315
|
-
caplog.clear()
|
|
316
|
-
|
|
317
|
-
with caplog.at_level(logging.INFO):
|
|
318
|
-
BoundaryForcing(
|
|
319
|
-
grid=grid,
|
|
320
|
-
start_time=datetime(2012, 1, 1),
|
|
321
|
-
end_time=datetime(2012, 12, 31),
|
|
322
|
-
source={"name": "GLORYS", "path": [fname1, fname2]},
|
|
323
|
-
adjust_depth_for_sea_surface_height=False,
|
|
324
|
-
use_dask=use_dask,
|
|
325
|
-
)
|
|
326
|
-
# Verify the warning message in the log
|
|
327
|
-
assert (
|
|
328
|
-
"Sea surface height will NOT be used to adjust depth coordinates."
|
|
329
|
-
in caplog.text
|
|
330
|
-
)
|
|
331
|
-
|
|
332
|
-
|
|
333
278
|
def test_1d_and_2d_fill_coincide_if_no_fill(use_dask):
|
|
334
279
|
grid = Grid(
|
|
335
280
|
nx=2,
|
|
@@ -395,29 +340,6 @@ def test_1d_and_2d_fill_coincide_if_no_land(use_dask):
|
|
|
395
340
|
xr.testing.assert_allclose(bf_1d_fill.ds, bf_2d_fill.ds, rtol=1.0e-4)
|
|
396
341
|
|
|
397
342
|
|
|
398
|
-
@pytest.mark.parametrize(
|
|
399
|
-
"boundary_forcing_fixture",
|
|
400
|
-
[
|
|
401
|
-
"boundary_forcing_adjusted_for_zeta",
|
|
402
|
-
"boundary_forcing_with_2d_fill_adjusted_for_zeta",
|
|
403
|
-
],
|
|
404
|
-
)
|
|
405
|
-
def test_correct_depth_coords_adjusted_for_zeta(
|
|
406
|
-
boundary_forcing_fixture, request, use_dask
|
|
407
|
-
):
|
|
408
|
-
boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
409
|
-
|
|
410
|
-
for direction in ["south", "east", "north", "west"]:
|
|
411
|
-
# Test that uppermost interface coincides with sea surface height
|
|
412
|
-
assert np.allclose(
|
|
413
|
-
boundary_forcing.ds_depth_coords[f"interface_depth_rho_{direction}"]
|
|
414
|
-
.isel(s_w=-1)
|
|
415
|
-
.values,
|
|
416
|
-
-boundary_forcing.ds[f"zeta_{direction}"].values,
|
|
417
|
-
atol=1e-6,
|
|
418
|
-
)
|
|
419
|
-
|
|
420
|
-
|
|
421
343
|
@pytest.mark.parametrize(
|
|
422
344
|
"boundary_forcing_fixture",
|
|
423
345
|
[
|
|
@@ -429,14 +351,15 @@ def test_correct_depth_coords_zero_zeta(boundary_forcing_fixture, request, use_d
|
|
|
429
351
|
boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
430
352
|
|
|
431
353
|
for direction in ["south", "east", "north", "west"]:
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
354
|
+
if boundary_forcing.boundaries[direction]:
|
|
355
|
+
# Test that uppermost interface coincides with sea surface height
|
|
356
|
+
assert np.allclose(
|
|
357
|
+
boundary_forcing.ds_depth_coords[f"interface_depth_rho_{direction}"]
|
|
358
|
+
.isel(s_w=-1)
|
|
359
|
+
.values,
|
|
360
|
+
0 * boundary_forcing.ds[f"zeta_{direction}"].values,
|
|
361
|
+
atol=1e-6,
|
|
362
|
+
)
|
|
440
363
|
|
|
441
364
|
|
|
442
365
|
def test_computed_missing_optional_fields(
|
|
@@ -446,16 +369,16 @@ def test_computed_missing_optional_fields(
|
|
|
446
369
|
|
|
447
370
|
# Use tight tolerances because 'DOC' and 'DOCr' can have values order 1e-6
|
|
448
371
|
|
|
449
|
-
# 'DOCr' was missing in the source data and should have been filled with a constant default value
|
|
450
372
|
for direction in ["south", "east", "north", "west"]:
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
"
|
|
458
|
-
|
|
373
|
+
if bgc_boundary_forcing_from_unified_climatology.boundaries[direction]:
|
|
374
|
+
# 'DOCr' was missing in the source data and should have been filled with a constant default value
|
|
375
|
+
assert np.allclose(
|
|
376
|
+
ds[f"DOCr_{direction}"].std(), 0.0, rtol=1e-10, atol=1e-10
|
|
377
|
+
), "DOCr should be constant across space and time"
|
|
378
|
+
# 'DOC' was present in the source data and should show spatial or temporal variability
|
|
379
|
+
assert ds[f"DOC_{direction}"].std() > 1e-10, (
|
|
380
|
+
"DOC should vary across space and time"
|
|
381
|
+
)
|
|
459
382
|
|
|
460
383
|
|
|
461
384
|
@pytest.mark.parametrize(
|
|
@@ -463,8 +386,6 @@ def test_computed_missing_optional_fields(
|
|
|
463
386
|
[
|
|
464
387
|
"boundary_forcing",
|
|
465
388
|
"boundary_forcing_with_2d_fill",
|
|
466
|
-
"boundary_forcing_adjusted_for_zeta",
|
|
467
|
-
"boundary_forcing_with_2d_fill_adjusted_for_zeta",
|
|
468
389
|
],
|
|
469
390
|
)
|
|
470
391
|
def test_boundary_forcing_plot(boundary_forcing_fixture, request):
|
|
@@ -472,24 +393,25 @@ def test_boundary_forcing_plot(boundary_forcing_fixture, request):
|
|
|
472
393
|
boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
473
394
|
|
|
474
395
|
for direction in ["south", "east", "north", "west"]:
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
396
|
+
if boundary_forcing.boundaries[direction]:
|
|
397
|
+
for layer_contours in [False, True]:
|
|
398
|
+
boundary_forcing.plot(
|
|
399
|
+
var_name=f"temp_{direction}", layer_contours=layer_contours
|
|
400
|
+
)
|
|
401
|
+
boundary_forcing.plot(
|
|
402
|
+
var_name=f"u_{direction}", layer_contours=layer_contours
|
|
403
|
+
)
|
|
404
|
+
boundary_forcing.plot(
|
|
405
|
+
var_name=f"v_{direction}", layer_contours=layer_contours
|
|
406
|
+
)
|
|
407
|
+
boundary_forcing.plot(var_name=f"zeta_{direction}")
|
|
408
|
+
boundary_forcing.plot(var_name=f"vbar_{direction}")
|
|
409
|
+
boundary_forcing.plot(var_name=f"ubar_{direction}")
|
|
410
|
+
|
|
411
|
+
# Test that passing a matplotlib.axes.Axes works
|
|
412
|
+
fig, ax = plt.subplots(1, 1)
|
|
413
|
+
boundary_forcing.plot(var_name=f"temp_{direction}", ax=ax)
|
|
414
|
+
boundary_forcing.plot(var_name=f"zeta_{direction}", ax=ax)
|
|
493
415
|
|
|
494
416
|
|
|
495
417
|
@pytest.mark.parametrize(
|
|
@@ -497,8 +419,6 @@ def test_boundary_forcing_plot(boundary_forcing_fixture, request):
|
|
|
497
419
|
[
|
|
498
420
|
"boundary_forcing",
|
|
499
421
|
"boundary_forcing_with_2d_fill",
|
|
500
|
-
"boundary_forcing_adjusted_for_zeta",
|
|
501
|
-
"boundary_forcing_with_2d_fill_adjusted_for_zeta",
|
|
502
422
|
],
|
|
503
423
|
)
|
|
504
424
|
def test_boundary_forcing_save(boundary_forcing_fixture, request, tmp_path):
|
|
@@ -543,10 +463,9 @@ def test_bgc_boundary_forcing_plot(boundary_forcing_fixture, request):
|
|
|
543
463
|
"""Test plot method."""
|
|
544
464
|
bgc_boundary_forcing = request.getfixturevalue(boundary_forcing_fixture)
|
|
545
465
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
bgc_boundary_forcing.plot(var_name="ALK_west", layer_contours=True)
|
|
466
|
+
for direction in ["south", "east", "north", "west"]:
|
|
467
|
+
if bgc_boundary_forcing.boundaries[direction]:
|
|
468
|
+
bgc_boundary_forcing.plot(var_name=f"ALK_{direction}", layer_contours=True)
|
|
550
469
|
|
|
551
470
|
|
|
552
471
|
@pytest.mark.parametrize(
|
|
@@ -328,11 +328,10 @@ class TestTracerPerturbation:
|
|
|
328
328
|
with pytest.raises(ValidationError):
|
|
329
329
|
TracerPerturbation(**self.params, tracer_fluxes={"ALK": ["not", "valid"]})
|
|
330
330
|
|
|
331
|
-
def
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
TracerPerturbation(**self.params, tracer_fluxes={"ALK": [-1, 15]})
|
|
331
|
+
def test_tracer_fluxes_negative(self):
|
|
332
|
+
tp = TracerPerturbation(**self.params, tracer_fluxes={"DIC": -1})
|
|
333
|
+
|
|
334
|
+
assert tp.tracer_fluxes["DIC"].values <= 0.0
|
|
336
335
|
|
|
337
336
|
def test_zero_fill_strategy(self):
|
|
338
337
|
alk_value = 100.0
|