conv2= cellArea/(86400) #m/day => m3/second #make lists totDemandList= [pcr.scalar(0) for year in range(endYear-staYear)] irrRetnList= [pcr.scalar(0) for year in range(endYear-staYear)] #calculate consumptive blue water use for irrigation and subsequently total water demand print '\tclculate irrigation and total blue water demand' for year in range(staYear,endYear,timeStep): print year, totDemandAnn= pcr.scalar(0) irrRetnAnn= pcr.scalar(0) #real irrigated areas (hectare) irrArea2000= pcr.scalar('irrigation\\irra2000.map') irrArea= pcr.scalar('irrigation\\irra%04d.map' % (year)) irrAreaFra= pcr.ifthen(clone,pcr.cover(pcr.min(1.,(irrArea)/irrArea2000),0.)) for month in range(staMonth,endMonth,timeStep): tp1Crop= pcr.scalar(0) tp2Crop= pcr.scalar(0) t1Fra= pcr.scalar(0) t2Fra= pcr.scalar(0) taCrop= pcr.scalar(0) irlCrop= pcr.scalar(0) inCrop= pcr.scalar(0) totDemand= pcr.scalar(0) #import from PCR-GLOBWB per calibration time step esp= pcr.readmap('PCRGLOBWB\\esp\\esp0%04d.%03d' % (year,month)) #potential bare soil evaporation (m/day) esa= pcr.readmap('PCRGLOBWB\\esa\\esac%04d.%03d' % (year,month)) #actual bare soil evaporation (m/day) t1p= pcr.readmap('PCRGLOBWB\\t1p\\t1p0%04d.%03d' % (year,month)) #potential transpiration from soil layer 1 (m/day) t2p= pcr.readmap('PCRGLOBWB\\t2p\\t2p0%04d.%03d' % (year,month)) #potential transpiration from soil layer 2 (m/day) t1a= pcr.readmap('PCRGLOBWB\\t1a\\t1a0%04d.%03d' % (year,month)) #actual transpiration from soil layer 1 (m/day)
print repStr #-optimize recharge reserved for ecological flow for catchments that are not mere lakes repStr= 'processing %d catchments; all flows expressed as volumes in m3 at the outlet of the catchment\n' % maximumCatchmentID print repStr textFile.write(repStr) #-initialize map of reserved recharge fraction fractionReservedRechargeMap= pcr.scalar(0.) #-create header to display on screen and write to file repStr= '%6s,%15s,%15s,%15s,%15s,%15s,%15s,%15s,%15s,%15s\n' % \ ('ID','Area [km2]','Q_Avg [m3]','Q_10 [m3]','Q_10/Q_Avg [-]','q_water [m3]','q_land [m3]','R_gw (pos.)','R_gw/q_land [-]','R_Q10/R_gw [-]') print repStr textFile.write(repStr) for catchment in xrange(1,maximumCatchmentID+1): #-create catchment mask and check whether it does not coincide with a lake catchmentMask= catchments == catchment catchmentSize= pcr.cellvalue(pcr.maptotal(pcr.ifthen(catchmentMask,cellArea*1.e-6)),1)[0] if pcr.cellvalue(pcr.maptotal(pcr.ifthen(catchmentMask,pcr.scalar(lakeMask))),1) <> \ pcr.cellvalue(pcr.maptotal(pcr.ifthen(catchmentMask,pcr.scalar(catchmentMask))),1)[0] and \ catchmentSize > catchmentSizeLimit: #-valid catchment, process catchmentRecharge= pcr.cellvalue(pcr.maptotal(pcr.ifthen(catchmentMask,pcr.max(0.,R3AVG)*365.25*(1.-fracWat)*cellArea)),1)[0] catchmentLandRunoff= pcr.cellvalue(pcr.maptotal(pcr.ifthen(catchmentMask,landSpecificRunoff*(1.-fracWat)*cellArea)),1)[0] catchmentWaterRunoff= pcr.cellvalue(pcr.maptotal(pcr.ifthen(catchmentMask,waterSpecificRunoff*fracWat*cellArea)),1)[0] catchmentRunoff= pcr.cellvalue(pcr.mapmaximum(pcr.ifthen(catchmentMask,\ pcr.accuthresholdflux(LDD,(fracWat*pcr.max(0.,waterSpecificRunoff)+\ (1.-fracWat)*landSpecificRunoff)*cellArea,fracWat*pcr.max(0.,-waterSpecificRunoff)*cellArea))),1)[0] catchmentEnvironmentalFlow= pcr.cellvalue(pcr.mapmaximum(pcr.ifthen(catchmentMask,environmentalQ)),1)[0]*365.25*3600*24 catchmentRunoff= max(catchmentRunoff,catchmentEnvironmentalFlow) #-groundwater recharge required to satisfy environmental flow conditions depends on the fraction environmental flow over the mean discharge # and the fraction contribution of the land runoff to the mean discharge if catchmentLandRunoff > 0: