Login problem `Error in basename(url) : a character vector argument expected`
Leprechault opened this issue · 4 comments
Leprechault commented
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
it is not the login problem. Looks like you are not getting any records from gedifinder().
Leprechault commented
Thanks @Rapsodia86, but I have the same error output if I try the package example in GitHub start page.
Rapsodia86 commented
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
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!!