Repository: climate Updated Branches: refs/heads/master 8b5de9c41 -> 2d30ef8ed
CLIMATE-465 Add class level documentation and Apache license to examples Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/7d6f5ae8 Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/7d6f5ae8 Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/7d6f5ae8 Branch: refs/heads/master Commit: 7d6f5ae8abc9d37cfdace59080da1c54ff7f71e4 Parents: d41041f Author: Michael Anderson <michaelanderson@Michaels-iMac.local> Authored: Sun Nov 26 16:30:10 2017 -0500 Committer: Michael Anderson <michaelanderson@Michaels-iMac.local> Committed: Sun Nov 26 16:30:10 2017 -0500 ---------------------------------------------------------------------- examples/GPM_WRF24_JPDF_comparison.py | 26 +++++++++++ examples/draw_climatology_map_MISR_AOD.py | 26 +++++++++++ examples/esgf_integration_example.py | 15 +++++++ examples/knmi_to_cru31_full_bias.py | 32 ++++++++++++++ examples/model_ensemble_to_rcmed.py | 32 ++++++++++++++ examples/multi_model_evaluation.py | 36 +++++++++++++++ examples/multi_model_taylor_diagram.py | 51 ++++++++++++++++++++++ examples/podaac_integration_example.py | 21 +++++++++ examples/simple_model_to_model_bias.py | 29 ++++++++++++ examples/simple_model_tstd.py | 24 ++++++++++ examples/subregions_portrait_diagram.py | 39 +++++++++++++++++ examples/subregions_rectangular_boundaries.py | 17 ++++++++ examples/subset_TRMM_data_for_NCA_regions.py | 25 ++++++++++- examples/taylor_diagram_example.py | 31 +++++++++++++ examples/temperature_trends_over_CONUS.py | 25 +++++++++++ examples/time_series_with_regions.py | 47 ++++++++++++++++---- 16 files changed, 466 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/GPM_WRF24_JPDF_comparison.py ---------------------------------------------------------------------- diff --git a/examples/GPM_WRF24_JPDF_comparison.py b/examples/GPM_WRF24_JPDF_comparison.py index 20b070e..45eee89 100644 --- a/examples/GPM_WRF24_JPDF_comparison.py +++ b/examples/GPM_WRF24_JPDF_comparison.py @@ -15,6 +15,32 @@ # specific language governing permissions and limitations # under the License. +""" + GPM_WRF24_JPDF_comparison.py + + This is an example of calculating the joint probability distribution + function of rainfall intensity and duration for the Northern Great + Plains using GPM IMERG data for June/01/2015 + + In this example: + + 1. Load the GPM and WRF24 datasets with spatial filter. + 2. Load the spatial filter (Bukovsky region mask). + 3. Spatially subset the WRF data. + 4. Analyze the wet spells. + 5. Calculate the joint PDF(JPDF) of spell_duration and peak_rainfall. + 6. Visualize the JPDF. + + OCW modules demonstrated: + + 1. datasource/local + 2. dataset + 3. dataset_processor + 4. metrics + 5. plotter + +""" + from ocw.dataset import Bounds import ocw.data_source.local as local import ocw.dataset_processor as dsp http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/draw_climatology_map_MISR_AOD.py ---------------------------------------------------------------------- diff --git a/examples/draw_climatology_map_MISR_AOD.py b/examples/draw_climatology_map_MISR_AOD.py index 979c0f5..c75d3b3 100644 --- a/examples/draw_climatology_map_MISR_AOD.py +++ b/examples/draw_climatology_map_MISR_AOD.py @@ -15,6 +15,32 @@ # specific language governing permissions and limitations # under the License. +""" + draw_climatology_map_MISR_AOD.py + + Use OCW to download an MISR dataset, subset the data, calculate the 16 and 5 year + mean and draw a countour map of the means and the current values. + + In this example: + + 1. Download a dataset from https://dx.doi.org/10.6084/m9.figshare.3753321.v1. + *** Note *** The dataset for this example is not downloaded as part of the example + and must be downloaded to examples directory before running the example. + *** Note *** Depending on the OS on which the example is being run, the download + may remove the - in the filename. Rename the file appropriately. + 2. Subset the data set (lat / lon / start date / end date). + 3. Calculate the 16, 5 and 1 year mean. + 4. Draw a three contour maps using the calculated means and current values. + + OCW modules demonstrated: + + 1. datasource/local + 2. dataset + 3. dataset_processor + 4. plotter + +""" + import ocw.dataset as ds import ocw.data_source.local as local import ocw.dataset_processor as dsp http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/esgf_integration_example.py ---------------------------------------------------------------------- diff --git a/examples/esgf_integration_example.py b/examples/esgf_integration_example.py index 8247435..e939927 100644 --- a/examples/esgf_integration_example.py +++ b/examples/esgf_integration_example.py @@ -15,6 +15,21 @@ # specific language governing permissions and limitations # under the License. +""" + esgf_integration_example.py + + Use OCW to download an ESGF dataset into the common format of an OCW dataset object. + + In this example: + + 1. Download an ESGF (https://esgf.llnl.gov/) dataset and load it into a OCW dataset object. + + OCW modules demonstrated: + + 1. datasource/esgf + +""" + import ocw.data_source.esgf as esgf from getpass import getpass import ssl http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/knmi_to_cru31_full_bias.py ---------------------------------------------------------------------- diff --git a/examples/knmi_to_cru31_full_bias.py b/examples/knmi_to_cru31_full_bias.py index 95b64a8..13b5686 100644 --- a/examples/knmi_to_cru31_full_bias.py +++ b/examples/knmi_to_cru31_full_bias.py @@ -15,6 +15,38 @@ # specific language governing permissions and limitations # under the License. +""" + knmi_to_cru31_full_bias.py + + Use OCW to download, evaluate and plot (contour map) a dataset + against a reference dataset and OCW standard metrics (bias). + + In this example: + + 1. Download a netCDF files from a local site. + AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc + 2. Load the local files into OCW dataset objects. + 3. Interface with the Regional Climate Model Evalutaion Database (https://rcmes.jpl.nasa.gov/) + to load the CRU3.1 Daily-Max Temp dataset (https://rcmes.jpl.nasa.gov/content/cru31). + 4. Process each dataset to the same same shape. + 5. Temporally rebin the datasets to a single timestep. + 6. Spatially regrid the dataset objects to a 1/2 degree grid. + 7. Build a bias metric to use for evaluation use the standard OCW metric set. + 8. Create an evaluation object using the datasets and metric. + 9. Plot the results of the evaluation (contour map). + + OCW modules demonstrated: + + 1. datasource/local + 2. datasource/rcmed + 3. dataset + 4. dataset_processor + 5. evaluation + 6. metrics + 7. plotter + +""" + import datetime import urllib from os import path http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/model_ensemble_to_rcmed.py ---------------------------------------------------------------------- diff --git a/examples/model_ensemble_to_rcmed.py b/examples/model_ensemble_to_rcmed.py index e8e3dbe..185aa2e 100644 --- a/examples/model_ensemble_to_rcmed.py +++ b/examples/model_ensemble_to_rcmed.py @@ -15,6 +15,38 @@ # specific language governing permissions and limitations # under the License. +""" + model_ensemble_to_rcmed.py + + Use OCW to download, evaluate and plot (contour map) two datasets + against a reference dataset and OCW standard metrics (bias). + + In this example: + + 1. Download two netCDF files from a local site. + AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc + AFRICA_UC-WRF311_CTL_ERAINT_MM_50km-rg_1989-2008_tasmax.nc + 2. Load the local files into OCW dataset objects. + 3. Interface with the Regional Climate Model Evaluation Database (https://rcmes.jpl.nasa.gov/) + to load the CRU3.1 Daily-Max Temp dataset (https://rcmes.jpl.nasa.gov/content/cru31). + 4. Temporally rebin the datasets to annual. + 5. Spatially regrid the dataset objects to a 1/2 degree grid. + 6. Build a bias metric to use for evaluation use the standard OCW metric set. + 7. Create an evaluation object using the datasets and metric. + 8. Plot the results of the evaluation (contour map). + + OCW modules demonstrated: + + 1. datasource/local + 2. datasource/rcmed + 3. dataset + 4. dataset_processor + 5. metrics + 6. evaluation + 7. plotter + +""" + import datetime import math import urllib http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/multi_model_evaluation.py ---------------------------------------------------------------------- diff --git a/examples/multi_model_evaluation.py b/examples/multi_model_evaluation.py index 7756cc9..ba6ad56 100644 --- a/examples/multi_model_evaluation.py +++ b/examples/multi_model_evaluation.py @@ -15,6 +15,42 @@ # specific language governing permissions and limitations # under the License. +""" + multi_model_evaluation.py + + Use OCW to download, evaluate and plot (contour map) two datasets + against a reference dataset and OCW standard metrics. + + In this example: + + 1. Download two netCDF files from a local site. + AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_pr.nc + AFRICA_UCT-PRECIS_CTL_ERAINT_MM_50km_1989-2008_pr.nc + 2. Load the local files into OCW dataset objects. + 3. Interface with the Regional Climate Model Evaluation Database (https://rcmes.jpl.nasa.gov/) + to load the CRU3.1 Daily Precipitation dataset (https://rcmes.jpl.nasa.gov/content/cru31). + 4. Process each dataset to the same same shape. + a.) Restrict the datasets re: geographic and time boundaries. + b.) Convert the dataset water flux to common units. + c.) Normalize the dataset date / times to monthly. + d.) Spatially regrid each dataset. + 5. Calculate the mean annual value for each dataset. + 6. Evaluate the datasets against the reference data set and OCW standard metric and plot + a contour map. + + OCW modules demonstrated: + + 1. datasource/local + 2. datasource/rcmed + 3. dataset + 4. dataset_processor + 5. metrics + 6. evaluation + 7. plotter + 8. utils + +""" + import datetime import urllib import numpy as np http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/multi_model_taylor_diagram.py ---------------------------------------------------------------------- diff --git a/examples/multi_model_taylor_diagram.py b/examples/multi_model_taylor_diagram.py index 31d4020..8edee7b 100644 --- a/examples/multi_model_taylor_diagram.py +++ b/examples/multi_model_taylor_diagram.py @@ -1,3 +1,54 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +""" + multi_model_taylor_diagram.py + + Use OCW to download, normalize and evaluate three datasets + against a reference dataset and OCW standard metrics + drawing a Taylor diagram of the results of the evaluation. + + In this example: + + 1. Download three netCDF files from a local site. + AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_pr.nc + AFRICA_ICTP-REGCM3_CTL_ERAINT_MM_50km-rg_1989-2008_pr.nc + AFRICA_UCT-PRECIS_CTL_ERAINT_MM_50km_1989-2008_pr.nc + 2. Load the local files into OCW dataset objects. + 3. Process each dataset to the same same shape. + a.) Restrict the datasets re: geographic and time boundaries. + b.) Temporally rebin the data (monthly). + c.) Spatially regrid each dataset. + 4. Extract the metrics used for the evaluation and evaluate + against a reference dataset and standard OCW metrics. + 5. Draw evaluation results Taylor diagram. + + OCW modules demonstrated: + + 1. datasource/local + 2. dataset + 3. dataset_processor + 4. evaluation + 5. metrics + 6. plotter + 7. utils + +""" + # Apache OCW lib immports from ocw.dataset import Dataset, Bounds import ocw.data_source.local as local http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/podaac_integration_example.py ---------------------------------------------------------------------- diff --git a/examples/podaac_integration_example.py b/examples/podaac_integration_example.py index 61663d7..be85884 100644 --- a/examples/podaac_integration_example.py +++ b/examples/podaac_integration_example.py @@ -15,6 +15,27 @@ # specific language governing permissions and limitations # under the License. +""" + podaac_integration_example.py + + Use OCW to download a PODACC dataset, evaluate and plot (contour map). + + In this example: + + 1. Download a remote PO.DAAC (https://podaac.jpl.nasa.gov/) dataset + and read it into an OCW dataset object. + 2. Create a temporal STD metric using one of the OCW standard metrics. + 3. Evaluate the dataset against the metric and plot a contour map. + + OCW modules demonstrated: + + 1. datasource/podaac_datasource + 2. metrics + 3. evaluation + 4. plotter + +""" + import ocw.data_source.podaac_datasource as podaac import ocw.evaluation as evaluation import ocw.metrics as metrics http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/simple_model_to_model_bias.py ---------------------------------------------------------------------- diff --git a/examples/simple_model_to_model_bias.py b/examples/simple_model_to_model_bias.py index 8e834b6..ad1f29b 100644 --- a/examples/simple_model_to_model_bias.py +++ b/examples/simple_model_to_model_bias.py @@ -15,6 +15,35 @@ # specific language governing permissions and limitations # under the License. +""" + simple_model_to_model_bias.py + + Use OCW to download, normalize and evaluate two datasets + against an OCW metric (bias) and plot the results of the + evaluation (contour map). + + In this example: + + 1. Download two netCDF files from a local site. + AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc + AFRICA_UC-WRF311_CTL_ERAINT_MM_50km-rg_1989-2008_tasmax.nc + 2. Load the local files into OCW dataset objects. + 3. Temporally rebin the data anually. + 4. Spatially regrid the dataset objects to a 1 degree grid. + 5. Build a bias metric to use for evaluation use the standard OCW metric set. + 6. Create an evaluation object using the datasets and metric. + 7. Plot the results of the evaluation (contour map). + + OCW modules demonstrated: + + 1. datasource/local + 2. dataset_processor + 3. evaluation + 4. metrics + 5. plotter + +""" + import datetime from os import path import sys http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/simple_model_tstd.py ---------------------------------------------------------------------- diff --git a/examples/simple_model_tstd.py b/examples/simple_model_tstd.py index fb3ce48..6412493 100644 --- a/examples/simple_model_tstd.py +++ b/examples/simple_model_tstd.py @@ -15,6 +15,30 @@ # specific language governing permissions and limitations # under the License. +""" + simple_model_tstd.py + + Use OCW to download, evaluate against a OCW standard + metrics (temporal STD) and plot the results (contour map). + + In this example: + + 1. Download a netCDF files from a local site. + AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc + 2. Load the local file into OCW dataset objects. + 3. Use the standard OCW metrics to build a metric against which to evaluation (temporal STD). + 4. Create an evaluation object of the dataset vs. the metric. + 5. Plot the results of the evaluation using a contour map. + + OCW modules demonstrated: + + 1. datasource/local + 2. metrics + 3. evaluation + 4. plotter + +""" + from os import path import urllib http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/subregions_portrait_diagram.py ---------------------------------------------------------------------- diff --git a/examples/subregions_portrait_diagram.py b/examples/subregions_portrait_diagram.py index a6d3c14..3e6785c 100644 --- a/examples/subregions_portrait_diagram.py +++ b/examples/subregions_portrait_diagram.py @@ -15,6 +15,45 @@ # specific language governing permissions and limitations # under the License. +""" + subregions_portrait_diagram.py + + Use OCW to download, normalize, evaluate and plot (portrait diagram) + three local datasets against a reference dataset. + + In this example: + + 1. Download three netCDF files from a local site. + AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_pr.nc + AFRICA_ICTP-REGCM3_CTL_ERAINT_MM_50km-rg_1989-2008_pr.nc + AFRICA_UCT-PRECIS_CTL_ERAINT_MM_50km_1989-2008_pr.nc + 2. Load the local files into OCW dataset objects. + 3. Interface with the Regional Climate Model Evaluation Database (https://rcmes.jpl.nasa.gov/) + to load the CRU3.1 Daily Precipitation dataset (https://rcmes.jpl.nasa.gov/content/cru31). + 4. Process each dataset to the same same shape. + a.) Restrict the datasets re: geographic and time boundaries. + b.) Convert the dataset water flux to common units. + c.) Normalize the dataset date / times to monthly. + d.) Spatially regrid each dataset. + 5. Calculate the mean annual value for each dataset. + 6. Separate each dataset into 13 subregions. + 7. Extract the metrics used for the evaluation and evaluate + against a reference dataset. + 8. Create a portrait diagram of the results of the evaluation. + + OCW modules demonstrated: + + 1. datasource/local + 2. datasource/rcmed + 3. dataset + 4. dataset_processor + 5. metrics + 6. evaluation + 7. plotter + 8. utils + +""" + from os import path import urllib import ssl http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/subregions_rectangular_boundaries.py ---------------------------------------------------------------------- diff --git a/examples/subregions_rectangular_boundaries.py b/examples/subregions_rectangular_boundaries.py index 37eb884..cf396bc 100644 --- a/examples/subregions_rectangular_boundaries.py +++ b/examples/subregions_rectangular_boundaries.py @@ -15,6 +15,23 @@ # specific language governing permissions and limitations # under the License. +""" + subregions_rectangular_boundaries.py + + Use OCW to define a set a sub regions and draw the sub regions. + + In this example: + + 1. Subset the data set (lat / lon / start date / end date). + 2. Draw each sub region. + + OCW modules demonstrated: + + 1. dataset (Bounds) + 2. plotter + +""" + import datetime import numpy as np http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/subset_TRMM_data_for_NCA_regions.py ---------------------------------------------------------------------- diff --git a/examples/subset_TRMM_data_for_NCA_regions.py b/examples/subset_TRMM_data_for_NCA_regions.py index 90b752b..4ae4300 100644 --- a/examples/subset_TRMM_data_for_NCA_regions.py +++ b/examples/subset_TRMM_data_for_NCA_regions.py @@ -15,9 +15,32 @@ # specific language governing permissions and limitations # under the License. +""" + subset_TRMM_data_for_NCA_regions.py + + Use OCW to subset TRMM data (https://pmm.nasa.gov/trmm) for NCA regions and draw + a contour map for the U.S. (CA', 'NV', 'UT', 'AZ', 'NM', 'CO'), Cuba and + the Bahamas (https://scenarios.globalchange.gov/regions_nca4). + + In this example: + + 1. Interface with the Regional Climate Model Evaluation Database (https://rcmes.jpl.nasa.gov/) + to load the TRMM dataset. + 2. Define the bounds for the U.S. (CA', 'NV', 'UT', 'AZ', 'NM', 'CO'), Cuba and the Bahamas and + the start date / end date. + 3. Create a contour map of the TRMM data for the U.S., Cuba, and Bahamas. + + OCW modules demonstrated: + + 1. datasource/rcmed + 2. dataset (Bounds) + 3. dataset_processor + 4. plotter + +""" + # Apache OCW lib immports import ocw.dataset_processor as dsp -import ocw.utils as utils from ocw.dataset import Bounds import ocw.data_source.rcmed as rcmed import ocw.plotter as plotter http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/taylor_diagram_example.py ---------------------------------------------------------------------- diff --git a/examples/taylor_diagram_example.py b/examples/taylor_diagram_example.py index 8d5bbf0..8f683c1 100644 --- a/examples/taylor_diagram_example.py +++ b/examples/taylor_diagram_example.py @@ -15,6 +15,37 @@ # specific language governing permissions and limitations # under the License. +""" + taylor_diagram_example.py + + Use OCW to download, normalize and evaluate two datasets + drawing a Taylor diagram of the results of the evaluation. + + In this example: + + 1. Download two netCDF files from a local site. + AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc + AFRICA_UC-WRF311_CTL_ERAINT_MM_50km-rg_1989-2008_tasmax.nc + 2. Load the local files into OCW dataset objects. + 3. Process each dataset to the same same shape. + a.) Restrict the datasets re: geographic and time boundaries. + b.) Temporally rebin the data (monthly). + c.) Spatially regrid each dataset. + 4. Extract the metrics used for the evaluation and evaluate + against a reference dataset. + 5. Draw evaluation results Taylor diagram. + + OCW modules demonstrated: + + 1. datasource/local + 2. dataset + 3. dataset_processor + 4. evaluation + 5. metrics + 6. plotter + +""" + import datetime import sys from os import path http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/temperature_trends_over_CONUS.py ---------------------------------------------------------------------- diff --git a/examples/temperature_trends_over_CONUS.py b/examples/temperature_trends_over_CONUS.py index 54f5843..028c8a2 100644 --- a/examples/temperature_trends_over_CONUS.py +++ b/examples/temperature_trends_over_CONUS.py @@ -15,6 +15,31 @@ # specific language governing permissions and limitations # under the License. +""" + temperature_trends_over_CONUS.py + + Use OCW to plot the temperature trends over CONUS using the nClimDiv reference data. + + In this example: + + 1. Load the local file nClimDiv/nClimDiv_tave_1895-2005.nc into OCW Dataset Objects. + *** Note *** It is assume this file exists locally in a subdirectory nClimDiv located + in the same directory as the example. + 2. Load the CMIP5 simulations into a list of OCW Dataset Objects. + 3. Spatially subset the observed dataset into state and regional boundaries. + 4. Temporally subset the observed and model datasets. + 5. Calculate and plot the temperature trend for each region. + + OCW modules demonstrated: + + 1. datasource/local + 2. dataset + 3. dataset_processor + 4. plotter + 5. utlis + +""" + import numpy as np import datetime http://git-wip-us.apache.org/repos/asf/climate/blob/7d6f5ae8/examples/time_series_with_regions.py ---------------------------------------------------------------------- diff --git a/examples/time_series_with_regions.py b/examples/time_series_with_regions.py index 0799cf0..d92599b 100644 --- a/examples/time_series_with_regions.py +++ b/examples/time_series_with_regions.py @@ -15,10 +15,38 @@ # specific language governing permissions and limitations # under the License. -''' - Download three netCDF files, process the files to be the same shape, - divide the data into subregions and plot a monthly time series for each sub region. -''' +""" + time_series_with_regions.py + + Use OCW to download and plot (time series) three local datasets against a reference dataset. + + In this example: + + 1. Download three netCDF files from a local site. + AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_pr.nc + AFRICA_ICTP-REGCM3_CTL_ERAINT_MM_50km-rg_1989-2008_pr.nc + AFRICA_UCT-PRECIS_CTL_ERAINT_MM_50km_1989-2008_pr.nc + 2. Load the local files into OCW dataset objects. + 3. Interface with the Regional Climate Model Evalutaion Database (https://rcmes.jpl.nasa.gov/) + to load the CRU3.1 Daily Precipitation dataset (https://rcmes.jpl.nasa.gov/content/cru31). + 4. Process each dataset to the same same shape. + a.) Restrict the datasets re: geographic and time boundaries. + b.) Convert the dataset water flux to common units. + c.) Normalize the dataset date / times to monthly. + d.) Spatially regrid each dataset. + 5. Calculate the mean monthly value for each dataset. + 6. Separate each dataset into 13 subregions. + 7. Create a time series for each dataset in each subregion. + + OCW modules demonstrated: + + 1. datasource/local + 2. datasource/rcmed + 3. dataset + 4. dataset_processor + 5. plotter + +""" import sys import datetime @@ -118,8 +146,8 @@ new_lons = np.arange(LON_MIN, LON_MAX, gridLonStep) CRU31 = dsp.spatial_regrid(CRU31, new_lats, new_lons) for member, each_target_dataset in enumerate(target_datasets): - target_datasets[member] = dsp.spatial_regrid( - target_datasets[member], new_lats, new_lons) + target_datasets[member] =\ + dsp.spatial_regrid(target_datasets[member], new_lats, new_lons) # Find climatology monthly for obs and models. CRU31.values, CRU31.times = utils.calc_climatology_monthly(CRU31) @@ -127,11 +155,12 @@ CRU31.values, CRU31.times = utils.calc_climatology_monthly(CRU31) # the xticks elegantly when the first date is the epoch and tries to determine # the start of the xticks based on a value < 1. for index, item in enumerate(CRU31.times): - CRU31.times[index] = datetime.date(item.year, item.month, monthrange(item.year, item.month)[1]) + CRU31.times[index] = \ + datetime.date(item.year, item.month, monthrange(item.year, item.month)[1]) for member, each_target_dataset in enumerate(target_datasets): - target_datasets[member].values, target_datasets[ - member].times = utils.calc_climatology_monthly(target_datasets[member]) + target_datasets[member].values, target_datasets[member].times = \ + utils.calc_climatology_monthly(target_datasets[member]) # make the model ensemble target_datasets_ensemble = dsp.ensemble(target_datasets)