Changeset 3561 for palm/trunk


Ignore:
Timestamp:
Nov 23, 2018 11:39:44 AM (6 years ago)
Author:
knoop
Message:

palmtest: enabled content-check of all found netcdf variables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palmtest

    r3457 r3561  
    254254    def get_var_list(self):
    255255        with netCDF4.Dataset(self.filename, mode='r') as netcdf:
    256             var_list = getattr(netcdf, 'VAR_LIST').split(';')
     256            var_list = list(netcdf.variables.keys())
    257257            var_list = filter(None, var_list)
    258258            return sorted(var_list)
     
    278278        with netCDF4.Dataset(self.filename, mode='r') as netcdf:
    279279            values = netcdf.variables[variable][:]  # extract values
    280             attributes = dict(
    281                 long_name=netcdf.variables[variable].name,
    282                 unit=netcdf.variables[variable].units,
    283             )
     280            attributes = dict()
     281            try:
     282                attributes['long_name'] = netcdf.variables[variable].name
     283            except:
     284                attributes['long_name'] = ''
     285            try:
     286                attributes['unit'] = netcdf.variables[variable].units
     287            except:
     288                attributes['unit'] = ''
    284289        return attributes, values
    285290
Note: See TracChangeset for help on using the changeset viewer.