Changeset 23677
- Timestamp:
- 02/01/19 03:29:03 (6 years ago)
- 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 1 1 def AnalysisConfiguration(solutiontype): #{{{ 2 2 """ 3 ANALYSISCONFIGURATION - return type of analyses, number of analyses 3 ANALYSISCONFIGURATION - return type of analyses, number of analyses 4 4 5 5 Usage: … … 9 9 if solutiontype == 'StressbalanceSolution': 10 10 analyses=['StressbalanceAnalysis','StressbalanceVerticalAnalysis','StressbalanceSIAAnalysis','L2ProjectionBaseAnalysis'] 11 12 11 elif solutiontype == 'SteadystateSolution': 13 12 analyses=['StressbalanceAnalysis','StressbalanceVerticalAnalysis','StressbalanceSIAAnalysis','L2ProjectionBaseAnalysis','ThermalAnalysis','MeltingAnalysis','EnthalpyAnalysis'] 14 15 13 elif solutiontype == 'ThermalSolution': 16 14 analyses=['EnthalpyAnalysis','ThermalAnalysis','MeltingAnalysis'] 17 18 15 elif solutiontype == 'MasstransportSolution': 19 16 analyses=['MasstransportAnalysis'] 20 21 17 elif solutiontype == 'BalancethicknessSolution': 22 18 analyses=['BalancethicknessAnalysis'] 23 24 19 elif solutiontype == 'SurfaceSlopeSolution': 25 20 analyses=['L2ProjectionBaseAnalysis'] 26 27 21 elif solutiontype == 'BalancevelocitySolution': 28 22 analyses=['BalancevelocityAnalysis'] 29 30 23 elif solutiontype == 'BedSlopeSolution': 31 24 analyses=['L2ProjectionBaseAnalysis'] 32 33 25 elif solutiontype == 'GiaSolution': 34 26 analyses=['GiaIvinsAnalysis'] 35 36 elif solutiontype == 'LoveSolution': 37 analyses=['LoveAnalysis'] 38 27 elif solutiontype == 'LoveSolution': 28 analyses=['LoveAnalysis'] 39 29 elif solutiontype == 'TransientSolution': 40 30 analyses=['StressbalanceAnalysis','StressbalanceVerticalAnalysis','StressbalanceSIAAnalysis','L2ProjectionBaseAnalysis','ThermalAnalysis','MeltingAnalysis','EnthalpyAnalysis','MasstransportAnalysis'] 41 42 31 elif solutiontype == 'HydrologySolution': 43 32 analyses=['L2ProjectionBaseAnalysis','HydrologyShreveAnalysis','HydrologyDCInefficientAnalysis','HydrologyDCEfficientAnalysis'] 44 45 33 elif 'DamageEvolutionSolution': 46 34 analyses=['DamageEvolutionAnalysis'] … … 86 74 if not md.private.isconsistent: 87 75 raise RuntimeError('Model not consistent, see messages above.') 88 -
issm/trunk-jpl/src/py3/exp/expdisp.py
r23670 r23677 5 5 6 6 def expdisp(ax,options): 7 8 7 ''' 8 plot the contents of a domain outline file 9 9 10 10 This routine reads in an exp file and plots all of the x,y points/lines/patches 11 11 12 12 'ax' is a handle to the current plot axes, onto which we want to plot 13 13 14 15 14 Usage: 15 expdisp(ax,options) 16 16 17 18 19 20 21 22 23 24 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 25 25 26 27 26 All options should be passed as lists of length len(number of exp files passed) 27 ''' 28 28 29 30 31 32 33 34 35 36 37 38 linestylei=linestyle[i]39 40 41 42 43 filenamei=filenames[i]44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 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 142 142 # }}} 143 143 # {{{ xlim, ylim, zlim 144 144 if options.exist('xlim'): 145 145 ax.set_xlim(options.getfieldvalue('xlim')) 146 146 if options.exist('ylim'): -
issm/trunk-jpl/src/py3/plot/checkplotoptions.py
r23670 r23677 29 29 if 'on' in options.getfieldvalue('showsection','on'): 30 30 options.changefieldvalue('showsection',4) 31 # }}} 31 # }}} 32 32 # {{{ smooth values 33 33 if options.exist('smooth'): … … 54 54 textlist.extend([text] if isinstance(text,str) else text) 55 55 numtext=len(textlist) 56 # text position 56 # text position 57 57 textpos=options.getfieldvalue('textposition',[0.5,0.5]) 58 58 if not isinstance(textpos,list): 59 59 raise Exception('textposition should be passed as a list') 60 60 if any(isinstance(i,list) for i in textpos): 61 62 63 64 65 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]] 66 66 if len(textx)!=numtext or len(texty)!=numtext: 67 67 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 19 19 raise IOError("loadresultsfromdisk error message: could not open '%s' for binary reading." % filename) 20 20 21 #initialize results: 21 #initialize results: 22 22 saveres=[] 23 23 … … 30 30 31 31 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: 33 33 if check_nomoresteps: 34 34 if loadres['step']>=1: … … 42 42 #Add result 43 43 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. 45 45 index = 0; 46 46 check_nomoresteps=1 … … 49 49 else: 50 50 index = counter; 51 51 52 52 if index > len(saveres)-1: 53 53 for i in range(len(saveres)-1,index-1): … … 56 56 elif saveres[index] is None: 57 57 saveres[index]=resultsclass.results() 58 58 59 59 #Get time and step 60 60 if loadres['step'] != -9999.: … … 83 83 saveres=[] 84 84 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, 86 86 #do a first pass, and figure out the structure of results 87 87 loadres=ReadDataDimensions(fid) … … 94 94 saveres.append(resultsclass.results()) 95 95 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']) 97 97 98 98 #Add result … … 121 121 saveres.append(saveresclass.saveres()) 122 122 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']) 124 124 125 125 #Add result … … 134 134 return saveres 135 135 # }}} 136 136 137 def ReadData(fid,md): # {{{ 137 138 """ 138 139 READDATA - ... 139 140 140 141 Usage: 141 142 field=ReadData(fid,md) … … 209 210 elif fieldname=='SmbRunoff': 210 211 field = field*yts 211 212 213 214 212 elif fieldname=='SmbEvaporation': 213 field = field*yts; 214 elif fieldname=='SmbRefreeze': 215 field = field*yts; 215 216 elif fieldname=='SmbEC': 216 217 field = field*yts … … 219 220 elif fieldname=='SmbMelt': 220 221 field = field*yts 221 222 222 elif fieldname=='SmbMAdd': 223 field = field*yts 223 224 elif fieldname=='CalvingCalvingrate': 224 225 field = field*yts … … 256 257 """ 257 258 READDATADIMENSIONS - read data dimensions, step and time, but not the data itself. 258 259 259 260 Usage: 260 261 field=ReadDataDimensions(fid) … … 264 265 try: 265 266 length=struct.unpack('i',fid.read(struct.calcsize('i')))[0] 266 267 267 fieldname=struct.unpack('%ds' % length,fid.read(length))[0][:-1] 268 268 time=struct.unpack('d',fid.read(struct.calcsize('d')))[0] 269 269 step=struct.unpack('i',fid.read(struct.calcsize('i')))[0] 270 271 270 type=struct.unpack('i',fid.read(struct.calcsize('i')))[0] 272 271 M=struct.unpack('i',fid.read(struct.calcsize('i')))[0] -
issm/trunk-jpl/src/py3/solve/solve.py
r23670 r23677 13 13 """ 14 14 SOLVE - apply solution sequence for this model 15 15 16 16 Usage: 17 17 md=solve(md,solutionstring,varargin) 18 18 where varargin is a list of paired arguments of string OR enums 19 19 20 20 solution types available comprise: 21 21 - 'Stressbalance' or 'sb' … … 39 39 - checkconsistency : 'yes' or 'no' (default is 'yes'), ensures checks on consistency of model 40 40 - restart: 'directory name (relative to the execution directory) where the restart file is located. 41 41 42 42 Examples: 43 43 md=solve(md,'Stressbalance'); … … 49 49 solutionstring = 'StressbalanceSolution'; 50 50 elif solutionstring.lower() == 'mt' or solutionstring.lower() == 'masstransport': 51 solutionstring = 'MasstransportSolution'; 51 solutionstring = 'MasstransportSolution'; 52 52 elif solutionstring.lower() == 'th' or solutionstring.lower() == 'thermal': 53 53 solutionstring = 'ThermalSolution'; … … 70 70 elif solutionstring.lower() == 'gia' or solutionstring.lower() == 'gia': 71 71 solutionstring = 'GiaSolution'; 72 73 72 elif solutionstring.lower() == 'lv' or solutionstring.lower() == 'love': 73 solutionstring = 'LoveSolution'; 74 74 elif solutionstring.lower() == 'esa': 75 75 solutionstring = 'EsaSolution'; 76 76 elif solutionstring.lower() == 'slr' or solutionstring.lower() == 'sealevelrise': 77 77 solutionstring = 'SealevelriseSolution'; 78 else: 78 else: 79 79 raise ValueError("solutionstring '%s' not supported!" % solutionstring) 80 80 options=pairoptions('solutionstring',solutionstring,*args) … … 82 82 #recover some fields 83 83 md.private.solution=solutionstring 84 cluster=md.cluster 84 cluster=md.cluster 85 85 if options.getfieldvalue('batch','no')=='yes': 86 86 batch=1 … … 106 106 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()) 107 107 else: 108 md.private.runtimename=md.miscellaneous.name 108 md.private.runtimename=md.miscellaneous.name 109 109 110 110 #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. 112 112 if md.qmu.isdakota: 113 113 md=preqmu(md,options) … … 120 120 121 121 #Write all input files 122 marshall(md) 123 md.toolkits.ToolkitsFile(md.miscellaneous.name+'.toolkits') 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) 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 125 125 126 126 #Stop here if batch mode … … 130 130 return md 131 131 132 #Upload all required files: 132 #Upload all required files: 133 133 modelname = md.miscellaneous.name 134 134 filelist = [modelname+'.bin ',modelname+'.toolkits ',modelname+'.queue '] … … 138 138 if not restart: 139 139 cluster.UploadQueueJob(md.miscellaneous.name,md.private.runtimename,filelist) 140 140 141 141 #Launch job 142 142 cluster.LaunchQueueJob(md.miscellaneous.name,md.private.runtimename,filelist,restart,batch)
Note:
See TracChangeset
for help on using the changeset viewer.