Ignore:
Timestamp:
08/29/15 11:55:39 (10 years ago)
Author:
Eric.Larour
Message:

CHG: moved md.surfaceforcings to md.smb.
By doing so, had to rename the SMB class to SMBforcing class (it's just that, a mass_balance forcing inside
a SMB class, hence the name).
We also now have an smb_core solution, taken out of the mass transport core. Makes more sense long term.
Synced all enums according to the new changes, and operated the adjustments in all the test decks.

In addition, progressing in terms of GEMB integration into ISSM, specifically at the SMBgemb level (which
is spurring all the changes described above). Brought the class up to the level of the GEMB.m call in Alex's
code. Starting the C integration now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/SMBgradients.py

    r19027 r19527  
    1818                self.b_pos   = float('NaN')
    1919                self.b_neg   = float('NaN')
     20                self.requested_outputs      = []
    2021                #}}}
    2122        def __repr__(self): # {{{
     
    2728                string="%s\n%s"%(string,fielddisplay(self,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated'))
    2829                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'))
    2931
    3032                return string
     
    3436                #Nothing for now
    3537                return self
     38        #}}}
     39        def defaultoutputs(self,md): # {{{
     40                return []
    3641        #}}}
    3742        def initialize(self,md): # {{{
     
    4449
    4550                if MasstransportAnalysisEnum() in analyses:
    46                         md = checkfield(md,'fieldname','surfaceforcings.href','timeseries',1,'NaN',1)
    47                         md = checkfield(md,'fieldname','surfaceforcings.smbref','timeseries',1,'NaN',1)
    48                         md = checkfield(md,'fieldname','surfaceforcings.b_pos','timeseries',1,'NaN',1)
    49                         md = checkfield(md,'fieldname','surfaceforcings.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)
    5055
     56                md = checkfield(md,'fieldname','masstransport.requested_outputs','stringrow',1)
    5157                return md
    5258        # }}}
     
    5561                yts=365.0*24.0*3600.0
    5662
    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
    6277        # }}}
Note: See TracChangeset for help on using the changeset viewer.