You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by le...@apache.org on 2018/01/17 02:00:48 UTC
[1/2] climate git commit: CLIMATE-626 Update doc strings in
Downscaling class
Repository: climate
Updated Branches:
refs/heads/master 4c06b8c04 -> 69bbe2736
CLIMATE-626 Update doc strings in Downscaling class
Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/6a86e25d
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/6a86e25d
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/6a86e25d
Branch: refs/heads/master
Commit: 6a86e25d65179cdc0dccb6dc39d69edd41034cd9
Parents: 4cf79f3
Author: Michael Anderson <mi...@Michaels-iMac.local>
Authored: Sun Jan 7 21:03:59 2018 -0500
Committer: Michael Anderson <mi...@Michaels-iMac.local>
Committed: Sun Jan 7 21:03:59 2018 -0500
----------------------------------------------------------------------
docs/source/index.rst | 1 +
docs/source/ocw/statistical_downscaling.rst | 8 ++++
ocw/statistical_downscaling.py | 51 ++++++++++++++++--------
3 files changed, 44 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/climate/blob/6a86e25d/docs/source/index.rst
----------------------------------------------------------------------
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 2834ee6..9e73110 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -18,6 +18,7 @@ Contents:
ocw/evaluation
ocw/metrics
ocw/plotter
+ ocw/statistical_downscaling
ocw/utils
data_source/data_sources
ui-backend/backend
http://git-wip-us.apache.org/repos/asf/climate/blob/6a86e25d/docs/source/ocw/statistical_downscaling.rst
----------------------------------------------------------------------
diff --git a/docs/source/ocw/statistical_downscaling.rst b/docs/source/ocw/statistical_downscaling.rst
new file mode 100644
index 0000000..be63151
--- /dev/null
+++ b/docs/source/ocw/statistical_downscaling.rst
@@ -0,0 +1,8 @@
+Downscaling Module
+******************
+
+Downscaling
+===========
+.. autoclass:: statistical_downscaling.Downscaling
+ :members:
+
http://git-wip-us.apache.org/repos/asf/climate/blob/6a86e25d/ocw/statistical_downscaling.py
----------------------------------------------------------------------
diff --git a/ocw/statistical_downscaling.py b/ocw/statistical_downscaling.py
index 57013a0..f3d701f 100755
--- a/ocw/statistical_downscaling.py
+++ b/ocw/statistical_downscaling.py
@@ -15,23 +15,36 @@
# specific language governing permissions and limitations
# under the License.
+"""
+Classes:
+ Downscaling - Container for applying statistical downscaling.
+"""
+
-import ocw.utils as utils
import numpy as np
-from scipy.stats import percentileofscore, linregress
+from scipy.stats import linregress, percentileofscore
+
+class Downscaling(object):
+ """
+ Statistical downscaling infers higher resolution information from lower resolution data.
+ For example, data collected at a more coarse regional level applied to a more refined
+ local level.
-class Downscaling:
+ Statistical downscaling establishes a relationship between different variables in the large scale
+ and the local scale and applies that relationship to the local scale.
+ """
def __init__(self, ref_dataset, model_present, model_future):
- '''
+ """ Default Downscaling constructor.
+
:param ref_dataset: The Dataset to use as the reference dataset (observation)
:type ref_dataset: Dataset
:param model_present: model simulation to be compared with observation
:type model_present: Dataset
:param model_future: model simulation to be calibrated for prediction
:type model_future: Dataset
- '''
+ """
self.ref_dataset = ref_dataset[~ref_dataset.mask].ravel()
self.model_present = model_present.ravel()
self.model_future = model_future.ravel()
@@ -39,11 +52,11 @@ class Downscaling:
description = "statistical downscaling methods"
def Delta_addition(self):
- '''Calculate the mean difference between future and present simulation,
+ """Calculate the mean difference between future and present simulation,
then add the difference to the observed distribution
:returns: downscaled model_present and model_future
- '''
+ """
ref = self.ref_dataset
model_present = self.model_present
model_future = self.model_future
@@ -51,23 +64,26 @@ class Downscaling:
return model_present, ref + np.mean(model_future - model_present)
def Delta_correction(self):
- '''Calculate the mean difference between observation and present simulation,
+ """Calculate the mean difference between observation and present simulation,
then add the difference to the future distribution
:returns: downscaled model_present and model_future
- '''
+ """
ref = self.ref_dataset
model_present = self.model_present
model_future = self.model_future
- return model_present + np.mean(ref) - np.mean(model_present), model_future + np.mean(ref) - np.mean(model_present)
+ return model_present + np.mean(ref) - np.mean(model_present), model_future + \
+ np.mean(ref) - np.mean(model_present)
def Quantile_mapping(self):
- '''Remove the biases for each quantile value
- Wood et al (2004) HYDROLOGIC IMPLICATIONS OF DYNAMICAL AND STATISTICAL APPROACHES TO DOWNSCALING CLIMATE MODEL OUTPUTS
+ """Remove the biases for each quantile value
+
+ Wood et al (2004) HYDROLOGIC IMPLICATIONS OF DYNAMICAL
+ AND STATISTICAL APPROACHES TO DOWNSCALING CLIMATE MODEL OUTPUTS
:returns: downscaled model_present and model_future
- '''
+ """
ref = self.ref_dataset
model_present = self.model_present
model_present_corrected = np.zeros(model_present.size)
@@ -86,11 +102,14 @@ class Downscaling:
return model_present_corrected, model_future_corrected
def Asynchronous_regression(self):
- '''Remove the biases by fitting a linear regression model with ordered observational and model datasets
- Stoner et al (2013) An asynchronous regional regression model for statistical downscaling of daily climate variables
+ """Remove the biases by fitting a linear regression model with ordered observational and
+ model datasets
+
+ Stoner et al (2013) An asynchronous regional regression model for statistical downscaling of
+ daily climate variables
:returns: downscaled model_present and model_future
- '''
+ """
ref_original = self.ref_dataset
model_present = self.model_present
[2/2] climate git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/climate
Posted by le...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/climate
Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/69bbe273
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/69bbe273
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/69bbe273
Branch: refs/heads/master
Commit: 69bbe27362d6158ffa7123dc0debbac658001dd8
Parents: 6a86e25 4c06b8c
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Tue Jan 16 18:00:42 2018 -0800
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Tue Jan 16 18:00:42 2018 -0800
----------------------------------------------------------------------
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 | 144 +++++++++++-----
examples/subregions_rectangular_boundaries.py | 73 +++++---
examples/subset_TRMM_data_for_NCA_regions.py | 25 ++-
examples/taylor_diagram_example.py | 31 ++++
examples/temperature_trends_over_CONUS.py | 71 +++++---
examples/time_series_with_regions.py | 172 ++++++++++++-------
.../directives/predictivefilebrowserinput.js | 25 ++-
ocw/dataset_processor.py | 10 +-
ocw/plotter.py | 36 +++-
19 files changed, 717 insertions(+), 162 deletions(-)
----------------------------------------------------------------------