예제 #1
0
def test(
        array):
    numpy2pcr(pcraster.Scalar, array, mv=6)
  index0= min(mapStack.shape[0]-1,int(percentile*mapStack.shape[0]))
  index1= min(mapStack.shape[0]-1,int(percentile*mapStack.shape[0])+1)
  x0= float(index0)/mapStack.shape[0]
  x1= float(index1)/mapStack.shape[0]
  if x0 <> x1:
    y= mapStack[index0,:]+(percentile-x0)*\
       (mapStack[index1,:]-mapStack[index0,:])/(x1-x0)
  else:
    y= mapStack[index0,:]
  #-convert a slice of the stack into an array
  mapArray= np.ones((mapArray.shape))*MV
  for iCnt in xrange(coordinates.shape[0]):
    row= coordinates[iCnt,0]-1
    col= coordinates[iCnt,1]-1
    mapArray[row,col]= y[iCnt]
  pcr.report(numpy2pcr(pcr.Scalar,mapArray,MV),'q%03d_cumsec.map' % percent)
print
#-retrieve average recharge
R3AVG= pcr.scalar(0.)
for year in yearList:
  fileName= rootR3AVGFileName % ('%04d' % year)
  tempFile= open(fileName,'wb')
  tempFile.write(zipArchive.read(fileName))
  tempFile.close()  
  R3AVG+= pcr.readmap(fileName)
  os.remove(fileName)
R3AVG/= len(yearList)
pcr.report(R3AVG,rootR3AVGFileName % '')
print 'retrieving average runoff components'
for rootQSpecFileName in rootQSpecFileNames:
  specificRunoffQ= pcr.scalar(0.)