Previously Unpublicised Code: PyMicrotops
Continuing my series of code that I’ve written in the past, and stuck up on Github, but never actually talked about…this post is about PyMicrotops: a Python library for processing data from the Microtops Sun Photometer.
The Microtops (pictured above) measures light coming from the sun in a number of narrow wavebands, and then calculates various atmospheric parameters including the Aerosol Optical Thickness (AOT) and Precipitable Water Content (PWC). The instrument has it’s own built-in data logger, and the stored data can be downloaded by a serial connection to a computer (yes, it’s a fairly old – but very good – piece of kit!).
I’ve done a lot of work with Microtops instruments over the last few years, and put together the PyMicrotops library to help me. It’s functionality can be split into two main parts: downloading Microtops data from the instrument, and then processing the data itself.
Downloading the data from the Microtops instrument is difficult to do these days – as the original software provided by the manufacturer seems to no longer work. However, with PyMicrotops it is easy – just run read_microtops from the terminal, or the following snippet of Python code:
from PyMicrotops import Microtops m = Microtops.read_from_serial('COM3', 'output_filename.csv')
Changing the port (you may want something like /dev/serial0 on Linux/Mac) and filename as appropriate).
Once you’ve read the data you can process it nice and easily in Python. If you read it using the Python code snippet above then you’ll already have the m object created, but if not then run the code below:
from PyMicrotops import Microtops m = Microtops('filename.csv')
You can then do a range of useful tasks with the data, for example:
# Plot all of the AOT data m.plot() # Plot for a specific time period m.plot('2014-07-10','2014-07-19') # Get AOT at a specific wavelength - interpolating # if needed, using the Angstrom coefficient m.aot(550)
All outputs are returned as Pandas Series or DataFrames, and if you want to do more advanced processing then you can access the raw data read from the file as m.data.
PyMicrotops can be installed from PyPI by running pip install PyMicrotops, and the code is available on Github, which is also where any bug reports/feature requests should be posted.
Categorised as: Academic, Previously Unpublicised Code, Programming, Python, Remote Sensing
[…] sourcesÂ online. If you’ve got Microtops data that you want to process then have a look at my PyMicrotops module that makes the process a lot […]
[…] If you’ve got Microtops data that you want to process then have a look at my PyMicrotops module that makes the process a lot […]