roms-tools 3.1.2__py3-none-any.whl → 3.3.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 +3 -0
- roms_tools/analysis/cdr_analysis.py +203 -0
- roms_tools/analysis/cdr_ensemble.py +198 -0
- roms_tools/analysis/roms_output.py +80 -46
- roms_tools/data/grids/GLORYS_global_grid.nc +0 -0
- roms_tools/download.py +4 -0
- roms_tools/plot.py +113 -51
- roms_tools/setup/boundary_forcing.py +45 -20
- roms_tools/setup/cdr_forcing.py +122 -8
- roms_tools/setup/cdr_release.py +161 -8
- roms_tools/setup/grid.py +150 -141
- roms_tools/setup/initial_conditions.py +113 -48
- roms_tools/setup/{datasets.py → lat_lon_datasets.py} +443 -938
- roms_tools/setup/mask.py +63 -7
- roms_tools/setup/nesting.py +314 -117
- roms_tools/setup/river_datasets.py +527 -0
- roms_tools/setup/river_forcing.py +46 -20
- roms_tools/setup/surface_forcing.py +7 -9
- roms_tools/setup/tides.py +2 -3
- roms_tools/setup/topography.py +8 -10
- roms_tools/setup/utils.py +396 -23
- roms_tools/tests/test_analysis/test_cdr_analysis.py +144 -0
- roms_tools/tests/test_analysis/test_cdr_ensemble.py +202 -0
- roms_tools/tests/test_analysis/test_roms_output.py +61 -3
- roms_tools/tests/test_setup/test_boundary_forcing.py +54 -52
- roms_tools/tests/test_setup/test_cdr_forcing.py +54 -0
- roms_tools/tests/test_setup/test_cdr_release.py +118 -1
- 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_ALT_CO2_west/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/ALK_west/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_ALT_CO2_west/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/DIC_west/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/DOC_west/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/DOCr_west/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/DON_west/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/DONr_west/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/DOP_west/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/DOPr_west/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/Fe_west/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/Lig_west/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/NH4_west/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/NO3_west/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/O2_west/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/PO4_west/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/SiO3_west/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/diatC_west/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/diatChl_west/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/diatFe_west/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/diatP_west/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/diatSi_west/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/diazC_west/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/diazChl_west/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/diazFe_west/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/diazP_west/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/spC_west/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/spCaCO3_west/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/spChl_west/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/spFe_west/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/spP_west/c/0/0/0 +0 -0
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_climatology.zarr/zarr.json +406 -406
- 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_climatology.zarr/zooC_west/c/0/0/0 +0 -0
- 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 +236 -115
- roms_tools/tests/test_setup/test_initial_conditions.py +94 -41
- roms_tools/tests/test_setup/{test_datasets.py → test_lat_lon_datasets.py} +409 -100
- roms_tools/tests/test_setup/test_nesting.py +119 -31
- roms_tools/tests/test_setup/test_river_datasets.py +48 -0
- roms_tools/tests/test_setup/test_surface_forcing.py +2 -1
- roms_tools/tests/test_setup/test_utils.py +92 -2
- roms_tools/tests/test_setup/utils.py +71 -0
- roms_tools/tests/test_tiling/test_join.py +241 -0
- roms_tools/tests/test_utils.py +139 -17
- roms_tools/tiling/join.py +189 -0
- roms_tools/utils.py +131 -99
- {roms_tools-3.1.2.dist-info → roms_tools-3.3.0.dist-info}/METADATA +12 -2
- {roms_tools-3.1.2.dist-info → roms_tools-3.3.0.dist-info}/RECORD +221 -211
- {roms_tools-3.1.2.dist-info → roms_tools-3.3.0.dist-info}/WHEEL +0 -0
- {roms_tools-3.1.2.dist-info → roms_tools-3.3.0.dist-info}/licenses/LICENSE +0 -0
- {roms_tools-3.1.2.dist-info → roms_tools-3.3.0.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import importlib.metadata
|
|
2
2
|
import logging
|
|
3
|
+
from collections import defaultdict
|
|
3
4
|
from dataclasses import dataclass, field
|
|
4
5
|
from datetime import datetime
|
|
5
6
|
from pathlib import Path
|
|
7
|
+
from typing import Literal
|
|
6
8
|
|
|
7
9
|
import numpy as np
|
|
8
10
|
import xarray as xr
|
|
@@ -11,8 +13,15 @@ from matplotlib.axes import Axes
|
|
|
11
13
|
from roms_tools import Grid
|
|
12
14
|
from roms_tools.plot import plot
|
|
13
15
|
from roms_tools.regrid import LateralRegridToROMS, VerticalRegridToROMS
|
|
14
|
-
from roms_tools.setup.
|
|
16
|
+
from roms_tools.setup.lat_lon_datasets import (
|
|
17
|
+
CESMBGCDataset,
|
|
18
|
+
GLORYSDataset,
|
|
19
|
+
GLORYSDefaultDataset,
|
|
20
|
+
LatLonDataset,
|
|
21
|
+
UnifiedBGCDataset,
|
|
22
|
+
)
|
|
15
23
|
from roms_tools.setup.utils import (
|
|
24
|
+
RawDataSource,
|
|
16
25
|
compute_barotropic_velocity,
|
|
17
26
|
compute_missing_bgc_variables,
|
|
18
27
|
from_yaml,
|
|
@@ -25,7 +34,6 @@ from roms_tools.setup.utils import (
|
|
|
25
34
|
write_to_yaml,
|
|
26
35
|
)
|
|
27
36
|
from roms_tools.utils import (
|
|
28
|
-
get_dask_chunks,
|
|
29
37
|
interpolate_from_rho_to_u,
|
|
30
38
|
interpolate_from_rho_to_v,
|
|
31
39
|
save_datasets,
|
|
@@ -48,7 +56,7 @@ class InitialConditions:
|
|
|
48
56
|
ini_time : datetime
|
|
49
57
|
The date and time at which the initial conditions are set.
|
|
50
58
|
If no exact match is found, the closest time entry to `ini_time` within the time range [ini_time, ini_time + 24 hours] is selected.
|
|
51
|
-
source :
|
|
59
|
+
source : RawDataSource
|
|
52
60
|
|
|
53
61
|
Dictionary specifying the source of the physical initial condition data. Keys include:
|
|
54
62
|
|
|
@@ -57,10 +65,12 @@ class InitialConditions:
|
|
|
57
65
|
|
|
58
66
|
- A single string (with or without wildcards).
|
|
59
67
|
- A single Path object.
|
|
60
|
-
- A list of strings or Path objects
|
|
68
|
+
- A list of strings or Path objects.
|
|
69
|
+
If omitted, the data will be streamed via the Copernicus Marine Toolkit.
|
|
70
|
+
Note: streaming is currently not recommended due to performance limitations.
|
|
61
71
|
- "climatology" (bool): Indicates if the data is climatology data. Defaults to False.
|
|
62
72
|
|
|
63
|
-
bgc_source :
|
|
73
|
+
bgc_source : RawDataSource, optional
|
|
64
74
|
Dictionary specifying the source of the biogeochemical (BGC) initial condition data. Keys include:
|
|
65
75
|
|
|
66
76
|
- "name" (str): Name of the data source (e.g., "CESM_REGRIDDED").
|
|
@@ -78,6 +88,13 @@ class InitialConditions:
|
|
|
78
88
|
The reference date for the model. Defaults to January 1, 2000.
|
|
79
89
|
use_dask: bool, optional
|
|
80
90
|
Indicates whether to use dask for processing. If True, data is processed with dask; if False, data is processed eagerly. Defaults to False.
|
|
91
|
+
allow_flex_time: bool, optional
|
|
92
|
+
Controls how strictly `ini_time` is handled:
|
|
93
|
+
|
|
94
|
+
- If False (default): requires an exact match to `ini_time`. Raises a ValueError if no match exists.
|
|
95
|
+
- If True: allows a +24h search window after `ini_time` and selects the closest available
|
|
96
|
+
time entry within that window. Raises a ValueError if none are found.
|
|
97
|
+
|
|
81
98
|
horizontal_chunk_size : int, optional
|
|
82
99
|
The chunk size used for horizontal partitioning for the vertical regridding when `use_dask = True`. Defaults to 50.
|
|
83
100
|
A larger number results in a bigger memory footprint but faster computations.
|
|
@@ -105,9 +122,9 @@ class InitialConditions:
|
|
|
105
122
|
"""Object representing the grid information."""
|
|
106
123
|
ini_time: datetime
|
|
107
124
|
"""The date and time at which the initial conditions are set."""
|
|
108
|
-
source:
|
|
125
|
+
source: RawDataSource
|
|
109
126
|
"""Dictionary specifying the source of the physical initial condition data."""
|
|
110
|
-
bgc_source:
|
|
127
|
+
bgc_source: RawDataSource | None = None
|
|
111
128
|
"""Dictionary specifying the source of the biogeochemical (BGC) initial condition
|
|
112
129
|
data."""
|
|
113
130
|
model_reference_date: datetime = datetime(2000, 1, 1)
|
|
@@ -115,6 +132,8 @@ class InitialConditions:
|
|
|
115
132
|
adjust_depth_for_sea_surface_height: bool = False
|
|
116
133
|
"""Whether to account for sea surface height variations when computing depth
|
|
117
134
|
coordinates."""
|
|
135
|
+
allow_flex_time: bool = False
|
|
136
|
+
"""Whether to handle ini_time flexibly."""
|
|
118
137
|
use_dask: bool = False
|
|
119
138
|
"""Whether to use dask for processing."""
|
|
120
139
|
horizontal_chunk_size: int = 50
|
|
@@ -161,14 +180,10 @@ class InitialConditions:
|
|
|
161
180
|
def _process_data(self, processed_fields, type="physics"):
|
|
162
181
|
target_coords = get_target_coords(self.grid)
|
|
163
182
|
|
|
164
|
-
|
|
165
|
-
data = self._get_data()
|
|
166
|
-
else:
|
|
167
|
-
data = self._get_bgc_data()
|
|
183
|
+
data = self._get_data(forcing_type=type)
|
|
168
184
|
|
|
169
185
|
data.choose_subdomain(
|
|
170
186
|
target_coords,
|
|
171
|
-
buffer_points=20, # lateral fill needs good buffer from data margin
|
|
172
187
|
)
|
|
173
188
|
# Enforce double precision to ensure reproducibility
|
|
174
189
|
data.convert_to_float64()
|
|
@@ -255,7 +270,7 @@ class InitialConditions:
|
|
|
255
270
|
field = processed_fields[var_name]
|
|
256
271
|
if self.use_dask:
|
|
257
272
|
field = field.chunk(
|
|
258
|
-
|
|
273
|
+
_set_dask_chunks(location, self.horizontal_chunk_size)
|
|
259
274
|
)
|
|
260
275
|
processed_fields[var_name] = vertical_regrid.apply(field)
|
|
261
276
|
|
|
@@ -280,7 +295,11 @@ class InitialConditions:
|
|
|
280
295
|
if "name" not in self.source.keys():
|
|
281
296
|
raise ValueError("`source` must include a 'name'.")
|
|
282
297
|
if "path" not in self.source.keys():
|
|
283
|
-
|
|
298
|
+
if self.source["name"] != "GLORYS":
|
|
299
|
+
raise ValueError("`source` must include a 'path'.")
|
|
300
|
+
|
|
301
|
+
self.source["path"] = GLORYSDefaultDataset.dataset_name
|
|
302
|
+
|
|
284
303
|
# set self.source["climatology"] to False if not provided
|
|
285
304
|
self.source = {
|
|
286
305
|
**self.source,
|
|
@@ -307,40 +326,63 @@ class InitialConditions:
|
|
|
307
326
|
"Sea surface height will NOT be used to adjust depth coordinates."
|
|
308
327
|
)
|
|
309
328
|
|
|
310
|
-
def _get_data(self):
|
|
311
|
-
|
|
312
|
-
data = GLORYSDataset(
|
|
313
|
-
filename=self.source["path"],
|
|
314
|
-
start_time=self.ini_time,
|
|
315
|
-
climatology=self.source["climatology"],
|
|
316
|
-
use_dask=self.use_dask,
|
|
317
|
-
)
|
|
318
|
-
else:
|
|
319
|
-
raise ValueError('Only "GLORYS" is a valid option for source["name"].')
|
|
320
|
-
return data
|
|
321
|
-
|
|
322
|
-
def _get_bgc_data(self):
|
|
323
|
-
if self.bgc_source["name"] == "CESM_REGRIDDED":
|
|
324
|
-
data = CESMBGCDataset(
|
|
325
|
-
filename=self.bgc_source["path"],
|
|
326
|
-
start_time=self.ini_time,
|
|
327
|
-
climatology=self.bgc_source["climatology"],
|
|
328
|
-
use_dask=self.use_dask,
|
|
329
|
-
)
|
|
330
|
-
elif self.bgc_source["name"] == "UNIFIED":
|
|
331
|
-
data = UnifiedBGCDataset(
|
|
332
|
-
filename=self.bgc_source["path"],
|
|
333
|
-
start_time=self.ini_time,
|
|
334
|
-
climatology=self.bgc_source["climatology"],
|
|
335
|
-
use_dask=self.use_dask,
|
|
336
|
-
)
|
|
329
|
+
def _get_data(self, forcing_type=Literal["physics", "bgc"]) -> LatLonDataset:
|
|
330
|
+
"""Determine the correct `Dataset` type and return an instance.
|
|
337
331
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
332
|
+
forcing_type : str
|
|
333
|
+
Specifies the type of forcing data. Options are:
|
|
334
|
+
|
|
335
|
+
- "physics": for physical atmospheric forcing.
|
|
336
|
+
- "bgc": for biogeochemical forcing.
|
|
337
|
+
Returns
|
|
338
|
+
-------
|
|
339
|
+
Dataset
|
|
340
|
+
The `Dataset` instance
|
|
341
|
+
"""
|
|
342
|
+
dataset_map: dict[str, dict[str, dict[str, type[LatLonDataset]]]] = {
|
|
343
|
+
"physics": {
|
|
344
|
+
"GLORYS": {
|
|
345
|
+
"external": GLORYSDataset,
|
|
346
|
+
"default": GLORYSDefaultDataset,
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
"bgc": {
|
|
350
|
+
"CESM_REGRIDDED": defaultdict(lambda: CESMBGCDataset),
|
|
351
|
+
"UNIFIED": defaultdict(lambda: UnifiedBGCDataset),
|
|
352
|
+
},
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
source_dict = self.source if forcing_type == "physics" else self.bgc_source
|
|
356
|
+
|
|
357
|
+
if source_dict is None:
|
|
358
|
+
raise ValueError(f"{forcing_type} source is not set")
|
|
359
|
+
|
|
360
|
+
source_name = str(source_dict["name"])
|
|
361
|
+
if source_name not in dataset_map[forcing_type]:
|
|
362
|
+
tpl = 'Valid options for source["name"] for type {} include: {}'
|
|
363
|
+
msg = tpl.format(
|
|
364
|
+
forcing_type, " and ".join(dataset_map[forcing_type].keys())
|
|
341
365
|
)
|
|
366
|
+
raise ValueError(msg)
|
|
342
367
|
|
|
343
|
-
|
|
368
|
+
has_no_path = "path" not in source_dict
|
|
369
|
+
has_default_path = source_dict.get("path") == GLORYSDefaultDataset.dataset_name
|
|
370
|
+
use_default = has_no_path or has_default_path
|
|
371
|
+
|
|
372
|
+
variant = "default" if use_default else "external"
|
|
373
|
+
|
|
374
|
+
data_type = dataset_map[forcing_type][source_name][variant]
|
|
375
|
+
|
|
376
|
+
if isinstance(source_dict["path"], bool):
|
|
377
|
+
raise ValueError('source["path"] cannot be a boolean here')
|
|
378
|
+
|
|
379
|
+
return data_type(
|
|
380
|
+
filename=source_dict["path"],
|
|
381
|
+
start_time=self.ini_time,
|
|
382
|
+
climatology=source_dict["climatology"], # type: ignore
|
|
383
|
+
allow_flex_time=self.allow_flex_time,
|
|
384
|
+
use_dask=self.use_dask,
|
|
385
|
+
)
|
|
344
386
|
|
|
345
387
|
def _set_variable_info(self, data, type="physics"):
|
|
346
388
|
"""Sets up a dictionary with metadata for variables based on the type.
|
|
@@ -483,10 +525,10 @@ class InitialConditions:
|
|
|
483
525
|
zeta = interpolate_from_rho_to_v(zeta)
|
|
484
526
|
|
|
485
527
|
if self.use_dask:
|
|
486
|
-
h = h.chunk(
|
|
487
|
-
if
|
|
528
|
+
h = h.chunk(_set_dask_chunks(location, self.horizontal_chunk_size))
|
|
529
|
+
if isinstance(zeta, xr.DataArray):
|
|
488
530
|
zeta = zeta.chunk(
|
|
489
|
-
|
|
531
|
+
_set_dask_chunks(location, self.horizontal_chunk_size)
|
|
490
532
|
)
|
|
491
533
|
depth = compute_depth(zeta, h, self.grid.ds.attrs["hc"], Cs, sigma)
|
|
492
534
|
self.ds_depth_coords[key] = depth
|
|
@@ -816,3 +858,26 @@ class InitialConditions:
|
|
|
816
858
|
**initial_conditions_params,
|
|
817
859
|
use_dask=use_dask,
|
|
818
860
|
)
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
def _set_dask_chunks(location: str, chunk_size: int):
|
|
864
|
+
"""Returns the appropriate Dask chunking dictionary based on grid location.
|
|
865
|
+
|
|
866
|
+
Parameters
|
|
867
|
+
----------
|
|
868
|
+
location : str
|
|
869
|
+
The grid location, one of "rho", "u", or "v".
|
|
870
|
+
chunk_size : int
|
|
871
|
+
The chunk size to apply.
|
|
872
|
+
|
|
873
|
+
Returns
|
|
874
|
+
-------
|
|
875
|
+
dict
|
|
876
|
+
Dictionary specifying the chunking strategy.
|
|
877
|
+
"""
|
|
878
|
+
chunk_mapping = {
|
|
879
|
+
"rho": {"eta_rho": chunk_size, "xi_rho": chunk_size},
|
|
880
|
+
"u": {"eta_rho": chunk_size, "xi_u": chunk_size},
|
|
881
|
+
"v": {"eta_v": chunk_size, "xi_rho": chunk_size},
|
|
882
|
+
}
|
|
883
|
+
return chunk_mapping.get(location, {})
|