Skip to content

Commit

Permalink
V3.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
imohamme committed Mar 21, 2023
1 parent 35215c5 commit a83f4e6
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 38 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: NASAaccess
Version: 3.4.0
Date: 2023-02-27
Version: 3.4.1
Date: 2023-03-21
Type: Package
Title: Downloading and Reformatting Tool for NASA Earth Observation Data Products
Authors@R: c(person("Ibrahim", "Mohammed", role = c("aut", "cre"),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NASAaccess 3.4.1

* no need for _netrc file creation in windows

# NASAaccess 3.4.0

* Adding automated script for .netrc file creation
Expand Down
5 changes: 2 additions & 3 deletions R/GLDASpolyCentroid.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,9 @@ GLDASpolyCentroid=function(Dir='./SWAT_INPUT/', watershed ='LowerMekong.shp', DE
else
{
cat('Sorry!',' \n')
cat('You need to create one/two file(s) named ".netrc" , "_netrc" and ".urs_cookies" at your home Directory. The "_netrc" file only needed for Windows users.',' \n')
cat('You need to create two files named ".netrc" and ".urs_cookies" at your home Directory.',' \n')
cat('Instructions on creating the ".netrc" and the ".urs_cookies" files can be accessed at https://wiki.earthdata.nasa.gov/display/EL/How+To+Access+Data+With+cURL+And+Wget',' \n')
cat('For Windows users follow instructions on creating the "_netrc" file at https://github.com/imohamme/NASAaccess/wiki/Curl-installation-on-Windows',' \n')
cat('Make sure that the netrc file contain the follwoing line with your credentials: ',' \n')
cat('Make sure that the ".netrc" file contain the follwoing line with your credentials: ',' \n')
cat('machine urs.earthdata.nasa.gov login uid_goes_here password password_goes_here',' \n')
cat('Thank you.',' \n')
}
Expand Down
9 changes: 4 additions & 5 deletions R/GLDASwat.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@

GLDASwat=function(Dir='./SWAT_INPUT/', watershed ='LowerMekong.shp', DEM = 'LowerMekong_dem.tif', start = '2015-12-1', end = '2015-12-3')
{
if(file.exists('~/.netrc')==FALSE||file.exists('~/_netrc')==FALSE)
if(file.exists('~/.netrc')==FALSE)
{
source(system.file("scripts", "netrc.R",
package = "NASAaccess"))
}

if(file.exists('~/.netrc')==TRUE||file.exists('~/_netrc')==TRUE)
if(file.exists('~/.netrc')==TRUE)
{
if(length(grep("urs.earthdata.nasa.gov", readLines('~/.netrc')))==!0||length(grep("urs.earthdata.nasa.gov", readLines('~/_netrc')))==!0)
{
Expand Down Expand Up @@ -215,10 +215,9 @@ GLDASwat=function(Dir='./SWAT_INPUT/', watershed ='LowerMekong.shp', DEM = 'Lowe
else
{
cat('Sorry!',' \n')
cat('You need to create one/two file(s) named ".netrc" , "_netrc" and ".urs_cookies" at your home Directory. The "_netrc" file only needed for Windows users.',' \n')
cat('You need to create two files named ".netrc" and ".urs_cookies" at your home Directory.',' \n')
cat('Instructions on creating the ".netrc" and the ".urs_cookies" files can be accessed at https://wiki.earthdata.nasa.gov/display/EL/How+To+Access+Data+With+cURL+And+Wget',' \n')
cat('For Windows users follow instructions on creating the "_netrc" file at https://github.com/imohamme/NASAaccess/wiki/Curl-installation-on-Windows',' \n')
cat('Make sure that the netrc file contain the follwoing line with your credentials: ',' \n')
cat('Make sure that the ".netrc" file contain the follwoing line with your credentials: ',' \n')
cat('machine urs.earthdata.nasa.gov login uid_goes_here password password_goes_here',' \n')
cat('Thank you.',' \n')
}
Expand Down
11 changes: 5 additions & 6 deletions R/GPM_NRT.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@
GPM_NRT=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'LowerMekong_dem.tif', start = '2022-6-1', end = '2022-6-10')
{

if(file.exists('~/.netrc')==FALSE||file.exists('~/_netrc')==FALSE)
if(file.exists('~/.netrc')==FALSE)
{

source(system.file("scripts", "netrc.R",
package = "NASAaccess"))
}


if(file.exists('~/.netrc')==TRUE||file.exists('~/_netrc')==TRUE)
if(file.exists('~/.netrc')==TRUE)
{
if(length(grep("urs.earthdata.nasa.gov", readLines('~/.netrc')))==!0||length(grep("urs.earthdata.nasa.gov", readLines('~/_netrc')))==!0)
if(length(grep("urs.earthdata.nasa.gov", readLines('~/.netrc')))==!0)
{


Expand Down Expand Up @@ -229,10 +229,9 @@ GPM_NRT=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'LowerMekon
else
{
cat('Sorry!',' \n')
cat('You need to create one/two file(s) named ".netrc" , "_netrc" and ".urs_cookies" at your home Directory. The "_netrc" file only needed for Windows users.',' \n')
cat('You need to create two files ".netrc" and ".urs_cookies" at your home Directory.',' \n')
cat('Instructions on creating the ".netrc" and the ".urs_cookies" files can be accessed at https://wiki.earthdata.nasa.gov/display/EL/How+To+Access+Data+With+cURL+And+Wget',' \n')
cat('For Windows users follow instructions on creating the "_netrc" file at https://github.com/imohamme/NASAaccess/wiki/Curl-installation-on-Windows',' \n')
cat('Make sure that the netrc file contain the follwoing line with your credentials: ',' \n')
cat('Make sure that the ".netrc" file contains the follwoing line with your credentials: ',' \n')
cat('machine urs.earthdata.nasa.gov login uid_goes_here password password_goes_here',' \n')
cat('Thank you.',' \n')
}
Expand Down
9 changes: 4 additions & 5 deletions R/GPMployCentroid.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
GPMpolyCentroid=function(Dir='./SWAT_INPUT/', watershed ='LowerMekong.shp', DEM = 'LowerMekong_dem.tif', start = '2015-12-1', end = '2015-12-3')
{

if(file.exists('~/.netrc')==FALSE||file.exists('~/_netrc')==FALSE)
if(file.exists('~/.netrc')==FALSE)
{
source(system.file("scripts", "netrc.R",
package = "NASAaccess"))
}


if(file.exists('~/.netrc')==TRUE||file.exists('~/_netrc')==TRUE)
if(file.exists('~/.netrc')==TRUE)
{
if(length(grep("urs.earthdata.nasa.gov", readLines('~/.netrc')))==!0||length(grep("urs.earthdata.nasa.gov", readLines('~/_netrc')))==!0)
{
Expand Down Expand Up @@ -240,10 +240,9 @@ GPMpolyCentroid=function(Dir='./SWAT_INPUT/', watershed ='LowerMekong.shp', DEM
else
{
cat('Sorry!',' \n')
cat('You need to create one/two file(s) named ".netrc" , "_netrc" and ".urs_cookies" at your home Directory. The "_netrc" file only needed for Windows users.',' \n')
cat('You need to create two files named ".netrc" and ".urs_cookies" at your home Directory.',' \n')
cat('Instructions on creating the ".netrc" and the ".urs_cookies" files can be accessed at https://wiki.earthdata.nasa.gov/display/EL/How+To+Access+Data+With+cURL+And+Wget',' \n')
cat('For Windows users follow instructions on creating the "_netrc" file at https://github.com/imohamme/NASAaccess/wiki/Curl-installation-on-Windows',' \n')
cat('Make sure that the netrc file contain the follwoing line with your credentials: ',' \n')
cat('Make sure that the ".netrc" file contains the follwoing line with your credentials: ',' \n')
cat('machine urs.earthdata.nasa.gov login uid_goes_here password password_goes_here',' \n')
cat('Thank you.',' \n')
}
Expand Down
9 changes: 4 additions & 5 deletions R/GPMswat.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
GPMswat=function(Dir='./SWAT_INPUT/', watershed ='LowerMekong.shp', DEM = 'LowerMekong_dem.tif', start = '2015-12-1', end = '2015-12-3')
{

if(file.exists('~/.netrc')==FALSE||file.exists('~/_netrc')==FALSE)
if(file.exists('~/.netrc')==FALSE)
{
source(system.file("scripts", "netrc.R",
package = "NASAaccess"))
}

if(file.exists('~/.netrc')==TRUE||file.exists('~/_netrc')==TRUE)
if(file.exists('~/.netrc')==TRUE)
{
if(length(grep("urs.earthdata.nasa.gov", readLines('~/.netrc')))==!0||length(grep("urs.earthdata.nasa.gov", readLines('~/_netrc')))==!0)
{
Expand Down Expand Up @@ -320,10 +320,9 @@ GPMswat=function(Dir='./SWAT_INPUT/', watershed ='LowerMekong.shp', DEM = 'Lower
else
{
cat('Sorry!',' \n')
cat('You need to create one/two file(s) named ".netrc" , "_netrc" and ".urs_cookies" at your home Directory. The "_netrc" file only needed for Windows users.',' \n')
cat('You need to create two files named ".netrc" and ".urs_cookies" at your home Directory.',' \n')
cat('Instructions on creating the ".netrc" and the ".urs_cookies" files can be accessed at https://wiki.earthdata.nasa.gov/display/EL/How+To+Access+Data+With+cURL+And+Wget',' \n')
cat('For Windows users follow instructions on creating the "_netrc" file at https://github.com/imohamme/NASAaccess/wiki/Curl-installation-on-Windows',' \n')
cat('Make sure that the netrc file contain the follwoing line with your credentials: ',' \n')
cat('Make sure that the ".netrc" file contains the follwoing line with your credentials: ',' \n')
cat('machine urs.earthdata.nasa.gov login uid_goes_here password password_goes_here',' \n')
cat('Thank you.',' \n')
}
Expand Down
7 changes: 3 additions & 4 deletions R/NEXGDDP.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@

NEX_GDDP_CMIP5=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'LowerMekong_dem.tif', start = '2060-12-1', end = '2060-12-3', model = 'IPSL-CM5A-MR', type = 'pr',slice = 'rcp85')
{
if(file.exists('~/.netrc')==FALSE||file.exists('~/_netrc')==FALSE)
if(file.exists('~/.netrc')==FALSE)
{
source(system.file("scripts", "netrc.R",
package = "NASAaccess"))
}
#if there is no logging information then update the netrc file with NEX-GDDP info
if(file.exists('~/.netrc')==TRUE||file.exists('~/_netrc')==TRUE)
if(file.exists('~/.netrc')==TRUE)
{
url.IMERG.input <- 'https://gpm1.gesdisc.eosdis.nasa.gov/data/GPM_L3/GPM_3IMERGDF.06/'
url.GDDP.input <- 'https://portal.nccs.nasa.gov/datashare/NEXGDDP/BCSD/'
Expand Down Expand Up @@ -354,9 +354,8 @@ NEX_GDDP_CMIP5=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'Low
else
{
cat('Sorry!',' \n')
cat('You need to create one/two file(s) named ".netrc" , "_netrc" and ".urs_cookies" at your home Directory. The "_netrc" file only needed for Windows users.',' \n')
cat('You need to create two files ".netrc" and ".urs_cookies" at your home Directory.',' \n')
cat('Instructions on creating the ".netrc" and the ".urs_cookies" files can be accessed at https://wiki.earthdata.nasa.gov/display/EL/How+To+Access+Data+With+cURL+And+Wget',' \n')
cat('For Windows users follow instructions on creating the "_netrc" file at https://github.com/imohamme/NASAaccess/wiki/Curl-installation-on-Windows',' \n')
cat('Thank you.',' \n')
}

Expand Down
7 changes: 3 additions & 4 deletions R/NEXGDDP_CMIP6.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@
NEX_GDDP_CMIP6=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'LowerMekong_dem.tif', start = '2060-12-1', end = '2060-12-3', model = 'MIROC6', type = 'pr',slice = 'ssp245')
{

if(file.exists('~/.netrc')==FALSE||file.exists('~/_netrc')==FALSE)
if(file.exists('~/.netrc')==FALSE)
{
source(system.file("scripts", "netrc.R",
package = "NASAaccess"))
}

#if there is no logging information then update the netrc file with NEX-GDDP info
if(file.exists('~/.netrc')==TRUE||file.exists('~/_netrc')==TRUE)
if(file.exists('~/.netrc')==TRUE)
{

url.IMERG.input <- 'https://gpm1.gesdisc.eosdis.nasa.gov/data/GPM_L3/GPM_3IMERGDF.06/'
Expand Down Expand Up @@ -343,9 +343,8 @@ NEX_GDDP_CMIP6=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'Low
else
{
cat('Sorry!',' \n')
cat('You need to create one/two file(s) named ".netrc" , "_netrc" and ".urs_cookies" at your home Directory. The "_netrc" file only needed for Windows users.',' \n')
cat('You need to create two files named ".netrc" and ".urs_cookies" at your home Directory.',' \n')
cat('Instructions on creating the ".netrc" and the ".urs_cookies" files can be accessed at https://wiki.earthdata.nasa.gov/display/EL/How+To+Access+Data+With+cURL+And+Wget',' \n')
cat('For Windows users follow instructions on creating the "_netrc" file at https://github.com/imohamme/NASAaccess/wiki/Curl-installation-on-Windows',' \n')
cat('Thank you.',' \n')
}

Expand Down
8 changes: 4 additions & 4 deletions inst/scripts/netrc.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ rm(login2,password2)
writeLines(paste('machine', 'urs.earthdata.nasa.gov', 'login', login, 'password', password, sep = " "),'~/.netrc')
cat("", file = '~/.urs_cookies')
##check the machine type to decide on _netrc file creation
if(.Platform$OS.type != "unix")
{
writeLines(paste('machine', 'urs.earthdata.nasa.gov', 'login', login, 'password', password, sep = " "),'~/_netrc')
}
#if(.Platform$OS.type != "unix")
#{
# writeLines(paste('machine', 'urs.earthdata.nasa.gov', 'login', login, 'password', password, sep = " "),'~/_netrc')
#}

rm(login,password)

Expand Down

0 comments on commit a83f4e6

Please sign in to comment.