Help for the Forecast Weather API

version 2017.01.06.22


Test Mode 1

The parameter 'test' by itself parrots that value back. This can be used to verify that you are able to successfully connect to the API.

Example Link:

http://parfait.snarkybox.com/forecast.php?test=true

What that link returns will look like this:

true


Test Mode 2

Adding the parameters 'lat' and 'lon' will dump the forecast xml sent by NOAA, plus parrot back a table of all the possible parameters and their current values. The values for the 'lat' and 'lon' parameters can be found at the MapQuest Latitude/Longitude Finder website. Any Latitude/Longitude recognized by NWS as being inside of the US can be used. The values for the 'lat' and 'lon' parameters can be found here: http://developer.mapquest.com/web/tools/lat-long-finder.

Example Link:

http://parfait.snarkybox.com/forecast.php?test=true&lat=33.94&lon=-118.4

What that link returns will look like this:


<?xml version="1.0" encoding="ISO-8859-1"?>
<dwml xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" xsi:noNamespaceSchemaLocation="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd">
  <head>
    <product concise-name="dwmlByDay" operational-mode="developmental" srsName="WGS 1984">
      <creation-date refresh-frequency="PT1H">2014-11-16T06:10:54-08:00</creation-date>
      <category>current observations and forecast</category>
    </product>
    <source>
      <production-center>Los Angeles/Oxnard, CA</production-center>
      <credit>http://www.wrh.noaa.gov/lox</credit>
      <more-information>http://www.nws.noaa.gov/forecasts/xml/</more-information>
    </source>
  </head>
  <data type="forecast">
    <location>
      <location-key>point1</location-key>
      <description>Los Angeles International Airport, CA</description>
      <point latitude="33.94" longitude="-118.39"/>
      <city state="CA">Los Angeles International Airport</city>
      <height datum="mean sea level">98</height>
    </location>
    <moreWeatherInformation applicable-location="point1">http://forecast.weather.gov/MapClick.php?lat=33.94&amp;lon=-118.39</moreWeatherInformation>
    <time-layout time-coordinate="local" summarization="12hourly">
      <layout-key>k-p6h-n1-1</layout-key>
      <start-valid-time>2014-11-16T08:00:00-08:00</start-valid-time>
      <end-valid-time>2014-11-22T18:00:00-08:00</end-valid-time>
    </time-layout>
    <time-layout time-coordinate="local" summarization="12hourly">
      <layout-key>k-p6h-n1-2</layout-key>
      <start-valid-time>2014-11-16T08:00:00-08:00</start-valid-time>
      <end-valid-time>2014-11-22T18:00:00-08:00</end-valid-time>
    </time-layout>
    <time-layout time-coordinate="local" summarization="12hourly">
      <layout-key>k-p12h-n13-1</layout-key>
      <start-valid-time period-name="Today">2014-11-16T06:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Tonight">2014-11-16T18:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Monday">2014-11-17T06:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Monday Night">2014-11-17T18:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Tuesday">2014-11-18T06:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Tuesday Night">2014-11-18T18:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Wednesday">2014-11-19T06:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Wednesday Night">2014-11-19T18:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Thursday">2014-11-20T06:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Thursday Night">2014-11-20T18:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Friday">2014-11-21T06:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Friday Night">2014-11-21T18:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Saturday">2014-11-22T06:00:00-08:00</start-valid-time>
    </time-layout>
    <time-layout time-coordinate="local" summarization="12hourly">
      <layout-key>k-p24h-n7-1</layout-key>
      <start-valid-time period-name="Today">2014-11-16T06:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Monday">2014-11-17T06:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Tuesday">2014-11-18T06:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Wednesday">2014-11-19T06:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Thursday">2014-11-20T06:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Friday">2014-11-21T06:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Saturday">2014-11-22T06:00:00-08:00</start-valid-time>
    </time-layout>
    <time-layout time-coordinate="local" summarization="12hourly">
      <layout-key>k-p24h-n6-2</layout-key>
      <start-valid-time period-name="Tonight">2014-11-16T18:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Monday Night">2014-11-17T18:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Tuesday Night">2014-11-18T18:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Wednesday Night">2014-11-19T18:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Thursday Night">2014-11-20T18:00:00-08:00</start-valid-time>
      <start-valid-time period-name="Friday Night">2014-11-21T18:00:00-08:00</start-valid-time>
    </time-layout>
    <parameters applicable-location="point1">
      <temperature type="maximum" units="Fahrenheit" time-layout="k-p24h-n7-1">
        <name>Daily Maximum Temperature</name>
        <value>74</value>
        <value>77</value>
        <value>80</value>
        <value>71</value>
        <value>67</value>
        <value>68</value>
        <value>68</value>
      </temperature>
      <temperature type="minimum" units="Fahrenheit" time-layout="k-p24h-n6-2">
        <name>Daily Minimum Temperature</name>
        <value>53</value>
        <value>55</value>
        <value>55</value>
        <value>58</value>
        <value>57</value>
        <value>56</value>
      </temperature>
      <probability-of-precipitation type="12 hour" units="percent" time-layout="k-p12h-n13-1">
        <name>12 Hourly Probability of Precipitation</name>
        <value xsi:nil="true"/>
        <value xsi:nil="true"/>
        <value xsi:nil="true"/>
        <value xsi:nil="true"/>
        <value xsi:nil="true"/>
        <value xsi:nil="true"/>
        <value xsi:nil="true"/>
        <value xsi:nil="true"/>
        <value xsi:nil="true"/>
        <value xsi:nil="true"/>
        <value xsi:nil="true"/>
        <value xsi:nil="true"/>
        <value xsi:nil="true"/>
      </probability-of-precipitation>
      <weather time-layout="k-p12h-n13-1">
        <name>Weather Type, Coverage, Intensity</name>
        <weather-conditions weather-summary="Sunny"/>
        <weather-conditions weather-summary="Mostly Clear"/>
        <weather-conditions weather-summary="Sunny"/>
        <weather-conditions weather-summary="Partly Cloudy"/>
        <weather-conditions weather-summary="Mostly Sunny"/>
        <weather-conditions weather-summary="Partly Cloudy"/>
        <weather-conditions weather-summary="Mostly Sunny"/>
        <weather-conditions weather-summary="Partly Cloudy"/>
        <weather-conditions weather-summary="Mostly Sunny"/>
        <weather-conditions weather-summary="Mostly Cloudy"/>
        <weather-conditions weather-summary="Slight Chc Rain"/>
        <weather-conditions weather-summary="Mostly Cloudy"/>
        <weather-conditions weather-summary="Mostly Sunny"/>
      </weather>
      <conditions-icon type="forecast-NWS" time-layout="k-p12h-n13-1">
        <name>Conditions Icon</name>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/few.png</icon-link>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/nfew.png</icon-link>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/few.png</icon-link>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/nsct.png</icon-link>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/sct.png</icon-link>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/nsct.png</icon-link>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/sct.png</icon-link>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/nsct.png</icon-link>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/sct.png</icon-link>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/nbkn.png</icon-link>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/ra.png</icon-link>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/nbkn.png</icon-link>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/sct.png</icon-link>
      </conditions-icon>
      <hazards time-layout="k-p6h-n1-1">
        <name>Watches, Warnings, and Advisories</name>
        <hazard-conditions>
          <hazard headline="Red Flag Warning">
            <hazardTextURL>http://forecast.weather.gov/showsigwx.php?warnzone=CAZ041&amp;warncounty=CAC037&amp;firewxzone=CAZ241&amp;local_place1=Los+Angeles+International+Airport+CA&amp;product1=Red+Flag+Warning</hazardTextURL>
          </hazard>
        </hazard-conditions>
      </hazards>
      <hazards time-layout="k-p6h-n1-2">
        <name>Watches, Warnings, and Advisories</name>
        <hazard-conditions>
          <hazard headline="Wind Advisory">
            <hazardTextURL>http://forecast.weather.gov/showsigwx.php?warnzone=CAZ041&amp;warncounty=CAC037&amp;firewxzone=CAZ241&amp;local_place1=Los+Angeles+International+Airport+CA&amp;product1=Wind+Advisory</hazardTextURL>
          </hazard>
        </hazard-conditions>
      </hazards>
      <hazards time-layout="">
        <name>Watches, Warnings, and Advisories</name>
        <hazard-conditions>
          <hazard headline="Hazardous Weather Outlook">
            <hazardTextURL>http://forecast.weather.gov/showsigwx.php?warnzone=CAZ041&amp;warncounty=CAC037&amp;firewxzone=CAZ241&amp;local_place1=Los+Angeles+International+Airport+CA&amp;product1=Hazardous+Weather+Outlook</hazardTextURL>
          </hazard>
        </hazard-conditions>
      </hazards>
      <wordedForecast time-layout="k-p12h-n13-1" dataSource="loxNetcdf" wordGenerator="markMitchell">
        <name>Text Forecast</name>
        <text>Sunny, with a high near 74. North northeast wind around 5 mph becoming west southwest in the afternoon. </text>
        <text>Mostly clear, with a low around 53. North northwest wind around 5 mph becoming calm  after midnight. </text>
        <text>Sunny, with a high near 77. North northeast wind 5 to 10 mph becoming west in the afternoon. </text>
        <text>Partly cloudy, with a low around 55. West wind 5 to 10 mph becoming north northeast in the evening. </text>
        <text>Mostly sunny, with a high near 80. North northeast wind around 5 mph becoming east in the morning. </text>
        <text>Partly cloudy, with a low around 55.</text>
        <text>Mostly sunny, with a high near 71.</text>
        <text>Partly cloudy, with a low around 58.</text>
        <text>Mostly sunny, with a high near 67.</text>
        <text>Mostly cloudy, with a low around 57.</text>
        <text>A slight chance of rain.  Mostly cloudy, with a high near 68.</text>
        <text>Mostly cloudy, with a low around 56.</text>
        <text>Mostly sunny, with a high near 68.</text>
      </wordedForecast>
    </parameters>
  </data>
  <data type="current observations">
    <location>
      <location-key>point1</location-key>
      <point latitude="33.93806" longitude="-118.38889"/>
      <area-description>Los Angeles, Los Angeles International Airport, CA</area-description>
      <height datum="mean sea level" height-units="feet">125</height>
    </location>
    <moreWeatherInformation applicable-location="point1">http://www.wrh.noaa.gov/total_forecast/other_obs.php?wfo=lox&amp;zone=CAZ041</moreWeatherInformation>
    <time-layout time-coordinate="local">
      <layout-key>k-p1h-n1-1</layout-key>
      <start-valid-time period-name="current">2014-11-16T06:53:00</start-valid-time>
    </time-layout>
    <parameters applicable-location="point1">
      <temperature type="apparent" units="Fahrenheit" time-layout="k-p1h-n1-1">
        <value>58</value>
      </temperature>
      <temperature type="dew point" units="Fahrenheit" time-layout="k-p1h-n1-1">
        <value>55</value>
      </temperature>
      <humidity type="relative" time-layout="k-p1h-n1-1">
        <value>90</value>
      </humidity>
      <weather time-layout="k-p1h-n1-1">
        <name>Weather Type, Coverage, Intensity</name>
        <weather-conditions weather-summary="Partly Cloudy"/>
        <weather-conditions>
          <value>
            <visibility units="statute miles">10.00</visibility>
          </value>
        </weather-conditions>
      </weather>
      <conditions-icon type="forecast-NWS" time-layout="k-p1h-n1-1">
        <name>Conditions Icon</name>
        <icon-link>http://forecast.weather.gov/images/wtf/medium/sct.png</icon-link>
      </conditions-icon>
      <direction type="wind" units="degrees true" time-layout="k-p1h-n1-1">
        <value>0</value>
      </direction>
      <wind-speed type="gust" units="knots" time-layout="k-p1h-n1-1">
        <value>NA</value>
      </wind-speed>
      <wind-speed type="sustained" units="knots" time-layout="k-p1h-n1-1">
        <value>0</value>
      </wind-speed>
      <pressure type="barometer" units="inches of mercury" time-layout="k-p1h-n1-1">
        <value>30.13</value>
      </pressure>
    </parameters>
  </data>
</dwml>

http://forecast.weather.gov/MapClick.php?lat=33.94&lon=-118.4&FcstType=dwml

lat lon layer periods title capsule test version
33.94 -118.4         true 2017.01.06.22

 


Periods Parameter

Using the parameter 'periods' will limit the numbers of periods returned, regardless of how many are sent in the NWS data.

If NWS sends fewer periods than requested using this parameter, the number of periods actually in the NWS data are all that will be returned.


Capsule Retrieval

Using the 'lat', 'lon', 'title' and the 'capsule' parameters together will retrieve a current weather forecast. The values for the 'lat' and 'lon' parameters can be found here: http://developer.mapquest.com/web/tools/lat-long-finder.

There are two main purposes for these parameters. First is to provide a text based report for use in a web application. Second is to provide an extremely simple HTML web page showing the current forecast. The 'title' parameter allows you set custom text you want as the title when you are creating HTML output. The 'capsule' parameter is further divided into data chunks that describe what and how you want the data displayed.

Basic Data Chunks:

Four basic data chunks are available: Title Display, Current Observations, Forecast Title Display and Forecast. The method used to create the capsule is to send a comma delimited string with the codes for each chunk. Please see the chart below for a complete listing of the codes available. For example, if a report containing the title and current observations were desired, the value for the capsule parameter would be sent like this: 'capsule=y,o'. The Forecast chunk works with the 'periods' parameter to limit the numbers of periods returned. The Title Display chunk will either display a basic location string or will display the text provided by the 'title' parameter.

There is a single modifier for the Current Observations chunk: 'c'. This will return more verbose text. If you use this modifier, you also need to include the observing station call sign encoded to be the ASCII values of the four characters that make up the ICAO code. The value for the weather observation stations can be found here: http://www.nws.noaa.gov/tg/siteloc.php. An Example: If you wanted to use the ICAO Code of 'klax', you would need to send the data chunk as 'oc107106097120'. NOTE: In order to get the additional data to build the verbose text, this may delay the build of the capsule slightly.

BASIC
CHUNK
CODE SAMPLE MODIFIER MODIFIER
RESULT
Title
Display
y Huntington, VA Weather    
Current
Observations
o Current Observations at 11:52 PM: Partly Cloudy,
20 degrees, with a north wind 10 mph.
c Current Observations at 11:52 pm EST: Partly Cloudy, 20 degrees.
Wind Speed: Northwest at 10.4 MPH (9 KT), Wind Chill: 9 F (-13 C)
Relative Humidity: 50%
Forecast Title
Display
z Forecast for Saturday at 4:27 PM    
Forecast f Tuesday: Mostly sunny, with a high near 57.    

HTML Chunks:

The capsule can be further modified to create an HTML web page. You could use this on it own, maybe as a browser shortcut, or you can embed it in an iframe in your own web page as a widget. Simply use an HTML chunk of 'x'. This will create a simple HTML5 web page with a simple table. Four modifiers, 'c', 'r', 'k', 'm' and 'e' can be used with this chunk. The text alignment defaults to left, so adding 'r' will set it to the right. Sending 'c' will set it to be centered. The table alignment defaults to left, so adding 'e' will set it to be centered. If you don't want a full HTML web page, but only want just the table and it's contents, add the 'k' modifier. If you don't want the generated CSS style because you want to provide your own, add the 'm' modifier. Please note, if you use the 'k' or 'm' modifiers, there will be no CSS style applied to the table or image. You will need to supply that yourself.

The HTML chunk 'u' will allow this web page to be automatically refreshed. Add the HTML chunk of 'u' with the number of seconds: 'u300' will refresh every five minutes.

The HTML chunk 'g' will add weather condition images. This chunk also has a position modifier. By default the image will be shown to the left of the text. If you add 'r' to the HTML chunk, then the image will be placed on the right of the text. If you want the image to be displayed at a different size, add the number of pixels to the HTML chunk. 'gr64' will display an image to the right of the text whose width and height have been set to be 64 pixels. If for some reason the image to be displayed has not been provided by NOAA, then the NOAA logo will be displayed instead.

The HTML chunk of 'b' will define the border of the table. It is a fifteen digit number consisting of five, three digit sub-numbers assigned by position. The first three are the RGB colors in decimal format, next is the number of pixels for the border size and last is the code for the style. For example: b153051255005006 will create a border style = "border-color: rgb(153,51,255); border-width: 5px; border-style: ridge;". Please see the table below for the Border Style and their code values.

The HTML chunk 'q' is used to select the color of the backgrounds for the page and table. It is a eighteen digit number consisting of six, three digit sub-numbers assigned by position. The first three numbers are the RGB colors in decimal format for the table background. The second three numbers are the RGB colors in decimal format for the page background. For example: q153204255 will set the table's style = "background-color: rgb(153,204,255);".

The HTML chunk 'j' is used to set the width of the weather text and the height of the table. It is a six digit number consisting of two, three digit sub-numbers assigned by position. These are the width and height, respectively, in decimal format. For example: j100200 will set the weather text's style = "width: 100px;" and the table's style = "height: 200px;". NOTE: Most browsers will automatically expand the table to fit it's contents. Since the width is required if you also want to set the height, any width smaller than ten is set to ten. The same goes for the height.

The HTML chunk 'd' is used to select the color of the text. It is a nine digit number consisting of three, three digit sub-numbers assigned by position. These numbers are the RGB colors in decimal format for the text. This chunk has five modifiers, 'r', 'c', 'm', 'k' and 'e'. These are used to select which of the four Basic Data Chunks you want to set the color for. Adding the modifier of 'r' will set the color for the Title Display. Adding the modifier of 'c' will set the color for the Current Observations. Adding the modifier of 'm' will set the color for the Forecast Title Display. Adding the modifier of 'k' will set the color for the Forecast Even Rows. Adding the modifier of 'e' will set the color for the Forecast Odd Rows. For example: dr153204255 will set the Title Display style = "color:rgb(153,204,255);".

The HTML chunk 'a' is used to select the background color of the Forecast rows. It is a eighteen digit number consisting of six, three digit sub-numbers assigned by position. The first three numbers are the RGB colors in decimal format for the background of the day time rows. The second three numbers are the RGB colors in decimal format for the background of the night time rows. Using this chunk you can set a green-bar effect for the forecast data. This chunk has one modifier: 'k'. This modifier will set the text color to either black or white based on the perceived brightness of the forecast row's background color. For example: a000051102153204255 will set the Forecast day time rows style = "background-color:rgb(0,51,102);" and the Forecast night time rows style = "background-color:rgb(153,204,255);".

HTML
CHUNK
CODE RIGHT ALIGN
MODIFIER
CENTER ALIGN
MODIFIER
TABLE ONLY
MODIFIER
NO STYLE
MODIFIER
TABLE CENTER
ALIGN MODIFIER
TITLE
DISPLAY
CURRENT
OBSERVATIONS
FORECAST
TITLE DISPLAY
FORECAST
EVEN ROWS
FORECAST
ODD ROWS
BLACK OR
WHITE TEXT
HTML
Output
x r c k m e            
Page
Refresh
u                      
Show
Image
g r                    
Table
Border
b                      
Table
Background
q                      
Table Size j                      
Text Color d           r c m k e  
Forecast Row
Background
a                     k

BORDER
STYLE
CODE
dotted 001
dashed 002
solid 003
double 004
groove 005
ridge 006
inset 007
outset 008

First Example Link:

http://parfait.snarkybox.com/forecast.php?lat=33.94&lon=-118.4&periods=4&capsule=o,f,y,z

What that link returns will look like this:

Los Angeles International Airport, CA Weather

Current Observations at 11:53 PM: Partly Cloudy, 58 degrees, with a west wind 8 mph. 

Forecast for Saturday at 2:31 PM

Overnight: Patchy fog. Otherwise, mostly cloudy, with a low around 56. Calm wind becoming south southeast around 5 mph.

Sunday: Patchy fog before 11am. Otherwise, partly sunny, with a high near 64. Light and variable wind becoming west southwest 5 to 10 mph in the afternoon. Winds could gust as high as 20 mph.

Sunday Night: Increasing clouds, with a low around 57. West wind 5 to 10 mph becoming light south southwest in the evening. Winds could gust as high as 20 mph.

Monday: Cloudy, then gradually becoming mostly sunny, with a high near 63. Light and variable wind becoming west southwest 10 to 15 mph in the afternoon. Winds could gust as high as 20 mph.

Second Example Link:

http://parfait.snarkybox.com/forecast.php?lat=33.94&lon=-118.4&periods=4&capsule=o,f,y,z,xe,j600001,b153051255005006,q204204204000000000,g,ak153204255000051102&title=My%20Weather%20Forecast

What that link returns will look like this:

My Weather Forecast Example


Complete Data Retrieval, Header

Using the parameters 'lat', 'lon' and 'layer' together will retrieve a '*' delimited, '~' line terminated, '|' layer terminated segment of weather elements. The values for the 'lat' and 'lon' parameters can be found here: http://developer.mapquest.com/web/tools/lat-long-finder.

'layer=head' will return a header information line.

Example Link:

http://parfait.snarkybox.com/forecast.php?lat=33.94&lon=-118.4&layer=head

What that link returns will look like this:

hd*ParfaitAPI*http://parfait.snarkybox.com/*forecast*33.94*-118.4****head*20141210*2111*68.100.18.139*2014.12.10.13~|

Element Names:

hd00 hd01 hd02 hd03 hd04 hd05 hd06 hd07 hd08 hd09
layer_code API identification API URL "forecast" lat parameter lon parameter periods parameter NULL NULL layer parameter
token string anyURI token token token token NULL NULL token

hd10 hd11 hd12 hd13
date of request (CCYYMMDD) time of request (HHMM) Remote IP Address parfait version
token token token token

Complete Data Retrieval, Meta Data Retrieval

Using the parameters 'lat', 'lon' and 'layer' together will retrieve a '*' delimited, '~' line terminated, '|' layer terminated segment of weather elements. The values for the 'lat' and 'lon' parameters can be found here: http://developer.mapquest.com/web/tools/lat-long-finder.

'layer=meta' will retrieve the meta data about the forecast.

Example Link:

http://parfait.snarkybox.com/forecast.php?lat=33.94&lon=-118.4&layer=meta

What that link returns will look like this:

mt**46*-113.05*7000**2013-09-25T21:36:21-06:00*14*PT1H*Missoula, MT*http://www.wrh.noaa.gov/mso*markMitchell~|

Field Names:

mt00 mt01 mt02 mt03 mt04 mt05 mt06 mt07 mt08 mt09
layer_code description latitude longitude elevation NULL creation-date period_count refresh-frequency production-center
token token decimal decimal nonNegativeInteger NULL dateTime nonNegativeInteger duration string

mt10 mt11
credit wordGenerator
anyURI token

NOTE: Element mt07 is not actually contained in the data from NWS. It is either the count of periods that NWS has sent in the data or the quantity specified in the 'periods' parameter.


Complete Data Retrieval, Low Verbosity Data Retrieval

Using the parameters 'lat', 'lon' and 'layer' together will retrieve a '*' delimited, '~' line terminated, '|' layer terminated segment of weather elements. The values for the 'lat' and 'lon' parameters can be found here: http://developer.mapquest.com/web/tools/lat-long-finder.

'layer=low' will retrieve the forecasted weather data segments for all of the periods contained in the forecast.

Example Link:

http://parfait.snarkybox.com/forecast.php?lat=33.94&lon=-118.4&layer=low

What that link returns will look like this:

lo*00*Tonight*http://forecast.weather.gov/newimages/medium/nfew.png*Mostly Clear*52*Minimum*Fahrenheit*0~lo*01*Wednesday*http://forecast.weather.gov/newimages/medium/few.png*Sunny*69*Maximum*Fahrenheit*0~lo*02*Wednesday Night*http://forecast.weather.gov/newimages/medium/nfew.png*Mostly Clear*56*Minimum*Fahrenheit*0~lo*03*Thursday*http://forecast.weather.gov/newimages/medium/sct.png*Mostly Sunny*68*Maximum*Fahrenheit*0~lo*04*Thursday Night*http://forecast.weather.gov/newimages/medium/nsct.png*Partly Cloudy*57*Minimum*Fahrenheit*0~lo*05*Friday*http://forecast.weather.gov/newimages/medium/ra30.png*Chance Rain*62*Maximum*Fahrenheit*30~lo*06*Friday Night*http://forecast.weather.gov/newimages/medium/nra40.png*Chance Rain*51*Minimum*Fahrenheit*40~lo*07*Saturday*http://forecast.weather.gov/DualImage.php?i=ra&j=sct&ip=0*Slight Chance Rain then Mostly Sunny*65*Maximum*Fahrenheit*0~lo*08*Saturday Night*http://forecast.weather.gov/newimages/medium/nsct.png*Partly Cloudy*54*Minimum*Fahrenheit*0~lo*09*Sunday*http://forecast.weather.gov/newimages/medium/ra.png*Slight Chance Rain*64*Maximum*Fahrenheit*0~lo*10*Sunday Night*http://forecast.weather.gov/newimages/medium/nra.png*Slight Chance Rain*57*Minimum*Fahrenheit*0~lo*11*Monday*http://forecast.weather.gov/newimages/medium/ra.png*Slight Chance Rain*66*Maximum*Fahrenheit*0~lo*12*Monday Night*http://forecast.weather.gov/newimages/medium/nra.png*Slight Chance Rain and Breezy*53*Minimum*Fahrenheit*0~lo*13*Tuesday*http://forecast.weather.gov/newimages/medium/ra.png*Slight Chance Rain and Breezy*66*Maximum*Fahrenheit*0~|

Field Names:

lo00 lo01 lo02 lo03 lo04 lo05 lo06 lo07 lo08
layer_code period period-name icon-URL weather temp tempName tempUnits probability-of-precipitation
token token string anyURI string integer string string nonNegativeInteger

 


Complete Data Retrieval, High Verbosity Data Retrieval

Using the parameters 'lat', 'lon' and 'layer' together will retrieve a '*' delimited, '~' line terminated, '|' layer terminated segment of weather elements. The values for the 'lat' and 'lon' parameters can be found here: http://developer.mapquest.com/web/tools/lat-long-finder.

'layer=high' will retrieve the forecasted weather data in a natural language format for all of the periods contained in the forecast.

Example Link:

http://parfait.snarkybox.com/forecast.php?lat=33.94&lon=-118.4&layer=high

What that link returns will look like this:

tx*00*2013-09-26T00:00:00-06:00*Snow. Low around 26. North wind 9 to 11 mph. Chance of precipitation is 100%. Total nighttime snow accumulation of 4 to 8 inches possible.~tx*01*2013-09-26T06:00:00-06:00*Snow. High near 34. North northeast wind 9 to 13 mph becoming south in the morning. Winds could gust as high as 20 mph. Chance of precipitation is 100%. New snow accumulation of 1 to 3 inches possible.~tx*02*2013-09-26T18:00:00-06:00*Snow showers likely, mainly before 7pm. Mostly cloudy, with a low around 22. Northeast wind 5 to 11 mph becoming north northwest after midnight. Chance of precipitation is 60%. New snow accumulation of less than one inch possible.~tx*03*2013-09-27T06:00:00-06:00*A 20 percent chance of snow showers before 1pm. Mostly sunny, with a high near 41. North northwest wind around 5 mph becoming light and variable.~tx*04*2013-09-27T18:00:00-06:00*Partly cloudy, with a low around 30. West wind 5 to 9 mph.~tx*05*2013-09-28T06:00:00-06:00*Mostly sunny, with a high near 51.~tx*06*2013-09-28T18:00:00-06:00*Partly cloudy, with a low around 33.~tx*07*2013-09-29T06:00:00-06:00*Mostly sunny, with a high near 54.~tx*08*2013-09-29T18:00:00-06:00*A slight chance of rain. Partly cloudy, with a low around 35.~tx*09*2013-09-30T06:00:00-06:00*A slight chance of rain. Mostly sunny, with a high near 54.~tx*10*2013-09-30T18:00:00-06:00*A slight chance of rain. Partly cloudy, with a low around 35.~tx*11*2013-10-01T06:00:00-06:00*A slight chance of rain. Mostly sunny, with a high near 53.~tx*12*2013-10-01T18:00:00-06:00*A slight chance of rain and snow. Snow level 7800 feet lowering to 7000 feet after midnight. Partly cloudy, with a low around 34.~tx*13*2013-10-02T06:00:00-06:00*A slight chance of snow. Mostly sunny, with a high near 50.~|

Field Names:

hi00 hi01 hi02 hi03
layer_code period periodRange text
token token dateTime string

 


Complete Data Retrieval, Hazard Data Retrieval

Using the parameters 'lat', 'lon' and 'layer' together will retrieve a '*' delimited, '~' line terminated, '|' layer terminated segment of weather elements. The values for the 'lat' and 'lon' parameters can be found here: http://developer.mapquest.com/web/tools/lat-long-finder.

'layer=hazard' will retrieve the forecasted weather hazard data.

Example Link:

http://parfait.snarkybox.com/forecast.php?lat=33.94&lon=-118.4&layer=hazard

What that link returns will look like this:

hz*00*Winter Storm Warning*http://forecast.weather.gov/showsigwx.php?warnzone=WYZ015&warncounty=WYC013&firewxzone=WYZ288&local_place1=20+Miles+WSW+Fort+Washakie+WY&product1=Winter+Storm+Warning~hz*01*Hazardous Weather Outlook*http://forecast.weather.gov/showsigwx.php?warnzone=WYZ015&warncounty=WYC013&firewxzone=WYZ288&local_place1=20+Miles+WSW+Fort+Washakie+WY&product1=Hazardous+Weather+Outlook~|

Field Names:

hz00 hz01 hz02 hz03
layer_code hazardSerial Headline URL
token token string anyURI

 


Complete Data Retrieval, Combinations

Multiple 'layer' parameters can be sent by simply putting a comma between them: 'layer=meta,high' or 'layer=low,high'. This results in all of the segments requested being returned in the same line, so you would first split them by a tilde. The first element of each segment is the layer_code, so inspecting the first four characters will tell you which segment you're working with. Splitting each of these segments by an asterisk will get each of the elements. The values for the 'lat' and 'lon' parameters can be found here: http://developer.mapquest.com/web/tools/lat-long-finder.

NOTE: the order in which the layer strings occur does not affect the output order. 'layer=meta,high' will have the same result as 'layer=high,meta'. The output order is always: Header, Meta, Low Verbosity, High Verbosity, Hazard

Example Link:

http://parfait.snarkybox.com/forecast.php?lat=33.94&lon=-118.4&layer=head,meta,low,high&periods=4

What that link returns will look like this:

hd*ParfaitAPI*http://parfait.snarkybox.com/*forecast*33.94*-118.4*4***head,meta,low,high*20160309*0141*2601:140:8202:cd8f:58f4:351e:5d28:5681*2016.03.09.18~|mt*Los Angeles International Airport, CA*33.94*-118.39*98**2016-03-08T21:04:07-08:00*4*PT1H*Los Angeles/Oxnard, CA*http://www.wrh.noaa.gov/lox*markMitchell~|lo*00*Tonight*http://forecast.weather.gov/newimages/medium/nfew.png*Mostly Clear*52*Minimum*Fahrenheit*0~lo*01*Wednesday*http://forecast.weather.gov/newimages/medium/few.png*Sunny*69*Maximum*Fahrenheit*0~lo*02*Wednesday Night*http://forecast.weather.gov/newimages/medium/nfew.png*Mostly Clear*56*Minimum*Fahrenheit*0~lo*03*Thursday*http://forecast.weather.gov/newimages/medium/sct.png*Mostly Sunny*68*Maximum*Fahrenheit*0~|hi*00*2016-03-08T22:00:00-08:00*Mostly clear, with a low around 52. North wind 5 to 10 mph, with gusts as high as 15 mph.~hi*01*2016-03-09T06:00:00-08:00*Sunny, with a high near 69. East northeast wind 5 to 10 mph becoming west in the morning. Winds could gust as high as 15 mph.~hi*02*2016-03-09T18:00:00-08:00*Mostly clear, with a low around 56. Calm wind becoming east around 5 mph.~hi*03*2016-03-10T06:00:00-08:00*Mostly sunny, with a high near 68. East wind 5 to 15 mph becoming west in the morning. Winds could gust as high as 20 mph.~|

 


Error Messages

Should you accidentally use the API incorrectly or if the API didn't return any data from it's source feed, you may see one of two errors.

Missing API Parameters

If the API is unhappy about not being passed the appropriate parameters, you will see this message:

er*Missing API Parameters*It appears you have tried to access the API without passing all required parameters.*http://parfait.snarkybox.com/reuters.php*http://parfait.snarkybox.com/help-reuters.php~

No Data Returned

If for some reason the source feed didn't return any data to PARFAIT, you will see this message:

er*No Data Returned*It appears that no data was returned from the feed using the parameters you entered into the API.*http://parfait.snarkybox.com/reuters.php?feed=topneews&layer=low&items=3*http://parfait.snarkybox.com/help-reuters.php~

Field Names:

er00 er01 er02 er03 er04
layer_code error description source link help file link
token string string anyURI anyURI