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
|
Binary file
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"shape": [
|
|
3
|
+
1,
|
|
4
|
+
7,
|
|
5
|
+
7
|
|
6
|
+
],
|
|
7
|
+
"data_type": "float32",
|
|
8
|
+
"chunk_grid": {
|
|
9
|
+
"name": "regular",
|
|
10
|
+
"configuration": {
|
|
11
|
+
"chunk_shape": [
|
|
12
|
+
1,
|
|
13
|
+
7,
|
|
14
|
+
7
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"chunk_key_encoding": {
|
|
19
|
+
"name": "default",
|
|
20
|
+
"configuration": {
|
|
21
|
+
"separator": "/"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"fill_value": 0.0,
|
|
25
|
+
"codecs": [
|
|
26
|
+
{
|
|
27
|
+
"name": "bytes",
|
|
28
|
+
"configuration": {
|
|
29
|
+
"endian": "little"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "zstd",
|
|
34
|
+
"configuration": {
|
|
35
|
+
"level": 0,
|
|
36
|
+
"checksum": false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"attributes": {
|
|
41
|
+
"long_name": "sea surface height",
|
|
42
|
+
"units": "m",
|
|
43
|
+
"coordinates": "abs_time",
|
|
44
|
+
"_FillValue": "AAAAAAAA+H8="
|
|
45
|
+
},
|
|
46
|
+
"dimension_names": [
|
|
47
|
+
"ocean_time",
|
|
48
|
+
"eta_rho",
|
|
49
|
+
"xi_rho"
|
|
50
|
+
],
|
|
51
|
+
"zarr_format": 3,
|
|
52
|
+
"node_type": "array",
|
|
53
|
+
"storage_transformers": []
|
|
54
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"shape": [
|
|
3
|
+
1,
|
|
4
|
+
3,
|
|
5
|
+
7,
|
|
6
|
+
7
|
|
7
|
+
],
|
|
8
|
+
"data_type": "float32",
|
|
9
|
+
"chunk_grid": {
|
|
10
|
+
"name": "regular",
|
|
11
|
+
"configuration": {
|
|
12
|
+
"chunk_shape": [
|
|
13
|
+
1,
|
|
14
|
+
3,
|
|
15
|
+
7,
|
|
16
|
+
7
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"chunk_key_encoding": {
|
|
21
|
+
"name": "default",
|
|
22
|
+
"configuration": {
|
|
23
|
+
"separator": "/"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"fill_value": 0.0,
|
|
27
|
+
"codecs": [
|
|
28
|
+
{
|
|
29
|
+
"name": "bytes",
|
|
30
|
+
"configuration": {
|
|
31
|
+
"endian": "little"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "zstd",
|
|
36
|
+
"configuration": {
|
|
37
|
+
"level": 0,
|
|
38
|
+
"checksum": false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"attributes": {
|
|
43
|
+
"long_name": "zooplankton carbon",
|
|
44
|
+
"units": "mmol/m^3",
|
|
45
|
+
"coordinates": "abs_time",
|
|
46
|
+
"_FillValue": "AAAAAAAA+H8="
|
|
47
|
+
},
|
|
48
|
+
"dimension_names": [
|
|
49
|
+
"ocean_time",
|
|
50
|
+
"s_rho",
|
|
51
|
+
"eta_rho",
|
|
52
|
+
"xi_rho"
|
|
53
|
+
],
|
|
54
|
+
"zarr_format": 3,
|
|
55
|
+
"node_type": "array",
|
|
56
|
+
"storage_transformers": []
|
|
57
|
+
}
|
|
@@ -18,7 +18,7 @@ from roms_tools.constants import (
|
|
|
18
18
|
UPPER_BOUND_THETA_B,
|
|
19
19
|
UPPER_BOUND_THETA_S,
|
|
20
20
|
)
|
|
21
|
-
from roms_tools.download import download_test_data
|
|
21
|
+
from roms_tools.datasets.download import download_test_data
|
|
22
22
|
from roms_tools.setup.topography import _compute_rfactor
|
|
23
23
|
|
|
24
24
|
try:
|
|
@@ -121,6 +121,25 @@ def grid_that_straddles_180_degree_meridian_with_global_srtm15_data():
|
|
|
121
121
|
return grid
|
|
122
122
|
|
|
123
123
|
|
|
124
|
+
@pytest.fixture()
|
|
125
|
+
def grid_with_emod_data():
|
|
126
|
+
grid = Grid(
|
|
127
|
+
nx=2,
|
|
128
|
+
ny=2,
|
|
129
|
+
size_x=32,
|
|
130
|
+
size_y=19.2,
|
|
131
|
+
center_lon=-21.68,
|
|
132
|
+
center_lat=64.325,
|
|
133
|
+
rot=0,
|
|
134
|
+
topography_source={
|
|
135
|
+
"name": "EMOD",
|
|
136
|
+
"path": download_test_data("EMODnet_C2_coarse100.nc"),
|
|
137
|
+
},
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
return grid
|
|
141
|
+
|
|
142
|
+
|
|
124
143
|
@pytest.fixture()
|
|
125
144
|
def grid_with_gshhs_coastlines():
|
|
126
145
|
iceland_fjord_kwargs = {
|
|
@@ -203,6 +222,7 @@ def test_coords_relation(grid_fixture, request):
|
|
|
203
222
|
"grid_that_straddles_dateline_with_global_srtm15_data",
|
|
204
223
|
"grid_that_straddles_180_degree_meridian_with_global_srtm15_data",
|
|
205
224
|
"grid_with_gshhs_coastlines",
|
|
225
|
+
"grid_with_emod_data",
|
|
206
226
|
],
|
|
207
227
|
)
|
|
208
228
|
def test_successful_initialization_with_topography(grid_fixture, request):
|
|
@@ -344,6 +364,7 @@ def test_grid_straddle_crosses_meridian():
|
|
|
344
364
|
"grid_that_straddles_dateline_with_shifted_global_etopo_data",
|
|
345
365
|
"grid_that_straddles_dateline_with_global_srtm15_data",
|
|
346
366
|
"grid_with_gshhs_coastlines",
|
|
367
|
+
"grid_with_emod_data",
|
|
347
368
|
],
|
|
348
369
|
)
|
|
349
370
|
def test_roundtrip_netcdf(grid_fixture, tmp_path, request):
|
|
@@ -379,6 +400,7 @@ def test_roundtrip_netcdf(grid_fixture, tmp_path, request):
|
|
|
379
400
|
"grid_that_straddles_dateline_with_shifted_global_etopo_data",
|
|
380
401
|
"grid_that_straddles_dateline_with_global_srtm15_data",
|
|
381
402
|
"grid_with_gshhs_coastlines",
|
|
403
|
+
"grid_with_emod_data",
|
|
382
404
|
],
|
|
383
405
|
)
|
|
384
406
|
def test_roundtrip_yaml(grid_fixture, tmp_path, request):
|
|
@@ -411,6 +433,7 @@ def test_roundtrip_yaml(grid_fixture, tmp_path, request):
|
|
|
411
433
|
"grid_that_straddles_dateline_with_shifted_global_etopo_data",
|
|
412
434
|
"grid_that_straddles_dateline_with_global_srtm15_data",
|
|
413
435
|
"grid_with_gshhs_coastlines",
|
|
436
|
+
"grid_with_emod_data",
|
|
414
437
|
],
|
|
415
438
|
)
|
|
416
439
|
def test_roundtrip_from_file_yaml(grid_fixture, tmp_path, request):
|
|
@@ -441,6 +464,7 @@ def test_roundtrip_from_file_yaml(grid_fixture, tmp_path, request):
|
|
|
441
464
|
"grid_that_straddles_dateline_with_shifted_global_etopo_data",
|
|
442
465
|
"grid_that_straddles_dateline_with_global_srtm15_data",
|
|
443
466
|
"grid_with_gshhs_coastlines",
|
|
467
|
+
"grid_with_emod_data",
|
|
444
468
|
],
|
|
445
469
|
)
|
|
446
470
|
def test_files_have_same_hash(grid_fixture, tmp_path, request):
|
|
@@ -741,6 +765,23 @@ def test_hmin_criterion_and_update_topography():
|
|
|
741
765
|
assert np.less_equal(grid.hmin, grid.ds.h.min())
|
|
742
766
|
|
|
743
767
|
|
|
768
|
+
def test_update_topography_raises_if_grid_loaded_from_file_has_no_source_info():
|
|
769
|
+
fname = download_test_data("grid_created_with_matlab.nc")
|
|
770
|
+
grid = Grid.from_file(fname)
|
|
771
|
+
|
|
772
|
+
with pytest.raises(
|
|
773
|
+
ValueError,
|
|
774
|
+
match="Topography source information is not available",
|
|
775
|
+
):
|
|
776
|
+
grid.update_topography(hmin=15)
|
|
777
|
+
|
|
778
|
+
with pytest.raises(
|
|
779
|
+
ValueError,
|
|
780
|
+
match="Minimal ocean depth is not available",
|
|
781
|
+
):
|
|
782
|
+
grid.update_topography(topography_source={"name": "ETOPO5"})
|
|
783
|
+
|
|
784
|
+
|
|
744
785
|
# Mask tests
|
|
745
786
|
|
|
746
787
|
|
|
@@ -826,6 +867,30 @@ def test_mask_topography_boundary():
|
|
|
826
867
|
)
|
|
827
868
|
|
|
828
869
|
|
|
870
|
+
def test_grid_copy_with_ds_does_not_mutate_original(grid):
|
|
871
|
+
"""
|
|
872
|
+
copy_with_ds should return a new Grid instance with the same metadata
|
|
873
|
+
but a different backing Dataset, leaving the original Grid unchanged.
|
|
874
|
+
"""
|
|
875
|
+
orig_ds = grid.ds
|
|
876
|
+
new_ds = orig_ds.isel(xi_rho=slice(0, 2), eta_rho=slice(0, 2))
|
|
877
|
+
|
|
878
|
+
new_grid = grid.copy_with_ds(new_ds)
|
|
879
|
+
|
|
880
|
+
# New object
|
|
881
|
+
assert new_grid is not grid
|
|
882
|
+
|
|
883
|
+
# Dataset replaced on copy
|
|
884
|
+
assert new_grid.ds is new_ds
|
|
885
|
+
|
|
886
|
+
# Original grid untouched
|
|
887
|
+
assert grid.ds is orig_ds
|
|
888
|
+
|
|
889
|
+
# Metadata preserved (adjust as needed for your Grid attributes)
|
|
890
|
+
for attr in ["nx", "ny", "size_x", "size_y", "center_lon", "center_lat", "rot"]:
|
|
891
|
+
assert getattr(new_grid, attr) == getattr(grid, attr)
|
|
892
|
+
|
|
893
|
+
|
|
829
894
|
# More Grid.from_file() tests
|
|
830
895
|
|
|
831
896
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import logging
|
|
2
1
|
import textwrap
|
|
3
2
|
from datetime import datetime
|
|
4
3
|
from pathlib import Path
|
|
@@ -10,17 +9,26 @@ import xarray as xr
|
|
|
10
9
|
|
|
11
10
|
from conftest import calculate_data_hash
|
|
12
11
|
from roms_tools import Grid, InitialConditions
|
|
13
|
-
from roms_tools.download import download_test_data
|
|
14
|
-
from roms_tools.
|
|
12
|
+
from roms_tools.datasets.download import download_test_data
|
|
13
|
+
from roms_tools.datasets.lat_lon_datasets import (
|
|
15
14
|
CESMBGCDataset,
|
|
16
15
|
UnifiedBGCDataset,
|
|
17
16
|
)
|
|
17
|
+
from roms_tools.setup.initial_conditions import _set_required_vars
|
|
18
18
|
from roms_tools.tests.test_setup.utils import download_regional_and_bigger
|
|
19
19
|
|
|
20
20
|
try:
|
|
21
21
|
import copernicusmarine # type: ignore
|
|
22
22
|
except ImportError:
|
|
23
23
|
copernicusmarine = None
|
|
24
|
+
try:
|
|
25
|
+
import xesmf # type: ignore
|
|
26
|
+
except ImportError:
|
|
27
|
+
xesmf = None
|
|
28
|
+
|
|
29
|
+
skip_xesmf = pytest.mark.skipif(
|
|
30
|
+
xesmf is None, reason="xesmf required for ROMS regridding"
|
|
31
|
+
)
|
|
24
32
|
|
|
25
33
|
|
|
26
34
|
@pytest.fixture
|
|
@@ -46,11 +54,10 @@ def example_grid():
|
|
|
46
54
|
"ic_fixture",
|
|
47
55
|
[
|
|
48
56
|
"initial_conditions",
|
|
49
|
-
"initial_conditions_adjusted_for_zeta",
|
|
50
57
|
"initial_conditions_with_bgc",
|
|
51
|
-
"initial_conditions_with_bgc_adjusted_for_zeta",
|
|
52
58
|
"initial_conditions_with_bgc_from_climatology",
|
|
53
59
|
"initial_conditions_with_unified_bgc_from_climatology",
|
|
60
|
+
pytest.param("initial_conditions_from_roms_without_bgc", marks=skip_xesmf),
|
|
54
61
|
],
|
|
55
62
|
)
|
|
56
63
|
def test_initial_conditions_creation_with_nondefault_glorys_dataset(
|
|
@@ -58,13 +65,6 @@ def test_initial_conditions_creation_with_nondefault_glorys_dataset(
|
|
|
58
65
|
):
|
|
59
66
|
"""Test the creation of the InitialConditions object."""
|
|
60
67
|
ic = request.getfixturevalue(ic_fixture)
|
|
61
|
-
|
|
62
|
-
assert ic.ini_time == datetime(2021, 6, 29)
|
|
63
|
-
assert ic.source == {
|
|
64
|
-
"name": "GLORYS",
|
|
65
|
-
"path": Path(download_test_data("GLORYS_coarse_test_data.nc")),
|
|
66
|
-
"climatology": False,
|
|
67
|
-
}
|
|
68
68
|
assert hasattr(ic.ds, "adjust_depth_for_sea_surface_height")
|
|
69
69
|
assert isinstance(ic.ds, xr.Dataset)
|
|
70
70
|
assert ic.ds.coords["ocean_time"].attrs["units"] == "seconds"
|
|
@@ -171,15 +171,14 @@ def test_initial_conditions_creation_with_duplicates(use_dask: bool) -> None:
|
|
|
171
171
|
"ic_fixture",
|
|
172
172
|
[
|
|
173
173
|
"initial_conditions_with_bgc",
|
|
174
|
-
"initial_conditions_with_bgc_adjusted_for_zeta",
|
|
175
174
|
"initial_conditions_with_bgc_from_climatology",
|
|
176
175
|
"initial_conditions_with_unified_bgc_from_climatology",
|
|
176
|
+
pytest.param("initial_conditions_from_roms", marks=skip_xesmf),
|
|
177
177
|
],
|
|
178
178
|
)
|
|
179
179
|
def test_initial_condition_creation_with_bgc(ic_fixture, request):
|
|
180
180
|
"""Test the creation of the BoundaryForcing object."""
|
|
181
181
|
ic = request.getfixturevalue(ic_fixture)
|
|
182
|
-
|
|
183
182
|
expected_bgc_variables = [
|
|
184
183
|
"PO4",
|
|
185
184
|
"NO3",
|
|
@@ -219,6 +218,88 @@ def test_initial_condition_creation_with_bgc(ic_fixture, request):
|
|
|
219
218
|
assert var in ic.ds
|
|
220
219
|
|
|
221
220
|
|
|
221
|
+
@pytest.mark.skipif(xesmf is None, reason="xesmf required")
|
|
222
|
+
def test_initial_conditions_raises_on_regridded_nans(use_dask):
|
|
223
|
+
"""Raise ValueError if regridded ROMS fields contain NaNs due to grid mismatch."""
|
|
224
|
+
parent_grid = Grid(
|
|
225
|
+
center_lon=-120, center_lat=30, nx=8, ny=13, size_x=3000, size_y=4000, rot=32
|
|
226
|
+
)
|
|
227
|
+
restart_file = Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
228
|
+
# create grid that is not entirely contained in the parent grid
|
|
229
|
+
grid_params = {
|
|
230
|
+
"nx": 5,
|
|
231
|
+
"ny": 5,
|
|
232
|
+
"center_lon": -128,
|
|
233
|
+
"center_lat": 9,
|
|
234
|
+
"size_x": 100,
|
|
235
|
+
"size_y": 100,
|
|
236
|
+
}
|
|
237
|
+
grid = Grid(**grid_params)
|
|
238
|
+
|
|
239
|
+
with pytest.raises(ValueError, match="NaN values found in regridded field."):
|
|
240
|
+
InitialConditions(
|
|
241
|
+
grid=grid,
|
|
242
|
+
ini_time=datetime(1998, 1, 6),
|
|
243
|
+
source={"name": "ROMS", "grid": parent_grid, "path": restart_file},
|
|
244
|
+
use_dask=use_dask,
|
|
245
|
+
bgc_source={
|
|
246
|
+
"name": "ROMS",
|
|
247
|
+
"grid": parent_grid,
|
|
248
|
+
"path": restart_file,
|
|
249
|
+
},
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
@pytest.mark.skipif(xesmf is None, reason="xesmf required")
|
|
254
|
+
def test_initial_conditions_unchanged_when_parent_and_child_grids_match(use_dask):
|
|
255
|
+
grid_params = {
|
|
256
|
+
"nx": 8,
|
|
257
|
+
"ny": 13,
|
|
258
|
+
"center_lon": -120,
|
|
259
|
+
"center_lat": 30,
|
|
260
|
+
"size_x": 3000,
|
|
261
|
+
"size_y": 4000,
|
|
262
|
+
"rot": 32,
|
|
263
|
+
}
|
|
264
|
+
parent_grid = Grid(**grid_params)
|
|
265
|
+
grid = Grid(**grid_params)
|
|
266
|
+
|
|
267
|
+
restart_file = Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
268
|
+
ds = xr.open_dataset(restart_file)
|
|
269
|
+
|
|
270
|
+
ic = InitialConditions(
|
|
271
|
+
grid=grid,
|
|
272
|
+
ini_time=datetime(1998, 1, 6),
|
|
273
|
+
source={"name": "ROMS", "grid": parent_grid, "path": restart_file},
|
|
274
|
+
use_dask=use_dask,
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
mask = grid.ds.mask_rho
|
|
278
|
+
|
|
279
|
+
# For scalar fields (temp, salt, zeta), values should be preserved exactly
|
|
280
|
+
# when parent and child grids are identical.
|
|
281
|
+
#
|
|
282
|
+
# NOTE:
|
|
283
|
+
# Velocity variables (u, v) are excluded here because their initialization
|
|
284
|
+
# involves multiple non-exact operations:
|
|
285
|
+
# - interpolation from staggered (u/v) points to rho-points,
|
|
286
|
+
# - rotation between grid-relative and earth-relative coordinates,
|
|
287
|
+
# - interpolation back to staggered grids.
|
|
288
|
+
#
|
|
289
|
+
# These steps are not mathematically invertible and introduce small
|
|
290
|
+
# numerical differences throughout the domain (not only at boundaries),
|
|
291
|
+
# so bitwise or near-bitwise agreement cannot be expected.
|
|
292
|
+
for var_name in ["temp", "salt", "zeta"]:
|
|
293
|
+
restart_values = ds[var_name].isel(time=1).where(mask).values
|
|
294
|
+
ic_values = ic.ds[var_name].squeeze().where(mask).values
|
|
295
|
+
|
|
296
|
+
assert np.allclose(
|
|
297
|
+
ic_values,
|
|
298
|
+
restart_values,
|
|
299
|
+
equal_nan=True,
|
|
300
|
+
), f"{var_name} values changed during initialization"
|
|
301
|
+
|
|
302
|
+
|
|
222
303
|
# Test initialization with missing 'name' in source
|
|
223
304
|
def test_initial_conditions_missing_physics_name(example_grid, use_dask):
|
|
224
305
|
with pytest.raises(ValueError, match="`source` must include a 'name'"):
|
|
@@ -262,8 +343,8 @@ def test_initial_conditions_missing_bgc_path(example_grid, use_dask):
|
|
|
262
343
|
def test_initial_conditions_missing_ini_time(example_grid, use_dask):
|
|
263
344
|
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
264
345
|
with pytest.raises(
|
|
265
|
-
|
|
266
|
-
match="`ini_time` must be a
|
|
346
|
+
TypeError,
|
|
347
|
+
match="`ini_time` must be a datetime object",
|
|
267
348
|
):
|
|
268
349
|
InitialConditions(
|
|
269
350
|
grid=example_grid,
|
|
@@ -303,90 +384,6 @@ def test_initial_conditions_default_bgc_climatology(example_grid, use_dask):
|
|
|
303
384
|
assert initial_conditions.bgc_source["climatology"] is False
|
|
304
385
|
|
|
305
386
|
|
|
306
|
-
def test_info_depth(caplog, use_dask):
|
|
307
|
-
grid = Grid(
|
|
308
|
-
nx=2,
|
|
309
|
-
ny=2,
|
|
310
|
-
size_x=500,
|
|
311
|
-
size_y=1000,
|
|
312
|
-
center_lon=0,
|
|
313
|
-
center_lat=55,
|
|
314
|
-
rot=10,
|
|
315
|
-
N=3, # number of vertical levels
|
|
316
|
-
theta_s=5.0, # surface control parameter
|
|
317
|
-
theta_b=2.0, # bottom control parameter
|
|
318
|
-
hc=250.0, # critical depth
|
|
319
|
-
)
|
|
320
|
-
|
|
321
|
-
fname = Path(download_test_data("GLORYS_coarse_test_data.nc"))
|
|
322
|
-
|
|
323
|
-
with caplog.at_level(logging.INFO):
|
|
324
|
-
InitialConditions(
|
|
325
|
-
grid=grid,
|
|
326
|
-
ini_time=datetime(2021, 6, 29),
|
|
327
|
-
source={"path": fname, "name": "GLORYS"},
|
|
328
|
-
adjust_depth_for_sea_surface_height=True,
|
|
329
|
-
use_dask=use_dask,
|
|
330
|
-
)
|
|
331
|
-
# Verify the warning message in the log
|
|
332
|
-
assert "Sea surface height will be used to adjust depth coordinates." in caplog.text
|
|
333
|
-
|
|
334
|
-
# Clear the log before the next test
|
|
335
|
-
caplog.clear()
|
|
336
|
-
|
|
337
|
-
with caplog.at_level(logging.INFO):
|
|
338
|
-
InitialConditions(
|
|
339
|
-
grid=grid,
|
|
340
|
-
ini_time=datetime(2021, 6, 29),
|
|
341
|
-
source={"path": fname, "name": "GLORYS"},
|
|
342
|
-
adjust_depth_for_sea_surface_height=False,
|
|
343
|
-
use_dask=use_dask,
|
|
344
|
-
)
|
|
345
|
-
# Verify the warning message in the log
|
|
346
|
-
assert (
|
|
347
|
-
"Sea surface height will NOT be used to adjust depth coordinates."
|
|
348
|
-
in caplog.text
|
|
349
|
-
)
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
@pytest.mark.parametrize(
|
|
353
|
-
"initial_conditions_fixture",
|
|
354
|
-
[
|
|
355
|
-
"initial_conditions_adjusted_for_zeta",
|
|
356
|
-
"initial_conditions_with_bgc_adjusted_for_zeta",
|
|
357
|
-
],
|
|
358
|
-
)
|
|
359
|
-
def test_correct_depth_coords_adjusted_for_zeta(
|
|
360
|
-
initial_conditions_fixture, request, use_dask
|
|
361
|
-
):
|
|
362
|
-
initial_conditions = request.getfixturevalue(initial_conditions_fixture)
|
|
363
|
-
|
|
364
|
-
# compute interface depth at rho-points and write it into .ds_depth_coords
|
|
365
|
-
zeta = initial_conditions.ds.zeta
|
|
366
|
-
initial_conditions._get_depth_coordinates(
|
|
367
|
-
zeta, location="rho", depth_type="interface"
|
|
368
|
-
)
|
|
369
|
-
# Test that lowermost interface coincides with topography
|
|
370
|
-
assert np.allclose(
|
|
371
|
-
initial_conditions.ds_depth_coords["interface_depth_rho"]
|
|
372
|
-
.isel(s_w=0)
|
|
373
|
-
.squeeze()
|
|
374
|
-
.values, # Extract raw NumPy array
|
|
375
|
-
initial_conditions.grid.ds.h.values,
|
|
376
|
-
atol=1e-6, # Adjust tolerance as needed
|
|
377
|
-
)
|
|
378
|
-
|
|
379
|
-
# Test that uppermost interface coincides with sea surface height
|
|
380
|
-
assert np.allclose(
|
|
381
|
-
initial_conditions.ds_depth_coords["interface_depth_rho"]
|
|
382
|
-
.isel(s_w=-1)
|
|
383
|
-
.squeeze()
|
|
384
|
-
.values,
|
|
385
|
-
-zeta.values,
|
|
386
|
-
atol=1e-6,
|
|
387
|
-
)
|
|
388
|
-
|
|
389
|
-
|
|
390
387
|
@pytest.mark.parametrize(
|
|
391
388
|
"initial_conditions_fixture",
|
|
392
389
|
[
|
|
@@ -498,9 +495,9 @@ def test_computed_missing_optional_fields(
|
|
|
498
495
|
@pytest.mark.parametrize(
|
|
499
496
|
"initial_conditions_fixture",
|
|
500
497
|
[
|
|
501
|
-
"initial_conditions_with_bgc_adjusted_for_zeta",
|
|
502
498
|
"initial_conditions_with_bgc_from_climatology",
|
|
503
499
|
"initial_conditions_with_unified_bgc_from_climatology",
|
|
500
|
+
pytest.param("initial_conditions_from_roms", marks=skip_xesmf),
|
|
504
501
|
],
|
|
505
502
|
)
|
|
506
503
|
def test_initial_conditions_plot(initial_conditions_fixture, request):
|
|
@@ -546,9 +543,9 @@ def test_initial_conditions_plot(initial_conditions_fixture, request):
|
|
|
546
543
|
"initial_conditions_fixture",
|
|
547
544
|
[
|
|
548
545
|
"initial_conditions",
|
|
549
|
-
"initial_conditions_adjusted_for_zeta",
|
|
550
546
|
"initial_conditions_with_bgc_from_climatology",
|
|
551
547
|
"initial_conditions_with_unified_bgc_from_climatology",
|
|
548
|
+
pytest.param("initial_conditions_from_roms", marks=skip_xesmf),
|
|
552
549
|
],
|
|
553
550
|
)
|
|
554
551
|
def test_initial_conditions_save(initial_conditions_fixture, request, tmp_path):
|
|
@@ -574,9 +571,9 @@ def test_initial_conditions_save(initial_conditions_fixture, request, tmp_path):
|
|
|
574
571
|
"initial_conditions_fixture",
|
|
575
572
|
[
|
|
576
573
|
"initial_conditions",
|
|
577
|
-
"initial_conditions_adjusted_for_zeta",
|
|
578
574
|
"initial_conditions_with_bgc_from_climatology",
|
|
579
575
|
"initial_conditions_with_unified_bgc_from_climatology",
|
|
576
|
+
pytest.param("initial_conditions_from_roms", marks=skip_xesmf),
|
|
580
577
|
],
|
|
581
578
|
)
|
|
582
579
|
def test_roundtrip_yaml(initial_conditions_fixture, request, tmp_path, use_dask):
|
|
@@ -607,9 +604,10 @@ def test_roundtrip_yaml(initial_conditions_fixture, request, tmp_path, use_dask)
|
|
|
607
604
|
"initial_conditions_fixture",
|
|
608
605
|
[
|
|
609
606
|
"initial_conditions",
|
|
610
|
-
"initial_conditions_adjusted_for_zeta",
|
|
611
607
|
"initial_conditions_with_bgc_from_climatology",
|
|
612
608
|
"initial_conditions_with_unified_bgc_from_climatology",
|
|
609
|
+
pytest.param("initial_conditions_from_roms_without_bgc", marks=skip_xesmf),
|
|
610
|
+
pytest.param("initial_conditions_from_roms", marks=skip_xesmf),
|
|
613
611
|
],
|
|
614
612
|
)
|
|
615
613
|
def test_files_have_same_hash(initial_conditions_fixture, request, tmp_path, use_dask):
|
|
@@ -676,3 +674,31 @@ def test_from_yaml_missing_initial_conditions(tmp_path, use_dask):
|
|
|
676
674
|
|
|
677
675
|
yaml_filepath = Path(yaml_filepath)
|
|
678
676
|
yaml_filepath.unlink()
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
# Test _set_required_vars
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
def test_default_var_type():
|
|
683
|
+
vars_map = _set_required_vars()
|
|
684
|
+
# Default is "physics"
|
|
685
|
+
expected_keys = {"zeta", "temp", "salt", "u", "v"}
|
|
686
|
+
assert set(vars_map.keys()) == expected_keys
|
|
687
|
+
# Values should match keys
|
|
688
|
+
for key, val in vars_map.items():
|
|
689
|
+
assert key == val
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
def test_bgc_var_type():
|
|
693
|
+
vars_map = _set_required_vars("bgc")
|
|
694
|
+
# Check a few expected keys exist
|
|
695
|
+
expected_keys = {"PO4", "NO3", "SiO3", "NH4", "Fe", "DIC", "spChl", "zooC"}
|
|
696
|
+
assert expected_keys.issubset(vars_map.keys())
|
|
697
|
+
# Values should match keys
|
|
698
|
+
for key, val in vars_map.items():
|
|
699
|
+
assert key == val
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
def test_invalid_var_type():
|
|
703
|
+
with pytest.raises(ValueError, match="Unsupported var_type"):
|
|
704
|
+
_set_required_vars("invalid_type")
|
|
@@ -14,7 +14,8 @@ from roms_tools.setup.nesting import (
|
|
|
14
14
|
modify_child_mask,
|
|
15
15
|
modify_child_topography,
|
|
16
16
|
)
|
|
17
|
-
from roms_tools.setup.utils import get_boundary_coords
|
|
17
|
+
from roms_tools.setup.utils import get_boundary_coords
|
|
18
|
+
from roms_tools.utils import wrap_longitudes
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
@pytest.fixture()
|
|
@@ -9,7 +9,7 @@ import xarray as xr
|
|
|
9
9
|
|
|
10
10
|
from conftest import calculate_data_hash
|
|
11
11
|
from roms_tools import Grid, SurfaceForcing
|
|
12
|
-
from roms_tools.download import download_test_data
|
|
12
|
+
from roms_tools.datasets.download import download_test_data
|
|
13
13
|
from roms_tools.setup.utils import RawDataSource
|
|
14
14
|
|
|
15
15
|
|
|
@@ -6,7 +6,7 @@ import xarray as xr
|
|
|
6
6
|
|
|
7
7
|
from conftest import calculate_data_hash
|
|
8
8
|
from roms_tools import Grid, TidalForcing
|
|
9
|
-
from roms_tools.download import download_test_data
|
|
9
|
+
from roms_tools.datasets.download import download_test_data
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
@pytest.fixture(scope="session")
|