lair.noaa.GMLData#
- class lair.noaa.GMLData(specie, site, platform='surface', sample_type='flask', lab_id=1, measurement_group='ccgg', frequency='event', driver='pandas', gml_dir=None)[source]#
NOAA GML Data
One file of NOAA GML’s measurements of one gas at one site: every sample (
frequency='event') or monthly means ('month').Each parameter is also an attribute of the same name.
- Parameters:
specie (str) – The greenhouse gas specie, in lower case as in NOAA’s file names (
'ch4').site (str) – The site where the flask samples were collected, its code in lower case (
'uta').platform (str, optional) – The platform where the flask samples were collected, by default ‘surface’.
sample_type (str, optional) – The sample type, by default ‘flask’. Use ‘pfp’ for Portable Flask Package data.
lab_id (int, optional) – The lab ID, by default 1.
measurement_group (str, optional) – The measurement group, by default ‘ccgg’.
frequency (str, optional) – The frequency of the measurements, by default ‘event’.
driver (str, optional) – The driver to use to read the data, by default ‘pandas’: a DataFrame from the
.txtfile, or'xarray': a Dataset from the.ncfile.gml_dir (str, optional) – The NOAA GML data root, by default
$LAIR_GML_DIR.
- Variables:
Notes
The file is read from, and
download()saves it to, one folder per species and sample type in the data root.specieandsiteare names in the file name, so spell them as NOAA does, in lower case ('ch4','uta'):$LAIR_GML_DIR/ ch4/ flask/ ch4_uta_surface-flask_1_ccgg_event.txt ch4_uta_surface-flask_1_ccgg_month.txt pfp/ ch4_mbo_surface-pfp_1_ccgg_event.txtEach name is
{specie}_{site}_{platform}-{sample_type}_{lab_id}_{measurement_group}_{frequency}and.txtfordriver='pandas'or.ncfordriver='xarray'.download()copies the file of that name from NOAA GML’s FTP server (/data/trace_gases/{specie}/{sample_type}/{platform}/{ext}/).See also
GMLData.apply_qaqcKeeps the samples with good flags.
CarbonTrackerNOAA’s model, for a background.
Examples
Making one reads nothing; it names the file:
>>> from lair.noaa import GMLData >>> uta = GMLData("ch4", "uta", gml_dir="gml") >>> uta.filepath.as_posix() 'gml/ch4/flask/ch4_uta_surface-flask_1_ccgg_event.txt'
Then
uta.download()fetches it anduta.datareads it.
Attributes
The file's data, read once. |
Methods
|
Apply QA/QC filtering. |
|
Download the file from NOAA GML's FTP server and return its path. |