Github user kwhitehall commented on a diff in the pull request:

    https://github.com/apache/climate/pull/194#discussion_r29371122
  
    --- Diff: ocw/data_source/local.py ---
    @@ -109,6 +111,61 @@ def _get_netcdf_variable_name(valid_var_names, netcdf, 
netcdf_var):
         )
         raise ValueError(error)
     
    +def load_merra_3d_files(file_path,
    +                    filename_pattern,
    +                    variable_name,
    +                    name='',
    +                    latitude_range=None,
    +                    longitude_range=None):
    +    ''' Load multiple MERRA reanalysis HDF files whose file names have 
common patterns into a Dataset.
    +    The dataset can be spatially subset.
    +    :param file_path: Directory to the NetCDF file to load.
    +    :type file_path: :mod:`string`
    +    :param filename_pattern: Path to the NetCDF file to load.
    +    :type filename_pattern: :list:`string`
    +    :param variable_name: The variable name to load from the NetCDF file.
    +    :type variable_name: :mod:`string`
    +    :param name: (Optional) A name for the loaded dataset.
    +    :type name: :mod:`string`
    +    :param latitude_range: (Optional) minimum and maximum latitudes for 
spatial subsetting
    +    :type name: :list:float  ex) [-30, 20]
    +    :param longitude_range: (Optional) minimum and maximum longitudes 
(Western and eastern boundaries) for spatial subsetting
    +    :type name: :list:float  ex) [-170, 60]
    +    :returns: An OCW Dataset object with the requested variable's data from
    +        the NetCDF file.
    +    :rtype: :class:`dataset.Dataset`
    +    :raises ValueError: 
    +    '''                  
    +    
    +    merra_files = []
    +    for pattern in filename_pattern:
    +        merra_files.extend(glob(file_path + pattern))
    +    merra_files.sort()
    --- End diff --
    
    @huikyole  you can save on this for loop with the following one liner
    merra_files=glob.glob(file_path+'/'+filename_pattern+'*')


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to