Changeset 19527 for issm/trunk-jpl/src/m/classes/SMBgradients.py
- Timestamp:
- 08/29/15 11:55:39 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/SMBgradients.py
r19027 r19527 18 18 self.b_pos = float('NaN') 19 19 self.b_neg = float('NaN') 20 self.requested_outputs = [] 20 21 #}}} 21 22 def __repr__(self): # {{{ … … 27 28 string="%s\n%s"%(string,fielddisplay(self,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated')) 28 29 string="%s\n%s"%(string,fielddisplay(self,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated')) 30 string="%s\n%s"%(string,fielddisplay(self,'requested_outputs','additional outputs requested')) 29 31 30 32 return string … … 34 36 #Nothing for now 35 37 return self 38 #}}} 39 def defaultoutputs(self,md): # {{{ 40 return [] 36 41 #}}} 37 42 def initialize(self,md): # {{{ … … 44 49 45 50 if MasstransportAnalysisEnum() in analyses: 46 md = checkfield(md,'fieldname','s urfaceforcings.href','timeseries',1,'NaN',1)47 md = checkfield(md,'fieldname','s urfaceforcings.smbref','timeseries',1,'NaN',1)48 md = checkfield(md,'fieldname','s urfaceforcings.b_pos','timeseries',1,'NaN',1)49 md = checkfield(md,'fieldname','s urfaceforcings.b_neg','timeseries',1,'NaN',1)51 md = checkfield(md,'fieldname','smb.href','timeseries',1,'NaN',1) 52 md = checkfield(md,'fieldname','smb.smbref','timeseries',1,'NaN',1) 53 md = checkfield(md,'fieldname','smb.b_pos','timeseries',1,'NaN',1) 54 md = checkfield(md,'fieldname','smb.b_neg','timeseries',1,'NaN',1) 50 55 56 md = checkfield(md,'fieldname','masstransport.requested_outputs','stringrow',1) 51 57 return md 52 58 # }}} … … 55 61 yts=365.0*24.0*3600.0 56 62 57 WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBgradientsEnum(),'format','Integer'); 58 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','href','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1) 59 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1) 60 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','b_pos','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1) 61 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1) 63 WriteData(fid,'enum',SmbEnum(),'data',SMBgradientsEnum(),'format','Integer'); 64 WriteData(fid,'object',self,'class','smb','fieldname','href','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1) 65 WriteData(fid,'object',self,'class','smb','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1) 66 WriteData(fid,'object',self,'class','smb','fieldname','b_pos','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1) 67 WriteData(fid,'object',self,'class','smb','fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1) 68 69 #process requested outputs 70 outputs = self.requested_outputs 71 indices = [i for i, x in enumerate(outputs) if x == 'default'] 72 if len(indices) > 0: 73 outputscopy=outputs[0:max(0,indices[0]-1)]+self.defaultoutputs(md)+outputs[indices[0]+1:] 74 outputs =outputscopy 75 WriteData(fid,'data',outputs,'enum',SmbRequestedOutputsEnum(),'format','StringArray') 76 62 77 # }}}
Note:
See TracChangeset
for help on using the changeset viewer.