Skip to content

Commit

Permalink
updated to laspy 2.0.0 (with optional laszip)
Browse files Browse the repository at this point in the history
  • Loading branch information
martibosch committed Jul 3, 2021
1 parent 9f07036 commit 7a4c5b6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

- name: Install detectree
run: |
python setup.py install
pip install .[laszip]
conda list
conda info --all
Expand Down
10 changes: 5 additions & 5 deletions detectree/lidar.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Utilities to get canopy information from LiDAR data."""

import laspy
import numpy as np
import pandas as pd
import rasterio as rio
from laspy import file as lp_file
from rasterio import enums, features
from shapely import geometry

Expand Down Expand Up @@ -36,10 +36,10 @@ def rasterize_lidar(lidar_filepath, lidar_tree_values, ref_img_filepath):
lidar_arr : numpy ndarray
Array with the rasterized lidar
"""
with lp_file.File(lidar_filepath, mode="r") as src:
c = src.get_classification()
x = src.x
y = src.y
las = laspy.read(lidar_filepath)
c = np.array(las.classification)
x = np.array(las.x)
y = np.array(las.y)

cond = np.isin(c, lidar_tree_values)
lidar_df = pd.DataFrame({"class_val": c[cond], "x": x[cond], "y": y[cond]})
Expand Down
2 changes: 1 addition & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
- dask
- distributed
- joblib
- laspy
- laspy>=2.0.0
- lastools
- laszip
- numpy>=1.15
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dask[delayed,distributed]
joblib
laspy >= 2.0.0
pymaxflow >= 1.0.0
numpy >= 1.15
pandas >= 0.23
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
packages=find_packages(exclude=["docs", "tests*"]),
include_package_data=True,
install_requires=install_requires,
extras_require={"laszip": ["laspy[laszip] >= 2.0.0"]},
dependency_links=dependency_links,
entry_points="""
[console_scripts]
Expand Down

0 comments on commit 7a4c5b6

Please sign in to comment.