Skip to content

Add notebook showing COPC access in R using lasR#576

Open
omshinde wants to merge 2 commits intodevelopfrom
rajat/lasr_testing
Open

Add notebook showing COPC access in R using lasR#576
omshinde wants to merge 2 commits intodevelopfrom
rajat/lasr_testing

Conversation

@omshinde
Copy link
Copy Markdown
Contributor

Addresses NASA-IMPACT/science-support#25

  • Install devel branch of lasR and from r-universe into hub image
  • Test partial read of COPC
  • Write a notebook in anticipation of release
  • plan for next R workspace release after this lands in released version
  • provide feedback if any bugs found

@omshinde omshinde self-assigned this Apr 13, 2026
@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@omshinde omshinde requested a review from hrodmn April 13, 2026 21:15
@@ -0,0 +1,1395 @@
{
Copy link
Copy Markdown
Collaborator

@wildintellect wildintellect Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure it's clear this only works on the MAAP Hub, and the R pyrocket-geospatial workspace.


Reply via ReviewNB

@@ -0,0 +1,1395 @@
{
Copy link
Copy Markdown
Collaborator

@wildintellect wildintellect Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #14.      dyn.load("/srv/conda/envs/notebook/lib/libgdal.so.36"),

Hmm, what image are you working in? on pyrocket-geospatial this should not be using conda.


Reply via ReviewNB

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this part to avoid confusion. It was forcing the libgdal from conda to resolve package dependency issues. Thanks

@@ -0,0 +1,1395 @@
{
Copy link
Copy Markdown
Contributor

@hrodmn hrodmn Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #8.    # Fetch first page of items (limit=10 to get a representative sample)

We should use rstac to do STAC queries in R!


Reply via ReviewNB

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Updated

@@ -0,0 +1,1395 @@
{
Copy link
Copy Markdown
Contributor

@hrodmn hrodmn Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is going on with these bounding boxes? the lon values are out of bounds.


Reply via ReviewNB

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are in local coordinate reference system.

@@ -0,0 +1,1395 @@
{
Copy link
Copy Markdown
Contributor

@hrodmn hrodmn Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #6.    full  <- exec(reader_las() + summarise(), on = url)

is exec a lasR function?


Reply via ReviewNB

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It's the pdal's pipeline.execute equivalent for lasR. Updated the code to specifically show lasR::exec()

@omshinde
Copy link
Copy Markdown
Contributor Author

@wildintellect @hrodmn Thanks for the comments. I updated the notebook and requested re-review.

@wildintellect
Copy link
Copy Markdown
Collaborator

@omshinde how did you get lasR upgraded install to work? when I tried to build it takes a long time, and then links to the conda gdal which causes issues.

@omshinde
Copy link
Copy Markdown
Contributor Author

omshinde commented Apr 16, 2026

I tested it again in a fresh R image and it works wit the following commands-

  1. Notebook
# Install lasR 0.20.0 from r-universe
install.packages(
  "lasR",
  repos = c("https://r-lidar.r-universe.dev", "https://cloud.r-project.org")
)

Verify

library(lasR)
packageVersion("lasR")  # should return 0.20.0
  1. From terminal
Rscript -e "install.packages('lasR', repos = c('https://r-lidar.r-universe.dev', 'https://cloud.r-project.org'))"

Verify:

Rscript -e "library(lasR); cat(as.character(packageVersion('lasR')), '\n')"

@wildintellect
Copy link
Copy Markdown
Collaborator

It's building against the conda versions of packages, which we don't want.

checking for gdal-config... /srv/conda/envs/notebook/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.10.2
checking GDAL version >= 2.0.1... yes
checking for gcc... gcc -std=gnu2x
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc -std=gnu2x accepts -g... yes
checking for gcc -std=gnu2x option to enable C11 features... none needed
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /srv/conda/envs/notebook/share/gdal/pcs.csv readable... no
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available for running:... yes
configure: GDAL: 3.10.2
configure: pkg-config proj exists, will use it
configure: using proj.h.
configure: PROJ: 9.4.0
checking PROJ: checking whether PROJ and sqlite3 are available for linking:... yes
checking for geos-config... /srv/conda/envs/notebook/bin/geos-config
checking geos-config usability... yes
configure: GEOS: 3.13.1
checking GEOS version >= 3.4.0... yes
checking for geos_c.h... yes
checking geos: linking with -L/srv/conda/envs/notebook/lib -lgeos_c... yes

@omshinde
Copy link
Copy Markdown
Contributor Author

This is what I see-

(notebook) jovyan@jupyter-omshinde23--r-test:~$ Rscript -e "install.packages('lasR', repos = c('https://r-lidar.r-universe.dev', 'https://cloud.r-project.org'))"
Use py_require() for Python interoperability without altering PATH.
Use use_condaenv('notebook') to use conda environment but this will alter PATH and may break R functions.
Restart R to reset PATH or store PATH before calling use_condaenv('notebook') and restore when done.
python:         /srv/conda/envs/notebook/bin/python
libpython:      /srv/conda/envs/notebook/lib/libpython3.12.so
pythonhome:     /srv/conda/envs/notebook:/srv/conda/envs/notebook
version:        3.12.12 | packaged by conda-forge | (main, Oct 22 2025, 23:25:55) [GCC 14.3.0]
numpy:          /srv/conda/envs/notebook/lib/python3.12/site-packages/numpy
numpy_version:  2.3.5

NOTE: Python version was forced by use_python() function
Installing package into ‘/home/jovyan/R/x86_64-pc-linux-gnu-library/4.5’
(as ‘lib’ is unspecified)
trying URL 'https://r-lidar.r-universe.dev/src/contrib/sha256-0fa743c14663c2fffc66c4742ba4fe770b8969ea8a28879035ee3813019bba16'
Content type 'application/gzip' length 27180486 bytes (25.9 MB)
==================================================
downloaded 25.9 MB

Use py_require() for Python interoperability without altering PATH.
Use use_condaenv('notebook') to use conda environment but this will alter PATH and may break R functions.
Restart R to reset PATH or store PATH before calling use_condaenv('notebook') and restore when done.
python:         /srv/conda/envs/notebook/bin/python
libpython:      /srv/conda/envs/notebook/lib/libpython3.12.so
pythonhome:     /srv/conda/envs/notebook:/srv/conda/envs/notebook
version:        3.12.12 | packaged by conda-forge | (main, Oct 22 2025, 23:25:55) [GCC 14.3.0]
numpy:          /srv/conda/envs/notebook/lib/python3.12/site-packages/numpy
numpy_version:  2.3.5

NOTE: Python version was forced by use_python() function
ERROR: failed to lock directory ‘/home/jovyan/R/x86_64-pc-linux-gnu-library/4.5’ for modifying
Try removing ‘/home/jovyan/R/x86_64-pc-linux-gnu-library/4.5/00LOCK-lasR’

The downloaded source packages are in
        ‘/tmp/Rtmp2CgHFh/downloaded_packages’
Warning message:
In install.packages("lasR", repos = c("https://r-lidar.r-universe.dev",  :
  installation of package ‘lasR’ had non-zero exit status
(notebook) jovyan@jupyter-omshinde23--r-test:~$ Rscript -e "library(lasR); cat(as.character(packageVersion('lasR')), '\n')"
Use py_require() for Python interoperability without altering PATH.
Use use_condaenv('notebook') to use conda environment but this will alter PATH and may break R functions.
Restart R to reset PATH or store PATH before calling use_condaenv('notebook') and restore when done.
python:         /srv/conda/envs/notebook/bin/python
libpython:      /srv/conda/envs/notebook/lib/libpython3.12.so
pythonhome:     /srv/conda/envs/notebook:/srv/conda/envs/notebook
version:        3.12.12 | packaged by conda-forge | (main, Oct 22 2025, 23:25:55) [GCC 14.3.0]
numpy:          /srv/conda/envs/notebook/lib/python3.12/site-packages/numpy
numpy_version:  2.3.5

NOTE: Python version was forced by use_python() function
0.20.0 
(notebook) jovyan@jupyter-omshinde23--r-test:~$ Rscript -e "library(lasR); cat(as.character(packageVersion('lasR')), '\n')"

@omshinde
Copy link
Copy Markdown
Contributor Author

omshinde commented Apr 20, 2026

MoM from lasR discussion with Sam G.

  • Tidyverse, terra, lasR, lidR should be enough for processing
  • R scripts working with Quarto and proposed package

Actions:

@wildintellect
Copy link
Copy Markdown
Collaborator

@omshinde let's move the install/container image with lasR to it's own ticket in a workspace related repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants