roms-tools 3.2.0__py3-none-any.whl → 3.4.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.py → datasets/lat_lon_datasets.py} +85 -854
- roms_tools/datasets/river_datasets.py +532 -0
- roms_tools/datasets/roms_dataset.py +767 -0
- roms_tools/datasets/utils.py +475 -0
- roms_tools/{setup/fill.py → fill.py} +110 -13
- roms_tools/plot.py +42 -34
- roms_tools/setup/boundary_forcing.py +52 -44
- roms_tools/setup/cdr_release.py +2 -4
- roms_tools/setup/grid.py +42 -17
- roms_tools/setup/initial_conditions.py +23 -23
- roms_tools/setup/nesting.py +270 -94
- roms_tools/setup/river_forcing.py +5 -5
- roms_tools/setup/surface_forcing.py +17 -12
- roms_tools/setup/tides.py +1 -1
- roms_tools/setup/topography.py +13 -7
- roms_tools/setup/utils.py +103 -294
- 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.py → test_datasets/test_lat_lon_datasets.py} +25 -64
- roms_tools/tests/test_datasets/test_river_datasets.py +48 -0
- roms_tools/tests/test_datasets/test_roms_dataset.py +539 -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_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/ALK_ALT_CO2_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_ALT_CO2_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/ALK_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_ALT_CO2_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DIC_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOC_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOCr_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DON_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DONr_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOP_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/DOPr_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Fe_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/Lig_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NH4_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/NO3_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/O2_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/PO4_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/SiO3_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatC_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatChl_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatFe_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatP_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diatSi_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazC_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazChl_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazFe_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/diazP_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spC_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spCaCO3_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spChl_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spFe_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/spP_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zarr.json +289 -2017
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zooC_north/c/0/0/0 +0 -0
- 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/boundary_forcing.zarr/salt_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_south/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/salt_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_south/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/temp_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_south/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/u_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_east/c/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_north/c/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_south/c/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/ubar_west/c/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_east/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_north/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_south/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/v_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_east/c/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_north/c/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_south/c/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/vbar_west/c/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/boundary_forcing.zarr/zarr.json +182 -182
- roms_tools/tests/test_setup/test_data/grid.zarr/h/c/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/grid.zarr/zarr.json +191 -191
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/h/c/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/grid_that_straddles_dateline.zarr/zarr.json +210 -210
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ALK_ALT_CO2/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DIC_ALT_CO2/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOC/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOCr/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DON/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DONr/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOP/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/DOPr/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Fe/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/Lig/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NH4/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/NO3/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/O2/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/PO4/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/SiO3/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatC/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatChl/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatFe/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatP/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diatSi/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazC/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazChl/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazFe/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/diazP/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/salt/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spC/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spCaCO3/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spChl/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spFe/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/spP/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/temp/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/u/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/ubar/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/v/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/vbar/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zarr.json +182 -182
- roms_tools/tests/test_setup/test_data/initial_conditions_with_bgc_from_climatology.zarr/zooC/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/salt/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/temp/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/u/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/ubar/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/v/c/0/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/vbar/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/initial_conditions_with_unified_bgc_from_climatology.zarr/zarr.json +187 -187
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Im/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/u_Re/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Im/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/v_Re/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/tidal_forcing.zarr/zarr.json +66 -66
- roms_tools/tests/test_setup/test_grid.py +56 -1
- roms_tools/tests/test_setup/test_initial_conditions.py +3 -94
- roms_tools/tests/test_setup/test_nesting.py +119 -30
- roms_tools/tests/test_setup/test_surface_forcing.py +2 -2
- roms_tools/tests/test_setup/test_tides.py +1 -1
- roms_tools/tests/test_setup/test_utils.py +100 -15
- roms_tools/tests/test_tiling/test_partition.py +63 -15
- roms_tools/tests/test_utils.py +78 -0
- roms_tools/tiling/partition.py +81 -211
- roms_tools/utils.py +193 -0
- {roms_tools-3.2.0.dist-info → roms_tools-3.4.0.dist-info}/METADATA +1 -1
- {roms_tools-3.2.0.dist-info → roms_tools-3.4.0.dist-info}/RECORD +190 -312
- {roms_tools-3.2.0.dist-info → roms_tools-3.4.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_ALT_CO2_west/zarr.json +0 -54
- 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/ALK_west/zarr.json +0 -54
- 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_ALT_CO2_west/zarr.json +0 -54
- 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/DIC_west/zarr.json +0 -54
- 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/DOC_west/zarr.json +0 -54
- 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/DOCr_west/zarr.json +0 -54
- 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/DON_west/zarr.json +0 -54
- 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/DOP_west/zarr.json +0 -54
- 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/Fe_west/zarr.json +0 -54
- 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/Lig_west/zarr.json +0 -54
- 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/NH4_west/zarr.json +0 -54
- 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/O2_west/zarr.json +0 -54
- 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/diatC_west/zarr.json +0 -54
- 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/diatChl_west/zarr.json +0 -54
- 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/diatFe_west/zarr.json +0 -54
- 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/diazChl_west/zarr.json +0 -54
- 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/spChl_west/zarr.json +0 -54
- 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/ALK_west/zarr.json +0 -54
- 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/diatFe_west/zarr.json +0 -54
- 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.2.0.dist-info → roms_tools-3.4.0.dist-info}/licenses/LICENSE +0 -0
- {roms_tools-3.2.0.dist-info → roms_tools-3.4.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
import os
|
|
3
|
-
from datetime import datetime
|
|
4
1
|
from pathlib import Path
|
|
5
2
|
|
|
6
3
|
import matplotlib.pyplot as plt
|
|
@@ -9,7 +6,7 @@ import pytest
|
|
|
9
6
|
import xarray as xr
|
|
10
7
|
|
|
11
8
|
from roms_tools import Grid, ROMSOutput
|
|
12
|
-
from roms_tools.download import download_test_data
|
|
9
|
+
from roms_tools.datasets.download import download_test_data
|
|
13
10
|
|
|
14
11
|
try:
|
|
15
12
|
import xesmf # type: ignore
|
|
@@ -58,20 +55,6 @@ def roms_output_from_restart_file_with_straddling_grid(use_dask):
|
|
|
58
55
|
)
|
|
59
56
|
|
|
60
57
|
|
|
61
|
-
@pytest.mark.parametrize(
|
|
62
|
-
"roms_output_fixture",
|
|
63
|
-
[
|
|
64
|
-
"roms_output_from_restart_file",
|
|
65
|
-
"roms_output_from_restart_file_adjusted_for_zeta",
|
|
66
|
-
"roms_output_from_restart_file_with_straddling_grid",
|
|
67
|
-
],
|
|
68
|
-
)
|
|
69
|
-
def test_load_model_output_file(roms_output_fixture, request):
|
|
70
|
-
roms_output = request.getfixturevalue(roms_output_fixture)
|
|
71
|
-
|
|
72
|
-
assert isinstance(roms_output.ds, xr.Dataset)
|
|
73
|
-
|
|
74
|
-
|
|
75
58
|
@pytest.fixture
|
|
76
59
|
def roms_output_from_two_restart_files(use_dask):
|
|
77
60
|
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
@@ -83,208 +66,6 @@ def roms_output_from_two_restart_files(use_dask):
|
|
|
83
66
|
return ROMSOutput(grid=grid, path=[file1, file2], use_dask=use_dask)
|
|
84
67
|
|
|
85
68
|
|
|
86
|
-
def test_load_model_output_file_list(roms_output_from_two_restart_files):
|
|
87
|
-
assert isinstance(roms_output_from_two_restart_files.ds, xr.Dataset)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
def test_load_model_output_with_wildcard(use_dask):
|
|
91
|
-
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
92
|
-
grid = Grid.from_file(fname_grid)
|
|
93
|
-
|
|
94
|
-
# Download at least two files, so these will be found within the pooch directory
|
|
95
|
-
Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
96
|
-
Path(download_test_data("eastpac25km_rst.19980126000000.nc"))
|
|
97
|
-
directory = Path(
|
|
98
|
-
os.path.dirname(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
output = ROMSOutput(grid=grid, path=directory / "*rst*.nc", use_dask=use_dask)
|
|
102
|
-
assert isinstance(output.ds, xr.Dataset)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def test_invalid_path(use_dask):
|
|
106
|
-
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
107
|
-
grid = Grid.from_file(fname_grid)
|
|
108
|
-
|
|
109
|
-
# Non-existent file
|
|
110
|
-
with pytest.raises(FileNotFoundError):
|
|
111
|
-
ROMSOutput(
|
|
112
|
-
grid=grid,
|
|
113
|
-
path=Path("/path/to/nonexistent/file.nc"),
|
|
114
|
-
use_dask=use_dask,
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
def test_set_correct_model_reference_date(use_dask):
|
|
119
|
-
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
120
|
-
grid = Grid.from_file(fname_grid)
|
|
121
|
-
|
|
122
|
-
output = ROMSOutput(
|
|
123
|
-
grid=grid,
|
|
124
|
-
path=Path(download_test_data("eastpac25km_rst.19980106000000.nc")),
|
|
125
|
-
use_dask=use_dask,
|
|
126
|
-
)
|
|
127
|
-
assert output.model_reference_date == datetime(1995, 1, 1)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
def test_model_reference_date_mismatch(use_dask):
|
|
131
|
-
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
132
|
-
grid = Grid.from_file(fname_grid)
|
|
133
|
-
|
|
134
|
-
# Create a ROMSOutput with a specified model_reference_date
|
|
135
|
-
model_ref_date = datetime(2020, 1, 1)
|
|
136
|
-
with pytest.raises(
|
|
137
|
-
ValueError, match="Mismatch between `self.model_reference_date`"
|
|
138
|
-
):
|
|
139
|
-
ROMSOutput(
|
|
140
|
-
grid=grid,
|
|
141
|
-
path=Path(download_test_data("eastpac25km_rst.19980106000000.nc")),
|
|
142
|
-
model_reference_date=model_ref_date,
|
|
143
|
-
use_dask=use_dask,
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def test_model_reference_date_no_metadata(use_dask, tmp_path, caplog):
|
|
148
|
-
# Helper function to handle the test logic for cases where metadata is missing or invalid
|
|
149
|
-
def test_no_metadata(faulty_ocean_time_attr, expected_exception, log_message=None):
|
|
150
|
-
ds = xr.open_dataset(fname)
|
|
151
|
-
ds["ocean_time"].attrs = faulty_ocean_time_attr
|
|
152
|
-
|
|
153
|
-
# Write modified dataset to a new file
|
|
154
|
-
fname_mod = tmp_path / "eastpac25km_rst.19980106000000_without_metadata.nc"
|
|
155
|
-
ds.to_netcdf(fname_mod)
|
|
156
|
-
|
|
157
|
-
# Test case 1: Expecting a ValueError when metadata is missing or invalid
|
|
158
|
-
with pytest.raises(
|
|
159
|
-
expected_exception,
|
|
160
|
-
match="Model reference date could not be inferred from the metadata",
|
|
161
|
-
):
|
|
162
|
-
ROMSOutput(grid=grid, path=fname_mod, use_dask=use_dask)
|
|
163
|
-
|
|
164
|
-
# Test case 2: When a model reference date is explicitly set, verify the warning
|
|
165
|
-
with caplog.at_level(logging.WARNING):
|
|
166
|
-
ROMSOutput(
|
|
167
|
-
grid=grid,
|
|
168
|
-
path=fname_mod,
|
|
169
|
-
model_reference_date=datetime(1995, 1, 1),
|
|
170
|
-
use_dask=use_dask,
|
|
171
|
-
)
|
|
172
|
-
|
|
173
|
-
if log_message:
|
|
174
|
-
# Verify the warning message in the log
|
|
175
|
-
assert log_message in caplog.text
|
|
176
|
-
|
|
177
|
-
fname_mod.unlink()
|
|
178
|
-
|
|
179
|
-
# Load grid and test data
|
|
180
|
-
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
181
|
-
grid = Grid.from_file(fname_grid)
|
|
182
|
-
fname = download_test_data("eastpac25km_rst.19980106000000.nc")
|
|
183
|
-
|
|
184
|
-
# Test 1: Ocean time attribute 'long_name' is missing
|
|
185
|
-
test_no_metadata({}, ValueError)
|
|
186
|
-
|
|
187
|
-
# Test 2: Ocean time attribute 'long_name' contains invalid information
|
|
188
|
-
test_no_metadata(
|
|
189
|
-
{"long_name": "some random text"},
|
|
190
|
-
ValueError,
|
|
191
|
-
"Could not infer the model reference date from the metadata.",
|
|
192
|
-
)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
def test_compute_depth_coordinates(use_dask):
|
|
196
|
-
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
197
|
-
grid = Grid.from_file(fname_grid)
|
|
198
|
-
fname_restart1 = Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
199
|
-
|
|
200
|
-
for adjust_depth_for_sea_surface_height in [True, False]:
|
|
201
|
-
output = ROMSOutput(
|
|
202
|
-
grid=grid,
|
|
203
|
-
path=fname_restart1,
|
|
204
|
-
use_dask=use_dask,
|
|
205
|
-
adjust_depth_for_sea_surface_height=adjust_depth_for_sea_surface_height,
|
|
206
|
-
)
|
|
207
|
-
|
|
208
|
-
# Before calling get_vertical_coordinates, check if the dataset doesn't already have depth coordinates
|
|
209
|
-
assert "layer_depth_rho" not in output.ds_depth_coords.data_vars
|
|
210
|
-
|
|
211
|
-
# Call the method to get vertical coordinates
|
|
212
|
-
output._get_depth_coordinates(depth_type="layer")
|
|
213
|
-
|
|
214
|
-
# Check if the depth coordinates were added
|
|
215
|
-
assert "layer_depth_rho" in output.ds_depth_coords.data_vars
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
def test_missing_zeta_gets_raised(use_dask):
|
|
219
|
-
"""Test that a ValueError is raised when `zeta` is missing from the dataset and
|
|
220
|
-
`adjust_depth_for_sea_surface_height` is enabled.
|
|
221
|
-
"""
|
|
222
|
-
# Load the grid
|
|
223
|
-
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
224
|
-
grid = Grid.from_file(fname_grid)
|
|
225
|
-
|
|
226
|
-
# Load the ROMS output
|
|
227
|
-
fname_restart1 = Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
228
|
-
roms_output = ROMSOutput(
|
|
229
|
-
grid=grid,
|
|
230
|
-
path=fname_restart1,
|
|
231
|
-
use_dask=use_dask,
|
|
232
|
-
adjust_depth_for_sea_surface_height=True,
|
|
233
|
-
)
|
|
234
|
-
|
|
235
|
-
# Remove `zeta` from the dataset
|
|
236
|
-
object.__setattr__(
|
|
237
|
-
roms_output, "ds", roms_output.ds.drop_vars("zeta", errors="ignore")
|
|
238
|
-
)
|
|
239
|
-
|
|
240
|
-
# Expect ValueError when calling `_get_depth_coordinates`
|
|
241
|
-
with pytest.raises(
|
|
242
|
-
ValueError,
|
|
243
|
-
match="`zeta` is required in provided ROMS output when `adjust_depth_for_sea_surface_height` is enabled.",
|
|
244
|
-
):
|
|
245
|
-
roms_output._get_depth_coordinates()
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
def test_check_vertical_coordinate_mismatch(use_dask):
|
|
249
|
-
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
250
|
-
grid = Grid.from_file(fname_grid)
|
|
251
|
-
|
|
252
|
-
fname_restart1 = Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
253
|
-
output = ROMSOutput(grid=grid, path=fname_restart1, use_dask=use_dask)
|
|
254
|
-
|
|
255
|
-
# create a mock dataset with inconsistent vertical coordinate parameters
|
|
256
|
-
ds_mock = output.ds.copy()
|
|
257
|
-
|
|
258
|
-
# Modify one of the vertical coordinate attributes to cause a mismatch
|
|
259
|
-
ds_mock.attrs["theta_s"] = 999
|
|
260
|
-
|
|
261
|
-
# Check if ValueError is raised due to mismatch
|
|
262
|
-
with pytest.raises(ValueError, match="theta_s from grid"):
|
|
263
|
-
output._check_vertical_coordinate(ds_mock)
|
|
264
|
-
|
|
265
|
-
# create a mock dataset with inconsistent vertical coordinate parameters
|
|
266
|
-
ds_mock = output.ds.copy()
|
|
267
|
-
|
|
268
|
-
# Modify one of the vertical coordinate attributes to cause a mismatch
|
|
269
|
-
ds_mock.attrs["Cs_w"] = ds_mock.attrs["Cs_w"] + 0.01
|
|
270
|
-
|
|
271
|
-
# Check if ValueError is raised due to mismatch
|
|
272
|
-
with pytest.raises(ValueError, match="Cs_w from grid"):
|
|
273
|
-
output._check_vertical_coordinate(ds_mock)
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
def test_that_coordinates_are_added(use_dask):
|
|
277
|
-
fname_grid = Path(download_test_data("epac25km_grd.nc"))
|
|
278
|
-
grid = Grid.from_file(fname_grid)
|
|
279
|
-
|
|
280
|
-
fname_restart1 = Path(download_test_data("eastpac25km_rst.19980106000000.nc"))
|
|
281
|
-
output = ROMSOutput(grid=grid, path=fname_restart1, use_dask=use_dask)
|
|
282
|
-
|
|
283
|
-
assert "abs_time" in output.ds.coords
|
|
284
|
-
assert "lat_rho" in output.ds.coords
|
|
285
|
-
assert "lon_rho" in output.ds.coords
|
|
286
|
-
|
|
287
|
-
|
|
288
69
|
@pytest.mark.parametrize(
|
|
289
70
|
"roms_output_fixture",
|
|
290
71
|
[
|
|
@@ -8,16 +8,15 @@ import numpy as np
|
|
|
8
8
|
import pytest
|
|
9
9
|
import xarray as xr
|
|
10
10
|
|
|
11
|
-
from roms_tools.download import download_test_data
|
|
12
|
-
from roms_tools.
|
|
11
|
+
from roms_tools.datasets.download import download_test_data
|
|
12
|
+
from roms_tools.datasets.lat_lon_datasets import (
|
|
13
13
|
GLORYS_GLOBAL_GRID_PATH,
|
|
14
14
|
CESMBGCDataset,
|
|
15
|
-
Dataset,
|
|
16
15
|
ERA5ARCODataset,
|
|
17
16
|
ERA5Correction,
|
|
18
17
|
GLORYSDataset,
|
|
19
18
|
GLORYSDefaultDataset,
|
|
20
|
-
|
|
19
|
+
LatLonDataset,
|
|
21
20
|
TPXODataset,
|
|
22
21
|
_concatenate_longitudes,
|
|
23
22
|
choose_subdomain,
|
|
@@ -158,7 +157,7 @@ def test_select_times(data_fixture, expected_time_values, request, tmp_path, use
|
|
|
158
157
|
|
|
159
158
|
filepath = tmp_path / "test.nc"
|
|
160
159
|
dataset.to_netcdf(filepath)
|
|
161
|
-
dataset =
|
|
160
|
+
dataset = LatLonDataset(
|
|
162
161
|
filename=filepath,
|
|
163
162
|
var_names={"var": "var"},
|
|
164
163
|
start_time=start_time,
|
|
@@ -192,7 +191,7 @@ def test_select_times_valid_start_no_end_time(
|
|
|
192
191
|
dataset.to_netcdf(filepath)
|
|
193
192
|
|
|
194
193
|
# Instantiate Dataset object using the temporary file
|
|
195
|
-
dataset =
|
|
194
|
+
dataset = LatLonDataset(
|
|
196
195
|
filename=filepath,
|
|
197
196
|
var_names={"var": "var"},
|
|
198
197
|
start_time=start_time,
|
|
@@ -229,7 +228,7 @@ def test_select_times_invalid_start_no_end_time(
|
|
|
229
228
|
ValueError,
|
|
230
229
|
match="No exact match found ",
|
|
231
230
|
):
|
|
232
|
-
dataset =
|
|
231
|
+
dataset = LatLonDataset(
|
|
233
232
|
filename=filepath,
|
|
234
233
|
var_names={"var": "var"},
|
|
235
234
|
start_time=datetime(2022, 5, 1),
|
|
@@ -245,7 +244,7 @@ def test_multiple_matching_times(
|
|
|
245
244
|
"""
|
|
246
245
|
filepath = tmp_path / "test.nc"
|
|
247
246
|
global_dataset_with_multiple_times_per_day.to_netcdf(filepath)
|
|
248
|
-
dataset =
|
|
247
|
+
dataset = LatLonDataset(
|
|
249
248
|
filename=filepath,
|
|
250
249
|
var_names={"var": "var"},
|
|
251
250
|
start_time=datetime(2021, 12, 31, 22, 0),
|
|
@@ -265,7 +264,7 @@ def test_warnings_times(global_dataset, tmp_path, caplog, use_dask):
|
|
|
265
264
|
start_time = datetime(2021, 1, 1)
|
|
266
265
|
end_time = datetime(2021, 2, 1)
|
|
267
266
|
|
|
268
|
-
|
|
267
|
+
LatLonDataset(
|
|
269
268
|
filename=filepath,
|
|
270
269
|
var_names={"var": "var"},
|
|
271
270
|
start_time=start_time,
|
|
@@ -279,7 +278,7 @@ def test_warnings_times(global_dataset, tmp_path, caplog, use_dask):
|
|
|
279
278
|
start_time = datetime(2024, 1, 1)
|
|
280
279
|
end_time = datetime(2024, 2, 1)
|
|
281
280
|
|
|
282
|
-
|
|
281
|
+
LatLonDataset(
|
|
283
282
|
filename=filepath,
|
|
284
283
|
var_names={"var": "var"},
|
|
285
284
|
start_time=start_time,
|
|
@@ -291,13 +290,13 @@ def test_warnings_times(global_dataset, tmp_path, caplog, use_dask):
|
|
|
291
290
|
|
|
292
291
|
|
|
293
292
|
def test_from_ds(global_dataset, global_dataset_with_noon_times, use_dask, tmp_path):
|
|
294
|
-
"""Test the from_ds method of the
|
|
293
|
+
"""Test the from_ds method of the LatLonDataset class."""
|
|
295
294
|
start_time = datetime(2022, 1, 1)
|
|
296
295
|
|
|
297
296
|
filepath = tmp_path / "test.nc"
|
|
298
297
|
global_dataset.to_netcdf(filepath)
|
|
299
298
|
|
|
300
|
-
dataset =
|
|
299
|
+
dataset = LatLonDataset(
|
|
301
300
|
filename=filepath,
|
|
302
301
|
var_names={"var": "var"},
|
|
303
302
|
dim_names={
|
|
@@ -311,9 +310,9 @@ def test_from_ds(global_dataset, global_dataset_with_noon_times, use_dask, tmp_p
|
|
|
311
310
|
allow_flex_time=True,
|
|
312
311
|
)
|
|
313
312
|
|
|
314
|
-
new_dataset =
|
|
313
|
+
new_dataset = LatLonDataset.from_ds(dataset, global_dataset_with_noon_times)
|
|
315
314
|
|
|
316
|
-
assert isinstance(new_dataset,
|
|
315
|
+
assert isinstance(new_dataset, LatLonDataset)
|
|
317
316
|
assert new_dataset.ds.equals(
|
|
318
317
|
global_dataset_with_noon_times
|
|
319
318
|
) # Verify the new ds attribute is set correctly
|
|
@@ -330,7 +329,7 @@ def test_reverse_latitude_reverse_depth_choose_subdomain(
|
|
|
330
329
|
global_dataset, tmp_path, use_dask
|
|
331
330
|
):
|
|
332
331
|
"""Test reversing latitude when it is not ascending, the choose_subdomain method,
|
|
333
|
-
and the convert_to_negative_depth method of the
|
|
332
|
+
and the convert_to_negative_depth method of the LatLonDataset class.
|
|
334
333
|
"""
|
|
335
334
|
start_time = datetime(2022, 1, 1)
|
|
336
335
|
|
|
@@ -339,7 +338,7 @@ def test_reverse_latitude_reverse_depth_choose_subdomain(
|
|
|
339
338
|
global_dataset["depth"] = global_dataset["depth"][::-1]
|
|
340
339
|
global_dataset.to_netcdf(filepath)
|
|
341
340
|
|
|
342
|
-
dataset =
|
|
341
|
+
dataset = LatLonDataset(
|
|
343
342
|
filename=filepath,
|
|
344
343
|
var_names={"var": "var"},
|
|
345
344
|
dim_names={
|
|
@@ -393,7 +392,9 @@ def test_reverse_latitude_reverse_depth_choose_subdomain(
|
|
|
393
392
|
def test_check_if_global_with_global_dataset(global_dataset, tmp_path, use_dask):
|
|
394
393
|
filepath = tmp_path / "test.nc"
|
|
395
394
|
global_dataset.to_netcdf(filepath)
|
|
396
|
-
dataset =
|
|
395
|
+
dataset = LatLonDataset(
|
|
396
|
+
filename=filepath, var_names={"var": "var"}, use_dask=use_dask
|
|
397
|
+
)
|
|
397
398
|
is_global = dataset.check_if_global(dataset.ds)
|
|
398
399
|
assert is_global
|
|
399
400
|
|
|
@@ -403,7 +404,9 @@ def test_check_if_global_with_non_global_dataset(
|
|
|
403
404
|
):
|
|
404
405
|
filepath = tmp_path / "test.nc"
|
|
405
406
|
non_global_dataset.to_netcdf(filepath)
|
|
406
|
-
dataset =
|
|
407
|
+
dataset = LatLonDataset(
|
|
408
|
+
filename=filepath, var_names={"var": "var"}, use_dask=use_dask
|
|
409
|
+
)
|
|
407
410
|
is_global = dataset.check_if_global(dataset.ds)
|
|
408
411
|
|
|
409
412
|
assert not is_global
|
|
@@ -421,7 +424,7 @@ def test_check_dataset(global_dataset, tmp_path, use_dask):
|
|
|
421
424
|
with pytest.raises(
|
|
422
425
|
ValueError, match="Dataset does not contain all required variables."
|
|
423
426
|
):
|
|
424
|
-
|
|
427
|
+
LatLonDataset(
|
|
425
428
|
filename=filepath,
|
|
426
429
|
var_names={"var": "var"},
|
|
427
430
|
start_time=start_time,
|
|
@@ -440,7 +443,7 @@ def test_check_dataset(global_dataset, tmp_path, use_dask):
|
|
|
440
443
|
with pytest.raises(
|
|
441
444
|
ValueError, match="Dataset does not contain all required dimensions."
|
|
442
445
|
):
|
|
443
|
-
|
|
446
|
+
LatLonDataset(
|
|
444
447
|
filename=filepath,
|
|
445
448
|
var_names={"var": "var"},
|
|
446
449
|
start_time=start_time,
|
|
@@ -601,14 +604,14 @@ def test_data_concatenation(use_dask):
|
|
|
601
604
|
def test_time_validation(use_dask):
|
|
602
605
|
fname = download_test_data("GLORYS_NA_2012.nc")
|
|
603
606
|
|
|
604
|
-
with pytest.raises(TypeError, match="start_time must be a datetime object"):
|
|
607
|
+
with pytest.raises(TypeError, match="`start_time` must be a datetime object"):
|
|
605
608
|
GLORYSDataset(
|
|
606
609
|
filename=fname,
|
|
607
610
|
start_time="dummy",
|
|
608
611
|
end_time=datetime(2013, 1, 1),
|
|
609
612
|
use_dask=use_dask,
|
|
610
613
|
)
|
|
611
|
-
with pytest.raises(TypeError, match="end_time must be a datetime object"):
|
|
614
|
+
with pytest.raises(TypeError, match="`end_time` must be a datetime object"):
|
|
612
615
|
GLORYSDataset(
|
|
613
616
|
filename=fname,
|
|
614
617
|
start_time=datetime(2012, 1, 1),
|
|
@@ -760,48 +763,6 @@ class TestTPXODataset:
|
|
|
760
763
|
global_tpxo_dataset.select_constituents(11, omega)
|
|
761
764
|
|
|
762
765
|
|
|
763
|
-
class TestRiverDataset:
|
|
764
|
-
def test_deduplicate_river_names(self, tmp_path):
|
|
765
|
-
sample_dim_and_var_names = {
|
|
766
|
-
"dim_names": {"station": "station", "time": "time"},
|
|
767
|
-
"var_names": {
|
|
768
|
-
"latitude": "lat",
|
|
769
|
-
"longitude": "lon",
|
|
770
|
-
"flux": "flux",
|
|
771
|
-
"ratio": "ratio",
|
|
772
|
-
"name": "name",
|
|
773
|
-
},
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
data = {
|
|
777
|
-
"lat": (["station"], [10.0, 20.0, 30.0]),
|
|
778
|
-
"lon": (["station"], [100.0, 110.0, 120.0]),
|
|
779
|
-
"flux": (["time", "station"], np.random.rand(1, 3)),
|
|
780
|
-
"ratio": (["time", "station"], np.random.rand(1, 3)),
|
|
781
|
-
"name": (["station"], ["Amazon", "Nile", "Amazon"]), # duplicate
|
|
782
|
-
}
|
|
783
|
-
coords = {"station": [0, 1, 2], "time": [0]}
|
|
784
|
-
ds = xr.Dataset(data, coords=coords)
|
|
785
|
-
|
|
786
|
-
# Write to temporary NetCDF file
|
|
787
|
-
file_path = tmp_path / "rivers.nc"
|
|
788
|
-
ds.to_netcdf(file_path)
|
|
789
|
-
|
|
790
|
-
river_dataset = RiverDataset(
|
|
791
|
-
filename=file_path,
|
|
792
|
-
start_time=datetime(2000, 1, 1),
|
|
793
|
-
end_time=datetime(2000, 1, 2),
|
|
794
|
-
dim_names=sample_dim_and_var_names["dim_names"],
|
|
795
|
-
var_names=sample_dim_and_var_names["var_names"],
|
|
796
|
-
)
|
|
797
|
-
|
|
798
|
-
names = river_dataset.ds["name"].values
|
|
799
|
-
assert "Amazon_1" in names
|
|
800
|
-
assert "Amazon_2" in names
|
|
801
|
-
assert "Nile" in names
|
|
802
|
-
assert len(set(names)) == len(names) # all names must be unique
|
|
803
|
-
|
|
804
|
-
|
|
805
766
|
# test _concatenate_longitudes
|
|
806
767
|
|
|
807
768
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import xarray as xr
|
|
5
|
+
|
|
6
|
+
from roms_tools.datasets.river_datasets import RiverDataset
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TestRiverDataset:
|
|
10
|
+
def test_deduplicate_river_names(self, tmp_path):
|
|
11
|
+
sample_dim_and_var_names = {
|
|
12
|
+
"dim_names": {"station": "station", "time": "time"},
|
|
13
|
+
"var_names": {
|
|
14
|
+
"latitude": "lat",
|
|
15
|
+
"longitude": "lon",
|
|
16
|
+
"flux": "flux",
|
|
17
|
+
"ratio": "ratio",
|
|
18
|
+
"name": "name",
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
data = {
|
|
23
|
+
"lat": (["station"], [10.0, 20.0, 30.0]),
|
|
24
|
+
"lon": (["station"], [100.0, 110.0, 120.0]),
|
|
25
|
+
"flux": (["time", "station"], np.random.rand(1, 3)),
|
|
26
|
+
"ratio": (["time", "station"], np.random.rand(1, 3)),
|
|
27
|
+
"name": (["station"], ["Amazon", "Nile", "Amazon"]), # duplicate
|
|
28
|
+
}
|
|
29
|
+
coords = {"station": [0, 1, 2], "time": [0]}
|
|
30
|
+
ds = xr.Dataset(data, coords=coords)
|
|
31
|
+
|
|
32
|
+
# Write to temporary NetCDF file
|
|
33
|
+
file_path = tmp_path / "rivers.nc"
|
|
34
|
+
ds.to_netcdf(file_path)
|
|
35
|
+
|
|
36
|
+
river_dataset = RiverDataset(
|
|
37
|
+
filename=file_path,
|
|
38
|
+
start_time=datetime(2000, 1, 1),
|
|
39
|
+
end_time=datetime(2000, 1, 2),
|
|
40
|
+
dim_names=sample_dim_and_var_names["dim_names"],
|
|
41
|
+
var_names=sample_dim_and_var_names["var_names"],
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
names = river_dataset.ds["name"].values
|
|
45
|
+
assert "Amazon_1" in names
|
|
46
|
+
assert "Amazon_2" in names
|
|
47
|
+
assert "Nile" in names
|
|
48
|
+
assert len(set(names)) == len(names) # all names must be unique
|