Parser for Licel binary format — lidar measurement profiles (analog & photon counting)
Project description
licelformat
Parser for Licel binary format files — a common data format in atmospheric lidar remote sensing. Reads analog and photon‑counting measurement profiles, extracts metadata, and provides scaling/unscaling consistent with the reference Go implementation.
Features
- Parse Licel
.dat/.licelfiles with full header + binary profile extraction - Scale raw ADC counts → millivolts and raw photon counts → MHz
- Round‑trip: save → reload preserves data losslessly (unscale on write)
- Multi‑file loading via glob masks and ZIP archives
- Profile selection by wavelength and channel type
- NumPy arrays for all profile data — ready for further analysis
Installation
pip install licelformat
Quick start
Load a single Licel file
from licelformat import LoadLicelFile
lf = LoadLicelFile("path/to/file.DAT")
print(lf.MeasurementSite) # "Vladivos"
print(lf.MeasurementStartTime) # datetime(2020, 2, 10, 19, 22, 35)
print(len(lf.Profiles)) # 12
# First profile
p = lf.Profiles[0]
print(p.Wavelength) # 355.0
print(p.Photon) # False (analog channel)
print(p.NShots) # 2001
print(p.Data[:5]) # numpy float64 array, units: mV or MHz
Select profiles by wavelength
# Pick the 355 nm photon‑counting channel
profile = lf.select_certain_wavelength(is_photon=True, wavelength=355.0)
Batch processing with LicelPack
from licelformat import NewLicelPack
pack = NewLicelPack("/data/2020/*.DAT")
profiles = pack.select_certain_wavelength(is_photon=True, wavelength=532.0)
for p in profiles:
print(p.Data.mean())
Load from a ZIP archive
from licelformat import NewLicelPackFromZip
pack = NewLicelPackFromZip("archive.zip")
Data scaling
Raw int32 values stored on disk are automatically scaled during loading:
| Channel type | Scale factor | Result unit |
|---|---|---|
| Analog | DiscrLevel × 1000 / (2^AdcBits × NShots) |
mV |
| Photon | 1 / (NShots × 0.05) |
MHz |
When saving, the inverse scaling is applied (round(scaled / scale)), so
round‑trip is lossless.
API reference
licelformat.LicelProfile
| Field | Type | Description |
|---|---|---|
Active |
bool |
Channel active flag |
Photon |
bool |
True for photon counting |
LaserType |
int |
Laser index (1, 2, 3) |
NDataPoints |
int |
Number of bins |
Reserved |
list |
3 reserved values |
HighVoltage |
int |
PMT high voltage (V) |
BinWidth |
float |
Range bin width (m) |
Wavelength |
float |
Laser wavelength (nm) |
Polarization |
str |
"o", "s", or "" |
BinShift |
int |
Bin shift |
DecBinShift |
int |
Decimal bin shift |
AdcBits |
int |
ADC resolution (bits) |
NShots |
int |
Number of laser shots |
DiscrLevel |
float |
Discriminator level (mV) |
DeviceID |
str |
2‑char device ID |
NCrate |
int |
Crate slot number |
Data |
np.ndarray |
Scaled float64 profile data |
Methods: metadata(), profile(), scale_factor(), to_dict()
licelformat.LicelFile
Fields: MeasurementSite, MeasurementStartTime, MeasurementStopTime,
AltitudeAboveSeaLevel, Longitude, Latitude, Zenith, Laser1NShots,
Laser1Freq, Laser2NShots, Laser2Freq, NDatasets, Laser3NShots,
Laser3Freq, FileLoaded, Profiles
Methods: select_certain_wavelength(), save(), to_dict()
licelformat.LicelPack
Fields: StartTime, Data (dict of LicelFile)
Methods: select_certain_wavelength(), save(), to_dict()
Module‑level functions
| Function | Description |
|---|---|
LoadLicelFile(path) |
Load a single Licel file from disk |
LoadLicelFileFromReader(r) |
Load from a binary stream |
NewLicelPack(mask) |
Load all files matching a glob pattern |
NewLicelPackFromZip(path) |
Load all valid files from a ZIP archive |
License
LGPL v3 or later. See LICENSE for details.
Related projects
This is a Python port of the Go package
github.com/physicist2018/licelfile.
Both packages produce bit‑identical results on the same input files.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file licelformat-0.1.1.tar.gz.
File metadata
- Download URL: licelformat-0.1.1.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
246669c2c3255111a2ce30e1fbae552c4ba87fb3fb2173aa4cc9eb3aedea93c6
|
|
| MD5 |
6fa0f17e4b1ac9938c0980ec16725120
|
|
| BLAKE2b-256 |
241a444e882bf6e0ba21ed846c863c6cc4d78f6c8e8b98c91451f13ed757ce2f
|
File details
Details for the file licelformat-0.1.1-py3-none-any.whl.
File metadata
- Download URL: licelformat-0.1.1-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b353bde9eecb9ea1684f943a41722309cf1f7121655b795c095ec803e709cb1
|
|
| MD5 |
8b438e23b8c781b48548fc7c5b833d09
|
|
| BLAKE2b-256 |
10289e0f14fff79bf05ae56944d2e3481e12de36ef6ecad8858e311de7a17c00
|