source:
issm/oecreview/Archive/24684-25833/ISSM-25459-25460.diff@
25834
Last change on this file since 25834 was 25834, checked in by , 4 years ago | |
---|---|
File size: 6.0 KB |
-
../trunk-jpl/src/m/classes/qmu.py
1 1 import numpy as np 2 3 from checkfield import checkfield4 2 from collections import OrderedDict 5 3 from dakota_method import * 6 4 from fielddisplay import fielddisplay … … 20 18 21 19 def __init__(self): # {{{ 22 20 self.isdakota = 0 23 self.output 21 self.output = 0 24 22 self.variables = OrderedStruct() 25 23 self.correlation_matrix = [] 26 24 self.responses = OrderedStruct() … … 31 29 self.variabledescriptors = [] 32 30 self.variablepartitions = [] 33 31 self.variablepartitions_npart = [] 32 self.variablepartitions_nt = [] 34 33 self.responsedescriptors = [] 35 34 self.responsepartitions = [] 36 35 self.responsepartitions_npart = [] … … 127 126 128 127 return s 129 128 # }}} 129 130 130 def extrude(self, md): # {{{ 131 131 return self 132 132 #}}} 133 133 134 def setdefaultparameters(self): # {{{ 134 135 return self 135 136 #}}} 137 136 138 def checkconsistency(self, md, solution, analyses): # {{{ 137 139 #Early return 138 140 if not md.qmu.isdakota: … … 165 167 if hasattr(variable, 'checkconsistency'): 166 168 variable.checkconsistency(md, solution, analyses) 167 169 168 # Go through variables and check that we have normal uncertains first, 169 # then uniform uncertains and finally histogram_bin_uncertain. Indeed, 170 # Dakota will order them this waym, and when we send partitions for 171 # scaled variables, they better show up in the order Dakota is feeding 170 # Go through variables and check that we have normal uncertains first, 171 # then uniform uncertains and finally histogram_bin_uncertain. Indeed, 172 # Dakota will order them this waym, and when we send partitions for 173 # scaled variables, they better show up in the order Dakota is feeding 172 174 # them to us in InputUpdateFromDakotax! 173 175 fv = fieldnames(self.variables) 174 176 classlist = [] … … 193 195 194 196 return md 195 197 # }}} 198 196 199 def marshall(self, prefix, md, fid): # {{{ 197 200 WriteData(fid, prefix, 'object', self, 'fieldname', 'isdakota', 'format', 'Boolean') 198 201 WriteData(fid, prefix, 'object', self, 'fieldname', 'output', 'format', 'Boolean') -
../trunk-jpl/src/m/contrib/defleurian/netCDF/export_netCDF.py
157 157 DimDict, ncvar = CreateVar(NCData, Var, field, NCgroup, DimDict) 158 158 if ncvar is not None: 159 159 FillVar(ncvar, Var) 160 # this is a multi layered group thta should not be an "else"160 # this is an issm class 161 161 elif isclass(type(md.__dict__[group].__dict__[field])): 162 162 classtype = getmodule(type(md.__dict__[group])).__name__ 163 163 NCgroup.__setattr__('classtype', classtype) 164 164 Subgroup = NCgroup.createGroup(str(field)) 165 classtype = getmodule(type(md.__dict__[group].__dict__[field])).__name__ 165 classname = type(md.__dict__[group].__dict__[field]).__name__ 166 modulename = getmodule(type(md.__dict__[group].__dict__[field])).__name__ 167 if classname == modulename: 168 #when module and class name have the same name 169 classtype = classname 170 else: 171 classtype = modulename + '.' + classname 166 172 Subgroup.__setattr__('classtype', classtype) 167 173 subfields = dict.keys(md.__dict__[group].__dict__[field].__dict__) 168 174 for subfield in subfields: -
../trunk-jpl/src/m/io/loadvars.py
16 16 def loadvars(*args, **kwargs): 17 17 """LOADVARS - function to load variables from a file 18 18 19 This function loads one or more variables from a file. The names of the 20 variables must be supplied. If more than one variable is specified, it may 21 be done with a list of names or a dictionary of name as keys. The output 22 type will correspond to the input type. All the variables in the file may 19 This function loads one or more variables from a file. The names of the 20 variables must be supplied. If more than one variable is specified, it may 21 be done with a list of names or a dictionary of name as keys. The output 22 type will correspond to the input type. All the variables in the file may 23 23 be loaded by specifying only the file name. 24 24 25 25 Usage: … … 303 303 if len(NCData.groups[group].groups) > 0: 304 304 for subgroup in NCData.groups[group].groups: 305 305 classe = str(group) + '.' + str(subgroup) 306 class_dict[classe] = [str(getattr(NCData.groups[group].groups[subgroup], 'classtype')), ] 306 submodule = str(getattr(NCData.groups[group].groups[subgroup], 'classtype')).split('.')[-1] 307 class_dict[classe] = [submodule, ] 307 308 if class_dict[classe][0] not in ['dict', 'list', 'cell']: 308 class_dict[classe].append(__import__(class_dict[classe][0])) 309 try: 310 class_dict[classe].append(__import__(class_dict[classe][0])) 311 except ModuleNotFoundError: 312 #submodule probably has a different name 313 modulename = str(getattr(NCData.groups[group].groups[subgroup], 'classtype')).split('.')[0] 314 class_dict[classe].append(__import__(modulename)) 309 315 class_tree[classe] = [group, subgroup] 310 316 else: 311 317 classe = str(group)
Note:
See TracBrowser
for help on using the repository browser.