Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

normalize_height causes "NULL value passed as symbol address" #580

Closed
Jean-Romain opened this issue May 6, 2022 Discussed in #579 · 3 comments
Closed

normalize_height causes "NULL value passed as symbol address" #580

Jean-Romain opened this issue May 6, 2022 Discussed in #579 · 3 comments
Assignees
Labels
Bug A bug in the package

Comments

@Jean-Romain
Copy link
Collaborator

Jean-Romain commented May 6, 2022

Discussed in #579

Originally posted by kulpojke May 5, 2022
I am using the lidR package to do some tree segmentation on a set of 561 km² tiles using the LAScatalog engine and the futures library for parallelization. I have successfully created the DTM, but when I attempt to normalize I get an error.

I have read this thread already and it did not solve my problem.

I am running inside of a container (rocker/tidyverse:4.2) with the following:

R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

future_1.25.0
lidR_4.0.0

Here is the code:

# import libraries
library(lidR)
library(future)

plan(multisession)

# define some paramaters, currently using ft :(
chunk_size <-1000            # chunk size 
buff <- 50                   # buffer size
resolution <-2               # raster resolution

# (1) path to data 
path <- '/data'

# make las catalog
ctg <- readLAScatalog(path)

# set disk storage option by assigning a filename template to a function
opt_output_files(ctg) <- paste0(tempdir(), "/{XCENTER}_{YCENTER}_{ID}")

# create index files (lax) to index points within laz files. speeds up reads.
lidR:::catalog_laxindex(ctg)

# set the chunk buffer ofr ctg
opt_chunk_buffer(ctg) <- buff

# set the chunk size for ctg
opt_chunk_size(ctg) <- chunk_size

# make dtm
opt_output_files(ctg) <- paste0(tempdir(), "/{XCENTER}_{YCENTER}_{ID}_dtm")
dtm <- rasterize_terrain(ctg, resolution, tin())

# in my Rmd I plot the dtm here and it looks right

# normalise ctg
opt_output_files(ctg) <- paste0(tempdir(), "/{XCENTER}_{YCENTER}_{ID}_norm")
ctg_norm <- normalize_height(ctg, dtm)

During the normalization I get the following warning, then error:

Processing [-----------------]   0% (0/1152) eta:  ?sWarning: There are 3 points flagged 'withheld'.
Processing [-----------------]   0% (1/1152) eta:  4hError: NULL value passed as symbol address

After reading this thread. I tried disabling multisession and using set_lidr_threads,

# import libraries
library(lidR)
library(future)

#plan(multisession)
get_lidr_threads()

but the problem persists. Any insights would be greatly appreciated.

@Jean-Romain
Copy link
Collaborator Author

Jean-Romain commented May 6, 2022

After reproducing with data of mine I get

Error : external pointer is not valid

Which is likely to be very similar to your error. SpatRaster are not serializable and I think this is what caused the error. However I do not have error with sequential processing because only one worker is implied and no serialization is involved. Are you sure you really disabled plan(multissesion). Did you start a fresh session or reset the strategy with plan(sequential)?

Edit: in another run I also go Error : NULL value passed as symbol address (with multisession)


Side note: plan(multisession) and s/get_lidr_threads() are doing very different things.

@Jean-Romain Jean-Romain added the Bug A bug in the package label May 6, 2022
@Jean-Romain Jean-Romain self-assigned this May 6, 2022
@r-lidar r-lidar deleted a comment from kulpojke May 24, 2022
@r-lidar r-lidar deleted a comment from kulpojke May 24, 2022
@r-lidar r-lidar deleted a comment from kulpojke May 24, 2022
@Jean-Romain
Copy link
Collaborator Author

Fixed with a workaround. If user is using a parallel strategy SpatRaster are converted to RasterLayer. There is not way to work with SpatRaster

@Ben-Shamgochian
Copy link

Fixed with a workaround. If user is using a parallel strategy SpatRaster are converted to RasterLayer. There is not way to work with SpatRaster

Hi, I'm currently experiencing the same issue when attempting to normalize height and I don't quite understand this work around. Do you mind explaining in a little more depth?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the package
Projects
None yet
Development

No branches or pull requests

2 participants