/* ======================================================================== /* @(#)tave.aml 1.3 09/18/1997 15:33:41 /*------------------------------------------------------------------------- /* Lab for synthetic dynamic vegephenomenology /*------------------------------------------------------------------------- /* Program: TAVE.AML /* Purpose: Calculate monthly Average-Temperature maps based on /* a fine-resolution grid and regression values from /* climate stations (to elevation). This procedure is /* especially appropriate if only few climate stations /* are available for the calculating area. /* /*------------------------------------------------------------------------- /* Usage: &r tave /*------------------------------------------------------------------------- /* Notes: The AML reads Intercept-Information (based on regression of /* climate values to elevation) from a pointcover /* that represents the location of the climate stations and /* the according "0" m.a.s.l. values. These values represent /* the regression intercepts, and they are expected to be sto- /* red in variables termed i1,i2,....,i12 (one for each month's /* regression intercept. The regression lapse rates have to be /* entered in the AML itself. /* The AML first interpolates the point values to a coarse-sca- /* le 900m grid, then smoothes this coarse grid, re-samples the /* grid using a point-lattice, and finally interpolates the co- /* arse 900m lattice to a resolution of 90m. The splitting of /* the interpolations into two steps aims at optimizing the /* time necessary to perform the task. If the climate stations /* would be interpolated to the final 90m cell size directly, /* it would require too much time, given the sparse scattering /* of the climate stations. The second interpolation then can /* be performed using a very small search radius only, since /* the surface is already smoothed and interpolated. This speeds /* the process up considerably. /* The AML, thus, needs to be adjusted manually for the correct /* dimensions of the coarse and the fine scale grid (the latter /* has to conform to the cell-spacing of the DEM. Also, a lat- /* tice needs to be prepared in order to sample the coarse scale /* grid. /*------------------------------------------------------------------------- /* Input: stations, DEM, lattice /* Output: tave1, tave2, ...... ,tave12, taveyy /*------------------------------------------------------------------------- /* History: Niklaus E Zimmermann - 09/18/1997 - Original coding /*========================================================================= /* -- The first IDW-loop interpolates 0m-values (local intercepts) from --- /* -- station data. These 0m-values are derived by adding the local re- --- /* -- siduals to the regression intercept (= mean value at 0m, which is --- /* -- the comparable altitude for all climate stations). The interpola- --- /* -- ted surface is smoothed using a 50-cell-radius filter. --- grid &dv month &sv month = 1 &label idwloop1 &type Currently running month: %month% ......................................... /* -- Adjust the spacing and the dimension of the generated coarse grid according --- /* -- to your needs. The station file is currently expected to be called "stations", --- /* -- and the monthly regression intercepts are stored in variables called i1,i2,.. --- tmp = idw(stations,i%month%_0,#,2,sample,4,#,900,489562.875,4652575,755602.875,4985530) ic%month% = focalmean(tmp,CIRCLE,30,DATA) kill tmp all &sys arc latticespot ic%month% lattice i%month%_0 &if %month% eq 12 &then &goto next &else &sv month = %month% + 1 &goto idwloop1 &label next quit /* -- The second IDW-loop interpolates the 900m smoothed local intercepts --- /* -- to the final resolution of 90m in the correct map-extent. To do so, --- /* -- the point-cover has to be cleaned first. All points with -9999 ha- --- /* -- ve to be removed, because they are not interpolated as NODATA...... --- rename lattice tmp reselect tmp lattice points res i1_0 ne -9999 ; ;n ;n kill tmp all grid &dv month &sv month = 1 &label idwloop2 &type Currently running month: %month% ......................................... /* -- Adjust the spacing and the dimension of the generated second grid according --- /* -- to your needs. It should correspond with the DEM. --- icept%month% = idw(lattice,i%month%_0,#,2,sample,4,#,90,489562.875,4652575,714562.875,4985530) &if %month% eq 12 &then &goto setlaps &else &sv month = %month% + 1 &goto idwloop2 &label setlaps /* -- The constant parameters for monthly laps rates are set. --- /* -- Also the DEM is defined including the path to locate the DEM --- &sv dem = /export/pfunk0/nez/dem/dem90 &sv lpsrt1 = -0.001372375 &sv lpsrt2 = -0.004904560 &sv lpsrt3 = -0.006613473 &sv lpsrt4 = -0.009414292 &sv lpsrt5 = -0.010507549 &sv lpsrt6 = -0.011010525 &sv lpsrt7 = -0.011746246 &sv lpsrt8 = -0.009068749 &sv lpsrt9 = -0.007748306 &sv lpsrt10 = -0.008362695 &sv lpsrt11 = -0.009098603 &sv lpsrt12 = -0.004494932 /* -- Finally the finescale monthly temperature-maps (in 1/10 units) --- /* -- are derived from local 0m-intercepts, lapsrates and a DEM of --- /* -- choice. A map of mean annual Average Temperature is calculated --- /* -- from the monthly temperature maps. --- tave1 = int(10 * (icept1 + (%lpsrt1% * %dem%))) tave2 = int(10 * (icept2 + (%lpsrt2% * %dem%))) tave3 = int(10 * (icept3 + (%lpsrt3% * %dem%))) tave4 = int(10 * (icept4 + (%lpsrt4% * %dem%))) tave5 = int(10 * (icept5 + (%lpsrt5% * %dem%))) tave6 = int(10 * (icept6 + (%lpsrt6% * %dem%))) tave7 = int(10 * (icept7 + (%lpsrt7% * %dem%))) tave8 = int(10 * (icept8 + (%lpsrt8% * %dem%))) tave9 = int(10 * (icept9 + (%lpsrt9% * %dem%))) tave10 = int(10 * (icept10 + (%lpsrt10% * %dem%))) tave11 = int(10 * (icept11 + (%lpsrt11% * %dem%))) tave12 = int(10 * (icept12 + (%lpsrt12% * %dem%))) tmp = (tave1 + tave2 + tave3 + tave4 + tave5 + tave6 + tave7) taveyy = int((tmp + tave8 + tave9 + tave10 + tave11 + tave12) / 12.) kill tmp all q &type &type &type +---------------------------------------------------------------------+ &type | | &type | This AML generated grid-covers of monthly temperature values | &type | | &type +----------------------------------------------------*--------*-------+ &type ' ~ * o o * ' &type ' +-----+ ~ * U * ' &type ' | -35 | * ~~~J * ' &type ' | -30 | ~ * ** * ' &type ' ~ | -25 | ~ ~ ' &type ' @@@@@ ~ | -20 | ~ ' &type ' v^v^v^v ~ | -15 | ~ ' &type ' vW _ _ Wv ~ ~ | -10 | ~ ' &type ' ( @ @ ) ~ | - 5 | ' &type ' +---o00o-(_)-o00o-- ~----------| - 0-|----------------------------+' &type ' U~ V V ' &type ' ~ | | ' &type ' # ' &type &type &type