Klasse AstronomicParametersTransformer

java.lang.Object
net.simplace.sim.io.FWSimIOAdapter
net.simplace.sim.io.resources.FWSimInputAdapter
net.simplace.sim.io.resources.FWSimResourceTransformer
net.simplace.sim.transformers.AstronomicParametersTransformer
Alle implementierten Schnittstellen:
net.simplace.sim.util.FWSimFieldContainer

public class AstronomicParametersTransformer extends net.simplace.sim.io.resources.FWSimResourceTransformer
WIKI_START Calculated daylength, photoperiodic daylength, solar constant and daily total effective solar height for each DOY for a set of given latitudes. == Input and output of the transformer == For each row in the resource it creates 366 rows containing values for each day of year (DOY) The transformer needs the field names of a resource, that contain - location id - latitude in decimal degrees - inclination of sun angle in decimal degrees Normally you do not enter the numeric value for latitude, but a reference to the value, i. e. the column name of the resource's column containing the latitudes. It outputs a resource with following fields - DOY (serves as a key) (INT) - location id (serves as a key, same as the key of the resource) - daylength (DOUBLE) - photoperiodic daylength (DOUBLE) - solar constant (DOUBLE) - seasonal offset of sine of solar height (DOUBLE) - amplitude of sine of solar height (DOUBLE) - daily integral of SINB over the day (DOUBLE) - daily integral of corrected SINB for lower atmospheric transmission at lower solar elevation (DOUBLE) - area under the sinBeta curve (DOUBLE) === Example === First you need a resource that has a latitude and sun inclination column. {{{ | |
| | | | | |
|
}}} Now the resource id="''locations''" has to be written into the transformers `resource` attribute. The header section contains the outputs of the tranformer. Make sure that they are in the same order as in the example. Dont't forget to add to the second element (`LocationId`) the same `key` attribute as in the resource. Finally you tell the transformer the name of the resources id field (`LocationId`) and the name of the fields that hold the latitude and sun inclination. Remember: the names have to match exactly, lower and upper case matters! {{{ | |
| | | | | | | | | |
| SunInclination | Latitude | LocationId |
}}} == Remarks == The calculation method follows mainly the routine from the Gecros model (1), see also (2) and (3): Differences between this routine and Gecros - Gecros limits the latitude between -67 and 67 degrees. This routine extends the range from -90 to 90 degrees as in Lintul5 (2) - Sine and Cosine of declination are calculated directly (in a mathematical equivalent way) - Values are calculated with double precision, which might result in slightly different values than from the FORTRAN code. == Formulas == WIKI_END Conversion factor from degrees to radians. The original Fortran/FST-Modules use a less precise approximation of \(\pi \approx 3.141592654\), whereas here \(\pi \approx 3.141592653589793\). \[ \begin{eqnarray} rad Ungültige Eingabe: "&"=Ungültige Eingabe: "&" \frac{\pi}{180}\\ \end{eqnarray} \] Sine and cosine of latitude, maximal declination. Values calculated only once per location. \[ \begin{eqnarray} sinlat Ungültige Eingabe: "&"=Ungültige Eingabe: "&" \sin(rad \cdot latitutde)\\ coslat Ungültige Eingabe: "&"=Ungültige Eingabe: "&" \cos(rad \cdot latitutde)\\ sindcm Ungültige Eingabe: "&"=Ungültige Eingabe: "&" \sin(rad \cdot 23.45)\\ \end{eqnarray} \] Sine and cosine of declination of the sun as function of day of year. Calculation is taken from Goudriaan, van Laar 1994. Some models first calculate \(dec\) as the arcsine of \(sindec\) and then take the sine and cosine. The methods are mathematically equivalent due to \(sin^2+cos^2=1\) \[ \begin{eqnarray} sindec Ungültige Eingabe: "&"=Ungültige Eingabe: "&" -sindcm \cos(2 \pi \frac{doy+10}{365})\\ cosdec Ungültige Eingabe: "&"=Ungültige Eingabe: "&" \sqrt{1-sindec^2}\\ sinld Ungültige Eingabe: "&"=Ungültige Eingabe: "&" sinlat \cdot sindec\\ cosld Ungültige Eingabe: "&"=Ungültige Eingabe: "&" coslat \cdot cosdec \end{eqnarray} \] Daylength calculation. \[ \begin{eqnarray} arg Ungültige Eingabe: "&"=Ungültige Eingabe: "&" \min(1,\max(-1,\frac{sinld}{cosld}))\\ daylength Ungültige Eingabe: "&"=Ungültige Eingabe: "&" 12 (1 + \frac{2}{\pi} \arcsin(arg))\\ \end{eqnarray} \] Photoperiodic daylength \[ \begin{eqnarray} arg2 Ungültige Eingabe: "&"=Ungültige Eingabe: "&" \min(1,\max(-1,\frac{-\sin(rad \cdot inclination)+sinld}{cosld}))\\ ddlp Ungültige Eingabe: "&"=Ungültige Eingabe: "&" 12(1+\frac{2}{\pi}\arcsin(arg2))\\ \end{eqnarray} \] Solar constant \[ \begin{eqnarray} sc Ungültige Eingabe: "&"=Ungültige Eingabe: "&" 1367(1 + 0.033 \cos(2 \pi\frac{doy-10}{365}))\\ \end{eqnarray} \] Daily total of effective solar height \[ \begin{eqnarray} dsinb Ungültige Eingabe: "&"=Ungültige Eingabe: "&" 3600(dayl \cdot sinld+24 cosld \frac{\sqrt{1-arg^2}}{\pi})\\ dsinbe Ungültige Eingabe: "&"=Ungültige Eingabe: "&" 3600(dayl(sinld+0.4(sinld^2+\frac{cosld^2}{2})) + 12 cosld(2+3\cdot 0.4 sinld)\frac{\sqrt{1-arg^2}}{\pi}) \end{eqnarray} \] Notice: The sine of solar height is \(sin\beta(h) = sinld + cosld \cdot \cos(2 \pi \frac{h-12}{24})\), \(dsinb\) is the integral \(\int_0^{24} sin\beta(h)dh\) converted to seconds. WIKI_START == Utilisation == Transformer is used in the FST based models: - Lintul5 - Gecros - Sucros == Notice == Transformer works only with resources that have a single column key (that identifies the location) The transformed resource has two keys: the DOY and the key from the resource. === Tweaks === Instead of transforming a resource, the transformer can get the values for latitude and inclination directly and generate day lengths etc. In order to use the transformer this way, you have to omit the resource attribute. !LatitudeField and !SunInclinationField should then reference the coresponding DOUBLE variables. {{{ | sevilla | 53.1 | -2.5 | ... | |
| | | | ... |
| vSunInclination | vLatitude | vActualLocation |
}}} '''It's recommended to use the transformer with a resource, rather than the tweaked method.''' You can't mix the two methods by taking one value from the resource and another directly. The way of configuring the tweaked method might change (especially the ids of the inputs might be renamed to distinguish them from the inputs of the standart method). == References == - (1) YIN, X. and van Laar, H. H., Crop Systems Dynamics, 2005 - (2) Wolf, J., User guide for Lintul 5, 2012 [https://models.pps.wur.nl/system/files/LINTUL5-report-vs1_0.zip] - (3) Goudriaan, Modeling Potential Crop Growth Processes, 1994, (revised version Nov. 2004) WIKI_END
Autor:
Gunther Krauss, Andreas Enders
  • Verschachtelte Klassen - Übersicht

    Von Klasse geerbte verschachtelte Klassen/Schnittstellen net.simplace.sim.io.FWSimIOAdapter

    net.simplace.sim.io.FWSimIOAdapter.FREQUENCE
  • Feldübersicht

    Von Klasse geerbte Felder net.simplace.sim.io.resources.FWSimResourceTransformer

    iFieldMap, iIntColumnMap, iLastInputValuesMap, iLastProjectID, iLastUniqueID, iPoolName, iSourceName

    Von Klasse geerbte Felder net.simplace.sim.io.resources.FWSimInputAdapter

    iJexlScript, iShouldCacheToDB

    Von Klasse geerbte Felder net.simplace.sim.io.FWSimIOAdapter

    iArrayMode, iFieldcount, iFrequence, iHeaderVariables, iInterface, iJexlRule, iKeyMap, iName, iOrderNumber, iProcessTime, iResourceElement, iSession, iSourceKey
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    AstronomicParametersTransformer(net.simplace.sim.FWSimSession aSession, Integer aOrderNumber)
     
    AstronomicParametersTransformer(net.simplace.sim.FWSimSession aSession, org.jdom2.Element aResourceElement, Integer aOrderNumber)
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    net.simplace.sim.io.resources.FWSimResourceCache
    calculateDaylength(net.simplace.sim.util.FWSimVariable<String> aIdname, net.simplace.sim.util.FWSimVariable<String> aLatitudename, net.simplace.sim.util.FWSimVariable<String> aInclinationname, net.simplace.sim.io.resources.FWSimResourceCache aCache, net.simplace.sim.util.FWSimVarMap aVarMap)
    Calculates Daylengths
    HashMap<String,net.simplace.sim.util.FWSimVariable<?>>
     
    net.simplace.sim.io.resources.FWSimResourceCache
    getData(net.simplace.sim.util.FWSimVarMap aVarMap)
    standard method from outside
    net.simplace.sim.io.resources.FWSimResourceCache
    getData(net.simplace.sim.util.FWSimVarMap aVarMap, net.simplace.sim.io.resources.FWSimResourceCache aResourceCache)
    used by test cases
    void
    updateFields(net.simplace.core.FWObservable aObservable)
     

    Von Klasse geerbte Methoden net.simplace.sim.io.resources.FWSimResourceTransformer

    addVariable, createFormFields, createResourceTransformer, createResourceTransformer, createResourceTransformer, fillVarMap, getCreateFormXML, getEditFormXML, getSourceResourceCache, getVariable, isUpdated, toXML

    Von Klasse geerbte Methoden net.simplace.sim.io.resources.FWSimInputAdapter

    getContentType, getInputVariables, getJexlScript, getOutputVariables, getVarMap, isTransformer, shouldCacheToDB, toHTMLTablestring

    Von Klasse geerbte Methoden net.simplace.sim.io.FWSimIOAdapter

    addProcessTime, checkCondition, createFormFields, finalize, getFieldMap, getFrequence, getHeaderVariables, getHeaderXML, getInterface, getJexlRule, getKeyMap, getName, getOrderNumber, isArrayMode, isConditionCheck, removeVariable, setInterface, setOrderNumber, toString, writeHeaderList

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Konstruktordetails

    • AstronomicParametersTransformer

      public AstronomicParametersTransformer(net.simplace.sim.FWSimSession aSession, org.jdom2.Element aResourceElement, Integer aOrderNumber)
      Parameter:
      aSession -
      aResourceElement -
      aOrderNumber -
    • AstronomicParametersTransformer

      public AstronomicParametersTransformer(net.simplace.sim.FWSimSession aSession, Integer aOrderNumber)
      Parameter:
      aSession -
      aOrderNumber -
  • Methodendetails

    • createVariables

      public HashMap<String,net.simplace.sim.util.FWSimVariable<?>> createVariables()
      Angegeben von:
      createVariables in Schnittstelle net.simplace.sim.util.FWSimFieldContainer
      Setzt außer Kraft:
      createVariables in Klasse net.simplace.sim.io.FWSimIOAdapter
    • getData

      public net.simplace.sim.io.resources.FWSimResourceCache getData(net.simplace.sim.util.FWSimVarMap aVarMap) throws net.simplace.sim.exceptions.MissingSimResourceException
      standard method from outside
      Angegeben von:
      getData in Klasse net.simplace.sim.io.resources.FWSimInputAdapter
      Löst aus:
      net.simplace.sim.exceptions.MissingSimResourceException
      Siehe auch:
      • FWSimInputAdapter.getData(net.simplace.sim.util.FWSimVarMap)
    • getData

      public net.simplace.sim.io.resources.FWSimResourceCache getData(net.simplace.sim.util.FWSimVarMap aVarMap, net.simplace.sim.io.resources.FWSimResourceCache aResourceCache) throws net.simplace.sim.exceptions.MissingSimResourceException
      used by test cases
      Parameter:
      aVarMap - variable map
      aResourceCache - Cached resources (soil data)
      Gibt zurück:
      delivered new data from transformer
      Löst aus:
      net.simplace.sim.exceptions.MissingSimResourceException
    • calculateDaylength

      public net.simplace.sim.io.resources.FWSimResourceCache calculateDaylength(net.simplace.sim.util.FWSimVariable<String> aIdname, net.simplace.sim.util.FWSimVariable<String> aLatitudename, net.simplace.sim.util.FWSimVariable<String> aInclinationname, net.simplace.sim.io.resources.FWSimResourceCache aCache, net.simplace.sim.util.FWSimVarMap aVarMap) throws net.simplace.sim.exceptions.MissingSimResourceException
      Calculates Daylengths
      Parameter:
      aIdname -
      aLatitudename -
      aInclinationname -
      aCache - original soil info stored
      aVarMap -
      idname -
      latitudename -
      inclinationname -
      Gibt zurück:
      the new created FWSimResourceCache
      Löst aus:
      net.simplace.sim.exceptions.MissingSimResourceException
    • updateFields

      public void updateFields(net.simplace.core.FWObservable aObservable)
      Angegeben von:
      updateFields in Klasse net.simplace.sim.io.resources.FWSimResourceTransformer
      Siehe auch:
      • FWSimResourceTransformer.updateFields(net.simplace.core.FWObservable)