roms-tools 3.3.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}/lat_lon_datasets.py +76 -64
- roms_tools/{setup → datasets}/river_datasets.py +9 -4
- 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 +4 -4
- roms_tools/setup/boundary_forcing.py +51 -43
- roms_tools/setup/cdr_release.py +2 -4
- roms_tools/setup/grid.py +29 -12
- roms_tools/setup/initial_conditions.py +19 -19
- roms_tools/setup/nesting.py +8 -4
- roms_tools/setup/river_forcing.py +4 -4
- roms_tools/setup/surface_forcing.py +14 -9
- roms_tools/setup/tides.py +1 -1
- roms_tools/setup/topography.py +10 -2
- roms_tools/setup/utils.py +72 -524
- roms_tools/tests/test_analysis/test_cdr_ensemble.py +4 -6
- roms_tools/tests/test_analysis/test_roms_output.py +1 -220
- roms_tools/tests/{test_setup → test_datasets}/test_lat_lon_datasets.py +4 -4
- roms_tools/tests/{test_setup → test_datasets}/test_river_datasets.py +1 -1
- roms_tools/tests/test_datasets/test_roms_dataset.py +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/zarr.json +293 -2021
- roms_tools/tests/test_setup/test_data/bgc_boundary_forcing_from_unified_climatology.zarr/zarr.json +294 -2022
- roms_tools/tests/test_setup/test_grid.py +42 -1
- roms_tools/tests/test_setup/test_initial_conditions.py +3 -94
- roms_tools/tests/test_setup/test_nesting.py +2 -1
- roms_tools/tests/test_setup/test_surface_forcing.py +1 -1
- roms_tools/tests/test_setup/test_tides.py +1 -1
- roms_tools/tests/test_setup/test_utils.py +100 -15
- roms_tools/tests/test_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.3.0.dist-info → roms_tools-3.4.0.dist-info}/METADATA +1 -1
- {roms_tools-3.3.0.dist-info → roms_tools-3.4.0.dist-info}/RECORD +46 -170
- {roms_tools-3.3.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.3.0.dist-info → roms_tools-3.4.0.dist-info}/licenses/LICENSE +0 -0
- {roms_tools-3.3.0.dist-info → roms_tools-3.4.0.dist-info}/top_level.txt +0 -0
|
@@ -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.lat_lon_datasets import (
|
|
14
|
+
from roms_tools.datasets.lat_lon_datasets import (
|
|
17
15
|
CESMBGCDataset,
|
|
18
16
|
GLORYSDataset,
|
|
19
17
|
GLORYSDefaultDataset,
|
|
20
18
|
UnifiedBGCDataset,
|
|
21
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
|
|
22
23
|
from roms_tools.setup.utils import (
|
|
23
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
|
@@ -206,7 +206,8 @@ class Grid:
|
|
|
206
206
|
hmin: float | None = None,
|
|
207
207
|
verbose: bool = False,
|
|
208
208
|
) -> None:
|
|
209
|
-
"""
|
|
209
|
+
"""
|
|
210
|
+
Update the grid dataset with processed topography.
|
|
210
211
|
|
|
211
212
|
This method performs the following operations:
|
|
212
213
|
|
|
@@ -218,29 +219,45 @@ class Grid:
|
|
|
218
219
|
Parameters
|
|
219
220
|
----------
|
|
220
221
|
topography_source : dict, optional
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
- "name" (str):
|
|
224
|
-
- "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
|
|
225
226
|
|
|
226
227
|
If not provided, `topography_source` will remain unchanged (i.e., the existing value will not be overwritten).
|
|
227
228
|
|
|
228
229
|
hmin : float, optional
|
|
229
|
-
|
|
230
|
+
Minimum ocean depth in meters.
|
|
230
231
|
If not provided, `hmin` will remain unchanged (i.e., the existing value will not be overwritten).
|
|
231
232
|
|
|
232
233
|
verbose : bool, optional
|
|
233
|
-
If True,
|
|
234
|
-
|
|
234
|
+
If True, print detailed information about the processing steps and timing.
|
|
235
|
+
Defaults to False.
|
|
235
236
|
|
|
236
237
|
Returns
|
|
237
238
|
-------
|
|
238
239
|
None
|
|
239
|
-
|
|
240
|
-
topography variable. It does not return any value.
|
|
240
|
+
Updates ``self.ds`` in place.
|
|
241
241
|
"""
|
|
242
|
-
|
|
243
|
-
|
|
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
|
+
)
|
|
244
261
|
|
|
245
262
|
name = topography_source["name"] # type: ignore[index]
|
|
246
263
|
|
|
@@ -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,15 +10,15 @@ 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.lat_lon_datasets import (
|
|
13
|
+
from roms_tools.datasets.lat_lon_datasets import (
|
|
17
14
|
CESMBGCDataset,
|
|
18
15
|
GLORYSDataset,
|
|
19
16
|
GLORYSDefaultDataset,
|
|
20
17
|
LatLonDataset,
|
|
21
18
|
UnifiedBGCDataset,
|
|
22
19
|
)
|
|
20
|
+
from roms_tools.plot import plot
|
|
21
|
+
from roms_tools.regrid import LateralRegridToROMS, VerticalRegridToROMS
|
|
23
22
|
from roms_tools.setup.utils import (
|
|
24
23
|
RawDataSource,
|
|
25
24
|
compute_barotropic_velocity,
|
|
@@ -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,12 +318,6 @@ 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
322
|
def _get_data(self, forcing_type=Literal["physics", "bgc"]) -> LatLonDataset:
|
|
330
323
|
"""Determine the correct `Dataset` type and return an instance.
|
|
@@ -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
|
roms_tools/setup/nesting.py
CHANGED
|
@@ -13,16 +13,16 @@ from roms_tools.plot import plot_nesting
|
|
|
13
13
|
from roms_tools.setup.topography import clip_depth
|
|
14
14
|
from roms_tools.setup.utils import (
|
|
15
15
|
Timed,
|
|
16
|
+
check_and_set_boundaries,
|
|
16
17
|
from_yaml,
|
|
17
18
|
get_boundary_coords,
|
|
18
19
|
interpolate_from_rho_to_u,
|
|
19
20
|
interpolate_from_rho_to_v,
|
|
20
21
|
pop_grid_data,
|
|
21
22
|
to_dict,
|
|
22
|
-
wrap_longitudes,
|
|
23
23
|
write_to_yaml,
|
|
24
24
|
)
|
|
25
|
-
from roms_tools.utils import save_datasets
|
|
25
|
+
from roms_tools.utils import save_datasets, wrap_longitudes
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
@dataclass(kw_only=True)
|
|
@@ -43,8 +43,8 @@ class ChildGrid(Grid):
|
|
|
43
43
|
parent_grid : Grid
|
|
44
44
|
The parent grid object, providing the reference for the topography and mask of the child grid.
|
|
45
45
|
boundaries : Dict[str, bool]
|
|
46
|
-
Specifies which child grid boundaries (south, east, north, west) should be adjusted for topography/mask
|
|
47
|
-
and included in `ds_nesting`.
|
|
46
|
+
Specifies which child grid boundaries ('south', 'east', 'north', 'west') should be adjusted for topography/mask
|
|
47
|
+
and included in `ds_nesting`. If not provided, valid (non-land) boundaries are enabled automatically.
|
|
48
48
|
metadata : Dict[str, Any]
|
|
49
49
|
Dictionary configuring the boundary nesting process, including:
|
|
50
50
|
|
|
@@ -87,6 +87,10 @@ class ChildGrid(Grid):
|
|
|
87
87
|
"=== Mapping the child grid boundary points onto the indices of the parent grid ===",
|
|
88
88
|
verbose=verbose,
|
|
89
89
|
):
|
|
90
|
+
self.boundaries = check_and_set_boundaries(
|
|
91
|
+
self.boundaries, self.ds.mask_rho
|
|
92
|
+
)
|
|
93
|
+
|
|
90
94
|
# Prepare parent and child grid datasets by adjusting longitudes for dateline crossing
|
|
91
95
|
parent_grid_ds, child_grid_ds = self._prepare_grid_datasets()
|
|
92
96
|
|
|
@@ -11,16 +11,16 @@ import xarray as xr
|
|
|
11
11
|
|
|
12
12
|
from roms_tools import Grid
|
|
13
13
|
from roms_tools.constants import MAX_DISTINCT_COLORS
|
|
14
|
+
from roms_tools.datasets.river_datasets import (
|
|
15
|
+
DaiRiverDataset,
|
|
16
|
+
get_indices_of_nearest_grid_cell_for_rivers,
|
|
17
|
+
)
|
|
14
18
|
from roms_tools.plot import (
|
|
15
19
|
assign_category_colors,
|
|
16
20
|
get_projection,
|
|
17
21
|
plot_2d_horizontal_field,
|
|
18
22
|
plot_location,
|
|
19
23
|
)
|
|
20
|
-
from roms_tools.setup.river_datasets import (
|
|
21
|
-
DaiRiverDataset,
|
|
22
|
-
get_indices_of_nearest_grid_cell_for_rivers,
|
|
23
|
-
)
|
|
24
24
|
from roms_tools.setup.utils import (
|
|
25
25
|
RawDataSource,
|
|
26
26
|
add_time_info_to_ds,
|
|
@@ -8,9 +8,7 @@ import numpy as np
|
|
|
8
8
|
import xarray as xr
|
|
9
9
|
|
|
10
10
|
from roms_tools import Grid
|
|
11
|
-
from roms_tools.
|
|
12
|
-
from roms_tools.regrid import LateralRegridToROMS
|
|
13
|
-
from roms_tools.setup.lat_lon_datasets import (
|
|
11
|
+
from roms_tools.datasets.lat_lon_datasets import (
|
|
14
12
|
CESMBGCSurfaceForcingDataset,
|
|
15
13
|
ERA5ARCODataset,
|
|
16
14
|
ERA5Correction,
|
|
@@ -18,6 +16,8 @@ from roms_tools.setup.lat_lon_datasets import (
|
|
|
18
16
|
LatLonDataset,
|
|
19
17
|
UnifiedBGCSurfaceDataset,
|
|
20
18
|
)
|
|
19
|
+
from roms_tools.plot import plot
|
|
20
|
+
from roms_tools.regrid import LateralRegridToROMS
|
|
21
21
|
from roms_tools.setup.utils import (
|
|
22
22
|
RawDataSource,
|
|
23
23
|
add_time_info_to_ds,
|
|
@@ -26,7 +26,6 @@ from roms_tools.setup.utils import (
|
|
|
26
26
|
get_target_coords,
|
|
27
27
|
get_variable_metadata,
|
|
28
28
|
group_dataset,
|
|
29
|
-
interpolate_from_climatology,
|
|
30
29
|
min_dist_to_land,
|
|
31
30
|
nan_check,
|
|
32
31
|
rotate_velocities,
|
|
@@ -34,7 +33,11 @@ from roms_tools.setup.utils import (
|
|
|
34
33
|
to_dict,
|
|
35
34
|
write_to_yaml,
|
|
36
35
|
)
|
|
37
|
-
from roms_tools.utils import
|
|
36
|
+
from roms_tools.utils import (
|
|
37
|
+
interpolate_from_climatology,
|
|
38
|
+
save_datasets,
|
|
39
|
+
transpose_dimensions,
|
|
40
|
+
)
|
|
38
41
|
|
|
39
42
|
DEFAULT_ERA5_ARCO_PATH = (
|
|
40
43
|
"gs://gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3"
|
|
@@ -461,8 +464,9 @@ class SurfaceForcing:
|
|
|
461
464
|
corr_factor = xr.concat(
|
|
462
465
|
[
|
|
463
466
|
interpolate_from_climatology(
|
|
464
|
-
correction_data.ds[correction_data.var_names["swr_corr"]],
|
|
465
|
-
correction_data.dim_names["time"],
|
|
467
|
+
field=correction_data.ds[correction_data.var_names["swr_corr"]],
|
|
468
|
+
time_dim=correction_data.dim_names["time"],
|
|
469
|
+
time_coord=correction_data.dim_names["time"],
|
|
466
470
|
time=time,
|
|
467
471
|
)
|
|
468
472
|
for time in radiation.time
|
|
@@ -472,8 +476,9 @@ class SurfaceForcing:
|
|
|
472
476
|
else:
|
|
473
477
|
# Interpolate across all time steps at once
|
|
474
478
|
corr_factor = interpolate_from_climatology(
|
|
475
|
-
correction_data.ds[correction_data.var_names["swr_corr"]],
|
|
476
|
-
correction_data.dim_names["time"],
|
|
479
|
+
field=correction_data.ds[correction_data.var_names["swr_corr"]],
|
|
480
|
+
time_dim=correction_data.dim_names["time"],
|
|
481
|
+
time_coord=correction_data.dim_names["time"],
|
|
477
482
|
time=radiation.time,
|
|
478
483
|
)
|
|
479
484
|
|
roms_tools/setup/tides.py
CHANGED
|
@@ -7,9 +7,9 @@ import numpy as np
|
|
|
7
7
|
import xarray as xr
|
|
8
8
|
|
|
9
9
|
from roms_tools import Grid
|
|
10
|
+
from roms_tools.datasets.lat_lon_datasets import TPXOManager
|
|
10
11
|
from roms_tools.plot import plot
|
|
11
12
|
from roms_tools.regrid import LateralRegridToROMS
|
|
12
|
-
from roms_tools.setup.lat_lon_datasets import TPXOManager
|
|
13
13
|
from roms_tools.setup.utils import (
|
|
14
14
|
from_yaml,
|
|
15
15
|
get_target_coords,
|
roms_tools/setup/topography.py
CHANGED
|
@@ -7,8 +7,12 @@ import gcm_filters
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
import xarray as xr
|
|
9
9
|
|
|
10
|
+
from roms_tools.datasets.lat_lon_datasets import (
|
|
11
|
+
EMODDataset,
|
|
12
|
+
ETOPO5Dataset,
|
|
13
|
+
SRTM15Dataset,
|
|
14
|
+
)
|
|
10
15
|
from roms_tools.regrid import LateralRegridToROMS
|
|
11
|
-
from roms_tools.setup.lat_lon_datasets import ETOPO5Dataset, SRTM15Dataset
|
|
12
16
|
from roms_tools.setup.utils import handle_boundaries
|
|
13
17
|
|
|
14
18
|
|
|
@@ -115,9 +119,12 @@ def _get_topography_data(source):
|
|
|
115
119
|
elif source["name"] == "SRTM15":
|
|
116
120
|
kwargs["filename"] = source["path"]
|
|
117
121
|
data = SRTM15Dataset(**kwargs)
|
|
122
|
+
elif source["name"] == "EMOD":
|
|
123
|
+
kwargs["filename"] = source["path"]
|
|
124
|
+
data = EMODDataset(**kwargs)
|
|
118
125
|
else:
|
|
119
126
|
raise ValueError(
|
|
120
|
-
'Only "ETOPO5" and "
|
|
127
|
+
'Only "ETOPO5", "SRTM15" and "EMOD" are valid options for topography_source["name"].'
|
|
121
128
|
)
|
|
122
129
|
|
|
123
130
|
return data
|
|
@@ -147,6 +154,7 @@ def _make_raw_topography(
|
|
|
147
154
|
data.choose_subdomain(target_coords, buffer_points=3, verbose=verbose)
|
|
148
155
|
# Enforce double precision to ensure reproducibility
|
|
149
156
|
data.convert_to_float64()
|
|
157
|
+
data.apply_lateral_fill()
|
|
150
158
|
|
|
151
159
|
if verbose:
|
|
152
160
|
start_time = time.time()
|