Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge branch 'patch-1' of https://github.com/Kejia/climate
Browse files Browse the repository at this point in the history
  • Loading branch information
lewismc committed Aug 5, 2017
2 parents 800b924 + 60ec96a commit 6540643
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions RCMES/statistical_downscaling/run_statistical_downscaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ def extract_data_at_nearest_grid_point(target_dataset, longitude, latitude):
:rtype: Open Climate Workbench Dataset Object
"""

if target_dataset.lons.ndim == 1 and target_dataset.lats.ndim == 1:
if target_dataset.lons.ndim == target_dataset.lats.ndim == 1:
new_lon, new_lat = np.meshgrid(target_dataset.lons, target_dataset.lats)
elif target_dataset.lons.ndim == 2 and target_dataset.lats.ndim == 2:
elif target_dataset.lons.ndim == target_dataset.lats.ndim == 2:
new_lon = target_datasets.lons
new_lat = target_datasets.lats
distance = (new_lon - longitude)**2. + (new_lat - latitude)**2.
Expand Down Expand Up @@ -155,16 +155,9 @@ def extract_data_at_nearest_grid_point(target_dataset, longitude, latitude):

print(downscale_option_names[DOWNSCALE_OPTION]+": Downscaling model output")

if DOWNSCALE_OPTION == 1:
downscaled_model_present, downscaled_model_future = downscale.Delta_addition()
elif DOWNSCALE_OPTION == 2:
downscaled_model_present, downscaled_model_future = downscale.Delta_correction()
elif DOWNSCALE_OPTION == 3:
downscaled_model_present, downscaled_model_future = downscale.Quantile_mapping()
elif DOWNSCALE_OPTION == 4:
downscaled_model_present, downscaled_model_future = downscale.Asynchronous_regression()
else:
sys.exit("DOWNSCALE_OPTION must be an integer between 1 and 4")
xdownscale = [downscale.Delta_addition, downscale.Delta_correction, downscale.Quantile_mapping, downscale.Asynchronous_regression]
if 0 < DOWNSCALE_OPTION <= len(xdownscale): xdownscale[DOWNSCALE_OPTION - 1]()
else: sys.exit("DOWNSCALE_OPTION must be an integer between 1 and " + len(xdownscale))


""" Step 5: Create plots and spreadsheet """
Expand Down

0 comments on commit 6540643

Please sign in to comment.