data_source.local.load_GPM_IMERG_files - the previous merge conflict is resolved
Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/6abd0a95 Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/6abd0a95 Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/6abd0a95 Branch: refs/heads/master Commit: 6abd0a95b4eb019d4a81d772d09810ba89d5277d Parents: dec62d2 Author: huikyole <[email protected]> Authored: Wed Oct 21 18:43:14 2015 -0700 Committer: huikyole <[email protected]> Committed: Wed Oct 21 18:43:14 2015 -0700 ---------------------------------------------------------------------- ocw/data_source/local.py | 44 +++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/6abd0a95/ocw/data_source/local.py ---------------------------------------------------------------------- diff --git a/ocw/data_source/local.py b/ocw/data_source/local.py index 9c1d059..34738ac 100644 --- a/ocw/data_source/local.py +++ b/ocw/data_source/local.py @@ -342,7 +342,6 @@ def load_multiple_files(file_path, return datasets, data_name -<<<<<<< HEAD def load_WRF_2d_files_RAIN(file_path=None, filename_pattern=None, filelist=None, @@ -493,26 +492,10 @@ def load_NLDAS_forcingA_files(file_path=None, :param filelist: A list of filenames :type filelist: :list:`string` :param variable_name: The variable name to load from the NetCDF file. -======= -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. ->>>>>>> CLIMATE-687 :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 -<<<<<<< HEAD the NetCDF file. :rtype: :class:`dataset.Dataset` :raises ValueError: @@ -545,7 +528,29 @@ def load_GPM_IMERG_files(file_path=None, 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) + +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: @@ -579,9 +584,8 @@ def load_GPM_IMERG_files(file_path=None, values0= numpy.expand_dims(values0, axis=0) if ifile == 0: values = values0 ->>>>>>> CLIMATE-687 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) + return Dataset(lats, lons, times, values, variable_name, units=variable_unit, name=name)
