Getting Started with Micromet
Micromet is a Python package for processing micrometeorological data from environmental monitoring stations. It provides utilities for formatting, validating, and analyzing data from sources such as AmeriFlux and Campbell Scientific systems.
This guide walks you through installation, basic usage, and how to start working with your own data.
Installation
Micromet is available on PyPI and can be installed using pip:
pip install micromet
Alternatively, if you want to use the latest development version, you can install it directly from GitHub:
pip install git+https://github.com/inkenbrandt/MicroMet.git
MicroMet is also available as a conda package. You can install it using the following command:
conda install -c conda-forge micromet
Micromet can be installed from source. First, clone the repository:
git clone https://github.com/inkenbrandt/MicroMet.git
cd MicroMet
It’s recommended to use a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
Install the package with optional documentation and development dependencies:
pip install -e .[docs,test]
Usage Overview
Micromet consists of modular tools for reformatting and analyzing micrometeorological data. Here’s a basic example to get started:
from micromet.format.reformatter import Reformatter
# Load your raw data into a pandas DataFrame
import pandas as pd
df = pd.read_csv("path/to/your/data.csv")
# Create a Reformatter instance and process the data
ref = Reformatter()
cleaned_df, report = ref.prepare(df, data_type='eddy')
# Now cleaned_df contains the cleaned and normalized data
print(cleaned_df.head())
Modules
The key subpackages and modules in Micromet are:
format— Data formatting subpackage:reformatter— MainReformatterclass for cleaning and standardizing datafile_compile— Utilities for compiling multiple raw.datfiles into a single datasetmerge— Functions for merging eddy covariance and met data streamscompare— Instrument comparison and cross-correlation functionsheaders— Utilities for detecting and applying missing headers across filestransformers— Data transformation submodule (columns,timestamps,corrections,validation,cleanup,interval_updates)
qaqc— Quality assurance and control subpackage:variable_limits— Physical and plausible range definitions for all variablesnetrad_limits— Net radiation QA/QC and timestamp alignmentdata_cleaning— QC flag application and data cleaning
report— Reporting and visualization subpackage:graphs— Plotting functions (energy Sankey diagrams, instrument comparison scatter plots)tools— Utility functions for analysis (irrigation event detection, gap finding)validate— Data validation, lag detection, and sensor intercomparisonfix_g_values— Soil heat flux storage correctionsrecalculate_albedo— Albedo recalculation utilitiesgap_summary— Gap analysis and reportingeddy_plots— Eddy covariance diagnostic plotseasyflux_footprint— Flux footprint analysisalfalfa_growth— Alfalfa height modeling from growing degree days
reader—AmerifluxDataProcessorfor reading AmeriFlux and TOA5 data filesstation_data_pull—StationDataDownloaderandStationDataProcessorfor managing station data
Note
The notebooks/ directory contains worked examples and is not part of the core API. See Example Notebooks for a guide to the available notebooks.
Contributing
We welcome contributions! If you have suggestions, bug reports, or would like to add features:
Fork the repository
Create a new branch
Submit a pull request
Please make sure to add unit tests for new functionality and follow PEP8 standards.