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
|
@@ -7,11 +7,11 @@ import pytest
|
|
|
7
7
|
import xarray as xr
|
|
8
8
|
|
|
9
9
|
from roms_tools import BoundaryForcing, Grid
|
|
10
|
-
from roms_tools.download import download_test_data
|
|
11
|
-
from roms_tools.setup.lat_lon_datasets import ERA5Correction
|
|
10
|
+
from roms_tools.datasets.download import download_test_data
|
|
12
11
|
from roms_tools.setup.utils import (
|
|
12
|
+
_infer_valid_boundaries_from_mask,
|
|
13
|
+
check_and_set_boundaries,
|
|
13
14
|
get_target_coords,
|
|
14
|
-
interpolate_from_climatology,
|
|
15
15
|
validate_names,
|
|
16
16
|
)
|
|
17
17
|
|
|
@@ -101,18 +101,6 @@ class TestGetTargetCoords:
|
|
|
101
101
|
assert "mask" in result
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
def test_interpolate_from_climatology(use_dask):
|
|
105
|
-
fname = download_test_data("ERA5_regional_test_data.nc")
|
|
106
|
-
era5_times = xr.open_dataset(fname).time
|
|
107
|
-
|
|
108
|
-
climatology = ERA5Correction(use_dask=use_dask)
|
|
109
|
-
field = climatology.ds["ssr_corr"]
|
|
110
|
-
field["time"] = field["time"].dt.days
|
|
111
|
-
|
|
112
|
-
interpolated_field = interpolate_from_climatology(field, "time", era5_times)
|
|
113
|
-
assert len(interpolated_field.time) == len(era5_times)
|
|
114
|
-
|
|
115
|
-
|
|
116
104
|
# Test yaml roundtrip with multiple source files
|
|
117
105
|
@pytest.fixture()
|
|
118
106
|
def boundary_forcing_from_multiple_source_files(request, use_dask):
|
|
@@ -210,3 +198,100 @@ def test_non_string_elements_in_list_raises():
|
|
|
210
198
|
def test_custom_label_in_errors():
|
|
211
199
|
with pytest.raises(ValueError, match="Invalid foozs: z"):
|
|
212
200
|
validate_names(["z"], VALID_NAMES, SENTINEL, MAX_TO_PLOT, label="fooz")
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
# test _infer_valid_boundaries_from_mask
|
|
204
|
+
@pytest.fixture
|
|
205
|
+
def simple_mask():
|
|
206
|
+
data = np.array(
|
|
207
|
+
[
|
|
208
|
+
[0, 0, 0, 0], # south
|
|
209
|
+
[1, 0, 0, 0],
|
|
210
|
+
[1, 0, 0, 0],
|
|
211
|
+
[1, 1, 1, 1], # north
|
|
212
|
+
]
|
|
213
|
+
)
|
|
214
|
+
return xr.DataArray(data, dims=("eta_rho", "xi_rho"))
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def test_infer_valid_boundaries_partial(simple_mask):
|
|
218
|
+
out = _infer_valid_boundaries_from_mask(simple_mask)
|
|
219
|
+
|
|
220
|
+
assert out == {
|
|
221
|
+
"south": False,
|
|
222
|
+
"north": True,
|
|
223
|
+
"west": True,
|
|
224
|
+
"east": True,
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def test_infer_valid_boundaries_all_ocean():
|
|
229
|
+
mask = xr.DataArray(np.ones((3, 3)), dims=("eta_rho", "xi_rho"))
|
|
230
|
+
|
|
231
|
+
out = _infer_valid_boundaries_from_mask(mask)
|
|
232
|
+
assert all(out.values())
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
# test check_and_set_boundaries
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def test_check_and_set_default_boundaries(simple_mask, monkeypatch):
|
|
239
|
+
monkeypatch.setattr(
|
|
240
|
+
"roms_tools.setup.utils._infer_valid_boundaries_from_mask",
|
|
241
|
+
lambda mask: {
|
|
242
|
+
"south": True,
|
|
243
|
+
"north": False,
|
|
244
|
+
"west": True,
|
|
245
|
+
"east": False,
|
|
246
|
+
},
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
result = check_and_set_boundaries(None, simple_mask)
|
|
250
|
+
|
|
251
|
+
assert result == {
|
|
252
|
+
"south": True,
|
|
253
|
+
"north": False,
|
|
254
|
+
"west": True,
|
|
255
|
+
"east": False,
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def test_check_and_set_partial_boundaries(simple_mask, monkeypatch):
|
|
260
|
+
monkeypatch.setattr(
|
|
261
|
+
"roms_tools.setup.utils._infer_valid_boundaries_from_mask",
|
|
262
|
+
lambda mask: {
|
|
263
|
+
"south": True,
|
|
264
|
+
"north": False,
|
|
265
|
+
"west": True,
|
|
266
|
+
"east": False,
|
|
267
|
+
},
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
user = {"south": False} # user overrides south → False
|
|
271
|
+
|
|
272
|
+
result = check_and_set_boundaries(user, simple_mask)
|
|
273
|
+
|
|
274
|
+
assert result == {
|
|
275
|
+
"south": False, # user-preserved
|
|
276
|
+
"north": False, # inferred
|
|
277
|
+
"west": True, # inferred
|
|
278
|
+
"east": False, # inferred
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def test_check_and_set_type_error(simple_mask):
|
|
283
|
+
with pytest.raises(TypeError):
|
|
284
|
+
check_and_set_boundaries({"south": "yes"}, simple_mask)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def test_check_and_set_invalid_key(simple_mask):
|
|
288
|
+
with pytest.raises(ValueError):
|
|
289
|
+
check_and_set_boundaries({"northeast": True}, simple_mask)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def test_check_and_set_full_user_boundaries(simple_mask):
|
|
293
|
+
boundaries = {"south": False, "north": True, "east": False, "west": True}
|
|
294
|
+
|
|
295
|
+
result = check_and_set_boundaries(boundaries, simple_mask)
|
|
296
|
+
|
|
297
|
+
assert result == boundaries # unchanged
|
|
@@ -5,6 +5,15 @@ from pathlib import Path
|
|
|
5
5
|
import pytest
|
|
6
6
|
import xarray as xr
|
|
7
7
|
|
|
8
|
+
try:
|
|
9
|
+
import xesmf # type: ignore
|
|
10
|
+
except ImportError:
|
|
11
|
+
xesmf = None
|
|
12
|
+
|
|
13
|
+
skip_xesmf = pytest.mark.skipif(
|
|
14
|
+
xesmf is None, reason="xesmf required for ROMS regridding"
|
|
15
|
+
)
|
|
16
|
+
|
|
8
17
|
|
|
9
18
|
@pytest.mark.parametrize(
|
|
10
19
|
"forcing_fixture",
|
|
@@ -14,6 +23,7 @@ import xarray as xr
|
|
|
14
23
|
"tidal_forcing",
|
|
15
24
|
"initial_conditions_with_bgc_from_climatology",
|
|
16
25
|
"initial_conditions_with_unified_bgc_from_climatology",
|
|
26
|
+
pytest.param("initial_conditions_from_roms", marks=skip_xesmf),
|
|
17
27
|
"surface_forcing",
|
|
18
28
|
"coarse_surface_forcing",
|
|
19
29
|
"corrected_surface_forcing",
|
|
@@ -59,6 +69,7 @@ def test_save_results(
|
|
|
59
69
|
"tidal_forcing",
|
|
60
70
|
"initial_conditions_with_bgc_from_climatology",
|
|
61
71
|
"initial_conditions_with_unified_bgc_from_climatology",
|
|
72
|
+
pytest.param("initial_conditions_from_roms", marks=skip_xesmf),
|
|
62
73
|
"surface_forcing",
|
|
63
74
|
"coarse_surface_forcing",
|
|
64
75
|
"corrected_surface_forcing",
|
|
@@ -93,13 +104,17 @@ def test_check_results(
|
|
|
93
104
|
[
|
|
94
105
|
"tidal_forcing",
|
|
95
106
|
"initial_conditions_with_bgc_from_climatology",
|
|
107
|
+
"initial_conditions_with_unified_bgc_from_climatology",
|
|
108
|
+
pytest.param("initial_conditions_from_roms", marks=skip_xesmf),
|
|
96
109
|
"surface_forcing",
|
|
97
110
|
"coarse_surface_forcing",
|
|
98
111
|
"corrected_surface_forcing",
|
|
99
112
|
"bgc_surface_forcing",
|
|
100
113
|
"bgc_surface_forcing_from_climatology",
|
|
114
|
+
"bgc_surface_forcing_from_unified_climatology",
|
|
101
115
|
"boundary_forcing",
|
|
102
116
|
"bgc_boundary_forcing_from_climatology",
|
|
117
|
+
"bgc_boundary_forcing_from_unified_climatology",
|
|
103
118
|
],
|
|
104
119
|
)
|
|
105
120
|
def test_dask_vs_no_dask(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
2
|
|
|
3
|
+
import numpy as np
|
|
3
4
|
import pytest
|
|
5
|
+
import xarray as xr
|
|
4
6
|
import xarray.testing as xrt
|
|
5
7
|
|
|
6
8
|
from roms_tools import Grid
|
|
@@ -18,7 +20,7 @@ class TestPartitionGrid:
|
|
|
18
20
|
def test_partition_grid_along_x(self, grid):
|
|
19
21
|
_, [ds1, ds2, ds3] = partition(grid.ds, np_eta=3, np_xi=1)
|
|
20
22
|
|
|
21
|
-
assert ds1.sizes == {
|
|
23
|
+
assert dict(ds1.sizes) == {
|
|
22
24
|
"eta_rho": 11,
|
|
23
25
|
"xi_rho": 32,
|
|
24
26
|
"xi_u": 31,
|
|
@@ -30,7 +32,7 @@ class TestPartitionGrid:
|
|
|
30
32
|
"s_rho": 100,
|
|
31
33
|
"s_w": 101,
|
|
32
34
|
}
|
|
33
|
-
assert ds2.sizes == {
|
|
35
|
+
assert dict(ds2.sizes) == {
|
|
34
36
|
"eta_rho": 10,
|
|
35
37
|
"xi_rho": 32,
|
|
36
38
|
"xi_u": 31,
|
|
@@ -42,7 +44,7 @@ class TestPartitionGrid:
|
|
|
42
44
|
"s_rho": 100,
|
|
43
45
|
"s_w": 101,
|
|
44
46
|
}
|
|
45
|
-
assert ds3.sizes == {
|
|
47
|
+
assert dict(ds3.sizes) == {
|
|
46
48
|
"eta_rho": 11,
|
|
47
49
|
"xi_rho": 32,
|
|
48
50
|
"xi_u": 31,
|
|
@@ -58,7 +60,7 @@ class TestPartitionGrid:
|
|
|
58
60
|
def test_partition_grid_along_y(self, grid):
|
|
59
61
|
_, [ds1, ds2, ds3] = partition(grid.ds, np_eta=1, np_xi=3)
|
|
60
62
|
|
|
61
|
-
assert ds1.sizes == {
|
|
63
|
+
assert dict(ds1.sizes) == {
|
|
62
64
|
"eta_rho": 32,
|
|
63
65
|
"xi_rho": 11,
|
|
64
66
|
"xi_u": 10,
|
|
@@ -70,7 +72,7 @@ class TestPartitionGrid:
|
|
|
70
72
|
"s_rho": 100,
|
|
71
73
|
"s_w": 101,
|
|
72
74
|
}
|
|
73
|
-
assert ds2.sizes == {
|
|
75
|
+
assert dict(ds2.sizes) == {
|
|
74
76
|
"eta_rho": 32,
|
|
75
77
|
"xi_rho": 10,
|
|
76
78
|
"xi_u": 10,
|
|
@@ -82,7 +84,7 @@ class TestPartitionGrid:
|
|
|
82
84
|
"s_rho": 100,
|
|
83
85
|
"s_w": 101,
|
|
84
86
|
}
|
|
85
|
-
assert ds3.sizes == {
|
|
87
|
+
assert dict(ds3.sizes) == {
|
|
86
88
|
"eta_rho": 32,
|
|
87
89
|
"xi_rho": 11,
|
|
88
90
|
"xi_u": 11,
|
|
@@ -103,7 +105,7 @@ class TestPartitionGrid:
|
|
|
103
105
|
ds7, ds8, ds9] = partition(grid.ds, np_eta=3, np_xi=3)
|
|
104
106
|
# fmt: on
|
|
105
107
|
|
|
106
|
-
assert ds1.sizes == {
|
|
108
|
+
assert dict(ds1.sizes) == {
|
|
107
109
|
"eta_rho": 11,
|
|
108
110
|
"xi_rho": 11,
|
|
109
111
|
"xi_u": 10,
|
|
@@ -115,7 +117,7 @@ class TestPartitionGrid:
|
|
|
115
117
|
"s_rho": 100,
|
|
116
118
|
"s_w": 101,
|
|
117
119
|
}
|
|
118
|
-
assert ds4.sizes == {
|
|
120
|
+
assert dict(ds4.sizes) == {
|
|
119
121
|
"eta_rho": 10,
|
|
120
122
|
"xi_rho": 11,
|
|
121
123
|
"xi_u": 10,
|
|
@@ -127,7 +129,7 @@ class TestPartitionGrid:
|
|
|
127
129
|
"s_rho": 100,
|
|
128
130
|
"s_w": 101,
|
|
129
131
|
}
|
|
130
|
-
assert ds7.sizes == {
|
|
132
|
+
assert dict(ds7.sizes) == {
|
|
131
133
|
"eta_rho": 11,
|
|
132
134
|
"xi_rho": 11,
|
|
133
135
|
"xi_u": 10,
|
|
@@ -139,7 +141,7 @@ class TestPartitionGrid:
|
|
|
139
141
|
"s_rho": 100,
|
|
140
142
|
"s_w": 101,
|
|
141
143
|
}
|
|
142
|
-
assert ds2.sizes == {
|
|
144
|
+
assert dict(ds2.sizes) == {
|
|
143
145
|
"eta_rho": 11,
|
|
144
146
|
"xi_rho": 10,
|
|
145
147
|
"xi_u": 10,
|
|
@@ -151,7 +153,7 @@ class TestPartitionGrid:
|
|
|
151
153
|
"s_rho": 100,
|
|
152
154
|
"s_w": 101,
|
|
153
155
|
}
|
|
154
|
-
assert ds5.sizes == {
|
|
156
|
+
assert dict(ds5.sizes) == {
|
|
155
157
|
"eta_rho": 10,
|
|
156
158
|
"xi_rho": 10,
|
|
157
159
|
"xi_u": 10,
|
|
@@ -163,7 +165,7 @@ class TestPartitionGrid:
|
|
|
163
165
|
"s_rho": 100,
|
|
164
166
|
"s_w": 101,
|
|
165
167
|
}
|
|
166
|
-
assert ds8.sizes == {
|
|
168
|
+
assert dict(ds8.sizes) == {
|
|
167
169
|
"eta_rho": 11,
|
|
168
170
|
"xi_rho": 10,
|
|
169
171
|
"xi_u": 10,
|
|
@@ -175,7 +177,7 @@ class TestPartitionGrid:
|
|
|
175
177
|
"s_rho": 100,
|
|
176
178
|
"s_w": 101,
|
|
177
179
|
}
|
|
178
|
-
assert ds3.sizes == {
|
|
180
|
+
assert dict(ds3.sizes) == {
|
|
179
181
|
"eta_rho": 11,
|
|
180
182
|
"xi_rho": 11,
|
|
181
183
|
"xi_u": 11,
|
|
@@ -187,7 +189,7 @@ class TestPartitionGrid:
|
|
|
187
189
|
"s_rho": 100,
|
|
188
190
|
"s_w": 101,
|
|
189
191
|
}
|
|
190
|
-
assert ds6.sizes == {
|
|
192
|
+
assert dict(ds6.sizes) == {
|
|
191
193
|
"eta_rho": 10,
|
|
192
194
|
"xi_rho": 11,
|
|
193
195
|
"xi_u": 11,
|
|
@@ -199,7 +201,7 @@ class TestPartitionGrid:
|
|
|
199
201
|
"s_rho": 100,
|
|
200
202
|
"s_w": 101,
|
|
201
203
|
}
|
|
202
|
-
assert ds9.sizes == {
|
|
204
|
+
assert dict(ds9.sizes) == {
|
|
203
205
|
"eta_rho": 11,
|
|
204
206
|
"xi_rho": 11,
|
|
205
207
|
"xi_u": 11,
|
|
@@ -246,6 +248,52 @@ class TestPartitionGrid:
|
|
|
246
248
|
assert ds.sizes["xi_coarse"] == grid.ds.sizes["xi_coarse"]
|
|
247
249
|
|
|
248
250
|
|
|
251
|
+
class TestPartitionGridWithExtraDims:
|
|
252
|
+
@pytest.fixture
|
|
253
|
+
def ds_with_extra_dims(self):
|
|
254
|
+
# Base dims
|
|
255
|
+
eta_rho = 10
|
|
256
|
+
xi_rho = 12
|
|
257
|
+
s_rho = 5
|
|
258
|
+
eta_v = eta_rho - 1
|
|
259
|
+
xi_u = xi_rho - 1
|
|
260
|
+
|
|
261
|
+
# Extra dims
|
|
262
|
+
eta_u = eta_rho
|
|
263
|
+
xi_v = xi_rho
|
|
264
|
+
|
|
265
|
+
ds = xr.Dataset(
|
|
266
|
+
{
|
|
267
|
+
"zeta": (("eta_rho", "xi_rho"), np.zeros((eta_rho, xi_rho))),
|
|
268
|
+
"u": (("s_rho", "eta_u", "xi_u"), np.zeros((s_rho, eta_u, xi_u))),
|
|
269
|
+
"v": (("s_rho", "eta_v", "xi_v"), np.zeros((s_rho, eta_v, xi_v))),
|
|
270
|
+
},
|
|
271
|
+
coords={
|
|
272
|
+
"eta_rho": np.arange(eta_rho),
|
|
273
|
+
"eta_u": np.arange(eta_u),
|
|
274
|
+
"eta_v": np.arange(eta_v),
|
|
275
|
+
"xi_rho": np.arange(xi_rho),
|
|
276
|
+
"xi_u": np.arange(xi_u),
|
|
277
|
+
"xi_v": np.arange(xi_v),
|
|
278
|
+
"s_rho": np.arange(s_rho),
|
|
279
|
+
},
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
return ds
|
|
283
|
+
|
|
284
|
+
def test_partition_with_extra_dims(self, ds_with_extra_dims):
|
|
285
|
+
file_numbers, parts = partition(ds_with_extra_dims, np_eta=2, np_xi=2)
|
|
286
|
+
|
|
287
|
+
# Test that partitioned datasets contain eta_u and xi_v
|
|
288
|
+
for ds_part in parts:
|
|
289
|
+
assert "eta_u" in ds_part.dims
|
|
290
|
+
assert "xi_v" in ds_part.dims
|
|
291
|
+
assert ds_part.sizes["eta_u"] < ds_with_extra_dims.sizes["eta_u"]
|
|
292
|
+
assert ds_part.sizes["xi_v"] < ds_with_extra_dims.sizes["xi_v"]
|
|
293
|
+
assert ds_part.sizes["eta_u"] > 0
|
|
294
|
+
assert ds_part.sizes["xi_v"] > 0
|
|
295
|
+
|
|
296
|
+
|
|
249
297
|
class TestPartitionMissingDims:
|
|
250
298
|
def test_partition_missing_dims(self, grid):
|
|
251
299
|
dims_to_drop = ["xi_u", "eta_v", "eta_coarse", "xi_coarse"]
|