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

Updated Mar. 25, 2021

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 web 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 Carneros, CA; zip=94558:
<A HREF="https://uspest.org/risk/models?mdl=a_scab&zipcode=94558"><img src="https://uspest.org/risk/models?img=a_scab&zipcode=94558" border="0"></img>
<object data="https://uspest.org/risk/models?dtbl=a_scab&zipcode=94558" 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="https://uspest.org/risk/models?img=temp&station=CRVO&tmpth=30%2050%2070&img_x=400&img_y=220"></img>
<img src="https://uspest.org/risk/models?img=tdsv&station=CRVO&img_x=400&img_y=220"></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="https://uspest.org/cgi-bin/ddmodel2.pl?uco=1&spp=swd&enm=10&end=30&wfl=KKLS20.txt
&fcz=98626&hfl=longview_wa.txt&spyr=1&shd=1&mkt=0&mkg=1&just_table=1" width="440" height="300" scrolling="yes" border="0"> </object>
<object id="model2" data="https://uspest.org/cgi-bin/ddmodel2.pl?uco=1&spp=swd&enm=8&end=30&wfl=KKLS20.txt
&fcz=98626&hfl=longview_wa.txt&spyr=0&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="https://uspest.org/risk/models?img=temp" border="0"> 
	 Embed a temperature chart for station CRVO (Corvallis, OR):
       <img src="https://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="https://uspest.org/risk/models?img=temp&zipcode=95616" border="0"> 
       where xxxxx is the weather parameter or disease for which you want a chart.
       See the 'wp' and 'mdl' parameter descriptions below to get a full list
       of available 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="https://uspest.org/risk/models?dtbl=temp" border=0> </object>    
	   Return a summary table of the apple scab model:
	  <object data="https://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/ddmodel2.pl to embed degree-day (DD) models.
     DD summary table:
     <object data="https://uspest.org/cgi-bin/ddmodel2.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="https://uspest.org/cgi-bin/ddmodel2.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. The spp=aaa is special as it signifies generic DD calculator mode.
	   stm= std= enm= end=  stand for starting month and day and ending month and day for the DD model 
	If you set the species to "aaa" (calculator mode) then these params apply, otherwise they are pre-set for the species: 
	      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)
	  These params apply to all models:	
      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"
	  These next two are "legacy" params and are not needed: 
		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 (risk/models) 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 20200704 is July 4, 2020)
      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 20200723 is July 23, 2020)
      of when to start displaying forcast data forecasted on a specific
      date. This param is rarely used unless you wish to compare a past forecast with observed data.
      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   (Grape Powdery Mildew)
         pgpm     (Pearson Gadoury Powdery 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)
         fb10_update_20120223 (Fire Blight 2010 updated 2012)
         boti     (Botrytis)
         tplb     (Tomato Potato Late Blight)
         dol_spot (Dollar Spot)
         bxwd_s   (Boxwood Blight)
         tdsv     (Tomcast DSV)
         gen      (Generic)
         chl      (Chilling)
         chl_u    (Chilling Utah Model)
         mum_b    (mummyberry of blueberry model)
         v_drift  (vapor drift Delta-T model)

      where xxx is a degree-day model
      to disable forecast
      to opt for National Weather Service digital forecast (vs default of Fox; Fox forecast subject to change)
      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).

Oregon IPM 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 Horticulture Dept. at coopl@oregonstate.edu or call 541-737-5523 if you have any questions about this information.