I'm trying to open a bz2 compressed netcdf file from ftp, but can't get it to work. Any help is much appreciated.
I've tried opening it directly using:
url <- 'ftp://podaac-ftp.jpl.nasa.gov/allData/ghrsst/data/L4/GLOB/NCDC/AVHRR_OI/1982/001/19820101-NCDC-L4LRblend-GLOB-v01-fv02_0-AVHRR_OI.nc.bz2'
nc_open(url)
but that doesn't work (I get: Error in R_nc4_open: No such file or directory
). I guess because of the compression, so I tried downloading the file first and decompress it.
temp <- tempfile()
download.file(url,temp)
nc_open(bzfile(temp, '19820101-NCDC-L4LRblend-GLOB-v01-fv02_0-AVHRR_OI.nc', 'rb'))
but that doesn't work either and I get both an error and a warning:
Error in bzfile(temp, "19820101-NCDC-L4LRblend-GLOB-v01-fv02_0-AVHRR_OI.nc", :
cannot open the connection
In addition: Warning message:
In bzfile(temp, "19820101-NCDC-L4LRblend-GLOB-v01-fv02_0-AVHRR_OI.nc", :
cannot open bzip2-ed file '/var/folders/hs/k9t_8wxs2hn48qq4vp_7xmgm0000gn/T//Rtmpv9UIBr/filef5659606aee', probable reason 'Invalid argument'
any ideas?
Thanks