IPM Pest and Plant Disease Models and Forecasting
for Agricultural, Pest Management, and Plant Biosecurity Decision Support in the US
How to add custom pest model widgets into your mashup web pages

API Technical Documentation
See also How to create custom risk/models bookmarks

Update Apr. 26, 2011

http://uspest.org/risk/models "MyPest Page" is a multi-crop, multi-model interface intended to serve users at local, regional, and national scales of pest management. Because of this diversity of users, you may wish to set up your webpages with custom embedded pest model charts and tables for one or more pests and locations. For example you could embed the disease model and temperature charts, and degree-day model tables or charts, into a County Extension webpage. All of these elements ("widgets" is the term used today) are loaded from our server into your pages (as you set them up) at the browser of the end-user in real-time (acting as simple web services for your mashups). The primary HTML tags to do this are <img> <object> (used here) and <iframe> (not used here).

Example 1: Embed a local (zipcode-based) apple scab chart and table plus a link to the model at uspest.org ex. for Woodbridge, CA; zip=95686:
<A HREF="http://uspest.org/risk/models?mdl=a_scab&zipcode=95686"><img src="http://uspest.org/risk/models?img=a_scab&zipcode=95686" border="0"></img>
<object data="http://uspest.org/risk/models?dtbl=a_scab&zipcode=95686" width="400" height="220" border="0"></object></A>

Example 2: Embed reduced-size charts for temperature and the Tomcast DSV model. Add lines in the temperature chart at 30, 50, and 70F) ex. for Corvallis, OR; station code=CRVO:
<img src="http://uspest.org/risk/models?img=temp&station=CRVO&tmpth=30%2050%2070&img_x=300&img_y=140"></img>
<img src="http://uspest.org/risk/models?img=tdsv&station=CRVO&img_x=300&img_y=140"></img>

Example 3: Embed a degree-day table and chart for spotted wing Drosophila (using the <object> tag) ex. for Kelso, WA (KKLS):
<object id="model1" data="http://uspest.org/cgi-bin/ddmodele.pl?uco=1&spp=swd&enm=10&end=30&wfl=KKLS11.txt
&fcz=98626&hfl=longview_wa.txt&spyr=1&shd=1&mkt=0&mkg=1&just_table=1" width="440" height="320" scrolling="yes" border="0"> </object>
<object id="model2" data="http://uspest.org/cgi-bin/ddmodele.pl?uco=1&spp=swd&enm=10&end=30&wfl=KKLS11.txt
&fcz=98626&hfl=longview_wa.txt&spyr=1&shd=1&mkt=0&mkg=1&mkgp=0" width="520" height="320" scrolling="no" border="0"> </object>

1. At this time, weather parameter and disease risk model charts do not include mention of the location. You should add your own location labels above or beside the chart. Tables, however do mention the Weather station code, plus the station name (for degree day tables).
2. No cookies are used by default; therefore all settings must be specified in the tags and params.

Full listing of Mypest Page mashup params and values:

  Chart settings - Weather/disease/other hourly driven models - use <img src="...." > tags:
    Use the 'img=' parameter to embed a chart of the selected item.
	 Embed a temperature chart:
       <img src="http://uspest.org/risk/models?img=temp" border="0"> 
	 Embed a temperature chart for station CRVO (Corvallis, OR):
       <img src="http://uspest.org/risk/models?img=temp&sta=CRVO" border="0">  
	 Embed a temperature chart for a station nearest the specified zipcode (Davis, CA):
       <img src="http://uspest.org/risk/models?img=temp&zipcode=95616" border="0"> 
       where xxxxx is the weather parameter or disease ov which you want a chart.
       See the 'wp' and 'mdl' parameter descriptions below to get a full list
       of avaible values.
    Image specific parameters:
       where xxx is the width in pixels
       where yyy is the height in pixels
  Table settings - Weather/disease/other hourly driven models - use <object data="...." > tags:
     Use the 'dtbl' parameter to embed a daily summary table for the selected item.
	   Return a summary table of temperature:
	  <object data="http://uspest.org/risk/models?dtbl=temp" border=0> </object>    
	   Return a summary table of the apple scab model:
	  <object data="http://uspest.org/risk/models?dtbl=a_scab" border=0> </object>  
	   Use further parameters (described below) to control the table.

  Degree-day model chart and table settings - use <object data="...." > tags:
     Use the program uspest.org/cgi-bin/ddmodele.pl to embed degree-day (DD) models.
     DD summary table:
     <object data="http://uspest.org/cgi-bin/ddmodele.pl?uco=1&spp=swd&enm=10&end=30&wfl=KKLS11.txt
	      &fcz=98626&hfl=longview_wa.txt&spyr=1&shd=1&mkt=0&mkg=1&just_table=1" width=440 height=420 
	      scrolling="yes" border=0> </object>

     DD chart:
     <object data="http://uspest.org/cgi-bin/ddmodele.pl?uco=1&spp=swd&enm=10&end=30&wfl=KKLS11.txt
	      &fcz=98626&hfl=longview_wa.txt&spyr=1&shd=1&mkt=0&mkg=1&mkgp=0" width=520 height=320 
	      border=0> </object> 
	   uco=  stands for "use calc only" when set to "1" which skips the legacy interface to DD models
	   spp=  specifies the species abbreviation to use for the model see this list
	       to find what models are available in our system. Contact us (scroll to bottom) if you would like a 
	   	 new model to be added.
	   stm= std= enm= end=  stand for starting month and day and ending month and day for the DD model 
	   cal=  stands for degree-day calculation method, where: 
	       T1  is single triangulation DDs (Sevacherian et al. 1977) 
	       T2  is double triangulation DDs (Sevacherian et al. 1977) 
	       S1  is single sine curve DDs (Baskerville & Emin 1969) (this is used by default)
	       S2  is double sine curve DDs (Baskerville & Emin 1969) 
	        A  is simple average/growing DDs (tmax + tmin/2 - tlow)
	        G  is corn growing degree-days (used for sweet corn)
	       DH  is degree-hours (4 day cumulative, used for fire blight)
	       HD  is heating DDs (power industry)
	       CD  is cooling DDs (power industry)
	       PD  is P-days (potato development DDs from Wisdom DSS)
	   tlo=  stands for the lower temperature threshold (needed when not using a model from the database)
	   thi=  stands for the upper temperature threshold (needed when not using a model from the database)
	   cel=  stands for "use celsius" rather than Fahrenheit
	   wfl=  stands for the station code to use for weather data, plus the year and .txt, ex. "11.txt"
	   fcz=  stands for the zipcode to use for a 7-day NWS forecast, or exclude this parameter and the 
	       program will attempt to find a zipcode to use (this is currently a bug)
	   hfl=  stands for the historical 30-year average temperature file to use see this list to find 
	       an appropriate station to use, or exclude this parameter and the program will attempt to find the 
	       nearest location.
	   spyr= stands for "spanyear" and normally is not needed unless your model begins in the fall and spans
	       into the winter/spring of the next year.
	   shd=  stands for "show header off" and should always be set to "1" unless you wish to show the legacy header
	       which includes photos of the pest (if available), and links to documentation.
	   mkt=  stands for "make table" meaning the full daily detailed table output. Normally this should be set to "0"
	       to not display the full table.
	   mkg=  stands for "make graph" which is the standard chart output. Use "0" for off and "1" for on.
	   mkgp= stands for "make tables popup from graph" which should be "0" unless you provide sufficient space
	       on the webpage and in the object tag settings (such as width="800" height="700") to display a 
			 popup table.
	   just_table= stands for "just table" for when a DD summary table is the primary output. Use "1" for on.

	   <object> tag parameters of interest:
	   data= the source URL you are embedding/mashing.
	   width= the number of pixels to allow for the object to display. Normally ca. 440 is recommended for a
            DD summary table, 520 is recommended for a DD chart, and 800 is recommended for a chart with a
            popup table (using tag mkgp=1).
	   height= the number of pixels to allow for height of the object to display. ca. 320, 320, and 700 can be
            used with the width recommendations above.
	   scrolling=  Set to "yes" or "1" to provide a scroll bar for the object if larger than the allotted space. 
	   border=  Set to "no" or "0" to not include a border around the object.

  Mypage params and values:
      where xxxxx is the station code. eg sta=CRVO or sta=v2CRVO (for virtual station).
      where yyyymmdd is year month day (eg 20100704 is July 4, 2010)
      of when to start displaying data.
      where xx is number of days data to display after start date
      where yyyymmdd is year month day (eg 20100723 is July 23, 2010)
      of when to start displaying forcast data forecasted on a specific
      where xxxxx is the weather parameter to display. Possible values:
      where xxxxx is hourly disease model. Model values:
         none (to force no models -- even cookied model params)
         a_scab   (Apple Scab)
         p_scab   (Pear Scab)
         p_mild   (Powder Mildew)
         h_pm     (Hops Powdery Midlew)
         ch_pm    (Cherry Powdery Mildew)
         cl_pm    (Cleistothecial Powdery Mildew)
         str_pm   (Strawberry Powdery Mildew)
         mm_mc    (Muskmelon Melcast)
         wm_mc    (Watermelon Melcast)
         p_scld   (Anjou Pear Scald)
         fb       (Fire Blight)
         fb10     (Fire Blight 2010)
         boti     (Botrytis)
         tplb     (Tomato Potato Late Blight)
         tdsv     (Tomcast DSV)
         gen      (Generic)
         chl      (Chilling)
         chl_u    (Chilling Utah Model)

      where xxxxx is degree-day model
      to disable forecast
      to opt for National Weather Service digital forecast (vs default of Fox)
      to opt for not using any station Leaf Senor data if available (default is to it).
      Forces using computed LW from Fox FuzzyLW routine based on temperature, dewpt, wind and precip.
      to force zero precip into the Fox FuzzyLw routine.
      to display plot of QA for temperature and dew point.
      to display temperature threshold lines on temperature graph
      where xx, yy and zz (and so on) are desired Farenheit degrees for
      lines to appear.
      to display wind speed threshold lines on windspeed graph
      where xx, yy and zz (and so on) are desired mph speed for
      lines to appear.
      to get a csv file of the data.
      to also display a tabular view of the selected weather and hourly model data.
      to disable display of graphs.

      where nnnnn is the zipcode to find a weather station for data. Use zipcode
      only if not defining a specific station (eg via the sta=xxxx).

National Plant Diagnostics Network Integrated Plant Protection Center at Oregon State University IPM PIPE The PRISM Group at OSU Western
Region Pest Management Center National Institute of
Food and Agriculture

[USPEST.ORG/WEA Home] [IPPC Home] [OSU Extension] [OSU Home] [OSU Disclaimer]
  Contact Len Coop, OSU IPPC and Botany & Plant Pathology Dept. at coopl@science.oregonstate.edu or call 541-737-5523 if you have any questions about this information.