Changeset 28013 for issm/trunk/src/m/classes/SMBd18opdd.py
- Timestamp:
- 11/15/23 12:14:04 (16 months ago)
- Location:
- issm/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
-
issm/trunk/src
- Property svn:mergeinfo changed
-
issm/trunk/src/m/classes/SMBd18opdd.py
r25836 r28013 13 13 SMBd18opdd = SMBd18opdd() 14 14 """ 15 def __init__(self ): # {{{15 def __init__(self, *args): # {{{ 16 16 self.desfac = 0. 17 17 self.s0p = float('NaN') … … 38 38 self.steps_per_step = 1 39 39 self.averaging = 0 40 41 #set defaults42 self.setdefaultparameters()43 40 self.requested_outputs = [] 44 #}}} 41 42 if len(args) == 0: 43 self.setdefaultparameters() 44 else: 45 raise Exception('constructor not supported') 46 # }}} 45 47 def __repr__(self): # {{{ 46 s tring = " surface forcings parameters:"47 48 s tring = "%s\n%s" % (string, fielddisplay(self, 'isd18opd', 'is delta18o parametrisation from present day temperature and precipitation activated(0 or 1, default is 0)'))49 s tring = "%s\n%s" % (string, fielddisplay(self, 'issetpddfac', 'is user passing in defined pdd factors (0 or 1, default is 0)'))50 s tring = "%s\n%s" % (string, fielddisplay(self, 'desfac', 'desertification elevation factor (between 0 and 1, default is 0.5) [m]'))51 s tring = "%s\n%s" % (string, fielddisplay(self, 's0p', 'should be set to elevation from precipsource (between 0 and a few 1000s m, default is 0) [m]'))52 s tring = "%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]'))53 string = "%s\n%s" % (string, fielddisplay(self, 'rlaps', 'present day lapse rate [degree/km]')) 54 if self.isd18opd: 55 s tring = "%s\n%s" % (string,fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o/mungsm is activated'))56 s tring = "%s\n%s" % (string,fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))57 s tring = "%s\n%s" % (string,fielddisplay(self, 'istemperaturescaled', 'if delta18o parametrisation from present day temperature and precipitation is activated, is temperature scaled to delta18o value? (0 or 1, default is 1)'))58 s tring = "%s\n%s" % (string,fielddisplay(self, 'isprecipscaled', 'if delta18o parametrisation from present day temperature and precipitation is activated, is precipitation scaled to delta18o value? (0 or 1, default is 1)'))48 s = ' surface forcings parameters:\n' 49 s += '{}\n'.format(fielddisplay(self, 'isd18opd', 'is delta18o parametrisation from present day temperature and precipitation activated (0 or 1, default is 0)')) 50 s += '{}\n'.format(fielddisplay(self, 'issetpddfac', 'is user passing in defined pdd factors (0 or 1, default is 0)')) 51 s += '{}\n'.format(fielddisplay(self, 'desfac', 'desertification elevation factor (between 0 and 1, default is 0.5) [m]')) 52 s += '{}\n'.format(ielddisplay(self, 's0p', 'should be set to elevation from precip source (between 0 and a few 1000s m, default is 0) [m]')) 53 s += '{}\n'.format(fielddisplay(self, 's0t', 'should be set to elevation from temperature source (between 0 and a few 1000s m, default is 0) [m]')) 54 s += '{}\n'.format(fielddisplay(self, 'rlaps', 'present day lapse rate [degree/km]')) 55 56 if self.isd18opd: 57 s += '{}\n'.format(fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o/mungsm is activated')) 58 s += '{}\n'.format(fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated')) 59 s += '{}\n'.format(fielddisplay(self, 'istemperaturescaled', 'if delta18o parametrisation from present day temperature and precipitation is activated, is temperature scaled to delta18o value? (0 or 1, default is 1)')) 60 s += '{}\n'.format(fielddisplay(self, 'isprecipscaled', 'if delta18o parametrisation from present day temperature and precipitation is activated, is precipitation scaled to delta18o value? (0 or 1, default is 1)')) 59 61 60 62 if self.istemperaturescaled == 0: 61 s tring = "%s\n%s" % (string,fielddisplay(self, 'temperatures_reconstructed', 'monthly historical surface temperatures [K], required if delta18o/mungsm/d18opd is activated and istemperaturescaled is not activated'))63 s += '{}\n'.format(fielddisplay(self, 'temperatures_reconstructed', 'monthly historical surface temperatures [K], required if delta18o/mungsm/d18opd is activated and istemperaturescaled is not activated')) 62 64 63 65 if self.isprecipscaled == 0: 64 s tring = "%s\n%s" % (string,fielddisplay(self, 'precipitations_reconstructed', 'monthly historical precipitation [m/yr water eq], required if delta18o/mungsm/d18opd is activated and isprecipscaled is not activated'))65 66 s tring = "%s\n%s" % (string,fielddisplay(self, 'delta18o', 'delta18o [per mil], required if pdd is activated and delta18o activated'))67 s tring = "%s\n%s" % (string,fielddisplay(self, 'dpermil', 'degree per mil, required if d18opd is activated'))68 s tring = "%s\n%s" % (string,fielddisplay(self, 'f', 'precip/temperature scaling factor, required if d18opd is activated'))66 s += '{}\n'.format(fielddisplay(self, 'precipitations_reconstructed', 'monthly historical precipitation [m/yr water eq], required if delta18o/mungsm/d18opd is activated and isprecipscaled is not activated')) 67 68 s += '{}\n'.format(fielddisplay(self, 'delta18o', 'delta18o [per mil], required if pdd is activated and delta18o activated')) 69 s += '{}\n'.format(fielddisplay(self, 'dpermil', 'degree per mil, required if d18opd is activated')) 70 s += '{}\n'.format(fielddisplay(self, 'f', 'precip/temperature scaling factor, required if d18opd is activated')) 69 71 70 72 if self.issetpddfac == 1: 71 string = "%s\n%s" % (string, fielddisplay(self, 'pddfac_snow', 'Pdd factor for snow for all the domain [mm ice equiv/day/degree C]')) 72 string = "%s\n%s" % (string, fielddisplay(self, 'pddfac_ice', 'Pdd factor for ice for all the domain [mm ice equiv/day/degree C]')) 73 string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step')) 74 string = "%s\n%s" % (string, fielddisplay(self, 'averaging', 'averaging methods from short to long steps')) 75 string = "%s\n\t\t%s" % (string, '0: Arithmetic (default)') 76 string = "%s\n\t\t%s" % (string, '1: Geometric') 77 string = "%s\n\t\t%s" % (string, '2: Harmonic') 78 79 string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested')) 80 81 return string 82 #}}} 73 s += '{}\n'.format(fielddisplay(self, 'pddfac_snow', 'Pdd factor for snow for all the domain [mm ice equiv/day/degree C]')) 74 s += '{}\n'.format(fielddisplay(self, 'pddfac_ice', 'Pdd factor for ice for all the domain [mm ice equiv/day/degree C]')) 75 76 s += '{}\n'.format(fielddisplay(self, 'steps_per_step', 'number of smb steps per time step')) 77 s += '{}\n'.format(fielddisplay(self, 'averaging', 'averaging methods from short to long steps')) 78 s += '\t\t{}\n'.format('0: Arithmetic (default)') 79 s += '\t\t{}\n'.format('1: Geometric') 80 s += '\t\t{}\n'.format('2: Harmonic') 81 s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested')) 82 return s 83 # }}} 83 84 def extrude(self, md): # {{{ 84 85 if self.isd18opd: … … 93 94 self.s0t = project3d(md, 'vector', self.s0t, 'type', 'node') 94 95 return self 95 # }}}96 # }}} 96 97 def defaultoutputs(self, md): # {{{ 97 return [ ]98 # }}}98 return ['SmbMassBalance'] 99 # }}} 99 100 def initialize(self, md): # {{{ 100 101 if np.all(np.isnan(self.s0p)): … … 108 109 # }}} 109 110 def setdefaultparameters(self): # {{{ 110 # pdd method not used in default mode111 # pdd method not used in default mode 111 112 self.ismungsm = 0 112 113 self.isd18opd = 1 … … 119 120 self.f = 0.169 120 121 self.issetpddfac = 0 122 self.requested_outputs = ['default'] 121 123 return self 122 # }}}124 # }}} 123 125 def checkconsistency(self, md, solution, analyses): # {{{ 124 126 if 'MasstransportAnalysis' in analyses: … … 197 199 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'pddfac_ice', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts) 198 200 199 #process requested outputs201 # Process requested outputs 200 202 outputs = self.requested_outputs 201 203 indices = [i for i, x in enumerate(outputs) if x == 'default'] … … 204 206 outputs = outputscopy 205 207 WriteData(fid, prefix, 'data', outputs, 'name', 'md.smb.requested_outputs', 'format', 'StringArray') 206 207 # }}} 208 # }}}
Note:
See TracChangeset
for help on using the changeset viewer.