Repository: climate Updated Branches: refs/heads/master 082a3ad67 -> d2861dea4
CLIMATE-673 - Update the module to load multiple netcdf files - ocw.data_source.local.load_multiple_files has been updated - filename_patterns deleted - common filename pattern can be added at the end of file_path - the module output lists of OCW datasets and their names Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/c244face Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/c244face Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/c244face Branch: refs/heads/master Commit: c244facefc618ee6f795fdb6f9e87135f725f499 Parents: 082a3ad Author: huikyole <[email protected]> Authored: Sun Sep 20 22:09:29 2015 -0700 Committer: huikyole <[email protected]> Committed: Sun Sep 20 22:09:29 2015 -0700 ---------------------------------------------------------------------- ocw/data_source/local.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/c244face/ocw/data_source/local.py ---------------------------------------------------------------------- diff --git a/ocw/data_source/local.py b/ocw/data_source/local.py index c0d4b07..60fcb50 100644 --- a/ocw/data_source/local.py +++ b/ocw/data_source/local.py @@ -271,19 +271,16 @@ def load_file(file_path, units=variable_unit, name=name, origin=origin) def load_multiple_files(file_path, - filename_pattern, variable_name, - dataset_name='ref', + dataset_name='model', variable_unit=None, lat_name=None, lon_name=None, time_name=None): ''' load multiple netcdf files with common filename pattern and return an array of OCW datasets - :param file_path: directory name where the NetCDF files to load are stored. + :param file_path: directory name and common file name patterns where the NetCDF files to load are stored. :type file_path: :mod:`string` - :param filename_pattern: common file name patterns - :type filename_pattern: :list:`string` :param dataset_name: a name of dataset when reading a single file :type dataset_name: :mod:'string' :param variable_name: The variable name to load from the NetCDF file. @@ -310,8 +307,7 @@ def load_multiple_files(file_path, ''' data_filenames = [] - for pattern in filename_pattern: - data_filenames.extend(glob(file_path + pattern)) + data_filenames.extend(glob(file_path)) data_filenames.sort() # number of files @@ -333,4 +329,4 @@ def load_multiple_files(file_path, datasets.append(load_file(filename, variable_name, variable_unit, name=data_name[ifile], lat_name=lat_name, lon_name=lon_name, time_name=time_name)) - return datasets + return datasets, data_name
