Skip to content
Prev 28908 / 29559 Next

Earthdata CMR access

Yes, you need to set context with session.
I could confirm that PO.DAAC OPeNDAP server requires session.
Thus, R ncdf4 package needs to do something extra like pydap example does.

-----Original Message-----
From: Ben Tupper <btupper at bigelow.org> 
Sent: Thursday, April 14, 2022 7:14 AM
To: Joe Lee <hyoklee at hdfgroup.org>
Cc: r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] Earthdata CMR access

Well, ncdf4 is a pretty good with OPeNDAP (which is one reason why we love it!)  Below is an example using your handy testing resource.

Hmmm. In your example using pydap, you establish a (credentialed?) session, and then open the OPeNDAP resource within that context?  I don't think I have seen that before in R, at least not for OPeNDAP.
I'll poke around and see if I can find something comparable.


### Start
library(ncdf4)

url <- "https://eosdap.hdfgroup.org:8080/opendap/data/hdf5/grid_1_2d.h5"
x <- nc_open(url)
library(ncdf4)

url <- "https://eosdap.hdfgroup.org:8080/opendap/data/hdf5/grid_1_2d.h5"
x <- nc_open(url)
temp <- ncvar_get(x, varid = "temperature",
                  start = c(2,1),
                  count = c(2,3))
temp
#      [,1] [,2] [,3]
# [1,]   10   11   12
# [2,]   10   11   12
### End
On Wed, Apr 13, 2022 at 10:25 PM Joe Lee <hyoklee at hdfgroup.org> wrote:
--
Ben Tupper (he/him)
Bigelow Laboratory for Ocean Science
East Boothbay, Maine
http://www.bigelow.org/
https://eco.bigelow.org
Message-ID: <DM6PR17MB2396481D16543CB59B0F4999C2EF9@DM6PR17MB2396.namprd17.prod.outlook.com>
In-Reply-To: <CALrbzg06hTrQ7VCNqBcMykYgOMHYx66rjG7Rr2LyKW7VajFfUw@mail.gmail.com>