=========================================================================== /* @(#)swb.aml 1.2 1/07/2000 11:36:56 /*------------------------------------------------------------------------- /* Lab for synthetic dynamic vegephenomenology /*------------------------------------------------------------------------- /* Program: SWB.AML /* Purpose: This AML generates a map of the site water balance, based /* on three input grids, namely a) soil bucket size (mm/m), /* b) monthly precipitation sums (mm), and c) monthly average /* of daily potential evapotranspiration (1/10 mm). /* /* The procedure evaluates, month by month, the difference be- /* tween precipitation, seeks for the first month in fall with /* positive atmospheric water balance, and starts recharging /* the bucket, until the end of the water-year for this speci- /* fic pixel is attained. The resulting coverage has the spa- /* tially explicit information on site water balance. /* /*------------------------------------------------------------------------- /* Usage: &r swb /*------------------------------------------------------------------------- /* Notes: All water units are converted mm(floating). /*------------------------------------------------------------------------- /* Input: precipitation, pot. evapotranspiration, and soil bucket /* Output: SWB-grid (in mm water/year) /*------------------------------------------------------------------------- /* History: Niklaus E Zimmermann - 9/18/1997 - Original coding /* Niklaus E Zimmermann - 1/07/2000 - Improved user interface /*========================================================================= &type &type Make sure all Precipitation coverages have NON-NEGATIVE - values !! &type &type &s etp = /auto/pfunk1/nez/shosh/etp/etp_jen &s ptt = /auto/ebig1/shosh/nez/prec/prec &s bck = /auto/pfunk1/nez/shosh/swb/bucket1 &s mm = 1 /* Initialize lastdry-grid /* -------------------------------------------------------- if (%etp%1 >= -1) lastdry = int(0) else lastdry = int(0) endif /* Calculate monthly differences between ppt and etp /* -------------------------------------------------------- &label calcdiff &if %mm% = 12 &then; &s nday = 31 &if %mm% = 11 &then; &s nday = 30 &if %mm% = 10 &then; &s nday = 31 &if %mm% = 9 &then; &s nday = 30 &if %mm% = 8 &then; &s nday = 31 &if %mm% = 7 &then; &s nday = 31 &if %mm% = 6 &then; &s nday = 30 &if %mm% = 5 &then; &s nday = 31 &if %mm% = 4 &then; &s nday = 30 &if %mm% = 3 &then; &s nday = 31 &if %mm% = 2 &then; &s nday = 28 &if %mm% = 1 &then; &s nday = 31 &type This month (%mm%) has: %nday% days diff%mm% = (%ptt%%mm% - (%nday% * float(%etp%%mm% / 10.))) &if %mm% eq 12 &then &goto setlast &else &s mm = %mm% + 1 &goto calcdiff /* Determine locally the last dry month of the year, which /* is the last month with negative ppt-etp - balance before /* soil water recharge begins. /* -------------------------------------------------------- &label setlast if (diff%mm% < 0 & lastdry == 0) last = int(%mm%) else last = lastdry endif kill lastdry all rename last lastdry describe lastdry &if %GRD$ZMIN% ne 0 &then &goto next &if %mm% eq 1 &then &goto next &else &s mm = %mm% - 1 &goto setlast /* Initialize swb-grid /* -------------------------------------------------------- &label next if (%etp%1 >= -1) swb = int(0) else swb = int(0) endif describe lastdry &s mm = %GRD$ZMIN% + 1 &type The Recharge-Loop for the fall starts at month: %mm% /* Fill bucket from beginning of local water-year to the end /* of the calender year. The water year starts at the first /* month in the year with a positive etp-ppt - balance after /* drought months (if any). /* -------------------------------------------------------- &label fillfall if (lastdry lt %mm%) aw = min(float(%bck%),(swb + diff%mm%)) else aw = swb endif kill swb all rename aw swb &if %mm% eq 12 &then &goto dosummer &else &s mm = %mm% + 1 &goto fillfall /* Fill (and evapotranspirate) water from the start of the /* calender year to the end of the water year (if not yet /* done in the previous loop). /* -------------------------------------------------------- &label dosummer &s mm = 1 &label swb if (%mm% le lastdry) aw = min(float(%bck%),(swb + diff%mm%)) else aw = swb endif kill swb all rename aw swb describe lastdry &if %GRD$ZMAX% eq %mm% &then &goto endtext &else &s mm = %mm% + 1 &goto swb &label endtext copy swb swb1 &type The last month of drought (%mm%) is reached for all pixels. &type Calculations of the Coverage SWB are done !!!!!!!!!!!!!!! &type &type