Rather than using
- Code: Select all
if timedelta.seconds> 7200:
- Code: Select all
if timedelta.totalseconds() > 7200:
-- Paul --
if timedelta.seconds> 7200:
if timedelta.totalseconds() > 7200:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="latest_ob.xsl" type="text/xsl"?>
<current_observation version="1.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.weather.gov/view/current_observation.xsd">
<credit>NOAA's National Weather Service</credit>
<credit_URL>https://weather.gov/</credit_URL>
<image>
<url>https://weather.gov/images/xml_logo.gif</url>
<title>NOAA's National Weather Service</title>
<link>https://www.weather.gov</link>
</image>
<suggested_pickup>15 minutes after the hour</suggested_pickup>
<suggested_pickup_period>60</suggested_pickup_period>
<location>Austin City, Austin Camp Mabry, TX</location>
<station_id>KATT</station_id>
<latitude>30.31667</latitude>
<longitude>-97.76667</longitude>
<observation_time>Last Updated on Jan 30 2022, 3:51 am CST</observation_time>
<observation_time_rfc822>Sun, 30 Jan 2022 03:51:00 -0600</observation_time_rfc822>
<weather>Fair</weather>
<temperature_string>41.0 F (5.0 C)</temperature_string>
<temp_f>41.0</temp_f>
<temp_c>5.0</temp_c>
<relative_humidity>57</relative_humidity>
<wind_string>Calm</wind_string>
<wind_dir>North</wind_dir>
<wind_degrees>0</wind_degrees>
<wind_mph>0.0</wind_mph>
<wind_kt>0</wind_kt>
<pressure_string>1022.5 mb</pressure_string>
<pressure_mb>1022.5</pressure_mb>
<pressure_in>30.20</pressure_in>
<dewpoint_string>27.0 F (-2.8 C)</dewpoint_string>
<dewpoint_f>27.0</dewpoint_f>
<dewpoint_c>-2.8</dewpoint_c>
<visibility_mi>10.00</visibility_mi>
<icon_url_base>https://forecast.weather.gov/images/wtf/small/</icon_url_base>
<two_day_history_url>https://www.weather.gov/data/obhistory/KATT.html</two_day_history_url>
<icon_url_name>nskc.png</icon_url_name>
<ob_url>https://www.weather.gov/data/METAR/KATT.1.txt</ob_url>
<disclaimer_url>https://www.weather.gov/disclaimer.html</disclaimer_url>
<copyright_url>https://www.weather.gov/disclaimer.html</copyright_url>
<privacy_policy_url>https://www.weather.gov/notice.html</privacy_policy_url>
</current_observation>
curl -X GET "https://api.weather.gov/stations/KVNY/observations/latest?require_qc=false" -H "accept: application/geo+json"
{
"@context": [
"https://geojson.org/geojson-ld/geojson-context.jsonld",
{
"@version": "1.1",
"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/KVNY/observations/2022-01-30T16:51:00+00:00",
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-118.48,
34.22
]
},
"properties": {
"@id": "https://api.weather.gov/stations/KVNY/observations/2022-01-30T16:51:00+00:00",
"@type": "wx:ObservationStation",
"elevation": {
"unitCode": "wmoUnit:m",
"value": 244
},
"station": "https://api.weather.gov/stations/KVNY",
"timestamp": "2022-01-30T16:51:00+00:00",
"rawMessage": "KVNY 301651Z AUTO 27006KT 10SM CLR 14/M06 A3015 RMK AO2 SLP205 T01391061",
"textDescription": "Clear",
"icon": "https://api.weather.gov/icons/land/day/skc?size=medium",
"presentWeather": [],
"temperature": {
"unitCode": "wmoUnit:degC",
"value": 13.9,
"qualityControl": "V"
},
"dewpoint": {
"unitCode": "wmoUnit:degC",
"value": -6.1,
"qualityControl": "V"
},
"windDirection": {
"unitCode": "wmoUnit:degree_(angle)",
"value": 270,
"qualityControl": "V"
},
"windSpeed": {
"unitCode": "wmoUnit:km_h-1",
"value": 11.16,
"qualityControl": "V"
},
"windGust": {
"unitCode": "wmoUnit:km_h-1",
"value": null,
"qualityControl": "Z"
},
"barometricPressure": {
"unitCode": "wmoUnit:Pa",
"value": 102100,
"qualityControl": "V"
},
"seaLevelPressure": {
"unitCode": "wmoUnit:Pa",
"value": 102050,
"qualityControl": "V"
},
"visibility": {
"unitCode": "wmoUnit:m",
"value": 16090,
"qualityControl": "C"
},
"maxTemperatureLast24Hours": {
"unitCode": "wmoUnit:degC",
"value": null
},
"minTemperatureLast24Hours": {
"unitCode": "wmoUnit:degC",
"value": null
},
"precipitationLastHour": {
"unitCode": "wmoUnit:m",
"value": null,
"qualityControl": "Z"
},
"precipitationLast3Hours": {
"unitCode": "wmoUnit:m",
"value": null,
"qualityControl": "Z"
},
"precipitationLast6Hours": {
"unitCode": "wmoUnit:m",
"value": null,
"qualityControl": "Z"
},
"relativeHumidity": {
"unitCode": "wmoUnit:percent",
"value": 24.48191577848,
"qualityControl": "V"
},
"windChill": {
"unitCode": "wmoUnit:degC",
"value": null,
"qualityControl": "V"
},
"heatIndex": {
"unitCode": "wmoUnit:degC",
"value": null,
"qualityControl": "V"
},
"cloudLayers": [
{
"base": {
"unitCode": "wmoUnit:m",
"value": null
},
"amount": "CLR"
}
]
}
}
jay (support) wrote:We'll see what we can do for the next release...
Hello Dylan. Thanks for the link.
Are you using a script to pull the information, or is someone manually looking at this link each hour?
If you are using a script, would it be possible to add a random string after the url that changes each time the script polls the website? I like to use the unix timestamp because I know that will be unique every time. For example, something like this:
https://w1.weather.gov/xml/current_obs/ ... 1643778123
My theory is that it is a caching issue. A unique URL will trick whatever machine is polling the data into thinking that it is a new site that it has never gone to before.
Let me know.
Thanks
dtich wrote:@Jay, what do you think? Does this sound plausible?
Hello Dylan. I apologize for the issues. Were you able to try the random string trick at the end of the url. As I mentioned before, it may not be so much an issue with caching done at the local level, but from our akamai caching service at the server level. This trick would help if that is the issue. Anothing think I would be curious about is the next time your script pulls old data, manually visit the page on your web browser and let me know if the data is still old, if so, try it again manually with a ?randomstring .
I am also sending your issue up to our regional and national web teams.
Here is a summary of the issue:
Dylan is using a script to grab xml feeds like: https://w1.weather.gov/xml/current_obs/KVNY.xml but the data is not being updated in a consistent manner. Often times the data returned is old. The data is being used to control irrigation systems. Any additional input would be appreciated.
Thanks.
Hi Dylan,
Here at the regional headquarters, we typically use the APIs to gather our observation data. We often use synoptic, which will provide you with data in json format or xml (https://developers.synopticdata.com/mesonet/explorer/). Weather.gov also has an API for forecast data, which is very stable (https://www.weather.gov/documentation/services-web-api).
I'm not involved with the maintenance of the w1.weather.gov xml service, but just wanted to let you know what I use as a data source.
--
Gary Abadian
Western Region AWIPS/Web Program Manager
National Weather Service, Western Region Headquarters
Desk (385) 419-3135
Cell (801) 300-3456
Users browsing this forum: No registered users and 1 guest