frappedata

frappedata is the FRAPPE dataset connector for boxmox.

The Front Range Air Pollution and Photochemistry Experiment (FRAPPE) field campaign (https://www2.acom.ucar.edu/frappe) has been conducted in 2014 in Colorado (USA). The frappedata python package provides a connector to the merge files created from the research aircraft observations of the field campaign.

A set of expert-selected “extracts” are included in the package to conduct simulations under varying environmental conditions.

Installation

pip install frappedata

To use a merge file, download it from the FRAPPE website, and see the example below for usage information.

Examples

Using the extracts:

import frappedata
extracts = frappedata.ExtractsDataset()

# see which extracts we know:
extract.tags
# ['BIOGENIC', 'COMMERCE_CITY', 'DENVER', 'DENVER_AVE', ...

# get the local time of the COMMERCE_CITY extract:
extracts.get_timestamp(tag='COMMERCE_CITY')
# datetime.datetime(2014, 8, 18, 9, 2, 23, 560973)

# acetaldehyde concentration as measured by TOGA in COMMERCE_CITY sample:
extracts.get_var('Acetaldehyde_TOGA', 'COMMERCE_CITY')
# 1682.0

# and its units?
extracts.get_units('Acetaldehyde_TOGA')
# pptv

Working with a merge file:

import frappedata
merge = frappedata.MergesDataset('path/to/example/frappe-mrg10-c130_merge_20140726_R2_thru20140818.ict')

import datetime

# get all data between 15:00 and 15:10 on 29 July 2014
starttime = datetime.datetime(year=2014, month=07, day=29, hour=15, minute=00)
endtime   = datetime.datetime(year=2014, month=07, day=29, hour=15, minute=10)

# is this actually a valid time frame? Do we have at least some data?
merge.valid(starttime=starttime, endtime=endtime)
# True

merge.get_var('Acetaldehyde_TOGA', starttime=starttime, endtime=endtime, avg=False)
# [509.0, 509.0, 509.0, 509.0, nan, nan, nan, nan, nan, nan, nan, 449.0, 449.0, 449.0, ...

# OK, just give me the average
merge.get_var('Acetaldehyde_TOGA', starttime=starttime, endtime=endtime)
# 335.8181818181818

API

ExtractsDataset

class frappedata.ExtractsDataset
get_data(tag, avg=False, **kwargs)

Return all data for a given tag, potentially time-averaged (avg=True)

get_timestamp(**kwargs)

Returns average time stamp (datetime.datetime) for the tag

get_units(vars)

Return units of one or several dataset variables (<vars>)

get_var(varname, tag, avg=True, **kwargs)

Return data for a given variable in a given tag, potentially time averaged (avg=True)

valid(tag)

Is a given tag found in the dataset?

photrates_used

List photolysis rate measurements in dataset that have been determined useful for genBOX processing

species_used

List chemical observations in dataset that have been determined useful for genBOX processing

tags

Returns list of tags (‘extracts’) that are available

MergesDataset

class frappedata.MergesDataset(merge_file)
get_data(starttime=None, endtime=None, specs=None, avg=False, **kwargs)

Return all data (for a given time frame), potentially time-averaged (avg=True)

get_timestamp(starttime=None, endtime=None, **kwargs)

Returns average time stamp (datetime.datetime) for the selected time frame or the whole dataset if no time frame is given

get_units(vars)

Return units of one or several dataset variables (<vars>)

get_var(spec, starttime=None, endtime=None, avg=True, **kwargs)

Return data for a given variable (for a given time frame), potentially time averaged (avg=True)

valid(starttime, endtime, **kwargs)

Checks whether at least one data line falls within the time frame

photrates_used

List photolysis rate measurements in dataset that have been determined useful for genBOX processing

species_used

List chemical observations in dataset that have been determined useful for genBOX processing