[R] OPeNDAP access / OPeNDAP subsetting with R

Debasish Pai Mazumder pai1981 at gmail.com
Mon Oct 10 21:25:47 CEST 2016


Hi Roy,
Thanks for your help. It works perfectly. if I am trying to read multiple
files similar ways, how do I do that?
with regards
-Deb



On Fri, Sep 30, 2016 at 5:53 PM, Roy Mendelssohn - NOAA Federal <
roy.mendelssohn at noaa.gov> wrote:

> Hi Deb:
>
> > > gribfile <- 'http://thredds.ucar.edu/thredds/ncss/grib/NCEP/GFS/
> Global_0p5deg/best?north=47.0126&west=-114.841&east=-112.
> 641&south=44.8534&time_start=present&time_duration=PT3H&
> accept=netcdf&var=v-component_of_wind_height_above_ground,u-
> component_of_wind_height_above_ground'
> > > download.file(gribfile,'junk.nc',mode = "wb")
> > trying URL 'http://thredds.ucar.edu/thredds/ncss/grib/NCEP/GFS/
> Global_0p5deg/best?north=47.0126&west=-114.841&east=-112.
> 641&south=44.8534&time_start=present&time_duration=PT3H&
> accept=netcdf&var=v-component_of_wind_height_above_ground,u-
> component_of_wind_height_above_ground'
> > Content type 'application/x-netcdf' length unknown
> > ....
> > downloaded 4360 bytes
> >
> > > library(ncdf4)
> > > junkFile <- nc_open('junk.nc')
> > > str(junkFile)
> > List of 14
> >  $ filename   : chr "junk.nc"
> >  $ writable   : logi FALSE
> >  $ id         : int 65536
> >  $ safemode   : logi FALSE
> >  $ format     : chr "NC_FORMAT_CLASSIC"
> >  $ is_GMT     : logi FALSE
> >  $ groups     :List of 1
> >   ..$ :List of 7
> >   .. ..$ id   : int 65536
> >   .. ..$ name : chr ""
> >   .. ..$ ndims: int 4
> >   .. ..$ nvars: int 7
> >   .. ..$ natts: int 13
> >   .. ..$ dimid: int [1:4(1d)] 0 1 2 3
> >   .. ..$ fqgn : chr ""
> >   .. ..- attr(*, "class")= chr "ncgroup4"
> >  $ fqgn2Rindex:List of 1
> >   ..$ : int 1
> >  $ ndims      : num 4
> >  $ natts      : num 13
> >  $ dim        :List of 4
> >
>
> <snip>
>
> I cut off the rest as that is not important for your question.
>
> HTH,
>
> -Roy
>
> > On Sep 30, 2016, at 4:21 PM, Debasish Pai Mazumder <pai1981 at gmail.com>
> wrote:
> >
> > Hi
> > Now I am using netcdfSubset and I am able to download the file but not
> sure how to read the files. here my scripts
> > library("ncdf4")
> >
> > gribfile<-"http://thredds.ucar.edu/thredds/ncss/grib/
> NCEP/GFS/Pacific_40km/best/dataset.html"
> > download.file(gribfile,basename(gribfile),mode = "wb")
> > x<-nc_open(gribfile)
> >
> > gribfile<-"http://thredds.ucar.edu/thredds/ncss/grib/
> NCEP/GFS/Global_0p5deg/best?north=47.0126&west=-114.841&
> east=-112.641&south=44.8534&time_start=present&time_
> duration=PT3H&accept=netcdf&var=v-component_of_wind_height_above_ground,u-
> component_of_wind_height_above_ground"
> > download.file(gribfile,basename(gribfile),mode = "wb")
> > x<-nc_open(gribfile)
> >
> >
> > nc_open doesn't work.
> >
> > which command should I use?
> >
> > with regards
> > -Deb
> >
> >
> > On Tue, Sep 27, 2016 at 9:30 PM, Michael Sumner <mdsumner at gmail.com>
> wrote:
> > Opendap won't work on Windows CRAN build of ncdf4, though the rgdal
> build does work directly on grib.
> >
> > Summary: download the files wholus for use on Windows, or set your own
> system on Linux.
> >
> > Building ncdf4 on Windows is not too hard if you know about doing that.
> >
> > Cheers, Mike
> >
> > On Wed, 28 Sep 2016, 06:49 Roy Mendelssohn - NOAA Federal <
> roy.mendelssohn at noaa.gov> wrote:
> > Please post the code of what you tried, as I have no idea otherwise what
> did or did not work for you.
> >
> > -Roy
> >
> > > On Sep 27, 2016, at 12:44 PM, Debasish Pai Mazumder <pai1981 at gmail.com>
> wrote:
> > >
> > > Hi Roy,
> > > Thanks for your response. I have tried according your suggestion but
> it doesn't work.
> > > the OPeNDAP link of the data
> > > http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cfsv2_
> forecast_ts_9mon/2014/201404/20140403/2014040312/
> > >
> > > datafile:
> > > tmax.01.2014040312.daily.grb2
> > >
> > > Thanks
> > > -Deb
> > >
> > > On Tue, Sep 27, 2016 at 11:51 AM, Roy Mendelssohn - NOAA Federal <
> roy.mendelssohn at noaa.gov> wrote:
> > > Look at the package ncdf4.  You can use an OPeNDAP URL in place of the
> file name to perform subsets.,
> > >
> > > -Roy
> > >
> > > > On Sep 27, 2016, at 9:06 AM, Debasish Pai Mazumder <
> pai1981 at gmail.com> wrote:
> > > >
> > > > Hi all,
> > > >
> > > > I would like to access and subset following OpeNDAP files.
> > > > server:
> > > > http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cfsv2_
> forecast_ts_9mon/2014/201404/20140403/2014040312/
> > > >
> > > > file name: tmax.01.2014040312.daily.grb2
> > > > <http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cfsv2_
> forecast_ts_9mon/2014/201404/20140403/2014040312/catalog.
> html?dataset=modeldata/cfsv2_forecast_ts_9mon/2014/201404/
> 20140403/2014040312/tmax.01.2014040312.daily.grb2>
> > > > I would like to access and subset the file. Any help will be
> appreciated.
> > > >
> > > > with regards
> > > > -Deb
> > > >
> > > >       [[alternative HTML version deleted]]
> > > >
> > > > ______________________________________________
> > > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > > 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
> > > ***Note new address and phone***
> > > 110 Shaffer Road
> > > Santa Cruz, CA 95060
> > > Phone: (831)-420-3666
> > > Fax: (831) 420-3980
> > > e-mail: Roy.Mendelssohn at noaa.gov 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"
> > > "the arc of the moral universe is long, but it bends toward justice"
> -MLK Jr.
> > >
> > >
> >
> > **********************
> > "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
> > ***Note new address and phone***
> > 110 Shaffer Road
> > Santa Cruz, CA 95060
> > Phone: (831)-420-3666
> > Fax: (831) 420-3980
> > e-mail: Roy.Mendelssohn at noaa.gov 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"
> > "the arc of the moral universe is long, but it bends toward justice"
> -MLK Jr.
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
> > --
> > Dr. Michael Sumner
> > Software and Database Engineer
> > Australian Antarctic Division
> > 203 Channel Highway
> > Kingston Tasmania 7050 Australia
> >
> >
>
> **********************
> "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
> ***Note new address and phone***
> 110 Shaffer Road
> Santa Cruz, CA 95060
> Phone: (831)-420-3666
> Fax: (831) 420-3980
> e-mail: Roy.Mendelssohn at noaa.gov 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"
> "the arc of the moral universe is long, but it bends toward justice" -MLK
> Jr.
>
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list