Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path naming fixes #102

Merged
merged 2 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmip6_downscaling/analysis/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def qaqc_checks(ds: xr.Dataset) -> Tuple[xr.Dataset, xr.Dataset]:
return annual_qaqc_ts, qaqc_maps


def monthly_summary(ds: xr.Dataset) -> xr.Dataset:
def monthly_summary(ds: xr.Dataset, **kwargs) -> xr.Dataset:
"""Creates an monthly summary dataset.

Parameters
Expand All @@ -66,7 +66,7 @@ def monthly_summary(ds: xr.Dataset) -> xr.Dataset:
return out_ds


def annual_summary(ds: xr.Dataset) -> xr.Dataset:
def annual_summary(ds: xr.Dataset, **kwargs) -> xr.Dataset:
"""Creates an annual summary dataset.

Parameters
Expand Down
23 changes: 22 additions & 1 deletion cmip6_downscaling/workflows/bcsd_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@
predict_period=predict_period,
bbox=bbox,
obs_identifier=obs_identifier,
chunking_approach='full_space',
gcm_grid_spec=gcm_grid_spec,
)

spatial_anomalies_ds = get_spatial_anomalies_task(
Expand All @@ -187,6 +189,7 @@
predict_period=predict_period,
bbox=bbox,
obs_identifier=obs_identifier,
gcm_grid_spec=gcm_grid_spec,
)

# the next three tasks prepare the inputs required by bcsd
Expand All @@ -199,6 +202,8 @@
predict_period=predict_period,
bbox=bbox,
obs_identifier=obs_identifier,
chunking_approach='full_time',
gcm_grid_spec=gcm_grid_spec,
)

gcm_train_subset_full_time_ds = return_gcm_train_full_time_task(
Expand Down Expand Up @@ -257,9 +262,25 @@

monthly_summary_ds = monthly_summary_task(
postprocess_bcsd_ds,
gcm=gcm,
scenario=scenario,
variable=variable,
train_period=train_period,
predict_period=predict_period,
bbox=bbox,
gcm_identifier=gcm_identifier,
)

annual_summary_ds = annual_summary_task(postprocess_bcsd_ds)
annual_summary_ds = annual_summary_task(
postprocess_bcsd_ds,
gcm=gcm,
scenario=scenario,
variable=variable,
train_period=train_period,
predict_period=predict_period,
bbox=bbox,
gcm_identifier=gcm_identifier,
)

pyramid_location_monthly = pyramid.regrid(
monthly_summary_ds, uri=config.get('storage.results.uri') + pyramid_path_monthly
Expand Down
14 changes: 8 additions & 6 deletions cmip6_downscaling/workflows/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ def make_rechunked_obs_path(
if obs_identifier is None:
obs_identifier = build_obs_identifier(**kwargs)

return f"rechunked_obs/{obs_identifier}_{chunking_approach}.zarr"
return f"rechunked_obs/{obs_identifier}{chunking_approach}.zarr"


def make_coarse_obs_path(obs_identifier: str, **kwargs) -> str:
def make_coarse_obs_path(
chunking_approach: str, obs_identifier: str, gcm_grid_spec: str, **kwargs
) -> str:
"""Build the path for coarsened observation

Parameters
Expand All @@ -124,7 +126,7 @@ def make_coarse_obs_path(obs_identifier: str, **kwargs) -> str:
Path to which coarsened observation defined by the parameters should be stored
"""

return f"coarsened_obs/{obs_identifier}.zarr"
return f"coarsened_obs/{obs_identifier}{chunking_approach}_{gcm_grid_spec}.zarr"


def make_interpolated_obs_path(
Expand All @@ -148,7 +150,7 @@ def make_interpolated_obs_path(
"""
if obs_identifier is None:
obs_identifier = build_obs_identifier(**kwargs)
return f"interpolated_obs/{obs_identifier}_{chunking_approach}_{gcm_grid_spec}.zarr"
return f"interpolated_obs/{obs_identifier}{chunking_approach}_{gcm_grid_spec}.zarr"


def make_interpolated_gcm_path(
Expand Down Expand Up @@ -521,7 +523,7 @@ def make_return_obs_path(obs_identifier: str, **kwargs) -> str:
return f"obs_ds/{obs_identifier}.zarr"


def make_spatial_anomalies_path(obs_identifier: str, **kwargs) -> str:
def make_spatial_anomalies_path(obs_identifier: str, gcm_grid_spec: str, **kwargs) -> str:
"""Build the path for spatial anomalies

Parameters
Expand All @@ -534,7 +536,7 @@ def make_spatial_anomalies_path(obs_identifier: str, **kwargs) -> str:
spatial_anomalies_path : str
Path to bcsd spatial anomalies file location
"""
return f"spatial_anomalies/{obs_identifier}.zarr"
return f"spatial_anomalies/{obs_identifier}{gcm_grid_spec}.zarr"


def make_gcm_predict_path(gcm_identifier: str = None, **kwargs) -> str:
Expand Down