Changeset 25459
- Timestamp:
- 08/25/20 05:24:25 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/contrib/defleurian/netCDF/export_netCDF.py
r25458 r25459 3 3 import time 4 4 import collections 5 from inspect import isclass, getmodule 5 6 from os import path, remove 6 7 … … 144 145 if ncvar is not None: 145 146 FillVar(ncvar, Var) 147 # empty fiel, do nothing 146 148 elif md.__dict__[group].__dict__[field] is None: 147 149 print('field md.{}.{} is None'.format(group, field)) 148 # do nothing149 150 # if it is a masked array 150 151 elif type(md.__dict__[group].__dict__[field]) is np.ma.core.MaskedArray: … … 158 159 FillVar(ncvar, Var) 159 160 # this is a multi layered group thta should not be an "else" 160 else: 161 NCgroup.__setattr__('classtype', str(group)) 161 elif isclass(type(md.__dict__[group].__dict__[field])): 162 classtype = getmodule(type(md.__dict__[group])).__name__ 163 NCgroup.__setattr__('classtype', classtype) 162 164 Subgroup = NCgroup.createGroup(str(field)) 163 if str(group) == 'solidearth' and str(field) == 'settings': 164 Subgroup.__setattr__('classtype', 'solidearthsettings') 165 else: 166 Subgroup.__setattr__('classtype', str(field)) 165 classtype = getmodule(type(md.__dict__[group].__dict__[field])).__name__ 166 Subgroup.__setattr__('classtype', classtype) 167 167 subfields = dict.keys(md.__dict__[group].__dict__[field].__dict__) 168 168 for subfield in subfields: … … 175 175 if ncvar is not None: 176 176 FillVar(ncvar, Var) 177 else: 178 print("WARNING, md.{}.{} is not treated as it does not fall in one of the existing cases.".format(str(group), str(field))) 179 177 180 NCData.close() 178 181
Note:
See TracChangeset
for help on using the changeset viewer.