Forum Discussion
pwares
5 years agoFrequent Visitor
Unable to Query Historical NOAA Weather Data from Weather Stations
Hi Everyone, For a project at work, I am trying to pull historical data from various weather stations from the NOAA and I would like to put it into a Power BI Database. My main goal is to pull da...
- 5 years ago
Hello @pwares
The token must be provided in the request header. I tried this and it works, just enter your own token at the top. Sample PBIX file here.
let api_url = "https://www.ncdc.noaa.gov/cdo-web/api/v2/datasets?stationid=GHCND:USW00014732&stationid=GHCND:USW00013739&stationid=GHCND:USW00014739&stationid=GHCND:USW00094823&stationid=GHCND:USW00014765", token = "XXXXXXXXX", Source = Json.Document(Web.Contents(api_url, [ Headers = [token = token ,#"Content-Type"="application/json"] ] ) ), #"Converted to Table" = Record.ToTable(Source), Value = #"Converted to Table"{1}[Value], #"Converted to Table1" = Table.FromList(Value, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"uid", "mindate", "maxdate", "name", "datacoverage", "id"}, {"uid", "mindate", "maxdate", "name", "datacoverage", "id"}) in #"Expanded Column1"Best regards
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking Thumbs Up.
PhilipTreacy
Super User
5 years agoHello @pwares
The token must be provided in the request header. I tried this and it works, just enter your own token at the top. Sample PBIX file here.
let
api_url = "https://www.ncdc.noaa.gov/cdo-web/api/v2/datasets?stationid=GHCND:USW00014732&stationid=GHCND:USW00013739&stationid=GHCND:USW00014739&stationid=GHCND:USW00094823&stationid=GHCND:USW00014765",
token = "XXXXXXXXX",
Source = Json.Document(Web.Contents(api_url,
[
Headers = [token = token ,#"Content-Type"="application/json"]
]
)
),
#"Converted to Table" = Record.ToTable(Source),
Value = #"Converted to Table"{1}[Value],
#"Converted to Table1" = Table.FromList(Value, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"uid", "mindate", "maxdate", "name", "datacoverage", "id"}, {"uid", "mindate", "maxdate", "name", "datacoverage", "id"})
in
#"Expanded Column1"
Best regards
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking Thumbs Up.
maltonji
3 years agoRegular Visitor
The code provided by PhilipTreacy only gives a summary for me not daily weather data