Changeset 26096


Ignore:
Timestamp:
03/15/21 02:42:09 (4 years ago)
Author:
bdef
Message:

CHG:change to the nc loader to take into account saved field that do not exist anymore.

File:
1 edited

Legend:

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

    r26063 r26096  
    5252        raise TypeError("Unrecognized input arguments.")
    5353
    54     onlylast = True
     54    onlylast = False
    5555
    5656    for key, value in kwargs.items():
     
    8989            if debug:
    9090                print(' ==== Now treating classtype {}'.format(mod))
    91             if np.size(classtree[mod]) > 1:
     91            if mod not in classtree.keys():
     92                print("WARNING: {} classe is not in the model anymore and will be omited.".format(mod))
     93            elif np.size(classtree[mod]) > 1:
    9294                # this points to a subclass (results.TransientSolution for example)
    9395                curclass = NCFile.groups[classtree[mod][0]].groups[classtree[mod][1]]
     
    115117                                nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]].steps.append(getattr(classtype[mod][1], 'solutionstep')())
    116118                            Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]][:]
    117                             print(nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]].steps[0])
    118119                # }}}
    119120                elif classtype[mod][0] == 'massfluxatgate':  #this is for output definitions {{{
     
    177178                                    timelist = np.arange(0, len(NCFile.dimensions['Time']))
    178179                                for t in timelist:
     180                                    print("filing step {} for {}".format(t, var))
    179181                                    if vardim == 0:
    180182                                        Tree[t].__dict__[str(var)] = varval[:].data
     
    337339                if class_dict[classe][0] not in ['dict', 'list', 'cell']:
    338340                    modulename = split(r'\.', class_dict[classe][0])[0]
    339                     class_dict[classe].append(__import__(modulename))
    340                     class_tree[classe] = [group, ]
     341                    if modulename == "giaivins":
     342                        print("WARNING: module {} does not exist anymore and is skipped".format(modulename))
     343                    else:
     344                        class_dict[classe].append(__import__(modulename))
     345                        class_tree[classe] = [group, ]
    341346            except AttributeError:
    342347                print(('group {} is empty'.format(group)))
Note: See TracChangeset for help on using the changeset viewer.