leighseverson / countyweather

9 stars 11 forks source link

Trouble with package - helper.R files not in package? #92

Closed wmatwijec closed 7 years ago

wmatwijec commented 7 years ago

Thanks for doing this package. It looks like it save me time in trying to profile our local weather.

Do the helper files need to be loaded also? I can connect through rnoaa with my key but am having difficulty listing station data with this package and also through rnoaa.

daily_stations("36005") Error in if (station_ids$meta$totalCount > 10) { : argument is of length zero In addition: Warning message: Sorry, no data found

Walt - BNA Nashville airport

leighseverson commented 7 years ago

Hi Walt, glad to hear that this package could be useful. The helper functions are not exported - if you're interested in using those functions, for now the easiest way to work with them might be to fork this repository.

I'm getting the same error for all of the functions pulling daily data (it looks like hourly data is still working) - it's possible that NOAA's API for the GHCN-Daily data is down. I'll keep looking into this!

wmatwijec commented 7 years ago

Thanks. I'll keep checking. Again thanks for the effort.

geanders commented 7 years ago

@wmatwijec Try re-installing rnoaa from CRAN with install.packages and then try your code again. That fixed the problem for me.

Also, you can call any of the helper functions from countyweather using the package:::function syntax. So, for example, you could run:

countyweather:::daily_stations("36005")
geanders commented 7 years ago

@leighseverson By the way, Rachel, it looks like there might be a new bug with the latest version of rnoaa. I tried to run:

bronx_weather <- daily_fips(fips = "36005")

and am getting:

Getting daily weather data for Bronx County, New York. This may take a while.
Error: unknown variable to group by : id

Based on traceback, it looks like a problem with meteo_coverage in rnoaa. This problem does't come up with the Miami example, so it might just be an issue where there's only one station in a county. So I don't know if this has always been a bug, and we just hadn't tried places with a single monitor, or if it's something that's cropped up with the newest version of rnoaa, but we'll want to follow up on that and see if we can figure out what's going on.

leighseverson commented 7 years ago

Thank you @geanders! I'll look into it.

geanders commented 7 years ago

Actually, I'm digging around a bit, it seems like it might be something with the var argument in the quiet_pull_monitors call to create meteo_df in daily_df, so I think we can fix it from our end. They may have just changed some arguments for that function.

geanders commented 7 years ago

... and it might just be var = "all" that doesn't work.

When you specify the variables, everything works okay. For example, this works fine:

bronx_weather <- daily_fips(fips = "36005", var = c("tmax", "tmin", "prcp", "snow"))
leighseverson commented 7 years ago

Got it - I think this change to daily_df should fix the problem!