Skip to content

Commit

Permalink
some intial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisblake committed Aug 1, 2023
1 parent 2104317 commit add57d3
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pyaerocom/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ class Config:
#: MEP name
MEP_NAME = "MEP"

#: ICOS name
ICOS_NAME = "ICOS"

#: boolean specifying wheter EBAS DB is copied to local cache for faster
#: access, defaults to True
EBAS_DB_LOCAL_CACHE = True
Expand Down Expand Up @@ -193,7 +196,6 @@ class Config:
_LUSTRE_CHECK_PATH = "/project/aerocom/aerocom1/"

def __init__(self, config_file=None, try_infer_environment=True):

# Directories
self._outputdir = None
self._cache_basedir = None
Expand Down Expand Up @@ -278,7 +280,6 @@ def _basedirs_search_db(self):
return [self.ROOTDIR, self.HOMEDIR]

def _infer_config_from_basedir(self, basedir):

basedir = os.path.normpath(basedir)
for env_id, chk_sub in self._check_subdirs_cfg.items():
chkdir = os.path.join(basedir, chk_sub)
Expand Down
6 changes: 5 additions & 1 deletion pyaerocom/data/paths.ini
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ EEA_V2 = ${BASEDIR}/aerocom/aerocom1/AEROCOM_OBSDATA/EEA_AQeRep.v2/renamed/
AIR_NOW = ${BASEDIR}/aerocom/aerocom1/AEROCOM_OBSDATA/MACC_INSITU_AirNow
MARCO_POLO = ${BASEDIR}/aerocom/aerocom1/AEROCOM_OBSDATA/CHINA_MP_NRT
MEP = ${BASEDIR}/aerocom/aerocom1/AEROCOM_OBSDATA/MEP/aggregated/
# LB: NOTE ICOS path exists but is not populated yet
ICOS = ${BASEDIR}/aerocom/aerocom1/AEROCOM_OBSDATA/ICSO/aggregated/

[obsnames]
#names of the different obs networks
Expand Down Expand Up @@ -147,6 +149,7 @@ EEA_V2 = EEAAQeRep.v2
AIR_NOW = AirNow
MARCO_POLO = MarcoPolo
MEP = MEP
ICOS = ICOS

[parameters]
#parameters definition
Expand Down Expand Up @@ -183,4 +186,5 @@ EEA = 2013
EARLINET = 2000
EEA_NRT = 2020
EEA_V2 = 2016
MEP = 2013
MEP = 2013
ICOS = 2008
Empty file.
74 changes: 74 additions & 0 deletions pyaerocom/plugins/icos/reader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
from __future__ import annotations

import logging
import re
from collections import defaultdict
from collections.abc import Iterable
from functools import cached_property, lru_cache
from pathlib import Path

import xarray as xr

from pyaerocom import const

from pyaerocom.plugins.mep import ReadMEP


class ReadICOS(ReadMEP):
"""Class for reading ICOS (CO2) observations. HARP format so based on MEP reader
Args:
ReadMEP (class): Base class for this reader, based on ReadUngriddedBase
"""

#: Mask for identifying datafiles
_FILEMASK = "icos-co2-*.nc"

#: Version log of this class (for caching)
__version__ = "0.01"

#: Name of the dataset (OBS_ID)
DATA_ID = const.ICOS_NAME

#: List of all datasets supported by this interface
SUPPORTED_DATASETS = [DATA_ID]

#: There is no global ts_type but it is specified in the data files...
TS_TYPE = "variable"

#: sampling frequencies found in data files
TS_TYPES_FILE = {"hour": "hourly", "day": "daily"}

#: field name of the start time of the measurement (in lower case)
START_TIME_NAME = "datetime_start"

#: filed name of the end time of the measurement (in lower case)
END_TIME_NAME = "datetime_stop"

#: there's no general instrument name in the data
INSTRUMENT_NAME = "unknown"

DATA_PRODUCT = ""

#: functions used to convert variables that are computed
AUX_FUNS = {}

VAR_MAPPING = {"vmrco2": "CO2_volume_mixing_ratio"}

STATION_REGEX = re.compile(
"icos-co2-nrt-(.*A)-.*.nc"
) # LB: this needs checking. Don't think it's right

DEFAULT_VARS = list(VAR_MAPPING)

DATASET_NAME = DATA_ID

PROVIDES_VARIABLES = list(VAR_MAPPING) + list(AUX_FUNS)

def __init__(self, data_id=None, data_dir=None):
if data_dir is None:
data_dir = const.OBSLOCS_UNGRIDDED[const.ICOS_NAME]

super().__init__(data_id=data_id, data_dir=data_dir)
self.files = sorted(map(str, self.FOUND_FILES))

0 comments on commit add57d3

Please sign in to comment.