Skip to content

Commit

Permalink
Merge branch 'atmosphere' of https://github.com/mirzaees/dolphin into…
Browse files Browse the repository at this point in the history
… atmosphere
  • Loading branch information
Sara Mirzaee committed Jan 3, 2024
2 parents 8dc0fbd + 92a77c9 commit 516e1df
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 32 deletions.
25 changes: 5 additions & 20 deletions src/dolphin/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@

class TropoModel(Enum):
"""Enumeration representing different tropospheric models.
Attributes
----------
ERA5 (str): ERA5 Tropospheric Model.
HRES (str): HRES Tropospheric Model.
ERAINT (str): ERAINT Tropospheric Model.
ERAI (str): ERAI Tropospheric Model.
MERRA (str): MERRA Tropospheric Model.
NARR (str): NARR Tropospheric Model.
HRRR (str): HRRR Tropospheric Model.
GMAO (str): GMAO Tropospheric Model.
"""

ERA5 = "ERA5"
Expand All @@ -61,17 +50,13 @@ class TropoModel(Enum):


class TropoType(Enum):
"""Enumeration representing different tropospheric types.
Attributes
----------
WET (str): Wet Tropospheric Type.
DRY (str): Dry Tropospheric Type.
HYDROSTATIC (str): Hydrostatic Tropospheric Type.
COMB (str): Combined Tropospheric Type.
"""
"""Type of tropospheric delay."""

WET = "wet"
"""Wet tropospheric delay."""
DRY = "dry"
"""Dry delay (same as hydrostatic, named "dry" in PyAPS)"""
HYDROSTATIC = "hydrostatic"
"""Hydrostatic (same as dry, named differently in raider)"""
COMB = "comb"
"""Combined wet + dry delay."""
12 changes: 6 additions & 6 deletions src/dolphin/atmosphere/troposphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def prepare_geometry(

for ds_name in datasets:
outfile = geometry_dir / f"{ds_name}.tif"
print(f"Creating {outfile}")
logger.info(f"Creating {outfile}")
stitched_geo_list[ds_name] = outfile
ds_path = f"/data/{ds_name}"
cur_files = [io.format_nc_filename(f, ds_name=ds_path) for f in geo_files]
Expand All @@ -270,8 +270,8 @@ def prepare_geometry(
if dem_file:
height_file = geometry_dir / "height.tif"
stitched_geo_list["height"] = height_file
if not os.path.exists(height_file):
print(f"Creating {height_file}")
if not height_file.exists():
logger.info(f"Creating {height_file}")
stitching.warp_to_match(
input_file=dem_file,
match_file=matching_file,
Expand Down Expand Up @@ -309,7 +309,7 @@ def compute_pyaps(delay_parameters: DelayParams) -> np.ndarray:

tropo_delay_datacube_list = []

for indx, hgt in enumerate(delay_parameters.z_coordinates):
for hgt in delay_parameters.z_coordinates:
dem_datacube = np.full(lat_datacube.shape, hgt)

# Delay for the reference image
Expand Down Expand Up @@ -470,8 +470,8 @@ def compute_2d_delay(
Returns
-------
dict
Dictionary containing computed 2D delay.
np.ndarray
Computed 2D delay.
"""
dem_file = geo_files["height"]

Expand Down
17 changes: 11 additions & 6 deletions src/dolphin/workflows/_cli_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def create_config(
troposphere_files: list[str] = [],
tropo_date_fmt: str = "%Y%m%d",
tropo_package: str = "pyaps",
tropo_model: str = "ERA5",
tropo_delay_type: str = "comb",
tropo_model: TropoModel = TropoModel.ERA5,
tropo_delay_type: TropoType = TropoType.COMB,
ionosphere_files: list[str] = [],
geometry_files: list[str] = [],
dem_file: Optional[str] = None,
Expand Down Expand Up @@ -271,13 +271,18 @@ def get_parser(subparser=None, subcommand_name="run"):
)
correction_group.add_argument(
"--tropo-model",
default="ERA5",
help="source of the atmospheric model. Choices are: ERA5, ERAI, MERRA2, NARR, HRRR, GMAO, HRES",
"--tropo-model",
default=TropoModel.ERA5.value,
choices=[t.value for t in TropoType],
type=TropoModel,
help="source of the atmospheric model.",
)
correction_group.add_argument(
"--tropo-delay_type",
default="comb",
help="Tropospheric delay type to calculate, comb contains both wet and dry delays, Choices are: wet, dry, comb.",
default=TropoType.COMB.value,
type=TropoType,
help="Tropospheric delay type to calculate, comb contains both wet and dry delays",
choices=[t.value for t in TropoType],
)
correction_group.add_argument(
"--ionosphere-files",
Expand Down

0 comments on commit 516e1df

Please sign in to comment.