先前的还原操作

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.

继续我过去编写的一系列代码,并停留在Github上,但从未真正谈论过……这篇文章是关于PyMicrotops的 :一个用于处理Microtops Sun Photometer数据的Python库。

Microtops

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!).

Microtops(如上图所示)测量来自多个窄波段的太阳光,然后计算各种大气参数,包括气溶胶光学厚度(AOT)和可沉淀水含量(PWC)。 该仪器具有自己的内置数据记录器,并且可以通过串行连接将存储的数据下载到计算机上(是的,它是一个相当旧的但非常好的工具包!)。

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.

在过去的几年中,我在Microtops仪器上做了很多工作,并整理了PyMicrotops库来帮助我。 它的功能可以分为两个主要部分:从仪器下载Microtops数据,然后处理数据本身。

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:

如今,很难从Microtops仪器下载数据-因为制造商提供的原始软件似乎不再起作用。 但是,使用PyMicrotops很容易–只需从终端或以下Python代码段运行read_microtops

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).

根据需要更改端口(在Linux / Mac上可能需要/ dev / serial0之类的名称 )和文件名。

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:

读取数据后,您可以在Python中轻松轻松地处理数据。 如果使用上面的Python代码片段阅读它,那么您已经创建了m对象,但是如果没有,请运行以下代码:

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.

所有输出均以Pandas Series或DataFrames的形式返回,如果您想进行更高级的处理,则可以访问从文件读取的原始数据,即m.data

翻译自: https://www.pybloggers.com/2016/01/previously-unpublicised-code-pymicrotops/

先前的还原操作

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐