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
roms_tools/__init__.py
CHANGED
|
@@ -20,7 +20,7 @@ from roms_tools.setup.river_forcing import RiverForcing # noqa: F401
|
|
|
20
20
|
from roms_tools.setup.surface_forcing import SurfaceForcing # noqa: F401
|
|
21
21
|
from roms_tools.setup.tides import TidalForcing # noqa: F401
|
|
22
22
|
from roms_tools.tiling.partition import partition_netcdf # noqa: F401
|
|
23
|
-
from roms_tools.
|
|
23
|
+
from roms_tools.datasets.lat_lon_datasets import get_glorys_bounds # noqa: F401
|
|
24
24
|
from roms_tools.tiling.join import open_partitions, join_netcdf # noqa: F401
|
|
25
25
|
|
|
26
26
|
|
|
@@ -59,7 +59,7 @@ class Ensemble:
|
|
|
59
59
|
Parameters
|
|
60
60
|
----------
|
|
61
61
|
ds : xr.Dataset
|
|
62
|
-
Dataset containing a "cdr_efficiency" variable and "
|
|
62
|
+
Dataset containing a "cdr_efficiency" variable and "time" coordinate.
|
|
63
63
|
|
|
64
64
|
Returns
|
|
65
65
|
-------
|
|
@@ -69,18 +69,20 @@ class Ensemble:
|
|
|
69
69
|
Raises
|
|
70
70
|
------
|
|
71
71
|
ValueError
|
|
72
|
-
If '
|
|
72
|
+
If 'time' coordinate is missing or there are no valid efficiency values.
|
|
73
73
|
"""
|
|
74
74
|
eff = ds["cdr_efficiency"]
|
|
75
75
|
|
|
76
|
-
# Check that
|
|
77
|
-
if "
|
|
78
|
-
abs_time = eff.coords["
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
# Check that time coordinate exists
|
|
77
|
+
if "time" in eff.coords:
|
|
78
|
+
abs_time = eff.coords["time"]
|
|
79
|
+
eff = eff.drop_vars("time")
|
|
80
|
+
elif "time" in ds.data_vars:
|
|
81
|
+
abs_time = ds["time"]
|
|
82
|
+
eff = eff.drop_vars("time")
|
|
81
83
|
else:
|
|
82
84
|
raise ValueError(
|
|
83
|
-
"Dataset must contain
|
|
85
|
+
"Dataset must contain a 'time' coordinate or data variable."
|
|
84
86
|
)
|
|
85
87
|
|
|
86
88
|
# Drop NaNs to find first valid time
|
|
@@ -97,11 +99,6 @@ class Ensemble:
|
|
|
97
99
|
eff_rel = eff.assign_coords(time=time_rel)
|
|
98
100
|
eff_rel.time.attrs["long_name"] = "time since release start"
|
|
99
101
|
|
|
100
|
-
if hasattr(eff_rel, "coords") and "abs_time" in eff_rel.coords:
|
|
101
|
-
eff_rel = eff_rel.drop_vars("abs_time")
|
|
102
|
-
elif hasattr(eff_rel, "variables") and "abs_time" in eff_rel.variables:
|
|
103
|
-
eff_rel = eff_rel.drop_vars("abs_time")
|
|
104
|
-
|
|
105
102
|
return eff_rel
|
|
106
103
|
|
|
107
104
|
def _align_times(self, effs: dict[str, xr.DataArray]) -> xr.Dataset:
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import re
|
|
3
|
-
import warnings
|
|
4
|
-
from dataclasses import dataclass, field
|
|
5
|
-
from datetime import datetime, timedelta
|
|
6
|
-
from pathlib import Path
|
|
1
|
+
from dataclasses import dataclass
|
|
7
2
|
|
|
8
3
|
import numpy as np
|
|
9
4
|
import xarray as xr
|
|
10
5
|
from matplotlib.axes import Axes
|
|
11
6
|
|
|
12
|
-
from roms_tools import Grid
|
|
13
7
|
from roms_tools.analysis.cdr_analysis import compute_cdr_metrics
|
|
8
|
+
from roms_tools.datasets.roms_dataset import ROMSDataset
|
|
14
9
|
from roms_tools.plot import plot, plot_uptake_efficiency
|
|
15
10
|
from roms_tools.regrid import LateralRegridFromROMS, VerticalRegridFromROMS
|
|
16
11
|
from roms_tools.utils import (
|
|
@@ -18,23 +13,19 @@ from roms_tools.utils import (
|
|
|
18
13
|
infer_nominal_horizontal_resolution,
|
|
19
14
|
interpolate_from_rho_to_u,
|
|
20
15
|
interpolate_from_rho_to_v,
|
|
21
|
-
load_data,
|
|
22
|
-
)
|
|
23
|
-
from roms_tools.vertical_coordinate import (
|
|
24
|
-
compute_depth_coordinates,
|
|
25
16
|
)
|
|
26
17
|
|
|
27
18
|
|
|
28
19
|
@dataclass(kw_only=True)
|
|
29
|
-
class ROMSOutput:
|
|
20
|
+
class ROMSOutput(ROMSDataset):
|
|
30
21
|
"""Represents ROMS model output.
|
|
31
22
|
|
|
32
23
|
Parameters
|
|
33
24
|
----------
|
|
25
|
+
path: str | Path | list[str | Path]
|
|
26
|
+
Filename, or list of filenames with model output.
|
|
34
27
|
grid : Grid
|
|
35
28
|
Object representing the grid information.
|
|
36
|
-
path : Union[str, Path, List[Union[str, Path]]]
|
|
37
|
-
Filename, or list of filenames with model output.
|
|
38
29
|
model_reference_date : datetime, optional
|
|
39
30
|
Reference date of ROMS simulation.
|
|
40
31
|
If not specified, this is inferred from metadata of the model output
|
|
@@ -46,32 +37,6 @@ class ROMSOutput:
|
|
|
46
37
|
Indicates whether to use dask for processing. If True, data is processed with dask; if False, data is processed eagerly. Defaults to False.
|
|
47
38
|
"""
|
|
48
39
|
|
|
49
|
-
grid: Grid
|
|
50
|
-
"""Object representing the grid information."""
|
|
51
|
-
path: str | Path
|
|
52
|
-
"""Filename, or list of filenames with model output."""
|
|
53
|
-
use_dask: bool = False
|
|
54
|
-
"""Whether to use dask for processing."""
|
|
55
|
-
model_reference_date: datetime | None = None
|
|
56
|
-
"""Reference date of ROMS simulation."""
|
|
57
|
-
adjust_depth_for_sea_surface_height: bool | None = False
|
|
58
|
-
"""Whether to account for sea surface height variations when computing depth
|
|
59
|
-
coordinates."""
|
|
60
|
-
|
|
61
|
-
ds: xr.Dataset = field(init=False, repr=False)
|
|
62
|
-
"""An xarray Dataset containing the ROMS output."""
|
|
63
|
-
|
|
64
|
-
def __post_init__(self):
|
|
65
|
-
ds = self._load_model_output()
|
|
66
|
-
self._infer_model_reference_date_from_metadata(ds)
|
|
67
|
-
self._check_vertical_coordinate(ds)
|
|
68
|
-
ds = self._add_absolute_time(ds)
|
|
69
|
-
ds = self._add_lat_lon_coords(ds)
|
|
70
|
-
self.ds = ds
|
|
71
|
-
|
|
72
|
-
# Dataset for depth coordinates
|
|
73
|
-
self.ds_depth_coords = xr.Dataset()
|
|
74
|
-
|
|
75
40
|
def cdr_metrics(self) -> None:
|
|
76
41
|
"""
|
|
77
42
|
Compute and plot Carbon Dioxide Removal (CDR) metrics.
|
|
@@ -379,272 +344,8 @@ class ROMSOutput:
|
|
|
379
344
|
if regridded_datasets:
|
|
380
345
|
ds = xr.merge(regridded_datasets)
|
|
381
346
|
|
|
382
|
-
with warnings.catch_warnings():
|
|
383
|
-
warnings.filterwarnings("ignore", category=UserWarning)
|
|
384
|
-
ds = ds.rename({"abs_time": "time"}).set_index(time="time")
|
|
385
347
|
ds["time"].attrs = {"long_name": "Time"}
|
|
386
348
|
ds["lon"].attrs = {"long_name": "Longitude", "units": "Degrees East"}
|
|
387
349
|
ds["lat"].attrs = {"long_name": "Latitude", "units": "Degrees North"}
|
|
388
350
|
|
|
389
351
|
return ds
|
|
390
|
-
|
|
391
|
-
def _get_depth_coordinates(self, depth_type="layer", locations=["rho"]):
|
|
392
|
-
"""Ensure depth coordinates are stored for a given location and depth type.
|
|
393
|
-
|
|
394
|
-
Calculates vertical depth coordinates (layer or interface) for specified locations (e.g., rho, u, v points)
|
|
395
|
-
and updates them in the dataset (`self.ds`).
|
|
396
|
-
|
|
397
|
-
Parameters
|
|
398
|
-
----------
|
|
399
|
-
depth_type : str
|
|
400
|
-
The type of depth coordinate to compute. Valid options:
|
|
401
|
-
- "layer": Compute layer depth coordinates.
|
|
402
|
-
- "interface": Compute interface depth coordinates.
|
|
403
|
-
locations : list[str], optional
|
|
404
|
-
Locations for which to compute depth coordinates. Default is ["rho", "u", "v"].
|
|
405
|
-
Valid options include:
|
|
406
|
-
- "rho": Depth coordinates at rho points.
|
|
407
|
-
- "u": Depth coordinates at u points.
|
|
408
|
-
- "v": Depth coordinates at v points.
|
|
409
|
-
|
|
410
|
-
Updates
|
|
411
|
-
-------
|
|
412
|
-
self.ds_depth_coords : xarray.Dataset
|
|
413
|
-
|
|
414
|
-
Raises
|
|
415
|
-
------
|
|
416
|
-
ValueError
|
|
417
|
-
If `adjust_depth_for_sea_surface_height` is enabled but `zeta` is missing from `self.ds`.
|
|
418
|
-
|
|
419
|
-
Notes
|
|
420
|
-
-----
|
|
421
|
-
- This method relies on the `compute_depth_coordinates` function to perform calculations.
|
|
422
|
-
- If `adjust_depth_for_sea_surface_height` is `True`, the method accounts for variations
|
|
423
|
-
in sea surface height (`zeta`).
|
|
424
|
-
"""
|
|
425
|
-
if self.adjust_depth_for_sea_surface_height:
|
|
426
|
-
if "zeta" not in self.ds:
|
|
427
|
-
raise ValueError(
|
|
428
|
-
"`zeta` is required in provided ROMS output when `adjust_depth_for_sea_surface_height` is enabled."
|
|
429
|
-
)
|
|
430
|
-
zeta = self.ds.zeta
|
|
431
|
-
else:
|
|
432
|
-
zeta = 0
|
|
433
|
-
|
|
434
|
-
for location in locations:
|
|
435
|
-
var_name = f"{depth_type}_depth_{location}"
|
|
436
|
-
if var_name not in self.ds_depth_coords:
|
|
437
|
-
self.ds_depth_coords[var_name] = compute_depth_coordinates(
|
|
438
|
-
self.grid.ds, zeta, depth_type, location
|
|
439
|
-
)
|
|
440
|
-
|
|
441
|
-
def _load_model_output(self) -> xr.Dataset:
|
|
442
|
-
"""Load the model output."""
|
|
443
|
-
# Load the dataset
|
|
444
|
-
ds = load_data(
|
|
445
|
-
self.path,
|
|
446
|
-
dim_names={"time": "time"},
|
|
447
|
-
use_dask=self.use_dask,
|
|
448
|
-
decode_times=False,
|
|
449
|
-
decode_timedelta=False,
|
|
450
|
-
time_chunking=True,
|
|
451
|
-
force_combine_nested=True,
|
|
452
|
-
)
|
|
453
|
-
|
|
454
|
-
return ds
|
|
455
|
-
|
|
456
|
-
def _infer_model_reference_date_from_metadata(self, ds: xr.Dataset) -> None:
|
|
457
|
-
"""Infer and validate the model reference date from `ocean_time` metadata.
|
|
458
|
-
|
|
459
|
-
Parameters
|
|
460
|
-
----------
|
|
461
|
-
ds : xr.Dataset
|
|
462
|
-
Dataset with an `ocean_time` variable and a `long_name` attribute
|
|
463
|
-
in the format `Time since YYYY/MM/DD`.
|
|
464
|
-
|
|
465
|
-
Raises
|
|
466
|
-
------
|
|
467
|
-
ValueError
|
|
468
|
-
If `self.model_reference_date` is not set and the reference date cannot
|
|
469
|
-
be inferred, or if the inferred date does not match `self.model_reference_date`.
|
|
470
|
-
|
|
471
|
-
Warns
|
|
472
|
-
-----
|
|
473
|
-
UserWarning
|
|
474
|
-
If `self.model_reference_date` is set but the reference date cannot be inferred.
|
|
475
|
-
"""
|
|
476
|
-
# Check if 'long_name' exists in the attributes of 'ocean_time'
|
|
477
|
-
if "long_name" in ds.ocean_time.attrs:
|
|
478
|
-
input_string = ds.ocean_time.attrs["long_name"]
|
|
479
|
-
match = re.search(r"(\d{4})/(\d{2})/(\d{2})", input_string)
|
|
480
|
-
|
|
481
|
-
if match:
|
|
482
|
-
# If a match is found, extract year, month, day and create the inferred date
|
|
483
|
-
year, month, day = map(int, match.groups())
|
|
484
|
-
inferred_date = datetime(year, month, day)
|
|
485
|
-
|
|
486
|
-
if hasattr(self, "model_reference_date") and self.model_reference_date:
|
|
487
|
-
# Check if the inferred date matches the provided model reference date
|
|
488
|
-
if self.model_reference_date != inferred_date:
|
|
489
|
-
raise ValueError(
|
|
490
|
-
f"Mismatch between `self.model_reference_date` ({self.model_reference_date}) "
|
|
491
|
-
f"and inferred reference date ({inferred_date})."
|
|
492
|
-
)
|
|
493
|
-
else:
|
|
494
|
-
# Set the model reference date if not already set
|
|
495
|
-
self.model_reference_date = inferred_date
|
|
496
|
-
else:
|
|
497
|
-
# Handle case where no match is found
|
|
498
|
-
if hasattr(self, "model_reference_date") and self.model_reference_date:
|
|
499
|
-
logging.warning(
|
|
500
|
-
"Could not infer the model reference date from the metadata. "
|
|
501
|
-
"`self.model_reference_date` will be used.",
|
|
502
|
-
)
|
|
503
|
-
else:
|
|
504
|
-
raise ValueError(
|
|
505
|
-
"Model reference date could not be inferred from the metadata, "
|
|
506
|
-
"and `self.model_reference_date` is not set."
|
|
507
|
-
)
|
|
508
|
-
else:
|
|
509
|
-
# Handle case where 'long_name' attribute doesn't exist
|
|
510
|
-
if hasattr(self, "model_reference_date") and self.model_reference_date:
|
|
511
|
-
logging.warning(
|
|
512
|
-
"`long_name` attribute not found in ocean_time. "
|
|
513
|
-
"`self.model_reference_date` will be used instead.",
|
|
514
|
-
)
|
|
515
|
-
else:
|
|
516
|
-
raise ValueError(
|
|
517
|
-
"Model reference date could not be inferred from the metadata, "
|
|
518
|
-
"and `self.model_reference_date` is not set."
|
|
519
|
-
)
|
|
520
|
-
|
|
521
|
-
def _check_vertical_coordinate(self, ds: xr.Dataset) -> None:
|
|
522
|
-
"""Check that the vertical coordinate parameters in the dataset are consistent
|
|
523
|
-
with the model grid.
|
|
524
|
-
|
|
525
|
-
This method compares the vertical coordinate parameters (`theta_s`, `theta_b`, `hc`, `Cs_r`, `Cs_w`) in
|
|
526
|
-
the provided dataset (`ds`) with those in the model grid (`self.grid`). The first three parameters are
|
|
527
|
-
checked for exact equality, while the last two are checked for numerical closeness.
|
|
528
|
-
|
|
529
|
-
Parameters
|
|
530
|
-
----------
|
|
531
|
-
ds : xarray.Dataset
|
|
532
|
-
The dataset containing vertical coordinate parameters in its attributes, such as `theta_s`, `theta_b`,
|
|
533
|
-
`hc`, `Cs_r`, and `Cs_w`.
|
|
534
|
-
|
|
535
|
-
Raises
|
|
536
|
-
------
|
|
537
|
-
ValueError
|
|
538
|
-
If the vertical coordinate parameters do not match the expected values (based on exact or approximate equality).
|
|
539
|
-
|
|
540
|
-
Notes
|
|
541
|
-
-----
|
|
542
|
-
- Missing attributes trigger a warning instead of an exception.
|
|
543
|
-
- `theta_s`, `theta_b`, and `hc` are checked for exact equality using `np.array_equal`.
|
|
544
|
-
- `Cs_r` and `Cs_w` are checked for numerical closeness using `np.allclose`.
|
|
545
|
-
"""
|
|
546
|
-
required_exact = ["theta_s", "theta_b", "hc"]
|
|
547
|
-
required_close = ["Cs_r", "Cs_w"]
|
|
548
|
-
|
|
549
|
-
# Check exact equality
|
|
550
|
-
for param in required_exact:
|
|
551
|
-
value = ds.attrs.get(param, None)
|
|
552
|
-
if value is None:
|
|
553
|
-
logging.warning(
|
|
554
|
-
f"Dataset is missing attribute '{param}'. Skipping this check."
|
|
555
|
-
)
|
|
556
|
-
continue
|
|
557
|
-
if not np.array_equal(getattr(self.grid, param), value):
|
|
558
|
-
raise ValueError(
|
|
559
|
-
f"{param} from grid ({getattr(self.grid, param)}) does not match dataset ({value})."
|
|
560
|
-
)
|
|
561
|
-
|
|
562
|
-
# Check numerical closeness
|
|
563
|
-
for param in required_close:
|
|
564
|
-
value = ds.attrs.get(param, None)
|
|
565
|
-
if value is None:
|
|
566
|
-
logging.warning(
|
|
567
|
-
f"Dataset is missing attribute '{param}'. Skipping this check."
|
|
568
|
-
)
|
|
569
|
-
continue
|
|
570
|
-
grid_value = getattr(self.grid.ds, param)
|
|
571
|
-
if not np.allclose(grid_value, value):
|
|
572
|
-
raise ValueError(
|
|
573
|
-
f"{param} from grid ({grid_value}) is not close to dataset ({value})."
|
|
574
|
-
)
|
|
575
|
-
|
|
576
|
-
def _add_absolute_time(self, ds: xr.Dataset) -> xr.Dataset:
|
|
577
|
-
"""Add absolute time as a coordinate to the dataset.
|
|
578
|
-
|
|
579
|
-
Computes "abs_time" based on "ocean_time" and a reference date,
|
|
580
|
-
and adds it as a coordinate.
|
|
581
|
-
|
|
582
|
-
Parameters
|
|
583
|
-
----------
|
|
584
|
-
ds : xarray.Dataset
|
|
585
|
-
Dataset containing "ocean_time" in seconds since the model reference date.
|
|
586
|
-
|
|
587
|
-
Returns
|
|
588
|
-
-------
|
|
589
|
-
xarray.Dataset
|
|
590
|
-
Dataset with "abs_time" added and "time" removed.
|
|
591
|
-
"""
|
|
592
|
-
if self.model_reference_date is None:
|
|
593
|
-
raise ValueError(
|
|
594
|
-
"`model_reference_date` must be set before computing absolute time."
|
|
595
|
-
)
|
|
596
|
-
|
|
597
|
-
ocean_time_seconds = ds["ocean_time"].values
|
|
598
|
-
|
|
599
|
-
abs_time = np.array(
|
|
600
|
-
[
|
|
601
|
-
self.model_reference_date + timedelta(seconds=seconds)
|
|
602
|
-
for seconds in ocean_time_seconds
|
|
603
|
-
]
|
|
604
|
-
)
|
|
605
|
-
|
|
606
|
-
abs_time = xr.DataArray(
|
|
607
|
-
abs_time, dims=["time"], coords={"time": ds["ocean_time"]}
|
|
608
|
-
)
|
|
609
|
-
abs_time.attrs["long_name"] = "absolute time"
|
|
610
|
-
ds = ds.assign_coords({"abs_time": abs_time})
|
|
611
|
-
ds = ds.drop_vars("time")
|
|
612
|
-
|
|
613
|
-
return ds
|
|
614
|
-
|
|
615
|
-
def _add_lat_lon_coords(self, ds: xr.Dataset) -> xr.Dataset:
|
|
616
|
-
"""Add latitude and longitude coordinates to the dataset based on the grid.
|
|
617
|
-
|
|
618
|
-
This method assigns latitude and longitude coordinates from the grid to the dataset.
|
|
619
|
-
It always adds the "lat_rho" and "lon_rho" coordinates. If the dataset contains the
|
|
620
|
-
"xi_u" or "eta_v" dimensions, it also adds the corresponding "lat_u", "lon_u",
|
|
621
|
-
"lat_v", and "lon_v" coordinates.
|
|
622
|
-
|
|
623
|
-
Parameters
|
|
624
|
-
----------
|
|
625
|
-
ds : xarray.Dataset
|
|
626
|
-
Input dataset to which latitude and longitude coordinates will be added.
|
|
627
|
-
|
|
628
|
-
Returns
|
|
629
|
-
-------
|
|
630
|
-
xarray.Dataset
|
|
631
|
-
Updated dataset with the appropriate latitude and longitude coordinates
|
|
632
|
-
assigned to "rho", "u", and "v" points if applicable.
|
|
633
|
-
"""
|
|
634
|
-
coords_to_add = {
|
|
635
|
-
"lat_rho": self.grid.ds["lat_rho"],
|
|
636
|
-
"lon_rho": self.grid.ds["lon_rho"],
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
if "xi_u" in ds.dims:
|
|
640
|
-
coords_to_add.update(
|
|
641
|
-
{"lat_u": self.grid.ds["lat_u"], "lon_u": self.grid.ds["lon_u"]}
|
|
642
|
-
)
|
|
643
|
-
if "eta_v" in ds.dims:
|
|
644
|
-
coords_to_add.update(
|
|
645
|
-
{"lat_v": self.grid.ds["lat_v"], "lon_v": self.grid.ds["lon_v"]}
|
|
646
|
-
)
|
|
647
|
-
|
|
648
|
-
# Add all necessary coordinates in one go
|
|
649
|
-
ds = ds.assign_coords(coords_to_add)
|
|
650
|
-
return ds
|
|
@@ -90,6 +90,7 @@ pup_test_data = pooch.create(
|
|
|
90
90
|
"GSHHS_l_L1.prj": "98aaf3d1c0ecadf1a424a4536de261c3daf4e373697cb86c40c43b989daf52eb",
|
|
91
91
|
"GSHHS_l_L1.shp": "bc76f101f9b8671f90e734b4026da91c20066fc627cc8b5889ba22d90cbf97e9",
|
|
92
92
|
"GSHHS_l_L1.shx": "72879354892d80d6c39c612f645661ec0edc75f3f9f8f74b19d9387ae0327377",
|
|
93
|
+
"EMODnet_C2_coarse100.nc": "4202a6a5877de726bf13f41de7a1edfea2db83278ce371fe7732eb4b6770ed6d",
|
|
93
94
|
},
|
|
94
95
|
)
|
|
95
96
|
|