Skip to content

getGLDAS error "Access denied" #110

Description

@brendanwallison

This seems to be identical to issue #69

I am using version 0.3.7 of climateR on Windows 11 OS. Running the test function mentioned in the above issue, I get an identical error.

sites_stack <- getGLDAS(AOI=AOI::aoi_get(state = "OR"),
                        varname='rootmoist_inst',
                        model='NOAH025_M.2.1',
                        startDate='2006-10-01',
                        endDate='2007-09-30',
                        verbose = TRUE)`


source:	 https://hydro1.gesdisc.eosdis.nasa.gov:443/dods/GLDAS_NOAH02... 
varname(s):
   > rootmoist_inst [NA] (** root zone soil moisture [kg m-2] )
==================================================
diminsions:  34, 19, 13 (names: lon,lat,time)
resolution:  0.25, 0.25, 1 months
extent:      -124.75, -116.25, 41.75, 46.5 (xmin, xmax, ymin, ymax)
crs:         +proj=longlat +a=6378137 +f=0.00335281066474748 +p...
time:        2006-10-01 to 2007-10-01
==================================================
values: 8,398 (vars*X*Y*T)Note:Caching=1
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.

> getNetrcPath()
[1] "C:\\Users\\brend\\.netrc"

> getDodsrcPath()
[1] "C:\\Users\\brend\\.dodsrc"

> checkNetrc()
[1] TRUE

> checkDodsrc()
[1] FALSE

In my user folder ("C:/Users/brend"), there is indeed a netrc file that looks correctly formatted. There is not a dodsrc file. The default location for the writeDodsrc() function does not reference the home directory (dodsrcFile = ".dodsrc"), so I thought maybe there is just a relative location issue of trying to save to the wrong place. To save time and hopefully sidestep this, I tried setting my working directory to the user directory. A dodsrc file indeed then appears in the user folder. The contents are as follows:

USE_CACHE=0
MAX_CACHE_SIZE=20
MAX_CACHED_OBJ=5
IGNORE_EXPIRES=0
DEFAULT_EXPIRES=86400
ALWAYS_VALIDATE=0
DEFLATE=0
VALIDATE_SSL=1
HTTP.COOKIEJAR=./.urs_cookies
HTTP.NETRC=C:\Users\brend.netrc

However, the validation function still fails

> checkDodsrc()
[1] FALSE

This appears to be because of backslashes. There are several tests in checkDodsrc(), but it is the last one that is failing.

> getNetrcPath()
[1] "C:\\Users\\brend\\.netrc"
> lines <- readLines(dodsrcFile)
> any(grepl(getNetrcPath(), lines))
[1] FALSE
> any(grepl("C:\\\\Users\\\\brend\\\\.netrc", lines))
[1] TRUE

Note that the test passes with four backslashes instead of two! Unfortunately, it is not just the checkDodsrc() function that fails.

sites_stack <- getGLDAS(AOI=AOI::aoi_get(state = "OR"),
                        varname='rootmoist_inst',
                        model='NOAH025_M.2.1',
                        startDate='2006-10-01',
                        endDate='2007-09-30',
                        verbose = TRUE)`


source:	 https://hydro1.gesdisc.eosdis.nasa.gov:443/dods/GLDAS_NOAH02... 
varname(s):
   > rootmoist_inst [NA] (** root zone soil moisture [kg m-2] )
==================================================
diminsions:  34, 19, 13 (names: lon,lat,time)
resolution:  0.25, 0.25, 1 months
extent:      -124.75, -116.25, 41.75, 46.5 (xmin, xmax, ymin, ymax)
crs:         +proj=longlat +a=6378137 +f=0.00335281066474748 +p...
time:        2006-10-01 to 2007-10-01
==================================================
values: 8,398 (vars*X*Y*T)Note:Caching=1
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.

Where should I go from here?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions