*Good day!* I'm using Vista(x64) and R 2.13.0(x64) (with ncdf and RnetCDF packs) *I have a problem:* I'm trying to open **.nc* file and I use this script (http://r.789695.n4.nabble.com/Problem-downloading-and-opening-netcdf-file-td3046897.html#a3046965) library(ncdf) link <- "http://ibis.grdl.noaa.gov/SAT/SeaLevelRise/slr/slr_sla_gbl_free_all_66.nc" dest <- "C:/temp/slr_sla_gbl_free_all_66.nc" download.file(url=link,destfile=dest) nc1 <- open.ncdf(dest) Prof Brian Ripley advises to use *mode="wb": AFAIK.* *Where exactly should I insert this code? * *Thank you for your help!* -- View this message in context: http://r.789695.n4.nabble.com/NetCDF-open-nc-tp3659401p3659401.html Sent from the R help mailing list archive at Nabble.com.
On Mon, 11 Jul 2011, kokavolchkov wrote:> *Good day!* > > I'm using Vista(x64) and R 2.13.0(x64) (with ncdf and RnetCDF packs) > > *I have a problem:* I'm trying to open **.nc* file and I use this script > (http://r.789695.n4.nabble.com/Problem-downloading-and-opening-netcdf-file-td3046897.html#a3046965) > > library(ncdf) > link <- > "http://ibis.grdl.noaa.gov/SAT/SeaLevelRise/slr/slr_sla_gbl_free_all_66.nc" > dest <- "C:/temp/slr_sla_gbl_free_all_66.nc" > download.file(url=link,destfile=dest) > nc1 <- open.ncdf(dest) > > Prof Brian Ripley advises to use *mode="wb": AFAIK.*See ?download.file (as the posting guide asked you to do before posting).> > *Where exactly should I insert this code? * > > *Thank you for your help!* > > -- > View this message in context: http://r.789695.n4.nabble.com/NetCDF-open-nc-tp3659401p3659401.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Well, if I use this script: library(ncdf) link <- "http://ibis.grdl.noaa.gov/SAT/SeaLevelRise/slr/slr_sla_gbl_free_all_66.nc" dest <- "C:/temp/slr_sla_gbl_free_all_66.nc" mode="wb": AFAIK download.file(url=link,destfile=dest) nc1 <- open.ncdf(dest) compiler prints: Error in R_nc_open: Invalid argument Error in open.ncdf trying to open file C:/temp/slr_sla_gbl_free_all_66.nc [Package ncdf is installed correctly] -- View this message in context: http://r.789695.n4.nabble.com/NetCDF-open-nc-tp3659401p3659597.html Sent from the R help mailing list archive at Nabble.com.
did you check that the file was actually downloaded correctly and is a valid netcdf file? My guess. particularly on Windows, is that for the download.file statement you need to add that mode="wb" to the command. -Roy M. On Jul 11, 2011, at 6:57 AM, kokavolchkov wrote:> Well, if I use this script: > > library(ncdf) > link <- > "http://ibis.grdl.noaa.gov/SAT/SeaLevelRise/slr/slr_sla_gbl_free_all_66.nc" > dest <- "C:/temp/slr_sla_gbl_free_all_66.nc" > mode="wb": AFAIK > download.file(url=link,destfile=dest) > nc1 <- open.ncdf(dest) > > compiler prints: > > Error in R_nc_open: Invalid argument > Error in open.ncdf trying to open file C:/temp/slr_sla_gbl_free_all_66.nc > > [Package ncdf is installed correctly] > > -- > View this message in context: http://r.789695.n4.nabble.com/NetCDF-open-nc-tp3659401p3659597.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.********************** "The contents of this message do not reflect any position of the U.S. Government or NOAA." ********************** Roy Mendelssohn Supervisory Operations Research Analyst NOAA/NMFS Environmental Research Division Southwest Fisheries Science Center 1352 Lighthouse Avenue Pacific Grove, CA 93950-2097 e-mail: Roy.Mendelssohn at noaa.gov (Note new e-mail address) voice: (831)-648-9029 fax: (831)-648-8440 www: http://www.pfeg.noaa.gov/ "Old age and treachery will overcome youth and skill." "From those who have been given much, much will be expected"