You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by hu...@apache.org on 2015/10/09 02:15:02 UTC
[1/5] climate git commit: CLIMATE-687 - A new loader to read GPM
precipitation data with a file list
Repository: climate
Updated Branches:
refs/heads/master 9263dc60c -> ece260d1c
CLIMATE-687 - A new loader to read GPM precipitation data with a file list
- ocw.data_source.local.load_GPM_IMERG_files is added
Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/32b184d7
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/32b184d7
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/32b184d7
Branch: refs/heads/master
Commit: 32b184d7c53d44b82d00e7ebf5da6cf46a0e8992
Parents: 9263dc6
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Wed Oct 7 16:40:33 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Wed Oct 7 16:40:33 2015 -0700
----------------------------------------------------------------------
ocw/data_source/local.py | 57 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/climate/blob/32b184d7/ocw/data_source/local.py
----------------------------------------------------------------------
diff --git a/ocw/data_source/local.py b/ocw/data_source/local.py
index 60fcb50..97e482b 100644
--- a/ocw/data_source/local.py
+++ b/ocw/data_source/local.py
@@ -27,6 +27,7 @@ from ocw.dataset import Dataset
import ocw.utils as utils
import netCDF4
+import h5py
import numpy
import numpy.ma as ma
@@ -330,3 +331,59 @@ def load_multiple_files(file_path,
lat_name=lat_name, lon_name=lon_name, time_name=time_name))
return datasets, data_name
+
+def load_GPM_IMERG_files(file_path=None,
+ filename_pattern=None,
+ filelist=None,
+ variable_name='precipitationCal',
+ name='GPM_IMERG'):
+ ''' Load multiple GPM Level 3 IMEGE files containing calibrated precipitation and generate an OCW Dataset obejct.
+ :param file_path: Directory to the HDF files to load.
+ :type file_path: :mod:`string`
+ :param filename_pattern: Path to the HDF files to load.
+ :type filename_pattern: :list:`string`
+ :param filelist: A list of filenames
+ :type filelist: :list:`string`
+ :param variable_name: The variable name to load from the HDF file.
+ :type variable_name: :mod:`string`
+ :param name: (Optional) A name for the loaded dataset.
+ :type name: :mod:`string`
+ :returns: An OCW Dataset object with the requested variable's data from
+ the HDF file.
+ :rtype: :class:`dataset.Dataset`
+ :raises ValueError:
+ '''
+
+ if not filelist:
+ GPM_files = []
+ for pattern in filename_pattern:
+ GPM_files.extend(glob(file_path + pattern))
+ else:
+ GPM_files = [line.rstrip('\n') for line in open(filelist)]
+
+ GPM_files.sort()
+
+ file_object_first = h5py.File(GPM_files[0])
+ lats = file_object_first['Grid']['lat'][:]
+ lons = file_object_first['Grid']['lon'][:]
+
+ lons, lats = np.meshgrid(lons, lats)
+
+ times = []
+ nfile = len(GPM_files)
+ for ifile, file in enumerate(GPM_files):
+ print 'Reading file '+str(ifile+1)+'/'+str(nfile), file
+ file_object = h5py.File(file)
+ time_struct_parsed = strptime(file[-39:-23],"%Y%m%d-S%H%M%S")
+ for ihour in numpy.arange(24):
+ times.append(datetime(*time_struct_parsed[:6]))
+ values0= ma.masked_less(file_object['Grid'][variable_name][:], 0.)
+ if ifile == 0:
+ values = values0
+ variable_unit = file_object.variables[variable_name].units
+ else:
+ values = numpy.concatenate((values, values0))
+ file_object.close()
+ times = numpy.array(times)
+ return Dataset(lats, lons, times, values, variable_name, units=variable_unit, name=name)
+
[3/5] climate git commit: CLIMATE-688 - Visualization and model
ensemble calculation in run_RCMES.py
Posted by hu...@apache.org.
CLIMATE-688 - Visualization and model ensemble calculation in run_RCMES.py
- color map for the bias map is changed
- the model ensemble is calculated only if there are multiple models
Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/965e7c45
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/965e7c45
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/965e7c45
Branch: refs/heads/master
Commit: 965e7c45d195928d0ad192e5c7a753dd82062a41
Parents: 491c78b
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Thu Oct 8 15:55:18 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Thu Oct 8 15:55:18 2015 -0700
----------------------------------------------------------------------
examples/configuration_file_examples/metrics_and_plots.py | 2 +-
examples/configuration_file_examples/run_RCMES.py | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/climate/blob/965e7c45/examples/configuration_file_examples/metrics_and_plots.py
----------------------------------------------------------------------
diff --git a/examples/configuration_file_examples/metrics_and_plots.py b/examples/configuration_file_examples/metrics_and_plots.py
index b564da5..f32446c 100644
--- a/examples/configuration_file_examples/metrics_and_plots.py
+++ b/examples/configuration_file_examples/metrics_and_plots.py
@@ -51,7 +51,7 @@ def Map_plot_bias_of_multiyear_climatology(obs_dataset, obs_name, model_datasets
m.drawcoastlines(linewidth=1)
m.drawcountries(linewidth=1)
m.drawstates(linewidth=0.5, color='w')
- max = m.contourf(x,y,obs_clim,levels = plotter._nice_intervals(obs_dataset.values, 10), extend='both',cmap='PuOr')
+ max = m.contourf(x,y,obs_clim,levels = plotter._nice_intervals(obs_dataset.values, 10), extend='both',cmap='rainbow')
ax.annotate('(a) \n' + obs_name,xy=(lon_min, lat_min))
cax = fig.add_axes([0.02, 1.-float(1./row), 0.01, 1./row*0.6])
plt.colorbar(max, cax = cax)
http://git-wip-us.apache.org/repos/asf/climate/blob/965e7c45/examples/configuration_file_examples/run_RCMES.py
----------------------------------------------------------------------
diff --git a/examples/configuration_file_examples/run_RCMES.py b/examples/configuration_file_examples/run_RCMES.py
index 6064c11..d32c7af 100644
--- a/examples/configuration_file_examples/run_RCMES.py
+++ b/examples/configuration_file_examples/run_RCMES.py
@@ -141,8 +141,9 @@ for idata,dataset in enumerate(model_datasets):
print 'Generating multi-model ensemble'
-model_datasets.append(dsp.ensemble(model_datasets))
-model_names.append('ENS-models')
+if len(model_datasets) >= 2.:
+ model_datasets.append(dsp.ensemble(model_datasets))
+ model_names.append('ENS')
""" Step 6: Generate subregion average and standard deviation """
if config['use_subregions']:
[2/5] climate git commit: CLIMATE-687 - A new loader to read GPM
precipitation data with a file list
Posted by hu...@apache.org.
CLIMATE-687 - A new loader to read GPM precipitation data with a file list
- ocw.data_source.local.load_GPM_IMERG_files is added
Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/491c78ba
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/491c78ba
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/491c78ba
Branch: refs/heads/master
Commit: 491c78ba884493c7e7200dd80101d261e9883e5f
Parents: 32b184d
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Wed Oct 7 18:09:57 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Wed Oct 7 18:09:57 2015 -0700
----------------------------------------------------------------------
ocw/data_source/local.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/climate/blob/491c78ba/ocw/data_source/local.py
----------------------------------------------------------------------
diff --git a/ocw/data_source/local.py b/ocw/data_source/local.py
index 97e482b..766eb8f 100644
--- a/ocw/data_source/local.py
+++ b/ocw/data_source/local.py
@@ -367,7 +367,9 @@ def load_GPM_IMERG_files(file_path=None,
lats = file_object_first['Grid']['lat'][:]
lons = file_object_first['Grid']['lon'][:]
- lons, lats = np.meshgrid(lons, lats)
+ lons, lats = numpy.meshgrid(lons, lats)
+
+ variable_unit = "mm/hr"
times = []
nfile = len(GPM_files)
@@ -375,12 +377,11 @@ def load_GPM_IMERG_files(file_path=None,
print 'Reading file '+str(ifile+1)+'/'+str(nfile), file
file_object = h5py.File(file)
time_struct_parsed = strptime(file[-39:-23],"%Y%m%d-S%H%M%S")
- for ihour in numpy.arange(24):
- times.append(datetime(*time_struct_parsed[:6]))
- values0= ma.masked_less(file_object['Grid'][variable_name][:], 0.)
+ times.append(datetime(*time_struct_parsed[:6]))
+ values0= numpy.transpose(ma.masked_less(file_object['Grid'][variable_name][:], 0.))
+ values0= numpy.expand_dims(values0, axis=0)
if ifile == 0:
- values = values0
- variable_unit = file_object.variables[variable_name].units
+ values = values0
else:
values = numpy.concatenate((values, values0))
file_object.close()
[5/5] climate git commit: Climate-688 - Visualization and model
ensemble calculation in run_RCMES.py
Posted by hu...@apache.org.
Climate-688 - Visualization and model ensemble calculation in run_RCMES.py
-color map for the bias map is changed
-the model ensemble is calculated only if there are multiple models
Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/ece260d1
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/ece260d1
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/ece260d1
Branch: refs/heads/master
Commit: ece260d1c2daefc0168daaf8e34482b00f5693e9
Parents: 9263dc6 8298f59
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Thu Oct 8 17:13:53 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Thu Oct 8 17:13:53 2015 -0700
----------------------------------------------------------------------
examples/configuration_file_examples/metrics_and_plots.py | 2 +-
examples/configuration_file_examples/run_RCMES.py | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
[4/5] climate git commit: separate CLIMATE-687
Posted by hu...@apache.org.
separate CLIMATE-687
Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/8298f59f
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/8298f59f
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/8298f59f
Branch: refs/heads/master
Commit: 8298f59f96d421d5b7290f8c7779d0789997732f
Parents: 965e7c4
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Thu Oct 8 16:10:48 2015 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Thu Oct 8 16:10:48 2015 -0700
----------------------------------------------------------------------
ocw/data_source/local.py | 58 -------------------------------------------
1 file changed, 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/climate/blob/8298f59f/ocw/data_source/local.py
----------------------------------------------------------------------
diff --git a/ocw/data_source/local.py b/ocw/data_source/local.py
index 766eb8f..60fcb50 100644
--- a/ocw/data_source/local.py
+++ b/ocw/data_source/local.py
@@ -27,7 +27,6 @@ from ocw.dataset import Dataset
import ocw.utils as utils
import netCDF4
-import h5py
import numpy
import numpy.ma as ma
@@ -331,60 +330,3 @@ def load_multiple_files(file_path,
lat_name=lat_name, lon_name=lon_name, time_name=time_name))
return datasets, data_name
-
-def load_GPM_IMERG_files(file_path=None,
- filename_pattern=None,
- filelist=None,
- variable_name='precipitationCal',
- name='GPM_IMERG'):
- ''' Load multiple GPM Level 3 IMEGE files containing calibrated precipitation and generate an OCW Dataset obejct.
- :param file_path: Directory to the HDF files to load.
- :type file_path: :mod:`string`
- :param filename_pattern: Path to the HDF files to load.
- :type filename_pattern: :list:`string`
- :param filelist: A list of filenames
- :type filelist: :list:`string`
- :param variable_name: The variable name to load from the HDF file.
- :type variable_name: :mod:`string`
- :param name: (Optional) A name for the loaded dataset.
- :type name: :mod:`string`
- :returns: An OCW Dataset object with the requested variable's data from
- the HDF file.
- :rtype: :class:`dataset.Dataset`
- :raises ValueError:
- '''
-
- if not filelist:
- GPM_files = []
- for pattern in filename_pattern:
- GPM_files.extend(glob(file_path + pattern))
- else:
- GPM_files = [line.rstrip('\n') for line in open(filelist)]
-
- GPM_files.sort()
-
- file_object_first = h5py.File(GPM_files[0])
- lats = file_object_first['Grid']['lat'][:]
- lons = file_object_first['Grid']['lon'][:]
-
- lons, lats = numpy.meshgrid(lons, lats)
-
- variable_unit = "mm/hr"
-
- times = []
- nfile = len(GPM_files)
- for ifile, file in enumerate(GPM_files):
- print 'Reading file '+str(ifile+1)+'/'+str(nfile), file
- file_object = h5py.File(file)
- time_struct_parsed = strptime(file[-39:-23],"%Y%m%d-S%H%M%S")
- times.append(datetime(*time_struct_parsed[:6]))
- values0= numpy.transpose(ma.masked_less(file_object['Grid'][variable_name][:], 0.))
- values0= numpy.expand_dims(values0, axis=0)
- if ifile == 0:
- values = values0
- else:
- values = numpy.concatenate((values, values0))
- file_object.close()
- times = numpy.array(times)
- return Dataset(lats, lons, times, values, variable_name, units=variable_unit, name=name)
-