6. Keys

Top  Previous  Next

Now let's exercise the setup of resources using different keys to filter data.

 

The solution 06_1_Keys.sol.xml uses vCropName = "default", which corresponds to the CROPNAME in simplace_modules/test/training/data/crop/crop.xml file.

 

Task 6.1.

Use the CROPNAME "barley" from the simplace_modules/test/training/data/crop/crop.xml crop file in your solution instead of "default" and

 also output the base temperature in the output file.

 

 Hints

  - Since you work with keys, the key of the crop file has to be changed.

  - After running, check if the value of the last column in your output file is equal to 3.2.

 

 Solution

    Open the 06_1_Keys_Answer.sol.xml to see how it should be done.

 

 


 

 

Task 6.2.

You can also use more than one key in the simulation.

 

Now open the file simplace_modules/test/training/data/weather/location_weather.txt. Check if it has a first column named as "Location".

 

This file contains daily weather information for two locations (Location 1 and Location 2). Open solution 06_2_Keys_Answer.sol.xml. Open the file and check the package contents. Here, a new variable id "vLocation" has been used to identify the location.

 

         <var id="vLocation" datatype="CHAR">Location 1</var>

 

Also, this new variable has to be mentioned under the resource as:

 

         <res id="Local" datatype="CHAR" key="vLocation" />

 

The location of the new weather file:

 

<filename>${_WORKDIR_}/training/data/weather/location_weather.txt</filename>

   

Now run for the second location.

 

 Hints

  -Check if you have changed the name of the new weather file.

  -Keep the same arrangement of the variables under the resource as they are in the original weather file.

 

 Solution

 Same as 06_2_Keys_Answer.sol.xml but: <var id="vLocation" datatype="CHAR">Location 1</var>

 

*ModelSolutions are found in simplace_modules\test\training\solution\1_WorkingWithSolutions