[R] download multiple files in one file

Debasish Pai Mazumder pai1981 at gmail.com
Thu Oct 13 16:53:45 CEST 2016


Hi All,
I have downloaded single file from the web using following scripts

gribfile<-"
http://nomads.ncdc.noaa.gov/thredds/ncss/grid/modeldata/cfsv2_forecast_ts_9mon/2011/201104/20110401/2011040100/tmax.01.2011040100.daily.grb2?north=47.0126&west=-114.841&east=-112.641&south=44.8534&time_start=2011-06-01&time_end=2011-06-31&accept=netcdf&var=Maximum_temperature
"

download.file(gribfile,basename('file.nc'),mode = "wb")
File <- nc_open('file.nc')
str(File)
lat = ncvar_get(File, "lat") # coordinate variable
temp =ncvar_get(File, "Maximum_temperature")

Now I have multiple files and they are

..../2011/201104/20110401/2011040100/tmax.01.2011040100.daily.grb2
..../2011/201104/20110401/2011040106/tmax.01.2011040106.daily.grb2
..../2011/201104/20110401/2011040112/tmax.01.2011040112.daily.grb2
..../2011/201104/20110401/2011040118/tmax.01.2011040118.daily.grb2

Is there any way to read them together and store them in file.nc

sincerely
-Deb

	[[alternative HTML version deleted]]



More information about the R-help mailing list