Changeset 3561
- Timestamp:
- Nov 23, 2018 11:39:44 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palmtest
r3457 r3561 254 254 def get_var_list(self): 255 255 with netCDF4.Dataset(self.filename, mode='r') as netcdf: 256 var_list = getattr(netcdf, 'VAR_LIST').split(';')256 var_list = list(netcdf.variables.keys()) 257 257 var_list = filter(None, var_list) 258 258 return sorted(var_list) … … 278 278 with netCDF4.Dataset(self.filename, mode='r') as netcdf: 279 279 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'] = '' 284 289 return attributes, values 285 290
Note: See TracChangeset
for help on using the changeset viewer.