Class DayLengthTransformer

java.lang.Object
net.simplace.sim.io.FWSimIOAdapter
net.simplace.sim.io.resources.FWSimInputAdapter
net.simplace.sim.io.resources.FWSimResourceTransformer
net.simplace.sim.transformers.DayLengthTransformer
All Implemented Interfaces:
net.simplace.sim.util.FWSimFieldContainer

public class DayLengthTransformer extends net.simplace.sim.io.resources.FWSimResourceTransformer
Calculates the Daylengths for a given latitude. WIKI_START == Inputs and Outputs == Takes `Latitude` in degrees as input Outputs - DOY - Daylength in minutes - Daylength change to previous day in minutes == Formulas == Sine and cosine of latitude, maximal declination. WIKI_END \[ \begin{eqnarray} rad &=& \frac{\pi}{180}\\ sinlat &=& \sin(rad \cdot latitutde)\\ coslat &=& \cos(rad \cdot latitutde)\\ sindcm &=& \sin(rad \cdot 23.45) \end{eqnarray} \] WIKI_START Sine and cosine of declination of the sun as function of day of year. Calculation is taken from (G). 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\) WIKI_END \[ \begin{eqnarray} sindec &=& -sindcm \cos(2 \pi \frac{doy+10}{365})\\ cosdec &=& \sqrt{1-sindec^2}\\ sinld &=& sinlat \cdot sindec\\ cosld &=& coslat \cdot cosdec \end{eqnarray} \] WIKI_START Daylength calculation. WIKI_END \[ \begin{eqnarray} arg &=& \min(1,\max(-1,\frac{sinld}{cosld}))\\ daylength &=& 12 (1 + \frac{2}{\pi} \arcsin(arg))\\ \end{eqnarray} \] WIKI_START == Notice == The transformer generates a resource, without transforming an existing one. == References == (G) Goudriaan, Modeling Potential Crop Growth Processes, 1994, (revised version Nov. 2004) WIKI_END
Author:
Gunther Krauss, Andreas Enders
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.simplace.sim.io.FWSimIOAdapter

    net.simplace.sim.io.FWSimIOAdapter.FREQUENCE
  • Field Summary

    Fields inherited from class net.simplace.sim.io.resources.FWSimResourceTransformer

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

    Fields inherited from class net.simplace.sim.io.resources.FWSimInputAdapter

    iJexlScript, iShouldCacheToDB

    Fields inherited from class net.simplace.sim.io.FWSimIOAdapter

    iArrayMode, iFieldcount, iFrequence, iHeaderVariables, iInterface, iJexlRule, iKeyMap, iName, iOrderNumber, iProcessTime, iResourceElement, iSession, iSourceKey
  • Constructor Summary

    Constructors
    Constructor
    Description
    DayLengthTransformer(net.simplace.sim.FWSimSession aSession, Integer aOrderNumber)
     
    DayLengthTransformer(net.simplace.sim.FWSimSession aSession, org.jdom2.Element aResourceElement, Integer aOrderNumber)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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)
     

    Methods inherited from class net.simplace.sim.io.resources.FWSimResourceTransformer

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

    Methods inherited from class net.simplace.sim.io.resources.FWSimInputAdapter

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

    Methods inherited from class 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

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DayLengthTransformer

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

      public DayLengthTransformer(net.simplace.sim.FWSimSession aSession, Integer aOrderNumber)
      Parameters:
      aSession -
      aOrderNumber -
  • Method Details

    • createVariables

      public HashMap<String,net.simplace.sim.util.FWSimVariable<?>> createVariables()
      Specified by:
      createVariables in interface net.simplace.sim.util.FWSimFieldContainer
      Overrides:
      createVariables in class 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
      Specified by:
      getData in class net.simplace.sim.io.resources.FWSimInputAdapter
      Throws:
      net.simplace.sim.exceptions.MissingSimResourceException
      See Also:
      • 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
      Parameters:
      aVarMap - variable map
      aResourceCache - Cached resources (soil data)
      Returns:
      delivered new data from transformer
      Throws:
      net.simplace.sim.exceptions.MissingSimResourceException
    • updateFields

      public void updateFields(net.simplace.core.FWObservable aObservable)
      Specified by:
      updateFields in class net.simplace.sim.io.resources.FWSimResourceTransformer
      See Also:
      • FWSimResourceTransformer.updateFields(net.simplace.core.FWObservable)