diff --git a/DESCRIPTION b/DESCRIPTION index acf62bd..6c3153a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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"), diff --git a/NEWS.md b/NEWS.md index 6696a01..78747f1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/R/GLDASpolyCentroid.R b/R/GLDASpolyCentroid.R index 1a384d8..9ce2218 100644 --- a/R/GLDASpolyCentroid.R +++ b/R/GLDASpolyCentroid.R @@ -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') } diff --git a/R/GLDASwat.R b/R/GLDASwat.R index 2caf27e..3cc55bf 100644 --- a/R/GLDASwat.R +++ b/R/GLDASwat.R @@ -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) { @@ -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') } diff --git a/R/GPM_NRT.R b/R/GPM_NRT.R index a2681db..351265a 100644 --- a/R/GPM_NRT.R +++ b/R/GPM_NRT.R @@ -37,7 +37,7 @@ 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", @@ -45,9 +45,9 @@ GPM_NRT=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'LowerMekon } - 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) { @@ -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') } diff --git a/R/GPMployCentroid.R b/R/GPMployCentroid.R index 5fa48f6..0d1078f 100644 --- a/R/GPMployCentroid.R +++ b/R/GPMployCentroid.R @@ -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) { @@ -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') } diff --git a/R/GPMswat.R b/R/GPMswat.R index 9efa14a..ee70209 100644 --- a/R/GPMswat.R +++ b/R/GPMswat.R @@ -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) { @@ -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') } diff --git a/R/NEXGDDP.R b/R/NEXGDDP.R index ee5ba3f..18ca414 100644 --- a/R/NEXGDDP.R +++ b/R/NEXGDDP.R @@ -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/' @@ -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') } diff --git a/R/NEXGDDP_CMIP6.R b/R/NEXGDDP_CMIP6.R index 0d2742e..a42025c 100644 --- a/R/NEXGDDP_CMIP6.R +++ b/R/NEXGDDP_CMIP6.R @@ -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/' @@ -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') } diff --git a/inst/scripts/netrc.R b/inst/scripts/netrc.R index f68f972..115d453 100644 --- a/inst/scripts/netrc.R +++ b/inst/scripts/netrc.R @@ -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)