carlos-alberto-silva / rGEDI

rGEDI: An R Package for NASA's Global Ecosystem Dynamics Investigation (GEDI) Data Visualization and Processing.
164 stars 66 forks source link

Login problem `Error in basename(url) : a character vector argument expected` #53

Closed Leprechault closed 1 year ago

Leprechault commented 1 year ago

I´d like to download some files, but the login doesn't work in W11.

I try to:

# loading rGEDI package
library(rGEDI)

# Create .netrc file
netrc = file.path(outdir, ".netrc")
netrc_conn <- file(netrc)

writeLines(c("machine urs.earthdata.nasa.gov",
            sprintf("login %s", Sys.getenv("*SECRET*")),
            sprintf("password %s", Sys.getenv("*SECRET*"))
), netrc_conn)

close(netrc_conn)

# Find GEDI data within your study area (GEDI finder tool)
# Study area boundary box coordinates
ul_lat<- -57.68973
lr_lat<- -57.69164
ul_lon<- -16.12342
lr_lon<- -16.12231 

# Specifying the date range
daterange=c("2023-04-01","2023-04-14")

# Get path to GEDI data
gLevel1B<-gedifinder(product="GEDI01_B",ul_lat, ul_lon, lr_lat, lr_lon,version="001",daterange=daterange)
gLevel2A<-gedifinder(product="GEDI02_A",ul_lat, ul_lon, lr_lat, lr_lon,version="001",daterange=daterange)
gLevel2B<-gedifinder(product="GEDI02_B",ul_lat, ul_lon, lr_lat, lr_lon,version="001",daterange=daterange)

# Set output dir for downloading the files
outdir=getwd()

# Downloading GEDI data
gediDownload(filepath=gLevel1B,outdir=outdir)

Error in basename(url) : a character vector argument expected

Please, any help with it?

Rapsodia86 commented 1 year ago

it is not the login problem. Looks like you are not getting any records from gedifinder().

Leprechault commented 1 year ago

Thanks @Rapsodia86, but I have the same error output if I try the package example in GitHub start page.

Rapsodia86 commented 1 year ago

Can you just try this:

library(rGEDI)
# Study area boundary box coordinates
ul_lat<- -44.0654
lr_lat<- -44.17246
ul_lon<- -13.76913
lr_lon<- -13.67646

# Specifying the date range
daterange=c("2019-07-01","2020-05-22")
outdir=getwd()

# Get path to GEDI data
gLevel1B<-gedifinder(product="GEDI01_B",ul_lat, ul_lon, lr_lat, lr_lon,version="002",daterange=daterange)

then print: length(gLevel1B) ? And try to download data without creating netrc file just providing username and password on pop ups? gediDownload(filepath=gLevel1B,outdir=outdir)

Leprechault commented 1 year ago
length(gLevel1B)
[1] 7
gediDownload(filepath=gLevel1B,outdir=outdir)
------------------------------
Downloading file 1/7: GEDI01_B_2019226215413_O03805_04_T02285_02_005_01_V002.h5
------------------------------
Connecting...
Connected successfully, downloading...

Thanks @Rapsodia86, problem solved!!