Skip to content

Commit

Permalink
V3.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
imohamme committed Apr 14, 2023
1 parent 9c39a9e commit 2263a03
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 18 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: NASAaccess
Version: 3.4.1
Date: 2023-03-21
Version: 3.4.2
Date: 2023-04-14
Type: Package
Title: Downloading and Reformatting Tool for NASA Earth Observation Data Products
Authors@R: c(person("Ibrahim", "Mohammed", role = c("aut", "cre"),
Expand All @@ -13,7 +13,7 @@ Description: A tool to generate gridded ascii tables and station files needed by
Creating the ".netrc" file at the user machine 'Home' directory and storing the NASA GES DISC user logging information in it is needed to execute the package commands.
URL: https://github.com/nasa/NASAaccess
BugReports: https://github.com/nasa/NASAaccess/issues
Imports: ncdf4, stats, shapefiles, rgeos, maptools, httr, stringr, rgdal, XML, sp, utils, raster, methods
Imports: ncdf4, stats, shapefiles, rgeos, maptools, httr, stringr, rgdal, XML, sp, utils, raster, methods, getPass
License: file LICENSE
Encoding: UTF-8
Language: en-US
Expand All @@ -25,5 +25,5 @@ Suggests:
ggmap,
sf,
ggplot2,
getPass
codetools
VignetteBuilder: knitr
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export(GPMswat)
export(NEX_GDDP_CMIP5)
export(NEX_GDDP_CMIP6)
import(XML)
import(getPass)
import(httr)
import(maptools)
import(methods)
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# NASAaccess 3.4.2
* Adding getPass library in Imports. Addressing curl Certificate Verification for NEX-GDDP.

# NASAaccess 3.4.1

* no need for _netrc file creation in windows
Expand Down
2 changes: 1 addition & 1 deletion R/GLDASpolyCentroid.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#' #Lower Mekong basin example
#' \dontrun{GLDASpolyCentroid(Dir = "./SWAT_INPUT/", watershed = "LowerMekong.shp",
#' DEM = "LowerMekong_dem.tif", start = "2015-12-1", end = "2015-12-3")}
#' @import ncdf4 httr stringr rgdal XML utils sp rgeos
#' @import ncdf4 httr stringr rgdal XML utils sp rgeos getPass
#' @importFrom stats na.exclude
#' @importFrom raster raster cellFromPolygon xyFromCell rowColFromCell extract
#' @importFrom rgeos gCentroid
Expand Down
2 changes: 1 addition & 1 deletion R/GLDASwat.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#' #Lower Mekong basin example
#' \dontrun{GLDASwat(Dir = "./SWAT_INPUT/", watershed = "LowerMekong.shp",
#' DEM = "LowerMekong_dem.tif", start = "2015-12-1", end = "2015-12-3")}
#' @import ncdf4 httr stringr rgdal XML utils sp
#' @import ncdf4 httr stringr rgdal XML utils sp getPass
#' @importFrom stats na.exclude
#' @importFrom raster raster cellFromPolygon xyFromCell rowColFromCell extract
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/GPM_NRT.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' #Lower Mekong basin example
#' \dontrun{GPM_NRT(Dir = "./INPUT/", watershed = "LowerMekong.shp",
#' DEM = "LowerMekong_dem.tif", start = "2022-6-1", end = "2022-6-10")}
#' @import ncdf4 shapefiles rgeos maptools httr stringr rgdal XML utils sp methods
#' @import ncdf4 shapefiles rgeos maptools httr stringr rgdal XML utils sp methods getPass
#' @importFrom stats na.exclude
#' @importFrom raster raster cellFromPolygon xyFromCell rowColFromCell extract
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/GPMployCentroid.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' #Lower Mekong basin example
#' \dontrun{GPMpolyCentroid(Dir = "./SWAT_INPUT/", watershed = "LowerMekong.shp",
#' DEM = "LowerMekong_dem.tif", start = "2015-12-1", end = "2015-12-3")}
#' @import ncdf4 shapefiles rgeos maptools httr stringr rgdal XML utils sp methods
#' @import ncdf4 shapefiles rgeos maptools httr stringr rgdal XML utils sp methods getPass
#' @importFrom stats na.exclude
#' @importFrom raster raster cellFromPolygon xyFromCell rowColFromCell extract
#' @importFrom rgeos gCentroid
Expand Down
2 changes: 1 addition & 1 deletion R/GPMswat.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' #Lower Mekong basin example
#' \dontrun{GPMswat(Dir = "./SWAT_INPUT/", watershed = "LowerMekong.shp",
#' DEM = "LowerMekong_dem.tif", start = "2015-12-1", end = "2015-12-3")}
#' @import ncdf4 shapefiles rgeos maptools httr stringr rgdal XML utils sp methods
#' @import ncdf4 shapefiles rgeos maptools httr stringr rgdal XML utils sp methods getPass
#' @importFrom stats na.exclude
#' @importFrom raster raster cellFromPolygon xyFromCell rowColFromCell extract
#' @export
Expand Down
8 changes: 4 additions & 4 deletions R/NEXGDDP.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#' \dontrun{NEX_GDDP_CMIP5(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')}
#' @import ncdf4 shapefiles rgeos maptools httr stringr rgdal XML utils sp methods
#' @import ncdf4 shapefiles rgeos maptools httr stringr rgdal XML utils sp methods getPass
#' @importFrom stats na.exclude
#' @importFrom raster raster cellFromPolygon xyFromCell rowColFromCell extract
#' @export
Expand Down Expand Up @@ -139,7 +139,7 @@ NEX_GDDP_CMIP5=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'Low

filename.start <- paste(paste(type.start,'day','BCSD',slice,'r1i1p1',model,format(time_period[1],"%Y"),sep = '_'),'.nc',sep="")
myurl <- paste(ifelse(isTRUE(type=="pr")==TRUE,ftp,ftp_min),filename.start,sep = '')
utils::download.file(quiet = T, method = 'curl', url = myurl, destfile = paste('./temp/',filename.start,sep= ''), mode = 'wb', extra = '-L')
utils::download.file(quiet = T, method = 'curl', url = myurl, destfile = paste('./temp/',filename.start,sep= ''), mode = 'wb', extra = '-k')

test2<-file.info(paste('./temp/',filename.start,sep= ''))$size
stopifnot('The NEX GDDP server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.' = test2 > 7.0e6)
Expand Down Expand Up @@ -222,7 +222,7 @@ NEX_GDDP_CMIP5=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'Low
myurl <- paste(ftp,filename,sep = '')
# downloading file
if(dir.exists('./temp/')==FALSE){dir.create('./temp/')}
if(file.exists(paste('./temp/',filename,sep= ''))==FALSE){utils::download.file(quiet = T, method = 'curl', url = myurl, destfile = paste('./temp/',filename,sep= ''), mode = 'wb', extra = '-L')}
if(file.exists(paste('./temp/',filename,sep= ''))==FALSE){utils::download.file(quiet = T, method = 'curl', url = myurl, destfile = paste('./temp/',filename,sep= ''), mode = 'wb', extra = '-k')}
# Reading the ncdf file
test3<-file.info(paste('./temp/',filename,sep= ''))$size
stopifnot('The NEX GDDP server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.' = test3 > 6.0e6)
Expand Down Expand Up @@ -276,7 +276,7 @@ NEX_GDDP_CMIP5=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'Low
myurl_max <- paste(ftp_max,filename_max,sep = '')
# downloading file
if(dir.exists('./temp/')==FALSE){dir.create('./temp/')}
if(file.exists(paste('./temp/',filename_min,sep= ''))==FALSE|file.exists(paste('./temp/',filename_max,sep= ''))==FALSE){utils::download.file(quiet = T, method = 'curl', url = myurl_min, destfile = paste('./temp/',filename_min,sep= ''), mode = 'wb', extra = '-L');utils::download.file(quiet = T, method = 'curl', url = myurl_max, destfile = paste('./temp/',filename_max,sep= ''), mode = 'wb', extra = '-L')}
if(file.exists(paste('./temp/',filename_min,sep= ''))==FALSE|file.exists(paste('./temp/',filename_max,sep= ''))==FALSE){utils::download.file(quiet = T, method = 'curl', url = myurl_min, destfile = paste('./temp/',filename_min,sep= ''), mode = 'wb', extra = '-k');utils::download.file(quiet = T, method = 'curl', url = myurl_max, destfile = paste('./temp/',filename_max,sep= ''), mode = 'wb', extra = '-k')}
# Reading the tasmin ncdf file
test4<-file.info(paste('./temp/',filename_min,sep= ''))$size
stopifnot('The NEX GDDP server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.' = test4 > 6.0e6)
Expand Down
8 changes: 4 additions & 4 deletions R/NEXGDDP_CMIP6.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#' \dontrun{NEX_GDDP_CMIP6(Dir = "./INPUT/", watershed = "LowerMekong.shp",
#' DEM = "LowerMekong_dem.tif", start = "2060-12-1", end = "2060-12-3",
#' model = 'MIROC6', type = 'pr', slice = 'ssp245')}
#' @import ncdf4 shapefiles rgeos maptools httr stringr rgdal XML utils sp methods
#' @import ncdf4 shapefiles rgeos maptools httr stringr rgdal XML utils sp methods getPass
#' @importFrom stats na.exclude
#' @importFrom raster raster cellFromPolygon xyFromCell rowColFromCell extract
#' @export
Expand Down Expand Up @@ -152,7 +152,7 @@ NEX_GDDP_CMIP6=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'Low
# Using dummy date and file info for a file in the NEX-GDDP-CMIP6 dataset
# downloading one file
if(dir.exists('./temp/')==FALSE){dir.create('./temp/')}
utils::download.file(quiet = T, method = 'curl', url = 'https://ds.nccs.nasa.gov/thredds/ncss/AMES/NEX/GDDP-CMIP6/ACCESS-CM2/ssp585/r1i1p1f1/tasmax/tasmax_day_ACCESS-CM2_ssp585_r1i1p1f1_gn_2015.nc?var=tasmax&disableLLSubset=on&disableProjSubset=on&horizStride=1&time_start=2015-09-01T12%3A00%3A00Z&time_end=2015-09-02T12%3A00%3A00Z&timeStride=1', destfile = paste('./temp/','tasmax_day_ssp585_r1i1p1f1_ACCESS-CM2_2015.nc',sep= ''), mode = 'wb', extra = '-L')
utils::download.file(quiet = T, method = 'curl', url = 'https://ds.nccs.nasa.gov/thredds/ncss/AMES/NEX/GDDP-CMIP6/ACCESS-CM2/ssp585/r1i1p1f1/tasmax/tasmax_day_ACCESS-CM2_ssp585_r1i1p1f1_gn_2015.nc?var=tasmax&disableLLSubset=on&disableProjSubset=on&horizStride=1&time_start=2015-09-01T12%3A00%3A00Z&time_end=2015-09-02T12%3A00%3A00Z&timeStride=1', destfile = paste('./temp/','tasmax_day_ssp585_r1i1p1f1_ACCESS-CM2_2015.nc',sep= ''), mode = 'wb', extra = '-k')
test2<-file.info(paste('./temp/','tasmax_day_ssp585_r1i1p1f1_ACCESS-CM2_2015.nc',sep= ''))$size
stopifnot('The NEX GDDP server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.' = test2 > 6.0e6)
#reading ncdf file
Expand Down Expand Up @@ -232,7 +232,7 @@ NEX_GDDP_CMIP6=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'Low

# downloading file
if(dir.exists('./temp/')==FALSE){dir.create('./temp/')}
if(file.exists(paste('./temp/',filename,sep= ''))==FALSE){utils::download.file(quiet = T, method = 'curl', url = myurl, destfile = paste('./temp/',filename,sep= ''), mode = 'wb', extra = '-L')}
if(file.exists(paste('./temp/',filename,sep= ''))==FALSE){utils::download.file(quiet = T, method = 'curl', url = myurl, destfile = paste('./temp/',filename,sep= ''), mode = 'wb', extra = '-k')}
# Reading the ncdf file
test3<-file.info(paste('./temp/',filename,sep= ''))$size
stopifnot('The NEX GDDP server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.' = test3 > 3.0e6)
Expand Down Expand Up @@ -275,7 +275,7 @@ NEX_GDDP_CMIP6=function(Dir='./INPUT/', watershed ='LowerMekong.shp', DEM = 'Low
myurl_max <- paste(ftp_max,timeyear,'.nc?','var=',type,'max','&disableLLSubset=on&disableProjSubset=on&horizStride=1&time_start=',as.character(timestart),'T12%3A00%3A00Z&time_duration=P1D','&timeStride=1',sep = '')
# downloading file
if(dir.exists('./temp/')==FALSE){dir.create('./temp/')}
if(file.exists(paste('./temp/',filename_min,sep= ''))==FALSE|file.exists(paste('./temp/',filename_max,sep= ''))==FALSE){utils::download.file(quiet = T, method = 'curl', url = myurl_min, destfile = paste('./temp/',filename_min,sep= ''), mode = 'wb', extra = '-L');utils::download.file(quiet = T, method = 'curl', url = myurl_max, destfile = paste('./temp/',filename_max,sep= ''), mode = 'wb', extra = '-L')}
if(file.exists(paste('./temp/',filename_min,sep= ''))==FALSE|file.exists(paste('./temp/',filename_max,sep= ''))==FALSE){utils::download.file(quiet = T, method = 'curl', url = myurl_min, destfile = paste('./temp/',filename_min,sep= ''), mode = 'wb', extra = '-k');utils::download.file(quiet = T, method = 'curl', url = myurl_max, destfile = paste('./temp/',filename_max,sep= ''), mode = 'wb', extra = '-k')}
# Reading the tmin ncdf file
test4<-file.info(paste('./temp/',filename_min,sep= ''))$size
stopifnot('The NEX GDDP server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.' = test4 > 3.0e6)
Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/netrc.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###code to save user credentials into netrc file
library(getPass)
#' @import getPass


repeat {
Expand Down

0 comments on commit 2263a03

Please sign in to comment.