ropensci / rnoaa

R interface to many NOAA data APIs
https://docs.ropensci.org/rnoaa
Other
330 stars 84 forks source link

Dev version cannot be installed on OS X #225

Closed michaeljakob closed 7 years ago

michaeljakob commented 7 years ago

I am trying for several hours to install the development version of RNOAA on OS X. I need the dev version because there are several bugs in the stable version that won't let me use another package (but I know it works with the dev version).

(1) I tried following this tutorial https://github.com/ropensci/rnoaa and first installed GDAL with the OS X package manager (.pkg).

(2) I tried to set the gdal-config in R Studio with the command given in https://github.com/ropensci/rnoaa [ERROR]

> install.packages("http://cran.r-project.org/src/contrib/rgdal_0.9-1.tar.gz", repos = NULL, type="source", configure.args = "--with-gdal-config=/Library/Frameworks/GDAL.framework/Versions/1.10/unix/bin/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib")
Installing package into ‘/Users/michaeljakob/Library/R/3.1/library’
(as ‘lib’ is unspecified)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0100  1008    0  1008    0     0   4434      0 --:--:-- --:--:-- --:--:--  4440
Error in getOctD(x, offset, len) : invalid octal digit
Warning in install.packages :
  installation of package ‘/var/folders/6h/n3ky9mhd57d8fnpdk_djhz700000gn/T//RtmpKjFhGZ/downloaded_packages/rgdal_0.9-1.tar.gz’ had non-zero exit status

(3) I tried to use the command below in R studio. [ERROR] However, RNOAA cannot be installed because several dependencies are missing.

devtools::install_github("ropensci/rnoaa")
Downloading GitHub repo ropensci/rnoaa@master
from URL https://api.github.com/repos/ropensci/rnoaa/zipball/master
Installing rnoaa
Skipping 4 unavailable packages: crul, hoardr, isdparser, tibble
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore CMD INSTALL  \
  '/private/var/folders/6h/n3ky9mhd57d8fnpdk_djhz700000gn/T/RtmpKjFhGZ/devtools2ec833d4349e/ropensci-rnoaa-c22eb9f'  \
  --library='/Users/michaeljakob/Library/R/3.1/library' --install-tests 

ERROR: dependencies ‘crul’, ‘tibble’, ‘isdparser’, ‘hoardr’ are not available for package ‘rnoaa’
* removing ‘/Users/michaeljakob/Library/R/3.1/library/rnoaa’
Error: Command failed (1)
sckott commented 7 years ago

thx for the report @michaeljakob ! and sorry about the trouble.

did you try installing rgdal as a binary, that is, install.packages("rgdal") - looks like there are mavericks binaries on cran - of course if you don't have gdal installed already it wont work - let me know if that works

michaeljakob commented 7 years ago

I installed "GDAL 2.1 Complete" from http://www.kyngchaos.com/software/frameworks After this, I restarted R studio and executed install.packages("rgdal") (success).

devtools::install_github("ropensci/rnoaa") still produced the same error as above. What would be the next step? Please let me know if you need any additional information.

sckott commented 7 years ago

@michaeljakob ah, it looks like you are on an old R installation. when you do install_github rnoaa, it should grab those pkgs you don't have yet. but i think it's erroring since you're on an old R version (3.1), we're on 3.4.1 now

michaeljakob commented 7 years ago

@sckott thank you, that seems to solve the most problems! However, now I cannot connect to the FTP server anymore. I could successfully install devtools::install_github("ropensci/rnoaa") after installing R 3.4.1.

stations now returns an all-empty table, whereas it previously returned 2 results (with the old R version, and stable RNOAA version).

My complete code looks like this:

> library(rnoaa)
> library(dplyr)
> library(plyr)
> library(lubridate)
> require(ggplot2)
> require(reshape2)
> 
> 
> stations <- isd_stations_search(lat = 41.79925, lon = -61.33052, radius = 10)
> airtemp = isd(usaf = stations$usaf[1], wban = stations$wban[1], year = 2015)
Error: download failed for
   ftp://ftp.ncdc.noaa.gov/pub/data/noaa/2015/NA-NA-2015.gz
> 
> dat2 <- (airtemp) #is this line correct? 
Error: object 'airtemp' not found
> dat3 <- dat2 %>% 
+   filter(date == in_date) %>%
+   filter(temperature < 999.9) # temperature data is available
Error in eval(lhs, parent, parent) : object 'dat2' not found
> 
> # select relevant columns
> dat4 <- dat3[,c("usaf_station", "wban_station", "date", "time", "latitude", "longitude", "wind_speed", "temperature", "air_pressure")]
Error: object 'dat3' not found
sckott commented 7 years ago

this line isd_stations_search(lat = 41.79925, lon = -61.33052, radius = 10) gives zero results - thus the next line gives NA's and then download fails, and so on - so modify your search in the isd_stations_search call

michaeljakob commented 7 years ago

Thank you, this solved it!! You are amazing.