Changeset 26129


Ignore:
Timestamp:
03/23/21 06:16:57 (4 years ago)
Author:
bdef
Message:

BUG: fix to netCDF load to deal with old files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/io/loadvars.py

    r26128 r26129  
    3030    filename = ''
    3131    nvdict = {}
    32     debug = False  #print messages if true
     32    debug = True  #print messages if true
    3333
    3434    if len(args) >= 1 and isinstance(args[0], str):
     
    174174            for groupindex, listclass in enumerate(groupclass):
    175175                for var in listclass.variables:
    176                     if debug:
    177                         print("    ==> treating var {}".format(var))
    178176                    if var not in ['errlog', 'outlog']:
    179177                        varval = listclass.variables[str(var)]
    180178                        vardim = varval.ndim
     179                        if debug:
     180                            print("    ==> treating var {} of dimension {}".format(var, vardim))
    181181                        #There is a special treatment for results to account for its specific structure
    182182                        #that is the new export version where time is a named dimension
     
    263263                                        strings2 = [str(arg[1]) for arg in varval]
    264264                                        Tree.__dict__[str(var)] = OrderedDict(list(zip(strings1, strings2)))
     265                                else:
     266                                    if type(Tree) == list:
     267                                        t = indexlist[i]
     268                                        if listtype == 'dict':
     269                                            Tree[t][str(var)] = varval[:, :].data
     270                                        else:
     271                                            Tree[t].__dict__[str(var)] = varval[:, :].data
     272                                    else:
     273                                        Tree.__dict__[str(var)] = varval[:, :].data
    265274                            elif vardim == 3:
    266275                                Tree.__dict__[str(var)] = varval[:, :, :].data
Note: See TracChangeset for help on using the changeset viewer.