Skip to main content

Lidar data processing tools focused on Spanish PNOA datasets

Project description

pypi Coverage Status Join the chat at https://gitter.im/cartolidar/cartolidar Binder

cartolidar Logo

CartoLidar

Lidar data processing tools focused on Spanish PNOA datasets

Herramientas para procesado de datos Lidar del PNOA

Lidar PNOA: https://pnoa.ign.es/el-proyecto-pnoa-lidar

Introduction

CartoLidar is a collection of tools to process lidar files "las" and "laz" and generate other products aimed to forestry and natural environment management.

This project is in alpha version and includes only the "clidtwins" tool.

"clidtwins" searchs for similar areas to a reference one in terms of dasoLidar Variables (DLVs)

DLV: Lidar variables that describe or characterize forest or land cover structure.

CartoLidar es una colección de herramientas destinadas a procesar ficheros lidar (las y laz) para clasificar los puntos y generar ficheros ráster con DEM y DLVs.

DEM (Digital Elevation Model): modelos digitales de elevaciones (MDT, MDS)

DLV (Daso Lidar Variables): variables dasoLidar, que representan diversos aspectos de la estructura de una formación arbolada, arbustiva o de matorral.

CartoLidar también proporciona herramientas adicionales para generar otros productos de utilidad en selvicultura y otras areas de gestión del medio natural a partir de los ficheros ráster con las DLVs.

El proyecto está en fase alpha e incluye únicamente la herramienta "clidtwins".

clidtwins está destinada a buscar zonas similares a una(s) de referencia en términos de determinadas variables dasoLidar (DLVs).

+ info: Read the Docs - cartolidar (página en construcción)

Install

  1. Install official version from pypi - cartolidar:
pip install cartolidar

or (in case you are working through a proxy server):

pip install cartolidar --proxy https://user:password@proxyserver:port
  1. Download development version from github - cartolidar

From github you can download the zip version, uncompress it somewhere, i.e.:

C:\users\yourUser\Downloads\cartolidar-main\

That folder contains a setup.py file (and the other components of the project) and you can install cartolidar from that directory for your python environment:

cd C:\users\yourUser\Downloads\cartolidar-main\
pip install .

Requeriments

cartolidar requires Python 3.7 or higher.

See other package requirements in requirements.txt.

Use

From the command line (cmd or bash)

a) Run cartolidar package:

python -m cartolidar [options]

It starts the main menu with the avaliable tools

Se inicia el menu principal con las herramientas disponibles en cartolidar:

Inicialmente solo está disponible la herramienta qlidtwins

    options:
        -h, --help          show this help message and exit

-h, --help show this help message and exit -v, --verbose set verbosity level [default: False] -V, --version show program's version number and exit -a ACCIONPRINCIPAL 0. Show main menu; 1. qlidtwins: buscar o verificar zonas analogas a una de referencia (con un determinado patron dasoLidar); 2. qlidmerge: integrar ficheros asc de 2x2 km en una capa tif unica (componer mosaico: merge). Default: 0 other options are tool-specific (see below).

b) It is also possible to run a tool (a module) without displayin the main menu (if the module is accesible). E.g.:

python qlidtwins.py [options]

    You can check options with:

python qlidtwins.py -h

A module is accesible if is called from its folder, is called with path_to_module or its folder is in the PATH environmental variable.

From python code

You can import packages, modules, classes of functions from a script.py or within the python interactive interpreter. Examples:

import cartolidar
from cartolidar import clidtools
from cartolidar.clidtools import clidtwins
from cartolidar.clidtools.clidtwins import DasoLidarSource

To execute module qlidtwins.py from python code:

from cartolidar import qlidtwins

In this case, there are no options: it runs with qlidtwins.cfg configuration (if exists) or by default.

Required inputs

Read Read the Docs - cartolidar for details.

clidtwins reads files in "asc" format (single vector layers) each with a dasoLidar variable (DLV).

Those files have to be named as: XXX_YYYY_*IdFileType*.asc where:

  • XXX, YYYY are UTM coordinates (miles) that identifies the location (the block).
    • XXX, YYYY are usually the upper-left corner of a 2x2 km square area
  • *IdFileType* is any string that includes a DVL identifier (like alt95, fcc05, etc.).

Example: 318_4738_alt95.asc and 320_4738_alt95.asc are two files with alt95 variable (blocks: 318_4738 and 320_4738).

If we want to process two blocks (318_4738 and 320_4738) with two DLVs (e.g. alt95 and fcc05), we need these files: 318_4738_alt95.asc, 318_4738_fcc05.asc, 320_4738_alt95.asc, 320_4738_fcc05.asc

It's also advisable to include a layer with forest type codes.

TODO: describe procedure

Use example with python code

Procedure:

  1. Import package (or Class) and instantiate DasoLidarSource Class:
from cartolidar.clidtools.clidtwins import DasoLidarSource
myDasolidar = DasoLidarSource()
  1. Delimit the prospecting area (optional):
myDasolidar.setRangeUTM(
    LCL_marcoCoordMiniX=CFG_marcoCoordMiniX,
    LCL_marcoCoordMaxiX=CFG_marcoCoordMaxiX,
    LCL_marcoCoordMiniY=CFG_marcoCoordMiniY,
    LCL_marcoCoordMaxiY=CFG_marcoCoordMaxiY,
)
  1. Search for dasoLidar files in the prospecting zone (if any):

First argument (LCL_listLstDasoVars) is a string with a sequence of DLV identifiers and second one (LCL_rutaAscRaizBase) is a path to look for the files with those DLV ids.

myDasolidar.searchSourceFiles(
    LCL_listLstDasoVars='Alt95,Fcc05,Fcc03',
    LCL_rutaAscRaizBase='C:/myAscFiles',
)

This method creates a property named inFilesListAllTypes. It is a list for every DLV, each with the list of found file tuples for that file type. It only includes files of blocks that have all the file types (one file type = one DLV). Every file tuple consist of a file path and file name.

  1. Create a raster (Tiff) file from the DLV found files:

The createMultiDasoLayerRasterFile method requires the name (with path) of the forest type or land cover type vector layer (e.g. Spanish Forest Map -MFE25-) and the name of the field (type int) with the forest or land cover type identifier (e.g. main species code).

myDasolidar.createMultiDasoLayerRasterFile(
    LCL_rutaCompletaMFE='C:/mfe25/24_mfe25.shp',
    LCL_cartoMFEcampoSp='SP1',
)
  1. Analyze the ranges of every DLV in the reference area:

The analyzeMultiDasoLayerRasterFile method requires the name (with path) of the vector file with the reference polygon for macthing (shp or gpkg). If it is ageopackage, the layer name is also required.

myDasolidar.analyzeMultiDasoLayerRasterFile(
    LCL_patronVectrName='C:/vector/CorralesPlots.gpkg,
    LCL_patronLayerName='plot01Quercus',
)
  1. Create new Tiff files with similar zones and proximity to reference one (patron):
myDasolidar.generarRasterCluster()

to be continued...

Ayuda Markdown de github Ayuda Markdown de markdownguide

Actions Status

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cartolidar-0.0a2.tar.gz (262.3 kB view hashes)

Uploaded Source

Built Distribution

cartolidar-0.0a2-py3-none-any.whl (268.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page