t2a= pcr.readmap('PCRGLOBWB\\t2a\\t2a0%04d.%03d' % (year,month)) #actual transpiration from soil layer 1 (m/day) #import number of days per month (days) daysMonth= calendar.monthrange(year,month) daysMonth= daysMonth[1] #read crop factor (-) kc= pcr.scalar('cropFactor\\kctotal0.0%02d' % (month)) #calculate potential crop transpiration per layer (million m3/month) tp1Crop= kc*(t1p)*daysMonth*irrArea/conv1 tp2Crop= kc*(t2p)*daysMonth*irrArea/conv1 #calculate fractions of actual to potential transpiration (-) t1Fra= pcr.ifthen(clone,pcr.cover(pcr.min(1.,t1a/t1p),0.)) t2Fra= pcr.ifthen(clone,pcr.cover(pcr.min(1.,t2a/t2p),0.)) #calculate actual crop transpiration (million m3/month) taCrop= (tp1Crop*rf1*t1Fra)+(tp2Crop*rf2*t2Fra) #calculate irrigation loss irlCrop= pcr.max(0.,esp - esa)*daysMonth*irrArea/conv1 #calculate consumptive blue water use for irrigation (million m3/month) inCrop= ((tp1Crop+tp2Crop)-taCrop+irlCrop)*(1.+(1.-efficiency)) pcr.report(inCrop,'results\\incr\\incr%04d.%03d' % (year,month)) #read other demands (-) otherDemands= pcr.scalar('otherWDs\\othr%04d.0%02d' % (year,month)) #calculate total water demand (million m3/month) totDemand= inCrop+otherDemands pcr.report(totDemand,'results\\totd\\totd%04d.0%02d' % (year,month)) #calculate annual total water demand (million m3/year) totDemandAnn= totDemandAnn+totDemand #estimate return flow from irrigation (million m3/year) frShort= pcr.scalar('irrigation\\frshort0.0%02d' % (month)) frTall= pcr.scalar('irrigation\\frtall00.0%02d' % (month)) percFc= kfc2*((frShort+frTall)*irrAreaFra)*daysMonth*cellArea/1000000 irrRch= (((1+1-efficiency))/(1+((1+1-efficiency))))*inCrop
#-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: fractionGroundwaterContribution= min(1.,catchmentRecharge/catchmentLandRunoff) else: fractionGroundwaterContribution= 1. if catchmentRunoff > 0.: fractionEnvironmentalFlow= catchmentEnvironmentalFlow/catchmentRunoff