Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add aeroval configurations to be run on CI #1403

Draft
wants to merge 1 commit into
base: main-dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
253 changes: 253 additions & 0 deletions pyaerocom/aeroval/config/ciconfigs/base_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
"""
this module contains basic aeroval configurations for running on CI
"""

import copy
import logging

Check warning on line 6 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L5-L6

Added lines #L5 - L6 were not covered by tests

from pathlib import Path

Check warning on line 8 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L8

Added line #L8 was not covered by tests


logger = logging.getLogger(__name__)

Check warning on line 11 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L11

Added line #L11 was not covered by tests

# Constraints
DEFAULT_RESAMPLE_CONSTRAINTS = dict(

Check warning on line 14 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L14

Added line #L14 was not covered by tests
yearly=dict(monthly=9),
monthly=dict(
daily=21,
weekly=3,
),
daily=dict(hourly=18),
)

DEFAULT_RESAMPLE_CONSTRAINTS_DAILY = dict(

Check warning on line 23 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L23

Added line #L23 was not covered by tests
daily=dict(hourly=18),
)

# ODCSFUN_EEANRT = "EEAAQeRep.NRT;concpm10/EEAAQeRep.NRT;concpm25"
ODCSFUN_EEAV2 = "EEAAQeRep.v2;concpm10/EEAAQeRep.v2;concpm25"
ODCSFUN_EBAS = "EBASMC;concpm10/EBASMC;concpm25"

Check warning on line 29 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L28-L29

Added lines #L28 - L29 were not covered by tests

HOMEDIR = Path.home()
MYPEYAEROCOM_DIR = Path.home() / "MyPyaerocom"
MYPEYAEROCOM_DIR.mkdir(exist_ok=True)
TMP_DIR = Path.home() / "tmp"
TMP_DIR.mkdir(exist_ok=True)
JSON_DIR = Path.home() / "tmp" / "data"
JSON_DIR.mkdir(exist_ok=True)
COLDATA_DIR = Path.home() / "tmp" / "coldata"
COLDATA_DIR.mkdir(exist_ok=True)

Check warning on line 39 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L31-L39

Added lines #L31 - L39 were not covered by tests



def get_CFG(reportyear, year, model_dir) -> dict:

Check warning on line 43 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L43

Added line #L43 was not covered by tests
"""create aeroval configuration dict to run the variable
ratpm10pm25 (ratio pm10 vspm25)

:returns: a dict of a model configuration usable for EvalSetup
"""
# get current path for reference to local gridded_io_aux.py

CFG = dict(

Check warning on line 51 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L51

Added line #L51 was not covered by tests
json_basedir=JSON_DIR,
coldata_basedir=COLDATA_DIR,
# io_aux_file=os.path.abspath("/home/jang/data/aeroval-local-web/gridded_io_aux.py"), not needed for ReadMscwCtm
# io_aux_file=os.path.join(base_conf_path, "gridded_io_aux.py"),
# var_scale_colmap_file=os.path.abspath(
# "/home/jang/data/aeroval-local-web/pyaerocom-config/config_files/CAMEO/user_var_scale_colmap.ini"
# ),
# if True, existing colocated data files will be deleted and contours will be overwritten
reanalyse_existing=True,
only_json=False,
add_model_maps=False,
only_model_maps=False,
modelmaps_opts=dict(maps_freq="monthly", maps_res_deg=5),
clear_existing_json=False,
# if True, the analysis will stop whenever an error occurs (else, errors that
# occurred will be written into the logfiles)
raise_exceptions=False,
# Regional filter for analysis
filter_name="ALL-wMOUNTAINS",
# colocation frequency (no statistics in higher resolution can be computed)
ts_type="daily",
map_zoom="Europe",
freqs=[
"yearly",
"monthly",
"daily",
],
periods=[f"{year}"],
main_freq="monthly",
zeros_to_nan=False,
use_diurnal=True,
min_num_obs=DEFAULT_RESAMPLE_CONSTRAINTS,
colocate_time=True,
obs_remove_outliers=False,
model_remove_outliers=False,
harmonise_units=True,
regions_how="country",
annual_stats_constrained=True,
proj_id="emep",
exp_id=f"{reportyear}-reporting",
exp_name=f"Evaluation of EMEP runs for {reportyear} EMEP reporting",
exp_descr=(
f"Evaluation of EMEP runs for {reportyear} EMEP reporting. The EMEP model, simulated for {year}, is compared against observations from EEA and EBAS."
),
exp_pi="[email protected]",
public=True,
# directory where colocated data files are supposed to be stored
weighted_stats=True,
var_order_menu=[
# Gases
"ratpm10pm25",
"ratpm25pm10",
"concNno",
"concNno2",
"concNtno3",
"concNhno3",
"concNtnh",
"concNnh3",
"concnh4",
"concSso2",
"concso4t",
"concso4c",
"vmro3",
"vmro3max",
"vmro3mda8",
"vmrox",
"vmrco",
# PMs
"concpm10",
"concpm25",
"concno3pm10",
"concno3pm25",
"concnh4pm25",
"concso4pm25",
"concCecpm10",
"concCecpm25",
"concCocpm10", # SURF_ugC_PM_OMCOARSE missing in model-output
"concCocpm25",
"concsspm10",
"concsspm25",
# Depositions
"wetrdn",
"wetoxs",
"wetoxn",
"prmm",
],
)

CFG["model_cfg"] = {

Check warning on line 140 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L140

Added line #L140 was not covered by tests
"EMEPcameo": dict(
model_id="EMEP,",
model_data_dir=model_dir,
gridded_reader_id={"model": "ReadMscwCtm"},
# model_read_aux={},
model_ts_type_read="daily",
),
}

"""

Check warning on line 150 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L150

Added line #L150 was not covered by tests
Filters
"""

BASE_FILTER = {

Check warning on line 154 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L154

Added line #L154 was not covered by tests
"latitude": [30, 82],
"longitude": [-30, 90],
}

EBAS_FILTER = {

Check warning on line 159 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L159

Added line #L159 was not covered by tests
**BASE_FILTER,
"data_level": [None, 2],
"set_flags_nan": True,
}

OBS_GROUNDBASED = {

Check warning on line 165 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L165

Added line #L165 was not covered by tests
##################
# EBAS
##################
"EBAS-d-10": dict(
obs_id="EBASratd10",
web_interface_name="EBAS-d",
obs_vars=["ratpm10pm25"],
obs_vert_type="Surface",
colocate_time=True,
min_num_obs=DEFAULT_RESAMPLE_CONSTRAINTS,
ts_type="daily",
obs_filters=EBAS_FILTER,
obs_type="ungridded",
obs_merge_how={
"ratpm10pm25": "eval",
},
obs_aux_requires={
"ratpm10pm25": {
"EBASMC": [
"concpm10",
"concpm25",
],
}
},
obs_aux_funs={
"ratpm10pm25":
# variables used in computation method need to be based on AeroCom
# units, since the colocated StationData objects (from which the
# new UngriddedData is computed, will perform AeroCom unit check
# and conversion)
"(EBASMC;concpm10/EBASMC;concpm25)"
},
obs_aux_units={"ratpm10pm25": "1"},
),
"EBAS-d-25": dict(
obs_id="EBASratd25",
web_interface_name="EBAS-d",
obs_vars=["ratpm25pm10"],
obs_vert_type="Surface",
colocate_time=True,
min_num_obs=DEFAULT_RESAMPLE_CONSTRAINTS,
ts_type="daily",
obs_filters=EBAS_FILTER,
obs_type="ungridded",
obs_merge_how={
"ratpm25pm10": "eval",
},
obs_aux_requires={
"ratpm25pm10": {
"EBASMC": [
"concpm10",
"concpm25",
],
}
},
obs_aux_funs={
"ratpm25pm10":
# variables used in computation method need to be based on AeroCom
# units, since the colocated StationData objects (from which the
# new UngriddedData is computed, will perform AeroCom unit check
# and conversion)
"(EBASMC;concpm25/EBASMC;concpm10)"
},
obs_aux_units={"ratpm25pm10": "1"},
),
"EBAS-d-tc": dict(
obs_id="EBASMC",
web_interface_name="EBAS-d",
obs_vars=[
"concpm10",
"concpm25",
],
obs_vert_type="Surface",
colocate_time=True,
min_num_obs=DEFAULT_RESAMPLE_CONSTRAINTS,
ts_type="daily",
obs_filters=EBAS_FILTER,
),
}

# Setup for supported satellite evaluations
OBS_SAT = {}

Check warning on line 247 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L247

Added line #L247 was not covered by tests

OBS_CFG = {**OBS_GROUNDBASED, **OBS_SAT}

Check warning on line 249 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L249

Added line #L249 was not covered by tests

CFG["obs_cfg"] = OBS_CFG

Check warning on line 251 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L251

Added line #L251 was not covered by tests

return copy.deepcopy(CFG)

Check warning on line 253 in pyaerocom/aeroval/config/ciconfigs/base_config.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/config/ciconfigs/base_config.py#L253

Added line #L253 was not covered by tests
Loading