National Meteorological Service (NOAA) REST API returns nil for forecast parameters

I am using the NWS REST API as a weather service for the application I am making. Initially, I did not want to use NWS due to poor documentation, but I could not resist, because it is offered completely free.

Now, when I try to use it, I encounter some difficulties. When requested for several days, the minimum temperature appears within a few days.

(EDIT: Since I tested the API more, I found that these are not always minimum temperatures that are zero. It can be maximum temperature or precipitation, it seems completely random. If you want to make test calls using their web interface, you can do it here: http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdBrowserByDay.htm

and here: http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdXML.htm )

Here is an example request: minimum temperatures are empty: http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdBrowserClientByDay.php?listLatLon=40.863235,-73.714780&format=24%20hourly&numDays=7

Surprisingly, the minimum temperatures are available on their website: http://forecast.weather.gov/MapClick.php?textField1=40.83&textField2=-73.70

At minimum temperatures, you will see that it is filled with an empty field of size 5 (sometimes smaller, inconsistent) that say <value xsi:nil="true"/>

If anyone can help me, it will be very helpful, using the NWS API can be a little overwhelming at times.

Thanks,

+4
source share
1 answer

The nil values ​​from which I can understand the documentation, here and here , simply indicate that the data is not available.

Without making any assumptions about the NOAA data architecture, it is possible that the information available through the API may differ from the information displayed on their website.

Missing values ​​are represented by an empty element and xsi: nil = "true" (R2.2.1).

The return values ​​of Nil are apparently related to a period of time. Note the difference between the time-layout keys (see Section 5.3.2) of 1 in these queries:

Data time is different.

<layout-key> element

The key is derived using the following convention:

  • "k" stands for key.
  • "p24h" means the length of the data period is 24 hours.
  • "n7" means the amount of data time is 7.
  • "1" is a sequence number used to store unique layout keys.

Here startDate is a factor. Leaving this, adds more time and may take into account some requested data that is not yet available.

In the documentation:

The starting day for which you want NDFD data. If the row is empty, it is considered that the start date is considered the earliest available day in the database. This entry is necessary only if it is necessary to reduce the time window data, it is necessary to extract for (less than 7 days); if the user wants data for 2-5 days.

I do not experience the accident you are talking about. People at NOAA Yahoo! A group forum could tell you more.

+3
source

Source: https://habr.com/ru/post/1439548/


All Articles