<resources> |
Top Previous Next |
The process of fetching the data of an <interface> object, applying a filter (when a key is provided), and storing it in the simulation data container (VarMap) is controlled by an <resource> object.
Therefore, this object contains important attributes that control for which <interface> data should be obtained, what are the key variables (if any) to filter the data, and the SimVariable specifications for each variable contained in the source data (minimum requirements are “id” and “datatype”).
To help optimise computational time, modellers can configure the frequency of data fetching operations with the “frequence” attribute. Modellers can choose between “DAILY”, “YEARLY”, “ONCE” or “COMPLEX” frequency options. When the latter is selected, the updating process of the respective <resource> will be triggered by a rule attributed, which can be a boolean SimVariable (e.g. “DoHarvest”) or a JEXL rule expression (Fig. 1). This is mainly a performance feature and allows, for example, the update of soil physical characteristics at the beginning of simulations (e.g. “ONCE”), and crop parameters whenever a new crop is sown (e.g. “rule=” in Fig. 1):
Fig 1. Simplified version of a model solution XML file summarizing the information flow and linkage (dashed red arrows) across the five main sections of a model solution (<variables>; <interfaces>; <resources>; <simmodel>; <outputs>) and its objects. The “...” represents parts of the solution that were omitted for simplicity. Solid red arrows indicate where rule-based expressions are used. The variable CropFile is not directly specified as a rule or source, in the case of <interface>, it can be passed by enclosing it in the placeholder “${}” (e.g. “${CropFile}”) (source: https://doi.org/10.1093/insilicoplants/diad006)
Thus, a resource describes the structure of the corresponding data file, e.g. the number and datatype of the columns in a csv file, or the elements of an xml file. In a data file or database, one has usually more than one record. e.g. rain, temperature for all days of a year or crop properties for different crops. To select the proper one, you have to indicate the key, by which it is selected.
In this example weather tells SIMPLACE the variables names to read from the weather input file, and the read frequency and key.
In order to do some preliminary calculation on your data, like unit conversions or subdivision of layers, one can also use a transformer to transform an existing resource. Inside <resources>, there is a special type of object called <transform> which is intended to further harmonise a pre-ingested <resource> object. One <interface> object can be used to generate many <resource> objects, but a <resource> can only process one <interface>. This also applies to <transform>, which can only process one <resource> object.