carlos-alberto-silva / rGEDI

rGEDI: An R Package for NASA's Global Ecosystem Dynamics Investigation (GEDI) Data Visualization and Processing.
157 stars 67 forks source link

R crashing on gediWFMetrics() #47

Closed mickeycampbell closed 1 year ago

mickeycampbell commented 1 year ago

Hello,

I am using rGEDI to simulate waveforms from ALS data. Following the example on GitHub, I am able to succesfully simulate a waveform using the gediWFSimulator() function. I can tell it's successful, because I'm able to plot out the waveform, again per the example. However, when I try to extract waveform metrics using the gediWFMetrics() function, R crashes. In RStudio, no errors are returned, I simply receive the "R Session Aborted: R encountered a fatal error. The session was terminated." pop-up box. I also tried running in R outside of RStudio, and R simply closed down when it reached the gediWFMetrics() step.

For reference, here is a simplified version of my code (associated with this LAS file: https://drive.google.com/file/d/1x3_HaRypOUSK6IG9pG8oJrnxKMSeGVt2/view?usp=sharing):

library(lidR)
library(rGEDI)

# read in las file
las.file <- "C:/temp/rGEDI/test_lidar.las"
las.data <- readLAS(las.file, filter = "-drop_withheld")

# get x and y geolocation
x <- mean(bbox(las.data)[1,])
y <- mean(bbox(las.data)[2,])

# simulate waveform
gedi.file <- "C:/temp/rGEDI/test_lidar.h5"
gedi.data <- gediWFSimulator(las.file, gedi.file, coords = c(x,y))

# get waveform metrics
gedi.mets <- gediWFMetrics(input = gedi.data, outRoot = "C:/temp/rGEDI")

I've tried several different options for the outRoot argument, wondering if that was the problem, such as:

# closer to the example on github
setwd("C:/temp/rGEDI")
gedi.mets <- gediWFMetrics(input = gedi.data, outRoot = file.path(getwd(), "test"))

...To no avail. I'm using R 4.2.0 and rGEDI 0.3.1. Any help is appreciated!

caiohamamura commented 1 year ago

The outRoot is not a directory name, it wil be the filename. That filename will have a .metric.txt automatically apended.