Skip to content

bochens/MPyLab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

126 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: MIT Version

MPyLab

Python toolkit for reading, plotting, and analyzing Micropulse Lidar data. Pronounce as Am-p-lab

This toolkit took inspiration and modified code from peterkuma's project: https://github.com/peterkuma/mpl2nc which can read .mpl binary files and output netcdf files.

Development Plan:

Note: the code is still in development and not fully tested.

  • pympl.py: Reading, Processing, and Interpolating .mpl data (In development)
    • Reading .MPL binary data files.
    • Reading afterpulse, overlap, and deadtime correction .bin files.
    • Function for interpolating lidar data to even timesteps and fill in NaN in any time timestamps.
    • Data selection based on start-time and end-time.
    • Calculate SNR, R2 corrected, NRB, and Depol Ratio
    • Output .MPL binary data (useful when need to combine or make modification to the binary data files)
  • plotmpl.py: Ploting mpl data
    • Function for 2d timeseries plot
    • Function for 1d timeseries plot
    • Function for single and average profile plot

Documentation

Micropulse Lidar data reading and processing

Micropulse Lidar data visualization

Example Usage

Here's an example usage of this toolkit for reading and plotting NRB data:

from pympl import PyMPL
import plotmpl
import matplotlib.pyplot as plt
import numpy as np

# Specify input file path
mpl_file_path = '/Path/to/mpl-folder'
ap_file_path  = '/Path/to/afterpulse-file.bin'
ov_file_path  = '/Path/to/overlap-file.bin'
dt_file_path  = '/Path/to/deadtime-file.bin'

# Create a MPL data object. All the basic corrections and calculations (like NRB) is done at the initialization of the MPL data object
mpl_object = PyMPL(mpl_file_path, ap_file_path, ov_file_path, dt_file_path)

# Peform interpolation over user specified datetime
mpl_object.interpolate_data(60, start_time = np.datetime64('YYYY-MM-DDThh:mm:ss'), end_time = np.datetime64('YYYY-MM-DDThh:mm:ss')) # here uses 60 seconds as interpolation time resolution

# Plot the non-interpolated copol nrb data using default colormap
fig0, ax0 = plt.subplots(nrows=1, ncols=1, figsize=(10,4))
plotmpl.plot_mpl_2d_timeseries(mpl_object.datetime, mpl_object.range, mpl_object.nrb_copol, fig=fig0, ax=ax0, range_max = 5, vmin=0, vmax=1)
ax0.set_title('copol nrb')

# Plot the interpolated copol nrb data using modified gist_ncar colormap
fig1, ax1 = plt.subplots(nrows=1, ncols=1, figsize=(10,4))
plotmpl.plot_mpl_2d_timeseries(mpl_object.interpolated_datetime, mpl_object.range, mpl_object.interpolated_nrb_copol, fig=fig1, ax=ax1, range_max = 5, vmin=0, vmax=1, color_map = plotmpl.lidar_gist)
ax1.set_title('interpolated copol nrb')

plt.show()

Example Gallery

space-1.jpg
NRB data collected during DOE TRACER project by TAMU mobile lab. The gaps show when lidar was off and the gaps in timestamps are handled by the interpolation function.

About

Python toolkit for reading, plotting, and analyzing Micropulse Lidar data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages