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/plot.py
CHANGED
|
@@ -96,12 +96,6 @@ def plot_2d_horizontal_field(
|
|
|
96
96
|
lon_deg = field.lon
|
|
97
97
|
lat_deg = field.lat
|
|
98
98
|
|
|
99
|
-
# check if North or South pole are in domain
|
|
100
|
-
if lat_deg.max().values > 89 or lat_deg.min().values < -89:
|
|
101
|
-
raise NotImplementedError(
|
|
102
|
-
"Plotting is not implemented for the case that the domain contains the North or South pole."
|
|
103
|
-
)
|
|
104
|
-
|
|
105
99
|
trans = get_projection(lon_deg, lat_deg)
|
|
106
100
|
|
|
107
101
|
if ax is None:
|
|
@@ -186,25 +180,8 @@ def plot_nesting(parent_grid_ds, child_grid_ds, parent_straddle, with_dim_names=
|
|
|
186
180
|
with_dim_names=with_dim_names,
|
|
187
181
|
)
|
|
188
182
|
|
|
189
|
-
vmax = 3
|
|
190
|
-
vmin = 0
|
|
191
|
-
cmap = plt.colormaps.get_cmap("Blues")
|
|
192
|
-
cmap.set_bad(color="gray")
|
|
193
|
-
kwargs = {"vmax": vmax, "vmin": vmin, "cmap": cmap}
|
|
194
|
-
|
|
195
|
-
field = parent_grid_ds.mask_rho
|
|
196
|
-
field = field.where(field)
|
|
197
|
-
|
|
198
|
-
_add_field_to_ax(
|
|
199
|
-
ax,
|
|
200
|
-
parent_lon_deg,
|
|
201
|
-
parent_lat_deg,
|
|
202
|
-
field,
|
|
203
|
-
add_colorbar=False,
|
|
204
|
-
kwargs=kwargs,
|
|
205
|
-
)
|
|
206
|
-
|
|
207
183
|
_add_gridlines(ax)
|
|
184
|
+
ax.coastlines()
|
|
208
185
|
|
|
209
186
|
ax.legend(loc="best")
|
|
210
187
|
|
|
@@ -659,7 +636,7 @@ def _add_field_to_ax(
|
|
|
659
636
|
proj = ccrs.PlateCarree()
|
|
660
637
|
|
|
661
638
|
p = ax.pcolormesh(lon_deg, lat_deg, field, transform=proj, **kwargs)
|
|
662
|
-
if hasattr(field, "long_name"):
|
|
639
|
+
if hasattr(field, "long_name") and hasattr(field, "units"):
|
|
663
640
|
label = f"{field.long_name} [{field.units}]"
|
|
664
641
|
elif hasattr(field, "Long_name"):
|
|
665
642
|
# this is the case for matlab generated grids
|
|
@@ -674,10 +651,36 @@ def _add_field_to_ax(
|
|
|
674
651
|
ax.clabel(cs, inline=True, fontsize=FONT_SZ)
|
|
675
652
|
|
|
676
653
|
|
|
677
|
-
def get_projection(lon, lat):
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
654
|
+
def get_projection(lon: xr.DataArray, lat: xr.DataArray):
|
|
655
|
+
"""
|
|
656
|
+
Return a Cartopy projection appropriate for the given lon/lat domain.
|
|
657
|
+
|
|
658
|
+
- Raises an error if the domain includes either pole.
|
|
659
|
+
- Uses PlateCarree if the longitudinal span > 90°.
|
|
660
|
+
- Otherwise uses NearsidePerspective centered on the domain.
|
|
661
|
+
|
|
662
|
+
Parameters
|
|
663
|
+
----------
|
|
664
|
+
lon, lat : xr.DataArray
|
|
665
|
+
Longitude and latitude values in degrees.
|
|
666
|
+
|
|
667
|
+
Returns
|
|
668
|
+
-------
|
|
669
|
+
cartopy.crs.Projection
|
|
670
|
+
The chosen Cartopy projection.
|
|
671
|
+
"""
|
|
672
|
+
# check if North or South pole are in domain
|
|
673
|
+
if lat.max() > 89 or lat.min() < -89:
|
|
674
|
+
raise NotImplementedError(
|
|
675
|
+
"Plotting is not implemented for the case that the domain contains the North or South pole."
|
|
676
|
+
)
|
|
677
|
+
|
|
678
|
+
if lon.max() - lon.min() > 90:
|
|
679
|
+
return ccrs.PlateCarree(central_longitude=lon.mean().values)
|
|
680
|
+
else:
|
|
681
|
+
return ccrs.NearsidePerspective(
|
|
682
|
+
central_longitude=lon.mean().values, central_latitude=lat.mean().values
|
|
683
|
+
)
|
|
681
684
|
|
|
682
685
|
|
|
683
686
|
def _validate_plot_inputs(
|
|
@@ -816,6 +819,7 @@ def plot(
|
|
|
816
819
|
yincrease: bool | None = None,
|
|
817
820
|
use_coarse_grid: bool = False,
|
|
818
821
|
with_dim_names: bool = False,
|
|
822
|
+
apply_mask: bool = True,
|
|
819
823
|
ax: Axes | None = None,
|
|
820
824
|
save_path: str | None = None,
|
|
821
825
|
cmap_name: str = "YlOrRd",
|
|
@@ -889,6 +893,9 @@ def plot(
|
|
|
889
893
|
with_dim_names : bool, optional
|
|
890
894
|
Add grid dimension names (`xi`, `eta`) to the outer plot edges. Only for 2D plots. Default is False.
|
|
891
895
|
|
|
896
|
+
apply_mask: bool, optional
|
|
897
|
+
Whether to apply the land mask to the field. Default is True.
|
|
898
|
+
|
|
892
899
|
ax : Axes, optional
|
|
893
900
|
Matplotlib axes object. If None, a new figure is created. Default is None.
|
|
894
901
|
|
|
@@ -971,7 +978,8 @@ def plot(
|
|
|
971
978
|
field = field.assign_coords({"lon": lon_deg, "lat": lat_deg})
|
|
972
979
|
|
|
973
980
|
# Mask the field
|
|
974
|
-
|
|
981
|
+
if apply_mask:
|
|
982
|
+
field = field.where(mask)
|
|
975
983
|
|
|
976
984
|
# Assign eta and xi as coordinates
|
|
977
985
|
coords_to_assign = {dim: field[dim] for dim in horizontal_dims.values()}
|
|
@@ -1268,7 +1276,7 @@ def plot_uptake_efficiency(ds: xr.Dataset) -> None:
|
|
|
1268
1276
|
----------
|
|
1269
1277
|
ds : xarray.Dataset
|
|
1270
1278
|
Dataset containing the following variables:
|
|
1271
|
-
- "
|
|
1279
|
+
- "time": array of timestamps (datetime-like)
|
|
1272
1280
|
- "cdr_efficiency": uptake efficiency from flux differences
|
|
1273
1281
|
- "cdr_efficiency_from_delta_diff": uptake efficiency from DIC differences
|
|
1274
1282
|
|
|
@@ -1281,16 +1289,16 @@ def plot_uptake_efficiency(ds: xr.Dataset) -> None:
|
|
|
1281
1289
|
-------
|
|
1282
1290
|
None
|
|
1283
1291
|
"""
|
|
1284
|
-
required_vars = ["
|
|
1292
|
+
required_vars = ["time", "cdr_efficiency", "cdr_efficiency_from_delta_diff"]
|
|
1285
1293
|
for var in required_vars:
|
|
1286
1294
|
if var not in ds or ds[var].size == 0:
|
|
1287
1295
|
raise ValueError(f"Dataset must contain non-empty variable '{var}'.")
|
|
1288
1296
|
|
|
1289
|
-
times = ds["
|
|
1297
|
+
times = ds["time"]
|
|
1290
1298
|
|
|
1291
1299
|
# Check for monotonically increasing times
|
|
1292
1300
|
if not np.all(times[1:] >= times[:-1]):
|
|
1293
|
-
raise ValueError("
|
|
1301
|
+
raise ValueError("time must be strictly increasing.")
|
|
1294
1302
|
|
|
1295
1303
|
fig, ax = plt.subplots(figsize=(10, 4))
|
|
1296
1304
|
|
|
@@ -11,17 +11,19 @@ import xarray as xr
|
|
|
11
11
|
from scipy.ndimage import label
|
|
12
12
|
|
|
13
13
|
from roms_tools import Grid
|
|
14
|
-
from roms_tools.
|
|
15
|
-
from roms_tools.regrid import LateralRegridToROMS, VerticalRegridToROMS
|
|
16
|
-
from roms_tools.setup.datasets import (
|
|
14
|
+
from roms_tools.datasets.lat_lon_datasets import (
|
|
17
15
|
CESMBGCDataset,
|
|
18
16
|
GLORYSDataset,
|
|
19
17
|
GLORYSDefaultDataset,
|
|
20
|
-
RawDataSource,
|
|
21
18
|
UnifiedBGCDataset,
|
|
22
19
|
)
|
|
20
|
+
from roms_tools.fill import one_dim_fill
|
|
21
|
+
from roms_tools.plot import line_plot, section_plot
|
|
22
|
+
from roms_tools.regrid import LateralRegridToROMS, VerticalRegridToROMS
|
|
23
23
|
from roms_tools.setup.utils import (
|
|
24
|
+
RawDataSource,
|
|
24
25
|
add_time_info_to_ds,
|
|
26
|
+
check_and_set_boundaries,
|
|
25
27
|
compute_barotropic_velocity,
|
|
26
28
|
compute_missing_bgc_variables,
|
|
27
29
|
from_yaml,
|
|
@@ -30,7 +32,6 @@ from roms_tools.setup.utils import (
|
|
|
30
32
|
get_variable_metadata,
|
|
31
33
|
group_dataset,
|
|
32
34
|
nan_check,
|
|
33
|
-
one_dim_fill,
|
|
34
35
|
rotate_velocities,
|
|
35
36
|
substitute_nans_by_fillvalue,
|
|
36
37
|
to_dict,
|
|
@@ -61,8 +62,9 @@ class BoundaryForcing:
|
|
|
61
62
|
The end time of the desired surface forcing data. This time is used to filter the dataset
|
|
62
63
|
to include only records on or before this time, with a single record at or after this time.
|
|
63
64
|
If no time filtering is desired, set it to None. Default is None.
|
|
64
|
-
boundaries :
|
|
65
|
-
|
|
65
|
+
boundaries : dict[str, bool], optional
|
|
66
|
+
Specifies which grid boundaries ('south', 'east', 'north', 'west') are active and to be processed.
|
|
67
|
+
if not provided, valid (non-land) boundaries are enabled automatically.
|
|
66
68
|
source : RawDataSource
|
|
67
69
|
Dictionary specifying the source of the boundary forcing data. Keys include:
|
|
68
70
|
|
|
@@ -86,10 +88,6 @@ class BoundaryForcing:
|
|
|
86
88
|
Indicates whether to perform a two-dimensional horizontal fill on the source data prior to regridding to boundaries.
|
|
87
89
|
If `False`, a one-dimensional horizontal fill is performed separately on each of the four regridded boundaries.
|
|
88
90
|
Defaults to `False`.
|
|
89
|
-
adjust_depth_for_sea_surface_height : bool, optional
|
|
90
|
-
Whether to account for sea surface height (`zeta`) variations when computing depth coordinates.
|
|
91
|
-
This adjustment is only applicable for `type="physics"`, as for biogeochemical fields usually `zeta` is not available.
|
|
92
|
-
Defaults to `False`.
|
|
93
91
|
model_reference_date : datetime, optional
|
|
94
92
|
Reference date for the model. Default is January 1, 2000.
|
|
95
93
|
use_dask: bool, optional
|
|
@@ -117,14 +115,7 @@ class BoundaryForcing:
|
|
|
117
115
|
"""The start time of the desired surface forcing data."""
|
|
118
116
|
end_time: datetime | None = None
|
|
119
117
|
"""The end time of the desired surface forcing data."""
|
|
120
|
-
boundaries: dict[str, bool] =
|
|
121
|
-
default_factory=lambda: {
|
|
122
|
-
"south": True,
|
|
123
|
-
"east": True,
|
|
124
|
-
"north": True,
|
|
125
|
-
"west": True,
|
|
126
|
-
}
|
|
127
|
-
)
|
|
118
|
+
boundaries: dict[str, bool] | None = None
|
|
128
119
|
"""Dictionary specifying which boundaries are forced (south, east, north, west)."""
|
|
129
120
|
source: RawDataSource
|
|
130
121
|
"""Dictionary specifying the source of the boundary forcing data."""
|
|
@@ -133,9 +124,6 @@ class BoundaryForcing:
|
|
|
133
124
|
apply_2d_horizontal_fill: bool = False
|
|
134
125
|
"""Whether to perform a two-dimensional horizontal fill on the source data prior to
|
|
135
126
|
regridding to boundaries."""
|
|
136
|
-
adjust_depth_for_sea_surface_height: bool = False
|
|
137
|
-
"""Whether to account for sea surface height (`zeta`) variations when computing
|
|
138
|
-
depth coordinates."""
|
|
139
127
|
model_reference_date: datetime = datetime(2000, 1, 1)
|
|
140
128
|
"""Reference date for the model."""
|
|
141
129
|
use_dask: bool = False
|
|
@@ -146,12 +134,18 @@ class BoundaryForcing:
|
|
|
146
134
|
ds: xr.Dataset = field(init=False, repr=False)
|
|
147
135
|
"""An xarray Dataset containing post-processed variables ready for input into
|
|
148
136
|
ROMS."""
|
|
137
|
+
adjust_depth_for_sea_surface_height: bool = field(init=False)
|
|
138
|
+
"""Whether to account for sea surface height when computing depth coordinates."""
|
|
139
|
+
ds_depth_coords: xr.Dataset = field(init=False, repr=False)
|
|
140
|
+
"""An xarray Dataset containing the depth coordinates."""
|
|
149
141
|
|
|
150
142
|
def __post_init__(self):
|
|
151
|
-
|
|
152
|
-
|
|
143
|
+
# Initialize depth coordinates
|
|
144
|
+
self.adjust_depth_for_sea_surface_height = False
|
|
153
145
|
self.ds_depth_coords = xr.Dataset()
|
|
154
146
|
|
|
147
|
+
self._input_checks()
|
|
148
|
+
|
|
155
149
|
target_coords = get_target_coords(self.grid)
|
|
156
150
|
|
|
157
151
|
data = self._get_data()
|
|
@@ -388,51 +382,58 @@ class BoundaryForcing:
|
|
|
388
382
|
|
|
389
383
|
self.ds = ds
|
|
390
384
|
|
|
391
|
-
def _input_checks(self):
|
|
392
|
-
|
|
385
|
+
def _input_checks(self) -> None:
|
|
386
|
+
"""Validate and normalize user-provided input parameters."""
|
|
387
|
+
# -------------------------------------------------------
|
|
388
|
+
# Time range checks
|
|
389
|
+
# -------------------------------------------------------
|
|
393
390
|
if (self.start_time is None) != (self.end_time is None):
|
|
394
391
|
raise ValueError(
|
|
395
392
|
"Both `start_time` and `end_time` must be provided together as datetime objects or both should be None."
|
|
396
393
|
)
|
|
397
394
|
|
|
398
|
-
# Trigger a warning if both are None
|
|
399
395
|
if self.start_time is None and self.end_time is None:
|
|
400
396
|
logging.warning(
|
|
401
397
|
"Both `start_time` and `end_time` are None. No time filtering will be applied to the source data."
|
|
402
398
|
)
|
|
403
399
|
|
|
404
|
-
#
|
|
405
|
-
|
|
400
|
+
# -------------------------------------------------------
|
|
401
|
+
# Type check
|
|
402
|
+
# -------------------------------------------------------
|
|
403
|
+
if self.type not in {"physics", "bgc"}:
|
|
406
404
|
raise ValueError("`type` must be either 'physics' or 'bgc'.")
|
|
407
405
|
|
|
408
|
-
#
|
|
406
|
+
# -------------------------------------------------------
|
|
407
|
+
# Source configuration checks
|
|
408
|
+
# -------------------------------------------------------
|
|
409
409
|
if "name" not in self.source:
|
|
410
410
|
raise ValueError("`source` must include a 'name'.")
|
|
411
|
+
|
|
411
412
|
if "path" not in self.source:
|
|
412
413
|
if self.source["name"] != "GLORYS":
|
|
413
414
|
raise ValueError("`source` must include a 'path'.")
|
|
414
|
-
|
|
415
415
|
self.source["path"] = GLORYSDefaultDataset.dataset_name
|
|
416
416
|
|
|
417
|
-
#
|
|
418
|
-
self.source =
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
417
|
+
# Assign default value
|
|
418
|
+
self.source["climatology"] = self.source.get("climatology", False)
|
|
419
|
+
|
|
420
|
+
# -------------------------------------------------------
|
|
421
|
+
# Boundary selection defaults and validation
|
|
422
|
+
# -------------------------------------------------------
|
|
423
|
+
|
|
424
|
+
self.boundaries = check_and_set_boundaries(
|
|
425
|
+
self.boundaries, self.grid.ds.mask_rho
|
|
426
|
+
)
|
|
422
427
|
|
|
423
|
-
#
|
|
428
|
+
# -------------------------------------------------------
|
|
429
|
+
# Depth adjustment checks
|
|
430
|
+
# -------------------------------------------------------
|
|
424
431
|
if self.type == "bgc" and self.adjust_depth_for_sea_surface_height:
|
|
425
432
|
logging.warning(
|
|
426
433
|
"adjust_depth_for_sea_surface_height is not applicable for BGC fields. "
|
|
427
434
|
"Setting it to False."
|
|
428
435
|
)
|
|
429
436
|
self.adjust_depth_for_sea_surface_height = False
|
|
430
|
-
elif self.adjust_depth_for_sea_surface_height:
|
|
431
|
-
logging.info("Sea surface height will be used to adjust depth coordinates.")
|
|
432
|
-
else:
|
|
433
|
-
logging.info(
|
|
434
|
-
"Sea surface height will NOT be used to adjust depth coordinates."
|
|
435
|
-
)
|
|
436
437
|
|
|
437
438
|
def _get_data(
|
|
438
439
|
self,
|
|
@@ -1061,7 +1062,14 @@ class BoundaryForcing:
|
|
|
1061
1062
|
filepath : Union[str, Path]
|
|
1062
1063
|
The path to the YAML file where the parameters will be saved.
|
|
1063
1064
|
"""
|
|
1064
|
-
forcing_dict = to_dict(
|
|
1065
|
+
forcing_dict = to_dict(
|
|
1066
|
+
self,
|
|
1067
|
+
exclude=[
|
|
1068
|
+
"ds_depth_coords",
|
|
1069
|
+
"adjust_depth_for_sea_surface_height",
|
|
1070
|
+
"use_dask",
|
|
1071
|
+
],
|
|
1072
|
+
)
|
|
1065
1073
|
write_to_yaml(forcing_dict, filepath)
|
|
1066
1074
|
|
|
1067
1075
|
@classmethod
|
roms_tools/setup/cdr_release.py
CHANGED
|
@@ -573,7 +573,7 @@ class TracerPerturbation(Release):
|
|
|
573
573
|
|
|
574
574
|
tracer_fluxes : dict, optional
|
|
575
575
|
|
|
576
|
-
Dictionary of tracer names and their
|
|
576
|
+
Dictionary of tracer names and their flux values. The flux values can be either
|
|
577
577
|
a float (constant in time) or a list of float (time-varying).
|
|
578
578
|
|
|
579
579
|
- Constant: applies uniformly across the entire simulation period.
|
|
@@ -589,9 +589,7 @@ class TracerPerturbation(Release):
|
|
|
589
589
|
"""
|
|
590
590
|
|
|
591
591
|
times: list[datetime] = Field([])
|
|
592
|
-
tracer_fluxes: dict[str, Flux |
|
|
593
|
-
{}
|
|
594
|
-
)
|
|
592
|
+
tracer_fluxes: dict[str, Flux | float | list[float]] = Field({})
|
|
595
593
|
"""Dictionary of tracer names and their non-negative flux values."""
|
|
596
594
|
|
|
597
595
|
release_type: Literal[ReleaseType.tracer_perturbation] = (
|
roms_tools/setup/grid.py
CHANGED
|
@@ -201,46 +201,71 @@ class Grid:
|
|
|
201
201
|
self.mask_shapefile = mask_shapefile
|
|
202
202
|
|
|
203
203
|
def update_topography(
|
|
204
|
-
self,
|
|
204
|
+
self,
|
|
205
|
+
topography_source: dict | None = None,
|
|
206
|
+
hmin: float | None = None,
|
|
207
|
+
verbose: bool = False,
|
|
205
208
|
) -> None:
|
|
206
|
-
"""
|
|
209
|
+
"""
|
|
210
|
+
Update the grid dataset with processed topography.
|
|
207
211
|
|
|
208
|
-
This method performs
|
|
209
|
-
|
|
210
|
-
|
|
212
|
+
This method performs the following operations:
|
|
213
|
+
|
|
214
|
+
1. Regrids the topography from the specified source.
|
|
215
|
+
2. Applies domain-wide and local smoothing.
|
|
216
|
+
3. Enforces the minimum depth constraint ``hmin``.
|
|
217
|
+
4. Updates the internal dataset (``self.ds``) with the processed bathymetry.
|
|
211
218
|
|
|
212
219
|
Parameters
|
|
213
220
|
----------
|
|
214
221
|
topography_source : dict, optional
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
- "name" (str):
|
|
218
|
-
- "path" (
|
|
222
|
+
Dictionary specifying the topography data source with keys:
|
|
223
|
+
|
|
224
|
+
- ``"name"`` (str): Name of the topography dataset (e.g. ``"SRTM15"``)
|
|
225
|
+
- ``"path"`` (str or pathlib.Path): Path to the raw data file
|
|
219
226
|
|
|
220
227
|
If not provided, `topography_source` will remain unchanged (i.e., the existing value will not be overwritten).
|
|
221
228
|
|
|
222
229
|
hmin : float, optional
|
|
223
|
-
|
|
230
|
+
Minimum ocean depth in meters.
|
|
224
231
|
If not provided, `hmin` will remain unchanged (i.e., the existing value will not be overwritten).
|
|
225
232
|
|
|
226
233
|
verbose : bool, optional
|
|
227
|
-
If True,
|
|
228
|
-
|
|
234
|
+
If True, print detailed information about the processing steps and timing.
|
|
235
|
+
Defaults to False.
|
|
229
236
|
|
|
230
237
|
Returns
|
|
231
238
|
-------
|
|
232
239
|
None
|
|
233
|
-
|
|
234
|
-
topography variable. It does not return any value.
|
|
240
|
+
Updates ``self.ds`` in place.
|
|
235
241
|
"""
|
|
236
|
-
|
|
237
|
-
|
|
242
|
+
if topography_source is None:
|
|
243
|
+
topography_source = self.topography_source
|
|
244
|
+
|
|
245
|
+
if hmin is None:
|
|
246
|
+
hmin = self.hmin
|
|
247
|
+
|
|
248
|
+
# This can only happen for externally generated grids read via Grid.from_file()
|
|
249
|
+
if topography_source is None:
|
|
250
|
+
raise ValueError(
|
|
251
|
+
"Topography source information is not available. "
|
|
252
|
+
"Please provide `topography_source` explicitly when calling "
|
|
253
|
+
"`update_topography()`."
|
|
254
|
+
)
|
|
255
|
+
# This can only happen for externally generated grids read via Grid.from_file()
|
|
256
|
+
if hmin is None:
|
|
257
|
+
raise ValueError(
|
|
258
|
+
"Minimal ocean depth is not available. "
|
|
259
|
+
"Please provide `hmin` explicitly when calling `update_topography()`."
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
name = topography_source["name"] # type: ignore[index]
|
|
238
263
|
|
|
239
264
|
# Extract target coordinates for processing
|
|
240
265
|
target_coords = get_target_coords(self)
|
|
241
266
|
|
|
242
267
|
with Timed(
|
|
243
|
-
f"=== Generating the topography using {
|
|
268
|
+
f"=== Generating the topography using {name} data and hmin = {hmin} meters ===",
|
|
244
269
|
verbose=verbose,
|
|
245
270
|
):
|
|
246
271
|
ds = add_topography(
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import importlib.metadata
|
|
2
|
-
import logging
|
|
3
2
|
from collections import defaultdict
|
|
4
3
|
from dataclasses import dataclass, field
|
|
5
4
|
from datetime import datetime
|
|
@@ -11,17 +10,17 @@ import xarray as xr
|
|
|
11
10
|
from matplotlib.axes import Axes
|
|
12
11
|
|
|
13
12
|
from roms_tools import Grid
|
|
14
|
-
from roms_tools.
|
|
15
|
-
from roms_tools.regrid import LateralRegridToROMS, VerticalRegridToROMS
|
|
16
|
-
from roms_tools.setup.datasets import (
|
|
13
|
+
from roms_tools.datasets.lat_lon_datasets import (
|
|
17
14
|
CESMBGCDataset,
|
|
18
|
-
Dataset,
|
|
19
15
|
GLORYSDataset,
|
|
20
16
|
GLORYSDefaultDataset,
|
|
21
|
-
|
|
17
|
+
LatLonDataset,
|
|
22
18
|
UnifiedBGCDataset,
|
|
23
19
|
)
|
|
20
|
+
from roms_tools.plot import plot
|
|
21
|
+
from roms_tools.regrid import LateralRegridToROMS, VerticalRegridToROMS
|
|
24
22
|
from roms_tools.setup.utils import (
|
|
23
|
+
RawDataSource,
|
|
25
24
|
compute_barotropic_velocity,
|
|
26
25
|
compute_missing_bgc_variables,
|
|
27
26
|
from_yaml,
|
|
@@ -81,9 +80,6 @@ class InitialConditions:
|
|
|
81
80
|
- A list of strings or Path objects containing multiple files.
|
|
82
81
|
- "climatology" (bool): Indicates if the data is climatology data. Defaults to False.
|
|
83
82
|
|
|
84
|
-
adjust_depth_for_sea_surface_height : bool, optional
|
|
85
|
-
Whether to account for sea surface height variations when computing depth coordinates.
|
|
86
|
-
Defaults to `False`.
|
|
87
83
|
model_reference_date : datetime, optional
|
|
88
84
|
The reference date for the model. Defaults to January 1, 2000.
|
|
89
85
|
use_dask: bool, optional
|
|
@@ -129,9 +125,6 @@ class InitialConditions:
|
|
|
129
125
|
data."""
|
|
130
126
|
model_reference_date: datetime = datetime(2000, 1, 1)
|
|
131
127
|
"""The reference date for the model."""
|
|
132
|
-
adjust_depth_for_sea_surface_height: bool = False
|
|
133
|
-
"""Whether to account for sea surface height variations when computing depth
|
|
134
|
-
coordinates."""
|
|
135
128
|
allow_flex_time: bool = False
|
|
136
129
|
"""Whether to handle ini_time flexibly."""
|
|
137
130
|
use_dask: bool = False
|
|
@@ -145,12 +138,18 @@ class InitialConditions:
|
|
|
145
138
|
ds: xr.Dataset = field(init=False, repr=False)
|
|
146
139
|
"""An xarray Dataset containing post-processed variables ready for input into
|
|
147
140
|
ROMS."""
|
|
141
|
+
adjust_depth_for_sea_surface_height: bool = field(init=False)
|
|
142
|
+
"""Whether to account for sea surface height when computing depth coordinates."""
|
|
143
|
+
ds_depth_coords: xr.Dataset = field(init=False, repr=False)
|
|
144
|
+
"""An xarray Dataset containing the depth coordinates."""
|
|
148
145
|
|
|
149
146
|
def __post_init__(self):
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
# Initialize depth coordinates
|
|
148
|
+
self.adjust_depth_for_sea_surface_height = False
|
|
152
149
|
self.ds_depth_coords = xr.Dataset()
|
|
153
150
|
|
|
151
|
+
self._input_checks()
|
|
152
|
+
|
|
154
153
|
processed_fields = {}
|
|
155
154
|
processed_fields = self._process_data(processed_fields, type="physics")
|
|
156
155
|
|
|
@@ -319,14 +318,8 @@ class InitialConditions:
|
|
|
319
318
|
**self.bgc_source,
|
|
320
319
|
"climatology": self.bgc_source.get("climatology", False),
|
|
321
320
|
}
|
|
322
|
-
if self.adjust_depth_for_sea_surface_height:
|
|
323
|
-
logging.info("Sea surface height will be used to adjust depth coordinates.")
|
|
324
|
-
else:
|
|
325
|
-
logging.info(
|
|
326
|
-
"Sea surface height will NOT be used to adjust depth coordinates."
|
|
327
|
-
)
|
|
328
321
|
|
|
329
|
-
def _get_data(self, forcing_type=Literal["physics", "bgc"]) ->
|
|
322
|
+
def _get_data(self, forcing_type=Literal["physics", "bgc"]) -> LatLonDataset:
|
|
330
323
|
"""Determine the correct `Dataset` type and return an instance.
|
|
331
324
|
|
|
332
325
|
forcing_type : str
|
|
@@ -339,7 +332,7 @@ class InitialConditions:
|
|
|
339
332
|
Dataset
|
|
340
333
|
The `Dataset` instance
|
|
341
334
|
"""
|
|
342
|
-
dataset_map: dict[str, dict[str, dict[str, type[
|
|
335
|
+
dataset_map: dict[str, dict[str, dict[str, type[LatLonDataset]]]] = {
|
|
343
336
|
"physics": {
|
|
344
337
|
"GLORYS": {
|
|
345
338
|
"external": GLORYSDataset,
|
|
@@ -826,7 +819,14 @@ class InitialConditions:
|
|
|
826
819
|
filepath : Union[str, Path]
|
|
827
820
|
The path to the YAML file where the parameters will be saved.
|
|
828
821
|
"""
|
|
829
|
-
forcing_dict = to_dict(
|
|
822
|
+
forcing_dict = to_dict(
|
|
823
|
+
self,
|
|
824
|
+
exclude=[
|
|
825
|
+
"ds_depth_coords",
|
|
826
|
+
"adjust_depth_for_sea_surface_height",
|
|
827
|
+
"use_dask",
|
|
828
|
+
],
|
|
829
|
+
)
|
|
830
830
|
write_to_yaml(forcing_dict, filepath)
|
|
831
831
|
|
|
832
832
|
@classmethod
|