Skip to content

Commit

Permalink
Replace paste0 and fs::file_path with file.path for paths
Browse files Browse the repository at this point in the history
  • Loading branch information
caiohamamura committed Mar 7, 2020
1 parent 13ba60d commit eb336a8
Show file tree
Hide file tree
Showing 50 changed files with 2,461 additions and 2,461 deletions.
5 changes: 2 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by roxygen2: do not edit by hand
# Generated by roxygen2: do not edit by hand

export(LPDAACDataPool)
export(clipLevel1B)
Expand All @@ -17,6 +17,7 @@ export(clipLevel2BPAVDProfile)
export(clipLevel2BPAVDProfileGeometry)
export(clipLevel2BVPM)
export(clipLevel2BVPMGeometry)
export(close)
export(gediWFMetrics)
export(gediWFSimulator)
export(gedifinder)
Expand All @@ -42,8 +43,6 @@ exportClasses(gedi.level1b)
exportClasses(gedi.level1bSim)
exportClasses(gedi.level2a)
exportClasses(gedi.level2b)
exportMethods(close)
exportMethods(plot)
import(data.table)
import(fs)
import(ggplot2)
Expand Down
10 changes: 5 additions & 5 deletions R/C_processExtractMetrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@
#' coords = c(xcenter_Savanna, ycenter_Savanna))
#'
#'# Extracting GEDI feull-waveform derived metrics
#'wf_amazon_metrics<-gediWFMetrics(input=wf_amazon,outRoot=getwd())
#'wf_cerrado_metrics<-gediWFMetrics(input=wf_cerrado,outRoot=getwd())
#'wf_amazon_metrics<-gediWFMetrics(input=wf_amazon,outRoot=file.path(getwd(), "amazon"))
#'wf_cerrado_metrics<-gediWFMetrics(input=wf_cerrado,outRoot=file.path(getwd(), "cerrado"))
#'
#'wf_amazon@h5$close()
#'wf_cerrado@h5$close()
#'close(wf_amazon)
#'close(wf_cerrtado)
#'
#'metrics<-rbind(wf_amazon_metrics,wf_cerrado_metrics)
#'rownames(metrics)<-c("Amazon","Cerrado")
Expand Down Expand Up @@ -404,7 +404,7 @@ gediWFMetrics = function(
cleanInList(inputInList)

if (res==0) {
output = paste0(outRoot, ".metric.txt")
output = fs::path_ext_set(outRoot, ".metric.txt")
header = read.csv(output, sep=",", nrow=1, header = FALSE, as.is=TRUE)
header[ncol(header)] = NULL
header=gsub(" *\\d+ *([^,]*)", "\\1", header)
Expand Down
8 changes: 4 additions & 4 deletions R/C_simulateFullWaveform.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@
#'plot(wf_Savanna, relative=TRUE, polygon=TRUE, type="l", lwd=2, col="green",
#' xlab="Waveform Amplitude (%)", ylab="Elevation (m)", ylim=c(815,835))
#'grid()
#'
#'wf_Amazon@h5$close_all()
#'wf_Savanna@h5$close_all()
#'
#'close(wf_Amazon)
#'close(wf_Amazon)
#'}
#'
#' @import hdf5r
Expand Down Expand Up @@ -234,7 +234,7 @@ gediWFSimulator = function(

inputInList = inputOrInList(input)
if (fs::path_ext(output) != "h5") {
output = paste0(output, ".h5")
output = fs::path_ext_set(output, ".h5")
}

.Call("C_gediSimulator",
Expand Down
2 changes: 1 addition & 1 deletion R/LPDAACDataPool.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ LPDAACDataPool<-function(filepath,outdir){

cat(paste0("Downloading file ",filename," \n"))
# Write file to disk (authenticating with netrc) using the current directory/filename
response <- httr::GET(files[i], httr::write_disk(paste0(outdir,"\\",filename), overwrite = TRUE), httr::progress(),
response <- httr::GET(files[i], httr::write_disk(file.path(outdir, "",filename), overwrite = TRUE), httr::progress(),
httr::config(netrc = TRUE, netrc_file = netrc), httr::set_cookies("LC" = "cookies"))

# Check to see if file downloaded correctly
Expand Down
7 changes: 4 additions & 3 deletions R/class.gedi.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ gedi.fullwaveform <- setClass(
#'
#'@param x An object of class "gedi.fullwaveform". (output of \code{\link[rGEDI:getLevel1BWF]{getLevel1BWF}} function)
#'@param y: not used (inherited from R base)
#'@param ...: will be passed to the main plot
#'
#'@param relative if TRUE, the Wavform Amplitude will be showed in percentage (\%)
#'@param polygon if TRUE, polygon will be added to the plot
Expand All @@ -86,13 +87,13 @@ setGeneric("plot", function(x, y, ...)
#' "https://github.com/carlos-alberto-silva/rGEDI/",
#' "releases/download/examples/examples.zip"
#' ),
#' destfile=paste0(outdir,"/examples.zip"))
#' destfile=file.path(outdir, "examples.zip"))
#'
#'# unzip the file
#'unzip(paste0(outdir,"\\examples.zip"))
#'unzip(file.path(outdir, "examples.zip"))
#'
#'# specify the path to GEDI level1B data
#'level1bpath = paste0(outdir,"\\GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.h5")
#'level1bpath = file.path(outdir, "GEDI01'_B_2019108080338_O01964_T05337_02_003_01_sub.h5")
#'
#'# Reading GEDI level1B file
#'level1b<-readLevel1b(gedilevel1b)
Expand Down
6 changes: 3 additions & 3 deletions R/clipLevel2BVPM.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ clipLevel2BVPM = function(level2BVPM,xmin, xmax, ymin, ymax){
#' "https://github.com/carlos-alberto-silva/rGEDI/",
#' "releases/download/examples/examples.zip"
#' ),
#' destfile=paste0(outdir,"/examples.zip"))
#' destfile=file.path(outdir, "examples.zip"))
#'
#'# unzip the file
#'unzip(paste0(outdir,"\\examples.zip"))
#'unzip(file.path(outdir, "examples.zip"))
#'
#'# specify the path to GEDI level2B data
#'level2bpath = paste0(outdir,"\\GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5")
#'level2bpath = file.path(outdir, "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5")
#'
#'# Reading GEDI level1B file
#'level2b<-readLevel2b(gedilevel2b)
Expand Down
6 changes: 3 additions & 3 deletions R/getLevel2BVPM.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
#' "https://github.com/carlos-alberto-silva/rGEDI/",
#' "releases/download/examples/examples.zip"
#' ),
#' destfile=paste0(outdir,"/examples.zip"))
#' destfile=file.path(outdir, "examples.zip"))
#'
#'# unzip the file
#'unzip(paste0(outdir,"\\examples.zip"))
#'unzip(file.path(outdir, "examples.zip"))
#'
#'# specify the path to GEDI level2B data
#'level2bpath = paste0(outdir,"\\GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5")
#'level2bpath = file.path(outdir, "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5")
#'
#'# Reading GEDI level1B file
#'level2b<-readLevel2b(gedilevel2b)
Expand Down
78 changes: 39 additions & 39 deletions man/LPDAACDataPool.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 55 additions & 55 deletions man/clipLevel1B.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit eb336a8

Please sign in to comment.