示例#1
0
        Latitude,Longitude = writeGbin(file,Trajectory,(NumTimesteps,NumLEs),HeaderData)#,flags
                
        mxLat = N.ones((NumTimesteps),N.Float)
        meanLat = N.ones((NumTimesteps),N.Float)
        mnLat = N.ones((NumTimesteps),N.Float)
        leTimes = []
        
        # Assumming a Timestep is an hour (3600 seconds)!
        count = 0        
        for cn in range(NumTimesteps):
            dtime = datetime.timedelta(seconds=cn*3600)
            time  = modelStartTime + dtime
            tLat = N.take(Latitude,(cn,), 1)
    #         print tLat
            mxL = MA.maximum(tLat,)
            mnL = MA.minimum(tLat,)            
            meanL=MLab.mean(tLat,0)    
            N.put(mxLat,cn,mxL)            
            N.put(mnLat,cn,mnL)
            N.put(meanLat,cn,meanL)
            leTimes.append(time)
            
            nboth = 0
            if time in ocTime:
                write_matches = 1
                while write_matches == 1:
#                     print nboth, cn                     
                    if count == 0:
                        nboth = ocTime.index(time)
                        count +=1                        
#                         fs.write('%i, %s, %i %i %i %i %i, %f %f %f, %f %f %f\n'%(cn, file, int(time.year), int(time.month), int(time.day), int(time.hour), int(time.minute), mxL, meanL, mnL, ocLat[nboth,0], ocLat[nboth,1],ocLat[nboth,2]))
示例#2
0
if dim != 'x' and dim != 'X':
	dim = 'y'
else:
	dim = 'x'

if ipos == 0:
	if dim == 'x':
		ipos = int(round(shape(pvar)[1]/2))
	else:
		ipos = int(round(shape(pvar)[2]/2))
	pos = repr(ipos)

if minval == maxval:
	if dim == 'x':
		minval = int(floor(MA.minimum(pvar[:,:,ipos])))
		maxval = int(ceil(MA.maximum(pvar[:,:,ipos])))
	else:
		minval = int(floor(MA.minimum(pvar[:,ipos,:])))
		maxval = int(ceil(MA.maximum(pvar[:,ipos,:])))
	minval = minval - abs(minval)*0.05
	maxval = maxval + abs(maxval)*0.05


sys.stdout.write("Plotting "+var+" (sliced at "+dim+" position "+pos+")\nPlotting time step ")

for t in range(maxt):
    
	sys.stdout.write(repr(t)+'...')
	sys.stdout.flush()
	
示例#3
0
文件: oroplot.py 项目: jsfan/swim
for opt, arg in opts:
        if opt == '--minval':
                minval = int(arg)
        elif opt == '--maxval':
                maxval = int(arg)
        elif opt in ('-t','--transpose'):
                tp = 1
        elif opt in ('--prefix','-p'):
                prefix = arg + '-'

if tp:
        print 'Value matrix will be transposed.'

# colourbar range not set on cmdline
if (minval == maxval):
        minval = int(floor(1.01*MA.minimum(pvar)))
        maxval = int(ceil(1.01*MA.maximum(pvar)))

print 'Boundaries for values are %0.2f and %0.2f' % (minval,maxval)

step = int(ceil((maxval-minval)/1024.0))

if tp:
	p.imshow(pvar[:,:].transpose(),origin='lower',interpolation='nearest',vmin=minval,vmax=maxval)
	p.colorbar(orientation='horizontal')
else:
	p.imshow(pvar[:,:],origin='lower',interpolation='nearest',vmin=minval,vmax=maxval)
	p.colorbar(orientation='horizontal')
    	
filename = prefix + "phioro.png"
p.title('Orography')