Author Topic: NWS current station conditions, new API  (Read 2356 times)

0 Members and 1 Guest are viewing this topic.

Offline daneast

  • Member
  • *
  • Posts: 48
NWS current station conditions, new API
« on: November 29, 2018, 08:05:45 PM »
I'm attempting to get the current conditions from a NWS station using the new api (api.weather.gov).  This is the station in question:
https://w1.weather.gov/xml/current_obs/display.php?stid=KMKJ

However when I query the API:
https://api.weather.gov/stations/KMKJ/observations/latest

I often only get a partial set of data (partial in that many fields may have a value of null). Even the temperature may be null from time to time.

I'm trying to figure out how in the world to make use of this. Getting all the observations returns a really large data set. I don't think NWS intends for us to get that big data set and iterate it to find a full set of values we need. The other option is for me to store the data on my end and just update whatever fields I happen to get.  Neither of those is a very good option.  I really only need latest temperature and wind speed.

Anyone else dealing with this as well?

Probably not very useful, but here is an output with next to no data (pretty much just visibility):
Code: [Select]
{
"@context": ["https:\/\/raw.githubusercontent.com\/geojson\/geojson-ld\/master\/contexts\/geojson-base.jsonld", {
"wx": "https:\/\/api.weather.gov\/ontology#",
"s": "https:\/\/schema.org\/",
"geo": "http:\/\/www.opengis.net\/ont\/geosparql#",
"unit": "http:\/\/codes.wmo.int\/common\/unit\/",
"@vocab": "https:\/\/api.weather.gov\/ontology#",
"geometry": {
"@id": "s:GeoCoordinates",
"@type": "geo:wktLiteral"
},
"city": "s:addressLocality",
"state": "s:addressRegion",
"distance": {
"@id": "s:Distance",
"@type": "s:QuantitativeValue"
},
"bearing": {
"@type": "s:QuantitativeValue"
},
"value": {
"@id": "s:value"
},
"unitCode": {
"@id": "s:unitCode",
"@type": "@id"
},
"forecastOffice": {
"@type": "@id"
},
"forecastGridData": {
"@type": "@id"
},
"publicZone": {
"@type": "@id"
},
"county": {
"@type": "@id"
}
}
],
"id": "https:\/\/api.weather.gov\/stations\/KMKJ\/observations\/2018-11-30T00:15:00+00:00",
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-81.34, 36.9]
},
"properties": {
"@id": "https:\/\/api.weather.gov\/stations\/KMKJ\/observations\/2018-11-30T00:15:00+00:00",
"@type": "wx:ObservationStation",
"elevation": {
"value": 780,
"unitCode": "unit:m"
},
"station": "https:\/\/api.weather.gov\/stations\/KMKJ",
"timestamp": "2018-11-30T00:15:00+00:00",
"rawMessage": "KMKJ 300015Z AUTO 00000KT 10SM OVC021 06\/01 A3005 RMK AO2 T00600005",
"textDescription": "Cloudy",
"icon": "https:\/\/api.weather.gov\/icons\/land\/night\/ovc?size=medium",
"presentWeather": [],
"temperature": {
"value": null,
"unitCode": "unit:degC",
"qualityControl": "qc:Z"
},
"dewpoint": {
"value": null,
"unitCode": "unit:degC",
"qualityControl": "qc:Z"
},
"windDirection": {
"value": null,
"unitCode": "unit:degree_(angle)",
"qualityControl": "qc:Z"
},
"windSpeed": {
"value": null,
"unitCode": "unit:m_s-1",
"qualityControl": "qc:Z"
},
"windGust": {
"value": null,
"unitCode": "unit:m_s-1",
"qualityControl": "qc:Z"
},
"barometricPressure": {
"value": null,
"unitCode": "unit:Pa",
"qualityControl": "qc:Z"
},
"seaLevelPressure": {
"value": null,
"unitCode": "unit:Pa",
"qualityControl": "qc:Z"
},
"visibility": {
"value": 16090,
"unitCode": "unit:m",
"qualityControl": "qc:C"
},
"maxTemperatureLast24Hours": {
"value": null,
"unitCode": "unit:degC",
"qualityControl": null
},
"minTemperatureLast24Hours": {
"value": null,
"unitCode": "unit:degC",
"qualityControl": null
},
"precipitationLastHour": {
"value": null,
"unitCode": "unit:m",
"qualityControl": "qc:Z"
},
"precipitationLast3Hours": {
"value": null,
"unitCode": "unit:m",
"qualityControl": "qc:Z"
},
"precipitationLast6Hours": {
"value": null,
"unitCode": "unit:m",
"qualityControl": "qc:Z"
},
"relativeHumidity": {
"value": null,
"unitCode": "unit:percent",
"qualityControl": "qc:C"
},
"windChill": {
"value": null,
"unitCode": "unit:degC",
"qualityControl": "qc:V"
},
"heatIndex": {
"value": null,
"unitCode": "unit:degC",
"qualityControl": "qc:V"
},
"cloudLayers": [{
"base": {
"value": 640,
"unitCode": "unit:m"
},
"amount": "OVC"
}
]
}
}

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9282
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS current station conditions, new API
« Reply #1 on: November 29, 2018, 09:38:37 PM »
Well, the API is still in 'Beta' so maybe not all things are working fully as expected.  It's been a hellishly-long Beta (since December 2016 or so).  There's been no announcement about when they plan to turn it on (and implement the forecast-v3.weather.gov site into production as www.weather.gov).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline daneast

  • Member
  • *
  • Posts: 48
Re: NWS current station conditions, new API
« Reply #2 on: November 29, 2018, 09:50:02 PM »
Thanks.  I also see this in the FAQ:
Quote
Delayed observations

An infrastructure issue is causing delayed processing of observation station data. Observations may be intermittently delayed or not available. This is being worked, and will likely take several weeks to resolve.

Updated 09/05/2018

Which API is the existing API this is more stable for latest observations? I don't care what type of call it requires or what the return data format is. I'll make it work. I don't have much more time to mess with this - I hope to have this project done tomorrow.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9282
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS current station conditions, new API
« Reply #3 on: November 29, 2018, 09:54:47 PM »
For now, the XML version is production. I’d go with it and rewrite for the JSON when api.weather.gov is production.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

 

anything