Changeset 18984


Ignore:
Timestamp:
01/06/15 08:59:53 (10 years ago)
Author:
Mathieu Morlighem
Message:

BUG: fixgin PDD in python

Location:
issm/trunk-jpl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/m/classes/SMBpdd.m

    r18968 r18984  
    1111                s0p                       = 0;
    1212                s0t                       = 0;
    13                 rlaps                     = 0;
    14                 rlapslgm                  = 0;               
    15                 Pfac                      = NaN;
    16                 Tdiff                     = NaN;
    17                 sealev                    = NaN;
     13                rlaps                     = 0;
     14                rlapslgm                  = 0;               
     15                Pfac                      = NaN;
     16                Tdiff                     = NaN;
     17                sealev                    = NaN;
    1818                isdelta18o                = 0;
    1919                ismungsm                  = 0;
     
    7575                                md = checkfield(md,'fieldname','surfaceforcings.rlapslgm','>=',0,'numel',1);
    7676                                if(obj.isdelta18o==0 & obj.ismungsm==0)
    77                                     md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','forcing',1,'NaN',1);
    78                                     md = checkfield(md,'fieldname','surfaceforcings.precipitation','forcing',1,'NaN',1);
    79                                 elseif(obj.isdelta18o==1)
    80                                     md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1);
    81                                     md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1);
    82                                     md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
    83                                     md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
    84                                     md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
    85                                     md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);                                       
    86                                     md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1);
    87                                     md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1);
    88                                 elseif(obj.ismungsm==1)
    89                                     md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
    90                                     md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
    91                                     md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
    92                                     md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);                                       
    93                                     md = checkfield(md,'fieldname','surfaceforcings.Pfac','NaN',1,'size',[2,NaN]);
    94                                     md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1);
    95                                     md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1);
     77                                        md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','forcing',1,'NaN',1);
     78                                        md = checkfield(md,'fieldname','surfaceforcings.precipitation','forcing',1,'NaN',1);
     79                                elseif(obj.isdelta18o==1)
     80                                        md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1);
     81                                        md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1);
     82                                        md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     83                                        md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     84                                        md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     85                                        md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);                                       
     86                                        md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1);
     87                                        md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1);
     88                                elseif(obj.ismungsm==1)
     89                                        md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     90                                        md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     91                                        md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     92                                        md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);                                       
     93                                        md = checkfield(md,'fieldname','surfaceforcings.Pfac','NaN',1,'size',[2,NaN]);
     94                                        md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1);
     95                                        md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1);
    9696                                end
    97                         end
     97                        end
    9898                end % }}}
    9999                function disp(obj) % {{{
     
    144144                        WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','rlapslgm','format','Double');
    145145
    146                         if(obj.isdelta18o==0 & obj.ismungsm==0)
    147                             %WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1);
    148                             WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
    149                             WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
     146                        if(obj.isdelta18o==0 & obj.ismungsm==0)
     147                                %WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1);
     148                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
     149                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
    150150                        elseif obj.isdelta18o
    151151                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','temperatures_presentday','format','DoubleMat','mattype',1);
     
    155155                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','delta18o_surface','format','DoubleMat','mattype',1);
    156156                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','delta18o','format','DoubleMat','mattype',1);
    157                                 WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1);
    158                                 WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1);
     157                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1);
     158                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1);
    159159                        elseif obj.ismungsm
    160160                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','temperatures_presentday','format','DoubleMat','mattype',1);
     
    162162                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','precipitations_presentday','format','DoubleMat','mattype',1);
    163163                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','precipitations_lgm','format','DoubleMat','mattype',1);
    164                                 WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','Pfac','format','DoubleMat','mattype',1);
    165                                 WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1);
    166                                 WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1);
     164                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','Pfac','format','DoubleMat','mattype',1);
     165                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1);
     166                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1);
    167167                        end
    168168                end % }}}
  • TabularUnified issm/trunk-jpl/src/m/classes/SMBpdd.py

    r18970 r18984  
    114114                        md = checkfield(md,'fieldname','surfaceforcings.rlapslgm','>=',0,'numel',[1])
    115115
    116                         if not (self.isdelta18o and self.ismungsm):
     116                        if (self.isdelta18o==0 and self.ismungsm==0):
    117117                                md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','NaN',1)
    118118                                md = checkfield(md,'fieldname','surfaceforcings.precipitation','NaN',1)
     
    151151                WriteData(fid,'object',self,'class','surfaceforcings','fieldname','rlapslgm','format','Double')
    152152
    153                 if not (self.isdelta18o and self.ismungsm):
     153                if (self.isdelta18o==0 and self.ismungsm==0):
    154154                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1)
    155155                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
  • TabularUnified issm/trunk-jpl/test/NightlyRun/test237.py

    r18968 r18984  
    5757
    5858# Interpolation factors
    59 md.surfaceforcings.Pfac[1,1:md.timestepping.final_time]=0.5;
    60 md.surfaceforcings.Tdiff[1,1:md.timestepping.final_time]=0.5;
    61 md.surfaceforcings.sealev[1,1:md.timestepping.final_time]=0.5;
     59md.surfaceforcings.Pfac=0.5*numpy.ones((2,md.timestepping.final_time))
     60md.surfaceforcings.Tdiff=0.5*numpy.ones((2,md.timestepping.final_time))
     61md.surfaceforcings.sealev=0.5*numpy.ones((2,md.timestepping.final_time))
    6262# Year of each data point
    63 md.surfaceforcings.Pfac[2,1:md.timestepping.final_time]=1:1:md.timestepping.final_time;
    64 md.surfaceforcings.Tdiff[2,1:md.timestepping.final_time]=1:1:md.timestepping.final_time;
    65 md.surfaceforcings.sealev[2,1:md.timestepping.final_time]=1:1:md.timestepping.final_time;
     63md.surfaceforcings.Pfac[1,1:md.timestepping.final_time]=numpy.arange(1.,md.timestepping.final_time)
     64md.surfaceforcings.Tdiff[1,1:md.timestepping.final_time]=numpy.arange(1.,md.timestepping.final_time)
     65md.surfaceforcings.sealev[1,1:md.timestepping.final_time]=numpy.arange(1.,md.timestepping.final_time)
    6666
    6767# time steps and resolution
Note: See TracChangeset for help on using the changeset viewer.