Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonsensical return values from ncdc(datasetid = 'GHCND') #378

Closed
amcdavid opened this issue Nov 16, 2020 · 2 comments
Closed

Nonsensical return values from ncdc(datasetid = 'GHCND') #378

amcdavid opened this issue Nov 16, 2020 · 2 comments
Milestone

Comments

@amcdavid
Copy link
Contributor

amcdavid commented Nov 16, 2020

When I get GHCND data, the temperature values do not seem remotely correct (and disagree with the CSV that I manually download from https://www.ncdc.noaa.gov/cdo-web/search, which looks plausible).

ibrary(rnoaa)
# Rochester, NY (not Mars)
foo = ncdc(datasetid = 'GHCND', stationid = 'GHCND:USW00014768', startdate = '2020-01-01', enddate = '2020-01-31', datatypeid = c('TMIN', "TMAX", 'TAVG'))
foo$data
# A tibble: 25 x 8
   date                datatype station           value fl_m  fl_q  fl_so fl_t  
                                        
 1 2020-01-01T00:00:00 TAVG     GHCND:USW00014768    -6 "H"   ""    S     ""    
 2 2020-01-01T00:00:00 TMAX     GHCND:USW00014768     6 ""    ""    W     "2400"
 3 2020-01-01T00:00:00 TMIN     GHCND:USW00014768   -21 ""    ""    W     "2400"
 4 2020-01-02T00:00:00 TAVG     GHCND:USW00014768    26 "H"   ""    S     ""    
 5 2020-01-02T00:00:00 TMAX     GHCND:USW00014768    89 ""    ""    W     "2400"
 6 2020-01-02T00:00:00 TMIN     GHCND:USW00014768   -27 ""    ""    W     "2400"
 7 2020-01-03T00:00:00 TAVG     GHCND:USW00014768    67 "H"   ""    S     ""    
 8 2020-01-03T00:00:00 TMAX     GHCND:USW00014768    83 ""    ""    W     "2400"
 9 2020-01-03T00:00:00 TMIN     GHCND:USW00014768    44 ""    ""    W     "2400"
10 2020-01-04T00:00:00 TAVG     GHCND:USW00014768    26 "H"   ""    S     ""   

FWIW, I get the same apparent nonsense with curl on the command line, so this is probably not an issue with rnoaa or parsing the json but rather with the NCDC REST API itself. I wanted to confirm I wasn't going crazy before figuring out who/how to escalate on their end.

@amcdavid
Copy link
Contributor Author

Looking more carefully at the units when I set add_units = TRUE, I now realize this is returning, as advertised, ten times the temperature in degrees celcius, so the values are both reasonable (and correct in light of the results in the .csv which are in fahrenheit). The integer-type should have been a warning to me...

@sckott
Copy link
Contributor

sckott commented Nov 16, 2020

FYI, add_units is not TRUE by default because it's still in development - there's a lot of NOAA datasets, with A LOT of different variables, many of which are not documented very well. We're doing our best, and can always use help from folks telling us if any variables are wrong - and filling in more information - the files where we keep units info are the files starting with units- here https://github.com/ropensci/rnoaa/tree/master/R

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants