subroutine applyLUT(jdutc, doy, hour, ws, qsol, dth, lat, lon, A swap, wsint, qsolint, dtinst, dtintq, B dtintuq) c Routine to apply look-up-table derived estimates of diurnal c warming based on estimates of the time of day, wind speed, and c solar radiation. Warming estimates are provided based on 3 c different LUT formulations: instantaneous wind speed and c insolation, instantaneous wind speed and daily integrated c insolation, and integrated wind speed and insolation c Note that the tables contain missing values of -999.0 if observations c of warming were not available for the corresponding set of conditions c Created by Sandra Castro and Gary Wick c University of Colorado/CCAR and NOAA ESRL c March 2009 c Arguments c Inputs c jdutc: Julian day in UTC time (ddd.ffff) c doy: Day of year (integer) c hour: hour of day in local solar time (w/ fractions) c ws: current wind speed (m/s) c qsol: current solar radiation (W/m2) c dth: time step (in hours) from last call (for integrations) c lat: Latitude (degrees and fractional degrees) c lon: Longitude (degrees and fractional degrees) c swap: A flag to indicate machine architecture to determine c if byte-swapped table is required c 0: little endian - PC/linux architecture (no swapping) c 1: big endian - sun/pre-intel Mac architecture (swapping) c Input and Output c wsint: Integrated wind speed (must be zero on first call of c each day following sunrise. Integration is performed c within the code and value returned for subsequent calls c for the corresponding location) c qsolint: Integrated insolation value (as above, should be c zero on first call following sunrise and is then c accumulated within the code for subsequent calls) c Outputs c dtinst: diurnal warming estimate from instantaneous LUT (K) c dtintu: warming estimate from integrated qsol LUT (K) c dtintuq: warming estimate from integrated ws and qsol LUT (K) c External routines c c solar_prop: computes theoretical clear sky insolation and c corresponding cloud index for observed insolation c calls SolarRadiance c calls solflux c c readLUT_inst: Reads LUT for instantaneous wind speed and insolation c readLUT_int: Reads LUT for inst. wind speed and int. insolation c readLUT_dblint: Reads LUT for integrated wind speed and insolation implicit none real jdutc, hour, ws, qsol, dth, lat, lon real wsint, qsolint real dtinst, dtintq, dtintuq real pastqsol, pastjd real sza, cli, clidum, qsolclear integer doy, swap integer i, numsteps c First step is to update/accumulate integrated quantities from the c last value to the current value c Wind speed is assumed to have been constant over the time interval c from the last call, so the current wind speed is multiplied by the c time step. Note that for the LUT formulation, the time unit for the c integration is hours consistent with the input units wsint = wsint + ws*dth c For insolation, the cloud cover is assumed to have been constant c over the time interval from the last call. We first determine c an estimate of the cloud content at the current time by comparing c the provided insolation with a corresponding clear sky value. call solar_prop(jdutc, lat, lon, qsol, sza, cli, qsolclear) c Since solar radiation is not a constant or linear function, we must c manually integrate over the interval since the last observation. A c time step of 15 minutes is used for the integration if the interval c between observations is greater. if (dth .le. 15./60.) then qsolint = qsolint + qsol*dth else numsteps = int(dth/0.25) pastjd = jdutc - (dth/24.0) do 5 i = 1, numsteps pastjd = pastjd + (0.25/24.0) c Only the past qsolclear is relevant on this call, qsol not used call solar_prop(pastjd, lat, lon, qsol, sza, clidum, A qsolclear) pastqsol = (1.0 - cli) * qsolclear qsolint = qsolint + pastqsol*0.25 5 continue end if c At this point all the instantaneous and integrated quantities are c available and the LUT are called to return the desired warming c estimates c Warming from instantaneous wind speed and insolation LUT call readLUT_inst(hour, ws, qsol, dtinst, swap) c Warming from instantaneous wind and integrated insolation LUT call readLUT_int(hour, ws, qsolint, dtintq, swap) c Warming from instantaneous wind and integrated insolation LUT call readLUT_dblint(hour, wsint, qsolint, dtintuq, swap) return end