From 8b72c9711e62bb1710829280bf156e1e890fb74f Mon Sep 17 00:00:00 2001 From: jtn <jtn@omoikane> Date: Fri, 6 Sep 2019 14:00:55 +0300 Subject: [PATCH] Added copyright, license, usage, description and interpretation texts In addition modifications were made to the model implementation in order to be able to show these messages. --- .../vips/model/cerealmodels/texts.properties | 7 +++ .../model/cerealmodels/FinnCerealModels.java | 56 +++++++++++-------- .../test/FinnCerealModelsTest.java | 8 +++ 3 files changed, 47 insertions(+), 24 deletions(-) create mode 100644 resources/fi/luke/vips/model/cerealmodels/texts.properties diff --git a/resources/fi/luke/vips/model/cerealmodels/texts.properties b/resources/fi/luke/vips/model/cerealmodels/texts.properties new file mode 100644 index 0000000..227792e --- /dev/null +++ b/resources/fi/luke/vips/model/cerealmodels/texts.properties @@ -0,0 +1,7 @@ +# +# +# model name has been hard-coded in the java source file due to the fact that the +#model can be used for three different diseases +usage=<p>The model setup requires the following parameters:</p><ul><li><strong>weather station(s)</strong> are the id(s) used for the relevant weather station(s). If possible, the stations used should be such that they\u2019re already included in VIPS system. It is possible to add new weather stations to VIPS, but this is extra work. Thus, if there\u2019s a near-by weather station already, it is preferred.</li><li><strong>Sowing date</strong> is the date the seeds were placed to the field in question. Please use DD.MM.YYYY format.</li><li><strong>Preceding crop</strong> is the crop type that was cultivated in the field the previous year. Possible crops are <strong>wheat, barley, oats, grass, turnip rape, sugar beet, and legumes</strong>. For fallow fields as well as fields with some other preceding crop use grass.</li><li><strong>Tillage method</strong> is the type of tillage done to the field before sowing. Possible values are <strong>ploughing, reduced tillage, and direct seeding</strong>. Reduced tillage should be used for all fields that are not ploughed and where direct seeding is NOT used.</li><li><strong>Crop susceptibility</strong> is a measure of how resistant the current crop is against the disease. The possible values are <strong>normal, resistant, and susceptible</strong>. In the model normal is the default; resistant crop causes the disease model to (in practice) progress at 50% of the default value and susceptible crop at 150% of the default.</li></ul><p>During the model execution the following weather parameters are required at <strong>One-hour precision</strong>:</p><ul><li>FM2: Average wind speed for the last 60 minutes, measured at 2 meter height (m/s)</li><li>UM: average relative humidity (%)</li><li>RR: Aggregated rainfall in millimeters</li><li>TM: Mean temperature (celcius)</li><li>FF2: Average wind speed for the last 10 minutes, measured at 2 meter height (m(s); only needed if FM2 is not available in the selected data source</li></ul> +description=<p>This is a mechanistic model that can be used for three fungal diseases in cereals: the <em>barley net blotch caused by Pyrenophora teres, the wheat tan spot caused by pyrenophora triciti-repentis, and the wheat stagonospora blotch caused by s. nodorum</em>.</p>All three diseases included in the model can be modeled similarly, but only one disease, shown in the model title, is being modeled at a time.</p><p>The model is based on explicitly modeling the progress of diseases separately on each location. The principal entities and phenomena used in the model are <em>the disease, the field, the cultivar, and the weather</em>. The output of the model provides the farmer with information when the situation on their field has been beneficial for disease development and thus there is an elevated risk of a disease outbreak. Modeling each disease is based on the same, mechanistic modeling approach. However, as the optimal circumstances for the progress of each disease are different, each disease needs to be modeled individually.</p> <p>The model gives two types of results: the daily risk and the accumulated risk. Of these the accumulated risk value is the one to keep an eye on. The accumulated risk tells how likely it is that the net blotch is going to infect the crop; the higher the accumulated risk value the higher the likehood of infection.</p><p><strong>an accumulated risk value of 50 or more is a cause for concern.</strong></p><p><strong>an accumulated risk value of 100 or more is a cause for heightened concern.</strong></p><p>To set up the model, the following information is required:</p><ul><li>A weather data source, such as a weather station, integrated to the VIPS system</li><li>The sowing date for the field in question</li><li>The preceding crop on the field</li><li>The tillage method used on the field</li><li>The susceptibility of the crop on the field</li></ul><p>As can be seen from the list, the model is field-specific, and therefore needs to be set up separately for each field where the disease situation is being monitored.</p> +statusInterpretation=<p>The model gives two types of results: the daily risk and the accumulated risk. Of these the accumulated risk value is the one to keep an eye on. The accumulated risk tells how likely it is that the net blotch is going to infect the crop; the higher the accumulated risk value the higher the likehood of infection.</p> <p><strong>In general, an accumulated risk value of 50 or more is a cause for concern. This is shown in VIPS with yellow color</strong>. At that point it is prudent to keep an eye on the fields for signs of net blotch infection. However, as the model itself is calculated on a daily cycle, it is not taking into account longer weather trends, and therefore farming expertise is still valuable in assessing the situation.</p> <p><strong>An accumulated risk value of 100 more is a cause for heightened concern. This is shown in VIPS in red color</strong>. At that point there is a reason to expect an immediate net blotch infection in the crop. However, farming expertise should still be used when making the decision on doing crop protection operations on the field. If there are no visible signs of net blotch infection, there might be no need for disease management operations, either. </p> <p>The daily risk values are calculated independently for each day, and therefore they do not (directly) give information about how the model progresses on longer time periods. A very large daily value merely represents that on that day the environment was very good for the progress of the disease.</p> \ No newline at end of file diff --git a/src/main/java/fi/luke/vips/model/cerealmodels/FinnCerealModels.java b/src/main/java/fi/luke/vips/model/cerealmodels/FinnCerealModels.java index 388c30f..77e8de6 100644 --- a/src/main/java/fi/luke/vips/model/cerealmodels/FinnCerealModels.java +++ b/src/main/java/fi/luke/vips/model/cerealmodels/FinnCerealModels.java @@ -16,6 +16,7 @@ import no.nibio.vips.entity.ModelConfiguration; import no.nibio.vips.entity.Result; import no.nibio.vips.entity.ResultImpl; import no.nibio.vips.entity.WeatherObservation; +import no.nibio.vips.i18n.I18nImpl; import no.nibio.vips.model.ConfigValidationException; import no.nibio.vips.model.Model; import no.nibio.vips.model.ModelExcecutionException; @@ -24,7 +25,7 @@ import no.nibio.vips.util.InvalidAggregationTypeException; import no.nibio.vips.util.WeatherObservationListException; import no.nibio.vips.util.WeatherUtil; -public class FinnCerealModels implements Model { +public class FinnCerealModels extends I18nImpl implements Model { private final static ModelId MODEL_ID = new ModelId("FINNCEREAL"); public static String PYRENOPHORA = "PyrenophoraTeres"; @@ -50,28 +51,31 @@ public class FinnCerealModels implements Model { private int noRisk = 50; // no risk warning required private int lowRisk = 75; // low risk warning; if the value is higher than this high risk warning is given + public FinnCerealModels() { + super("fi.luke.vips.model.cerealmodels.texts"); + } + @Override public String getCopyright() { - // TODO Auto-generated method stub - return null; + return "Copyright (c) 2016-2019 Natural Resources Institute Finland"; } @Override public String getLicense() { - // TODO Auto-generated method stub - return null; + return "Copyright (c) 2016-2019 Natural Resources Institute Finland\n" + + "This file is part of the Finnish cereal models package." + + "The Finnish cereal models package is free software: you can distribute and/or modify it\n" + + "under the terms of the GNU Lesser General Public License (LGPL) version 3, or any later version."; } @Override public String getModelDescription() { - // TODO Auto-generated method stub - return null; + return getModelDescription(Model.DEFAULT_LANGUAGE); } @Override - public String getModelDescription(String arg0) { - // TODO Auto-generated method stub - return null; + public String getModelDescription(String lang) { + return getText("description", lang); } @Override @@ -82,28 +86,35 @@ public class FinnCerealModels implements Model { @Override public String getModelName() { - return "Model for net blotch (pyrenophora teres), tan spot (pyrenophora triciti-repentis), and stagonospora blotch (s. nodorum)"; + if(pathogen == null || pathogen.equals("")) { + return "Model for net blotch (pyrenophora teres), tan spot (pyrenophora triciti-repentis), and stagonospora blotch (s. nodorum)"; + } else { + return "Model for " + pathogen; + } } @Override public String getModelName(String arg0) { // TODO Auto-generated method stub if (arg0.equals("fi")) { - return "Pistelaikku-, verkkolaikku-, ja ruskolaikkumalli"; + if(pathogen == null || pathogen.equals("")) + return "Pistelaikku-, verkkolaikku-, ja ruskolaikkumalli"; + else + return pathogen + " -malli"; + } return getModelName(); } @Override public String getModelUsage() { - // TODO Auto-generated method stub - return null; + return getModelUsage(Model.DEFAULT_LANGUAGE); } @Override - public String getModelUsage(String arg0) { - // TODO Auto-generated method stub - return null; + public String getModelUsage(String lang) { + return getText("usage", lang); + } // this is the method that actually runs the model. At most it should be refactored to get no parameters @@ -258,20 +269,17 @@ public class FinnCerealModels implements Model { @Override public String getSampleConfig() { - // TODO Auto-generated method stub - return null; + return "No sample config provided at this time."; } @Override public String getWarningStatusInterpretation() { - // TODO Auto-generated method stub - return null; + return getWarningStatusInterpretation(Model.DEFAULT_LANGUAGE); } @Override - public String getWarningStatusInterpretation(String arg0) { - // TODO Auto-generated method stub - return null; + public String getWarningStatusInterpretation(String lang) { + return getText("statusInterpretation", lang); } public void setAccumulatedRisk(Double d) { diff --git a/src/main/java/fi/luke/vips/model/cerealmodels/test/FinnCerealModelsTest.java b/src/main/java/fi/luke/vips/model/cerealmodels/test/FinnCerealModelsTest.java index ec049bf..8b6a10f 100644 --- a/src/main/java/fi/luke/vips/model/cerealmodels/test/FinnCerealModelsTest.java +++ b/src/main/java/fi/luke/vips/model/cerealmodels/test/FinnCerealModelsTest.java @@ -73,6 +73,14 @@ public class FinnCerealModelsTest { generalTest(FinnCerealModels.STAGONOSPORA, "STAGONOSPORA",altData); if(printTime) System.out.println(new Date().getTime()); } + + @Test + public void messageTest() { + FinnCerealModels model = new FinnCerealModels(); + System.out.println(model.getModelDescription()); + System.out.println(model.getModelUsage()); + System.out.println(model.getWarningStatusInterpretation()); + } public List<Result> generalTest(String modelName, String modelPublicName, String inputFileName) { FinnCerealModels pm = new FinnCerealModels(); -- GitLab