Changeset 24240 for issm/trunk-jpl/src/m/classes/SMBpdd.py
- Timestamp:
- 10/17/19 06:03:43 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/SMBpdd.py
r24213 r24240 34 34 self.precipitations_presentday = float('NaN') 35 35 self.precipitations_lgm = float('NaN') 36 self.steps_per_step = 1 36 37 37 38 #set defaults … … 48 49 string = "%s\n%s" % (string, fielddisplay(self, 's0p', 'should be set to elevation from precip source (between 0 and a few 1000s m, default is 0) [m]')) 49 50 string = "%s\n%s" % (string, fielddisplay(self, 's0t', 'should be set to elevation from temperature source (between 0 and a few 1000s m, default is 0) [m]')) 50 string = "%s\n%s" % (string, fielddisplay(self, 'rlaps', 'present day lapse rate [degree /km]'))51 string = "%s\n%s" % (string, fielddisplay(self, 'rlapslgm', 'LGM lapse rate [degree /km]'))51 string = "%s\n%s" % (string, fielddisplay(self, 'rlaps', 'present day lapse rate [degree/km]')) 52 string = "%s\n%s" % (string, fielddisplay(self, 'rlapslgm', 'LGM lapse rate [degree/km]')) 52 53 if not (self.isdelta18o and self.ismungsm): 53 string = "%s\n%s" % (string, fielddisplay(self, 'monthlytemperatures', ['monthly surface temperatures [K], required if pdd is activated and delta18o not activated']))54 string = "%s\n%s" % (string, fielddisplay(self, 'precipitation', ['monthly surface precipitation [m / yr water eq], required if pdd is activated and delta18o or mungsm not activated']))54 string = "%s\n%s" % (string, fielddisplay(self, 'monthlytemperatures', 'monthly surface temperatures [K], required if pdd is activated and delta18o not activated')) 55 string = "%s\n%s" % (string, fielddisplay(self, 'precipitation', 'monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o or mungsm not activated')) 55 56 if self.isdelta18o: 56 57 string = "%s\n%s" % (string, fielddisplay(self, 'delta18o', 'delta18o [per mil], required if pdd is activated and delta18o activated')) 57 58 string = "%s\n%s" % (string, fielddisplay(self, 'delta18o_surface', 'surface elevation of the delta18o site, required if pdd is activated and delta18o activated')) 58 string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o /mungsm is activated'))59 string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o/mungsm is activated')) 59 60 string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_lgm', 'monthly LGM surface temperatures [K], required if delta18o or mungsm is activated')) 60 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m /yr water eq], required if delta18o or mungsm is activated'))61 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_lgm', 'monthly surface precipitation [m /yr water eq], required if delta18o or mungsm is activated'))61 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated')) 62 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_lgm', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated')) 62 63 string = "%s\n%s" % (string, fielddisplay(self, 'Tdiff', 'time interpolation parameter for temperature, 1D(year), required if mungsm is activated')) 63 64 string = "%s\n%s" % (string, fielddisplay(self, 'sealev', 'sea level [m], 1D(year), required if mungsm is activated')) 65 64 66 if self.ismungsm: 65 string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o /mungsm is activated'))67 string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o/mungsm is activated')) 66 68 string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_lgm', 'monthly LGM surface temperatures [K], required if delta18o or mungsm is activated')) 67 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m /yr water eq], required if delta18o or mungsm is activated'))68 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_lgm', 'monthly surface precipitation [m /yr water eq], required if delta18o or mungsm is activated'))69 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated')) 70 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_lgm', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated')) 69 71 string = "%s\n%s" % (string, fielddisplay(self, 'Pfac', 'time interpolation parameter for precipitation, 1D(year), required if mungsm is activated')) 70 72 string = "%s\n%s" % (string, fielddisplay(self, 'Tdiff', 'time interpolation parameter for temperature, 1D(year), required if mungsm is activated')) 71 73 string = "%s\n%s" % (string, fielddisplay(self, 'sealev', 'sea level [m], 1D(year), required if mungsm is activated')) 74 75 string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step')) 72 76 string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested')) 73 77 … … 79 83 self.precipitation = project3d(md, 'vector', self.precipitation, 'type', 'node') 80 84 self.monthlytemperatures = project3d(md, 'vector', self.monthlytemperatures, 'type', 'node') 85 81 86 if self.isdelta18o: 82 87 self.temperatures_lgm = project3d(md, 'vector', self.temperatures_lgm, 'type', 'node') 83 if self.isdelta18o:84 88 self.temperatures_presentday = project3d(md, 'vector', self.temperatures_presentday, 'type', 'node') 85 if self.isdelta18o:86 89 self.precipitations_presentday = project3d(md, 'vector', self.precipitations_presentday, 'type', 'node') 87 if self.isdelta18o:88 90 self.precipitations_lgm = project3d(md, 'vector', self.precipitations_lgm, 'type', 'node') 91 89 92 if self.ismungsm: 90 93 self.temperatures_lgm = project3d(md, 'vector', self.temperatures_lgm, 'type', 'node') 91 if self.ismungsm:92 94 self.temperatures_presentday = project3d(md, 'vector', self.temperatures_presentday, 'type', 'node') 93 if self.ismungsm:94 95 self.precipitations_presentday = project3d(md, 'vector', self.precipitations_presentday, 'type', 'node') 95 if self.ismungsm:96 96 self.precipitations_lgm = project3d(md, 'vector', self.precipitations_lgm, 'type', 'node') 97 97 98 self.s0p = project3d(md, 'vector', self.s0p, 'type', 'node') 98 99 self.s0t = project3d(md, 'vector', self.s0t, 'type', 'node') 99 100 100 return self 101 101 #}}} … … 128 128 #}}} 129 129 130 def checkconsistency(self, md, solution, analyses): # {{{ 130 def checkconsistency(self, md, solution, analyses): # {{{ 131 131 132 if 'MasstransportAnalysis' in analyses: 132 133 md = checkfield(md, 'fieldname', 'smb.desfac', '<=', 1, 'numel', [1]) … … 157 158 md = checkfield(md, 'fieldname', 'smb.sealev', 'NaN', 1, 'Inf', 1, 'size', [2, np.nan], 'singletimeseries', 1) 158 159 160 md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1]) 159 161 md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1) 160 162 return md 161 163 #}}} 162 164 163 def marshall(self, prefix, md, fid): # {{{165 def marshall(self, prefix, md, fid): # {{{ 164 166 yts = md.constants.yts 165 167 166 168 WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 4, 'format', 'Integer') 169 167 170 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isdelta18o', 'format', 'Boolean') 168 171 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'ismungsm', 'format', 'Boolean') … … 173 176 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'rlaps', 'format', 'Double') 174 177 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'rlapslgm', 'format', 'Double') 178 WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer') 175 179 176 180 if (self.isdelta18o == 0 and self.ismungsm == 0): … … 182 186 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitations_presentday', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 183 187 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitations_lgm', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 184 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'delta18o_surface', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)185 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'delta18o', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)186 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)187 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)188 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'delta18o_surface', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts) 189 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'delta18o', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts) 190 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts) 191 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts) 188 192 elif self.ismungsm: 189 193 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'temperatures_presentday', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) … … 191 195 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitations_presentday', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 192 196 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitations_lgm', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 193 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Pfac', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)194 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)195 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)196 197 #process requested outputs197 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Pfac', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts) 198 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts) 199 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts) 200 201 #process requested outputs 198 202 outputs = self.requested_outputs 199 203 indices = [i for i, x in enumerate(outputs) if x == 'default']
Note:
See TracChangeset
for help on using the changeset viewer.