Repository: climate Updated Branches: refs/heads/master 83d83ba5e -> d55b8ae98
Propagation of missing data information from each dataset Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/fb43681b Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/fb43681b Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/fb43681b Branch: refs/heads/master Commit: fb43681b8143bc244557927fdbca788e17c9dc20 Parents: 83d83ba Author: huikyole <[email protected]> Authored: Thu Jul 30 16:52:34 2015 -0700 Committer: huikyole <[email protected]> Committed: Thu Jul 30 16:52:34 2015 -0700 ---------------------------------------------------------------------- ocw/dataset_processor.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/fb43681b/ocw/dataset_processor.py ---------------------------------------------------------------------- diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py index 984e142..a77739a 100755 --- a/ocw/dataset_processor.py +++ b/ocw/dataset_processor.py @@ -458,6 +458,24 @@ def _rcmes_normalize_datetimes(datetimes, timestep): return normalDatetimes +def mask_missing_data(dataset_array): + ''' Check missing values in observation and model datasets. + If any of dataset in dataset_array has missing values at a grid point, + the values at the grid point in all other datasets are masked. + :param dataset_array: an array of OCW datasets + ''' + mask_array = np.zeros(dataset_array[0].values.shape) + for dataset in dataset_array: + index = np.where(dataset.values.mask == True) + if index[0].size >0: + mask_array[index] = 1 + masked_array = [] + for dataset in dataset_array: + dataset.values = ma.array(dataset.values, mask=mask_array) + masked_array.append(dataset) + return [masked_dataset for masked_dataset in masked_array] + + def _rcmes_spatial_regrid(spatial_values, lat, lon, lat2, lon2, order=1): ''' Spatial regrid from one set of lat,lon values onto a new set (lat2,lon2)
