Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

However there is exception to the above mentioned approach. If the input variable is a scalar timeseries at multiple locations (using LocationSetId in TimeSeriesSet definition) and spatial type is set to spatial, and then the following approach is used:

1.     Create a grid (as defined by area map),
2.     Get the data value for a current time from a timeseries for a first location,
3.     For this location, get the geo-reference coordinates (X, Y),
4.     Get the corresponding grid cell within which the above location lies,
5.     Put the data value as that grid cell value,
6.     Get the data value for the current time from the timeseries for next location.
7.     Repeat the steps 3-6 till all the data for the current time at all locations is read and the value is put in the appropriate grid cell.* TimeSeriesSet, if the input data is a timeseries.

...

No Format
<?xml version="1.0" encoding="UTF-8"?>
<!-- Solar radiation module demonstration configuration -->
<pcrTransformationSets xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews
http://fews.wldelft.nl/schemas/version1.0/pcrTransformationSets.xsd" version="1.1">
	<logLevel>WARN</logLevel>
	<pcrTransformationSet id="Potradiation">
		<areaMap>
			<locationId>Radiation</locationId>
		</areaMap>
		<definitions>
			<dataExchange>memory</dataExchange>
			<inputVariable variableId="Altitude" dataType="scalar" convertDatum="false" spatialType="spatial">
				<timeSeriesSet>
					<moduleInstanceId>Radiation</moduleInstanceId>
					<valueType>grid</valueType>
					<parameterId>Time.event</parameterId>
					<locationId>Radiation</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="minute" multiplier="15"/>
					<relativeViewPeriod unit="hour" start="0" end="48"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</inputVariable>
			<inputVariable variableId="YearDay" dataType="scalar" convertDatum="false" scalarType="timeAsDayofYear">
				<timeSeriesSet>
					<moduleInstanceId>Radiation</moduleInstanceId>
					<valueType>scalar</valueType>
					<parameterId>Time.event</parameterId>
					<locationId>Radiation</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="minute" multiplier="15"/>
					<relativeViewPeriod unit="hour" start="0" end="48"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</inputVariable>
			<inputVariable variableId="Hour" dataType="scalar" convertDatum="false" scalarType="timeAsHourofDay">
				<timeSeriesSet>
					<moduleInstanceId>Radiation</moduleInstanceId>
					<valueType>scalar</valueType>
					<parameterId>Time.event</parameterId>
					<locationId>Radiation</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="minute" multiplier="15"/>
					<relativeViewPeriod unit="hour" start="0" end="48"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</inputVariable>
			<!-- Total potential Solar radiation -->
			<outputVariable variableId="SL" dataType="scalar" convertDatum="false">
				<timeSeriesSet>
					<moduleInstanceId>Radiation</moduleInstanceId>
					<valueType>grid</valueType>
					<parameterId>Sol.pot</parameterId>
					<locationId>Radiation</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="minute" multiplier="15"/>
					<relativeViewPeriod unit="hour" start="0" end="48"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</outputVariable>
			<!-- Diffuse radiation -->
			<outputVariable variableId="SLDF" dataType="scalar" convertDatum="false">
				<timeSeriesSet>
					<moduleInstanceId>Radiation</moduleInstanceId>
					<valueType>grid</valueType>
					<parameterId>Sol.pot.diffuse</parameterId>
					<locationId>Radiation</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="minute" multiplier="15"/>
					<relativeViewPeriod unit="hour" start="0" end="48"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</outputVariable>
			<!-- direct radiation -->
			<outputVariable variableId="SLDR" dataType="scalar" convertDatum="false">
				<timeSeriesSet>
					<moduleInstanceId>Radiation</moduleInstanceId>
					<valueType>grid</valueType>
					<parameterId>Sol.pot.direct</parameterId>
					<locationId>Radiation</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="minute" multiplier="15"/>
					<relativeViewPeriod unit="hour" start="0" end="48"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</outputVariable>
		</definitions>
		<pcrModel id="String">
			<text><![CDATA[
#! --unittrue --degrees
# Test script to determine radiation over a grid.
#
# Inputs from Delft-Fews into this script
# - YearDay -> scalar with  day since beginning of year
# - Hour of day -> Fractional hour of day (e.g. 12.5 = 12:30)
# Ouputs to FEWS
# - SL -> Total Solar radiation
#
# This version determines Clear Sky radiation assuming a level surface using a uniform
# altitude. This level is configured in the script below.
Altitude=spatial(10);

Latitude = ycoordinate(boolean(Altitude));
Longitude = xcoordinate(boolean(Altitude));

Day =YearDay;
pi = 3.1416;
Sc       = 1367.0;          # Solar constant (Gates, 1980) [W/m2]
Trans    = 0.6;             # Transmissivity tau (Gates, 1980)

AtmPcor = ((288-0.0065*Altitude)/288)**5.256;            # atm pressure corr [-]

# Solar geometry
# ----------------------------
# SolDec  :declination sun per day  between +23 and -23 [deg]
# HourAng :hour angle [-] of sun during day
# SolAlt  :solar altitude [deg], height of sun above horizon
# SolDec  = -23.4*cos(360*(Day+10)/365);
# Now added a new function that should work on all latitudes! 
theta    =(Day-1)*360/365;  # day expressed in degrees

# Time change equal to 4 min per degree longtitude
# Assume the time input to be GMT
HourS = Hour + (Longitude * 4/60);
 
SolDec =180/pi * (0.006918-0.399912 * cos(theta)+0.070257 * sin(theta) -   0.006758 * cos(2*theta)+0.000907 * sin(2*theta) -  0.002697 * cos(3*theta)+0.001480 * sin(3*theta));

HourAng = 15*(HourS-12.01);

SolAlt  = scalar(asin(scalar(sin(Latitude)*sin(SolDec)+cos(Latitude)*
           cos(SolDec)*cos(HourAng))));
            
# Solar azimuth 
# ----------------------------
# SolAzi  :angle solar beams to N-S axes earth [deg]
 SolAzi = scalar(acos((sin(SolDec)*cos(Latitude)-cos(SolDec)*
          sin(Latitude)*cos(HourAng))/cos(SolAlt)));
 SolAzi = if(HourS le 12 then SolAzi else 360 - SolAzi);
 
 Slope = spatial(0.0001);
 Aspect = spatial(1);
 
# Surface azimuth
# ----------------------------
# cosIncident :cosine of angle of incident; angle solar beams to angle surface
 cosIncident = sin(SolAlt)*cos(Slope)+cos(SolAlt)*sin(Slope)
               *cos(SolAzi-Aspect);

# Radiation outer atmosphere
# ----------------------------
 OpCorr = Trans**((sqrt(1229+(614*sin(SolAlt))**2)
          -614*sin(SolAlt))*AtmPcor);    # correction for air masses [-] 
 Sout   = Sc*(1+0.034*cos(360*Day/365)); # radiation outer atmosphere [W/m2]
 Snor   = Sout*OpCorr;                   # rad on surface normal to the beam [W/m2]

# Radiation at DEM
# ----------------------------
# Sdir   :direct sunlight on a horizontal surface [W/m2] if no shade
# Sdiff  :diffuse light [W/m2] for shade and no shade
# Stot   :total incomming light Sdir+Sdiff [W/m2] at Hour
# Radiation :avg of Stot(Hour) and Stot(Hour-HourStep)
# NOTE: PradM only valid for HourStep and DayStep = 1
 Sdir   = if(Snor*cosIncident<0,0.0,Snor*cosIncident);
 Sdiff  = if(Sout*(0.271-0.294*OpCorr)*sin(SolAlt)<0, 0.0,
          Sout*(0.271-0.294*OpCorr)*sin(SolAlt));

# Fill in missing values with areaaaverage
SLDR=cover((Sdir*1),(Altitude * 0) + areaaverage(Sdir*1,boolean(Altitude))); # hourly rad [W/m2]
SLDF=cover((Sdiff*1),(Altitude * 0) + areaaverage(Sdiff*1,boolean(Altitude))); # hourly rad [W/m2]

SL   = SLDR + SLDF;       # Total rad  in [W/m2]



			]]></text>
		</pcrModel>
	</pcrTransformationSet>
</pcrTransformationSets>