Presentation is loading. Please wait.

Presentation is loading. Please wait.

A Framework for Agricultural Model Development Kei Tanaka NARC-NARO.

Similar presentations


Presentation on theme: "A Framework for Agricultural Model Development Kei Tanaka NARC-NARO."— Presentation transcript:

1 A Framework for Agricultural Model Development Kei Tanaka NARC-NARO

2 Contents of Presentation Background of model development Framework Efficiency of using framework Conclusions

3 Background of Agricultural Model Development Developed several agricultural models –Plant growth models (rice, pear, …) –Disease prediction models (wheat, pear, …) –Executable in an web page

4 Java APIs: Network, GUI, … Cross-platform: Windows, Linux, Mac OS, … Applet: If JRE is installed, additional installation work is not necessary. –Execution easily is important to popularize a model Secure programming

5 MetBroker A middleware between weather databases and agricultural models Provides consistent methods to access various weather databases through the Internet

6 Framework –Program library summarized to reuse for the specific purpose application. Advantages of using a Framework –Offers implementation Development productivity improves –Specifies a development method Quality of application is kept high

7 Frameworks Web MVC –Struts, Tapestry, JSF, Spring MVC, Web Work O/R Mapping –Hibernate, PriDE, O/R Broker, Mr.Persister Testing –JUnit, TestNG, JTiger SOA (Service Oriented Architecture) –Celtix, Beehive, JBoss jBPM

8 Common Features of Agricultural Models Management of data –Sequential value:Air Temp., Rain, … –Numerical value:Weight, Threshold, … –Date:Transplant date, … –Boolean value:Use or Not use Weather data acquisition from a MetBroker or a users local file Result display in a table or a chart

9 import net.agmodel.data.*; import net.agmodel.datareader.*; … public class PearDuthieData extends ExecutionDataImpl{ public BlastamData(){ //Setup for parameters and sequential data addValueElement(LEAF_WETNESS_THRESHOLD);//Declaration of a parameter setValue_(LEAF_WETNESS_THRESHOLD, 80.0);//Set of the initial value of a parameter addSequenceElement(AIRTEMPERATURE);//Declaration of a sequential data addSequenceElement(LEAFWETNESS); DataSourceAttribute dsAttrAirTemp = getDataSourceAttribute(AIRTEMPERATURE); DataSourceAttribute dsAttrLeafWet = getDataSourceAttribute(LEAFWETNESS); //Set of the data source of sequential data dsAttrAirTemp.addUsableDataSource(DataSourceElement.MET_BROKER);//MetBroker dsAttrAirTemp.addUsableDataSource(DataSourceElement.USER_DATA);//User Data dsAttrLeafWet.addUsableDataSource(DataSourceElement.MET_BROKER); dsAttrLeafWet.addUsableDataSource(DataSourceElement.USER_DATA); dsAttrLeafWet.addUsableDataSource(DataSourceElement.ESTIMATED_DATA);//Estimated Data … } public UserDataReader getUserDataReader(){ //Setup to aquire users local file data UserDataReaderImpl udReader = new UserDataReaderImpl(); udReader.addTextDataElement(new TextDataElement(AIRTEMPERATURE, AIRTEMPERATURE.toString(), "C")); udReader.addTextDataElement(new TextDataElement(LEAFWETNESS, LEAFWETNESS.toString(), "")); return udReader; } … } Example 1 Data Source Setup

10 public class PearDuthieData extends ExecutionDataImpl{ public BlastamData(){ addValueElement(LEAF_WETNESS_THRESHOLD); setValue_(LEAF_WETNESS_THRESHOLD, 80.0); addSequenceElement(AIRTEMPERATURE); addSequenceElement(LEAFWETNESS); DataSourceAttribute dsAttrAirTemp = getDataSourceAttribute(AIRTEMPERATURE); DataSourceAttribute dsAttrLeafWet = getDataSourceAttribute(LEAFWETNESS); //Set of the data source of sequential data dsAttrAirTemp.addUsableDataSource(DataSourceElement.MET_BROKER); dsAttrAirTemp.addUsableDataSource(DataSourceElement.USER_DATA); dsAttrLeafWet.addUsableDataSource(DataSourceElement.MET_BROKER); dsAttrLeafWet.addUsableDataSource(DataSourceElement.USER_DATA); dsAttrLeafWet.addUsableDataSource(DataSourceElement.ESTIMATED_DATA); … } public UserDataReader getUserDataReader(){ //Setup to aquire users local file data UserDataReaderImpl udReader = new UserDataReaderImpl(); udReader.addTextDataElement(new TextDataElement(AIRTEMPERATURE, AIRTEMPERATURE.toString(), "C")); udReader.addTextDataElement(new TextDataElement(LEAFWETNESS, LEAFWETNESS.toString(), "")); return udReader; } … }

11 public class PearDuthieTableUI extends net.agmodel.gui.ModelTableFrame{ //Display result data in a table protected SequenceTM[] createSequenceTM(ResultData data){ JigsawQuantityFormat jqf = new JigsawQuantityFormat("0", DEVOID);//Number format to display Sequence wetness = data.getSequence(WETNESS_DURATION); Sequence infection = data.getSequence(INFECTION_RATE); return new SequenceTM[]{//Array of sequential data displayed in a table new SequenceTM((MetSequence)data.getSequence(AIRTEMPERATURE)), new SequenceTM((MetSequence)data.getSequence(LEAFWETNESS)), new SequenceTM(data.getSequence(WETNESS_DURATION), WETNESS_DURATION.toString(), "h", SummaryKind.AVERAGE, jqf), new SequenceTM(data.getSequence(INFECTION_RATE), INFECTION_RATE.toString(), "", SummaryKind.MAXIMUM, jqf)}; } //Display result data in a chart protected SequenceC[] createSequenceC(ResultData data){ Interval in = data.getResultInterval(); Duration re = data.getResolution(); return new SequenceC[]{//Array of sequential data displayed in a chart new SequenceC((MetSequence)data.getSequence(AIRTEMPERATURE), in, re), new SequenceC((MetSequence)data.getSequence(LEAFWETNESS), in, re), new SequenceC(new SequenceU(data.getSequence(INFECTION_RATE), SummaryKind.MAXIMUM), INFECTION_RATE.toString(), null, null, in, re)}; } //Display result data in a map protected net.agmodel.gui.MultipleStationResultMap createMap(double latitude, double longitude){ return new PearDuthieMap((ResultData[])allData, latitude, longitude, , INFECTION_RATE.toString()); } Example 2 Result Display

12 public class BlastamTableUI extends net.agmodel.gui.ModelTableFrame{ //Display result data in a table protected SequenceTM[] createSequenceTM(ResultData data){ //Number format to display JigsawQuantityFormat jqf = new JigsawQuantityFormat("0", DEVOID); //Array of sequential data displayed in a table return new SequenceTM[]{ new SequenceTM((MetSequence)data.getSequence(AIRTEMPERATURE)), new SequenceTM((MetSequence)data.getSequence(RAIN)), new SequenceTM((MetSequence)data.getSequence(WIND)), new SequenceTM((MetSequence)data.getSequence(SUNSHINE))}; } //Display result data in a chart protected SequenceC[] createSequenceC(ResultData data){ Interval in = data.getResultInterval(); Duration re = data.getResolution(); return new SequenceC[]{//Array of sequential data displayed in a chart new SequenceC((MetSequence)data.getSequence(AIRTEMPERATURE), in, re), new SequenceC((MetSequence)data.getSequence(RAIN), in, re), new SequenceC((MetSequence)data.getSequence(WIND), in, re), new SequenceC((MetSequence)data.getSequence(SUNSHINE), in, re)}; } //Display result data in a map protected net.agmodel.gui.MultipleStationResultMap createMap(double latitude, double longitude){ return new BlastamMap((ResultData[])allData, latitude, longitude, , INFECTION_RATE.toString()); }

13 public class BlastamTableUI extends net.agmodel.gui.ModelTableFrame{ //Display result data in a table protected SequenceTM[] createSequenceTM(ResultData data){ //Number format to display JigsawQuantityFormat jqf = new JigsawQuantityFormat("0", DEVOID); //Array of sequential data displayed in a table return new SequenceTM[]{ new SequenceTM((MetSequence)data.getSequence(AIRTEMPERATURE)), new SequenceTM((MetSequence)data.getSequence(RAIN)), new SequenceTM((MetSequence)data.getSequence(WIND)), new SequenceTM((MetSequence)data.getSequence(SUNSHINE))}; } //Display result data in a chart protected SequenceC[] createSequenceC(ResultData data){ Interval in = data.getResultInterval(); Duration re = data.getResolution(); //Array of sequential data displayed in a chart return new SequenceC[]{ new SequenceC((MetSequence)data.getSequence(AIRTEMPERATURE), in, re), new SequenceC((MetSequence)data.getSequence(RAIN), in, re), new SequenceC((MetSequence)data.getSequence(WIND), in, re), new SequenceC((MetSequence)data.getSequence(SUNSHINE), in, re)}; } //Display result data in a map protected net.agmodel.gui.MultipleStationResultMap createMap(double latitude, double longitude){ return new BlastamMap((ResultData[])allData, latitude, longitude, , INFECTION_RATE.toString()); }

14 public class BlastamTableUI extends net.agmodel.gui.ModelTableFrame{ //Display result data in a table protected SequenceTM[] createSequenceTM(ResultData data){ //Number format to display JigsawQuantityFormat jqf = new JigsawQuantityFormat("0", DEVOID); //Array of sequential data displayed in a table return new SequenceTM[]{ new SequenceTM((MetSequence)data.getSequence(AIRTEMPERATURE)), new SequenceTM((MetSequence)data.getSequence(RAIN)), new SequenceTM((MetSequence)data.getSequence(WIND)), new SequenceTM((MetSequence)data.getSequence(SUNSHINE))}; } //Display result data in a chart protected SequenceC[] createSequenceC(ResultData data){ Interval in = data.getResultInterval(); Duration re = data.getResolution(); return new SequenceC[]{//Array of sequential data displayed in a chart new SequenceC((MetSequence)data.getSequence(AIRTEMPERATURE), in, re), new SequenceC((MetSequence)data.getSequence(RAIN), in, re), new SequenceC((MetSequence)data.getSequence(WIND), in, re), new SequenceC((MetSequence)data.getSequence(SUNSHINE), in, re)}; } //Display result data in a map protected net.agmodel.gui.MultipleStationResultMap createMap(double latitude, double longitude){ return new BlastamMap((ResultData[])allData, latitude, longitude, , INFECTION_RATE.toString()); }

15

16 Agricultural Models developed by using Framework ModelsContents of models JAPONICA Java version Program of Oryza-Nitrogen relation for Crop Growth Analysis MetBLASTAM Rice blast forecasting model PearDuthie Japanese pear scab infection forecasting model PearSugiura Pear blooming and cultivation date prediction model InsectDVR Insect generation prediction model WeedDamage Weed damage prediction model WeedEmergence Weed emergence prediction model LeafWetness Leaf wetness prediction model (3 models)

17 Efficiency of using Framework MetBLASTAM (Rice blast forecasting model) 2,000 lines was developed for the model 25,000 lines provided by the framework was called from the model program Calculation part (main part of the model) is 45% of the model program Developer can use much time to develop main part, not Data acquisition, GUI.

18 Conclusions Developed the framework for agricultural models Several models developed by using the framework Program for weather data acquisition and result display only lists data names Model developer can use much time to develop main part


Download ppt "A Framework for Agricultural Model Development Kei Tanaka NARC-NARO."

Similar presentations


Ads by Google