Changeset 23677


Ignore:
Timestamp:
02/01/19 03:29:03 (6 years ago)
Author:
bdef
Message:

CHG: adding missing directories and cleaning code

Location:
issm/trunk-jpl/src/py3
Files:
133 added
6 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/py3/consistency/ismodelselfconsistent.py

    r23670 r23677  
    11def AnalysisConfiguration(solutiontype): #{{{
    22        """
    3         ANALYSISCONFIGURATION - return type of analyses, number of analyses 
     3        ANALYSISCONFIGURATION - return type of analyses, number of analyses
    44
    55                Usage:
     
    99        if   solutiontype == 'StressbalanceSolution':
    1010                analyses=['StressbalanceAnalysis','StressbalanceVerticalAnalysis','StressbalanceSIAAnalysis','L2ProjectionBaseAnalysis']
    11 
    1211        elif solutiontype == 'SteadystateSolution':
    1312                analyses=['StressbalanceAnalysis','StressbalanceVerticalAnalysis','StressbalanceSIAAnalysis','L2ProjectionBaseAnalysis','ThermalAnalysis','MeltingAnalysis','EnthalpyAnalysis']
    14 
    1513        elif solutiontype == 'ThermalSolution':
    1614                analyses=['EnthalpyAnalysis','ThermalAnalysis','MeltingAnalysis']
    17 
    1815        elif solutiontype == 'MasstransportSolution':
    1916                analyses=['MasstransportAnalysis']
    20 
    2117        elif solutiontype == 'BalancethicknessSolution':
    2218                analyses=['BalancethicknessAnalysis']
    23 
    2419        elif solutiontype == 'SurfaceSlopeSolution':
    2520                analyses=['L2ProjectionBaseAnalysis']
    26 
    2721        elif solutiontype == 'BalancevelocitySolution':
    2822                analyses=['BalancevelocityAnalysis']
    29 
    3023        elif solutiontype == 'BedSlopeSolution':
    3124                analyses=['L2ProjectionBaseAnalysis']
    32 
    3325        elif solutiontype == 'GiaSolution':
    3426                analyses=['GiaIvinsAnalysis']
    35 
    36         elif solutiontype == 'LoveSolution':
    37                 analyses=['LoveAnalysis']
    38 
     27        elif solutiontype == 'LoveSolution':
     28                analyses=['LoveAnalysis']
    3929        elif solutiontype == 'TransientSolution':
    4030                analyses=['StressbalanceAnalysis','StressbalanceVerticalAnalysis','StressbalanceSIAAnalysis','L2ProjectionBaseAnalysis','ThermalAnalysis','MeltingAnalysis','EnthalpyAnalysis','MasstransportAnalysis']
    41 
    4231        elif solutiontype == 'HydrologySolution':
    4332                analyses=['L2ProjectionBaseAnalysis','HydrologyShreveAnalysis','HydrologyDCInefficientAnalysis','HydrologyDCEfficientAnalysis']
    44 
    4533        elif 'DamageEvolutionSolution':
    4634                analyses=['DamageEvolutionAnalysis']
     
    8674        if not md.private.isconsistent:
    8775                raise RuntimeError('Model not consistent, see messages above.')
    88 
  • issm/trunk-jpl/src/py3/exp/expdisp.py

    r23670 r23677  
    55
    66def expdisp(ax,options):
    7     '''
    8     plot the contents of a domain outline file
     7        '''
     8        plot the contents of a domain outline file
    99
    10     This routine reads in an exp file and plots all of the x,y points/lines/patches
     10        This routine reads in an exp file and plots all of the x,y points/lines/patches
    1111
    12     'ax' is a handle to the current plot axes, onto which we want to plot
     12        'ax' is a handle to the current plot axes, onto which we want to plot
    1313
    14     Usage:
    15         expdisp(ax,options)
     14        Usage:
     15        expdisp(ax,options)
    1616
    17     List of options passable to plotmodel:
    18         'expdisp'      : path (or list of paths) to the exp file to be plotted
    19         'explinewidth' : linewidth
    20         'explinestyle' : matplotlib linestyle string
    21         'explinecolor' : matplotlib color string
    22         'expfill'      : (True/False) fill a closed contour
    23         'expfillcolor' : Color for a filled contour, only used if expfill is True
    24         'expfillalpha' : alpha transparency for filled contour
     17        List of options passable to plotmodel:
     18        'expdisp'      : path (or list of paths) to the exp file to be plotted
     19        'explinewidth' : linewidth
     20        'explinestyle' : matplotlib linestyle string
     21        'explinecolor' : matplotlib color string
     22        'expfill'      : (True/False) fill a closed contour
     23        'expfillcolor' : Color for a filled contour, only used if expfill is True
     24        'expfillalpha' : alpha transparency for filled contour
    2525
    26     All options should be passed as lists of length len(number of exp files passed)
    27     '''
     26        All options should be passed as lists of length len(number of exp files passed)
     27        '''
    2828
    29     filenames=options.getfieldvalue('expdisp')
    30     linewidth=options.getfieldvalue('explinewidth',[1]*len(filenames))
    31     linestyle=options.getfieldvalue('explinestyle',['-']*len(filenames))
    32     linecolor=options.getfieldvalue('explinecolor',['k']*len(filenames))
    33     fill=options.getfieldvalue('expfill',[0]*len(filenames))
    34     alpha=options.getfieldvalue('expfillalpha',[1]*len(filenames))
    35     facecolor=options.getfieldvalue('expfillcolor',['r']*len(filenames))
    36     unitmultiplier=options.getfieldvalue('unit',1)
    37     for i in range(len(filenames)):
    38         linestylei=linestyle[i]
    39         linecolori=linecolor[i]
    40         linewidthi=linewidth[i]
    41         alphai=alpha[i]
    42         facecolori=facecolor[i]
    43         filenamei=filenames[i]
    44         filli=fill[i]
    45         domain=expread(filenamei)
    46         for j in range(len(domain)):
    47             if domain[j]['nods']==1:
    48                 ax.plot(domain[j]['x']*unitmultiplier,domain[j]['y']*unitmultiplier,'o',mec='k',mfc='r',ms=10)
    49             elif filli:
    50                 verts=np.column_stack((domain[j]['x'],domain[j]['y']))
    51                 codes=[Path.MOVETO] + [Path.LINETO]*(len(domain[j]['x'])-2) + [Path.CLOSEPOLY]
    52                 path=Path(verts, codes)
    53                 patch=patches.PathPatch(path,facecolor=facecolori,edgecolor=linecolori,alpha=alphai,
    54                         lw=linewidthi)
    55                 ax.add_patch(patch)
    56             else:
    57                 x=domain[j]['x'].tolist() # since expread returns a string representation of the arrays
    58                 y=domain[j]['y'].tolist()
    59                 ax.plot(x*unitmultiplier,y*unitmultiplier,ls=linestylei,lw=linewidthi,c=linecolori)
     29        filenames=options.getfieldvalue('expdisp')
     30        linewidth=options.getfieldvalue('explinewidth',[1]*len(filenames))
     31        linestyle=options.getfieldvalue('explinestyle',['-']*len(filenames))
     32        linecolor=options.getfieldvalue('explinecolor',['k']*len(filenames))
     33        fill=options.getfieldvalue('expfill',[0]*len(filenames))
     34        alpha=options.getfieldvalue('expfillalpha',[1]*len(filenames))
     35        facecolor=options.getfieldvalue('expfillcolor',['r']*len(filenames))
     36        unitmultiplier=options.getfieldvalue('unit',1)
     37        for i in range(len(filenames)):
     38                linestylei=linestyle[i]
     39                linecolori=linecolor[i]
     40                linewidthi=linewidth[i]
     41                alphai=alpha[i]
     42                facecolori=facecolor[i]
     43                filenamei=filenames[i]
     44                filli=fill[i]
     45                domain=expread(filenamei)
     46                for j in range(len(domain)):
     47                        if domain[j]['nods']==1:
     48                                ax.plot(domain[j]['x']*unitmultiplier,domain[j]['y']*unitmultiplier,'o',mec='k',mfc='r',ms=10)
     49                        elif filli:
     50                                verts=np.column_stack((domain[j]['x'],domain[j]['y']))
     51                                codes=[Path.MOVETO] + [Path.LINETO]*(len(domain[j]['x'])-2) + [Path.CLOSEPOLY]
     52                                path=Path(verts, codes)
     53                                patch=patches.PathPatch(path,facecolor=facecolori,edgecolor=linecolori,alpha=alphai,
     54                                                                                                                                lw=linewidthi)
     55                                ax.add_patch(patch)
     56                        else:
     57                                x=domain[j]['x'].tolist() # since expread returns a string representation of the arrays
     58                                y=domain[j]['y'].tolist()
     59                                ax.plot(x*unitmultiplier,y*unitmultiplier,ls=linestylei,lw=linewidthi,c=linecolori)
  • issm/trunk-jpl/src/py3/plot/applyoptions.py

    r23670 r23677  
    142142        # }}}
    143143        # {{{ xlim, ylim, zlim
    144         if options.exist('xlim'):
     144        if options.exist('xlim'):
    145145                ax.set_xlim(options.getfieldvalue('xlim'))
    146146        if options.exist('ylim'):
  • issm/trunk-jpl/src/py3/plot/checkplotoptions.py

    r23670 r23677  
    2929                if 'on' in options.getfieldvalue('showsection','on'):
    3030                        options.changefieldvalue('showsection',4)
    31         # }}}   
     31        # }}}
    3232        # {{{ smooth values
    3333        if options.exist('smooth'):
     
    5454                textlist.extend([text] if isinstance(text,str) else text)
    5555                numtext=len(textlist)
    56                 # text position 
     56                # text position
    5757                textpos=options.getfieldvalue('textposition',[0.5,0.5])
    5858                if not isinstance(textpos,list):
    5959                        raise Exception('textposition should be passed as a list')
    6060                if any(isinstance(i,list) for i in textpos):
    61                     textx=[item[0] for item in textpos]
    62                     texty=[item[1] for item in textpos]
    63                 else:
    64                     textx=[textpos[0]]
    65                     texty=[textpos[1]]
     61                        textx=[item[0] for item in textpos]
     62                        texty=[item[1] for item in textpos]
     63                else:
     64                        textx=[textpos[0]]
     65                        texty=[textpos[1]]
    6666                if len(textx)!=numtext or len(texty)!=numtext:
    6767                        raise Exception('textposition should contain one list of x,y vertices for every text instance')
  • issm/trunk-jpl/src/py3/solve/parseresultsfromdisk.py

    r23670 r23677  
    1919                raise IOError("loadresultsfromdisk error message: could not open '%s' for binary reading." % filename)
    2020
    21         #initialize results: 
     21        #initialize results:
    2222        saveres=[]
    2323
     
    3030
    3131        while loadres:
    32                 #check that the new result does not add a step, which would be an error: 
     32                #check that the new result does not add a step, which would be an error:
    3333                if check_nomoresteps:
    3434                        if loadres['step']>=1:
     
    4242                #Add result
    4343                if loadres['step']==0:
    44                         #if we have a step = 0, this is a steady state solution, don't expect more steps. 
     44                        #if we have a step = 0, this is a steady state solution, don't expect more steps.
    4545                        index = 0;
    4646                        check_nomoresteps=1
     
    4949                else:
    5050                        index = counter;
    51                
     51
    5252                if index > len(saveres)-1:
    5353                        for i in range(len(saveres)-1,index-1):
     
    5656                elif saveres[index] is None:
    5757                        saveres[index]=resultsclass.results()
    58                        
     58
    5959                #Get time and step
    6060                if loadres['step'] != -9999.:
     
    8383        saveres=[]
    8484
    85         #if we have done split I/O, ie, we have results that are fragmented across patches, 
     85        #if we have done split I/O, ie, we have results that are fragmented across patches,
    8686        #do a first pass, and figure out the structure of results
    8787        loadres=ReadDataDimensions(fid)
     
    9494                        saveres.append(resultsclass.results())
    9595                setattr(saveres[loadres['step']-1],'step',loadres['step'])
    96                 setattr(saveres[loadres['step']-1],'time',loadres['time']) 
     96                setattr(saveres[loadres['step']-1],'time',loadres['time'])
    9797
    9898                #Add result
     
    121121                        saveres.append(saveresclass.saveres())
    122122                setattr(saveres[loadres['step']-1],'step',loadres['step'])
    123                 setattr(saveres[loadres['step']-1],'time',loadres['time']) 
     123                setattr(saveres[loadres['step']-1],'time',loadres['time'])
    124124
    125125                #Add result
     
    134134        return saveres
    135135        # }}}
     136
    136137def ReadData(fid,md):    # {{{
    137138        """
    138139        READDATA - ...
    139          
     140
    140141            Usage:
    141142               field=ReadData(fid,md)
     
    209210                elif fieldname=='SmbRunoff':
    210211                        field = field*yts
    211                 elif fieldname=='SmbEvaporation':
    212                         field = field*yts;
    213                 elif fieldname=='SmbRefreeze':
    214                         field = field*yts;
     212                elif fieldname=='SmbEvaporation':
     213                        field = field*yts;
     214                elif fieldname=='SmbRefreeze':
     215                        field = field*yts;
    215216                elif fieldname=='SmbEC':
    216217                        field = field*yts
     
    219220                elif fieldname=='SmbMelt':
    220221                        field = field*yts
    221                 elif fieldname=='SmbMAdd':
    222                         field = field*yts
     222                elif fieldname=='SmbMAdd':
     223                        field = field*yts
    223224                elif fieldname=='CalvingCalvingrate':
    224225                        field = field*yts
     
    256257        """
    257258        READDATADIMENSIONS - read data dimensions, step and time, but not the data itself.
    258          
     259
    259260            Usage:
    260261               field=ReadDataDimensions(fid)
     
    264265        try:
    265266                length=struct.unpack('i',fid.read(struct.calcsize('i')))[0]
    266 
    267267                fieldname=struct.unpack('%ds' % length,fid.read(length))[0][:-1]
    268268                time=struct.unpack('d',fid.read(struct.calcsize('d')))[0]
    269269                step=struct.unpack('i',fid.read(struct.calcsize('i')))[0]
    270 
    271270                type=struct.unpack('i',fid.read(struct.calcsize('i')))[0]
    272271                M=struct.unpack('i',fid.read(struct.calcsize('i')))[0]
  • issm/trunk-jpl/src/py3/solve/solve.py

    r23670 r23677  
    1313        """
    1414        SOLVE - apply solution sequence for this model
    15  
     15
    1616           Usage:
    1717              md=solve(md,solutionstring,varargin)
    1818              where varargin is a list of paired arguments of string OR enums
    19  
     19
    2020                solution types available comprise:
    2121                 - 'Stressbalance'    or 'sb'
     
    3939                  - checkconsistency : 'yes' or 'no' (default is 'yes'), ensures checks on consistency of model
    4040                  - restart: 'directory name (relative to the execution directory) where the restart file is located.
    41  
     41
    4242           Examples:
    4343              md=solve(md,'Stressbalance');
     
    4949                solutionstring = 'StressbalanceSolution';
    5050        elif solutionstring.lower() == 'mt' or solutionstring.lower() == 'masstransport':
    51                 solutionstring = 'MasstransportSolution';       
     51                solutionstring = 'MasstransportSolution';
    5252        elif solutionstring.lower() == 'th' or solutionstring.lower() == 'thermal':
    5353                solutionstring = 'ThermalSolution';
     
    7070        elif solutionstring.lower() == 'gia' or solutionstring.lower() == 'gia':
    7171                solutionstring = 'GiaSolution';
    72         elif solutionstring.lower() == 'lv' or solutionstring.lower() == 'love':
    73                 solutionstring = 'LoveSolution';
     72        elif solutionstring.lower() == 'lv' or solutionstring.lower() == 'love':
     73                solutionstring = 'LoveSolution';
    7474        elif solutionstring.lower() == 'esa':
    7575                solutionstring = 'EsaSolution';
    7676        elif solutionstring.lower() == 'slr' or solutionstring.lower() == 'sealevelrise':
    7777                solutionstring = 'SealevelriseSolution';
    78         else:   
     78        else:
    7979                raise ValueError("solutionstring '%s' not supported!" % solutionstring)
    8080        options=pairoptions('solutionstring',solutionstring,*args)
     
    8282        #recover some fields
    8383        md.private.solution=solutionstring
    84         cluster=md.cluster 
     84        cluster=md.cluster
    8585        if options.getfieldvalue('batch','no')=='yes':
    8686                batch=1
     
    106106                                md.private.runtimename="%s-%02i-%02i-%04i-%02i-%02i-%02i-%i" % (md.miscellaneous.name,c.month,c.day,c.year,c.hour,c.minute,c.second,os.getpid())
    107107                        else:
    108                                 md.private.runtimename=md.miscellaneous.name 
     108                                md.private.runtimename=md.miscellaneous.name
    109109
    110110        #if running qmu analysis, some preprocessing of dakota files using models
    111         #fields needs to be carried out. 
     111        #fields needs to be carried out.
    112112        if md.qmu.isdakota:
    113113                md=preqmu(md,options)
     
    120120
    121121        #Write all input files
    122         marshall(md)                                          # bin file
    123         md.toolkits.ToolkitsFile(md.miscellaneous.name+'.toolkits')    # toolkits file
    124         cluster.BuildQueueScript(md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof,md.qmu.isdakota,md.transient.isoceancoupling)    # queue file
     122        marshall(md)                                                                                                                                                                    # bin file
     123        md.toolkits.ToolkitsFile(md.miscellaneous.name+'.toolkits')              # toolkits file
     124        cluster.BuildQueueScript(md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof,md.qmu.isdakota,md.transient.isoceancoupling)          # queue file
    125125
    126126        #Stop here if batch mode
     
    130130                return md
    131131
    132         #Upload all required files: 
     132        #Upload all required files:
    133133        modelname = md.miscellaneous.name
    134134        filelist  = [modelname+'.bin ',modelname+'.toolkits ',modelname+'.queue ']
     
    138138        if not restart:
    139139                cluster.UploadQueueJob(md.miscellaneous.name,md.private.runtimename,filelist)
    140        
     140
    141141        #Launch job
    142142        cluster.LaunchQueueJob(md.miscellaneous.name,md.private.runtimename,filelist,restart,batch)
Note: See TracChangeset for help on using the changeset viewer.