Skip to content
Merged
2 changes: 2 additions & 0 deletions doc/sphinx/source/input.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ A list of the datasets for which a cmorizers is available is provided in the fol
+------------------------------+------------------------------------------------------------------------------------------------------+------+-----------------+
| ESACCI-SST | ts, tsStderr (Amon) | 2 | NCL |
+------------------------------+------------------------------------------------------------------------------------------------------+------+-----------------+
| ESACCI-WATERVAPOUR | prw (Amon) | 3 | Python |
+------------------------------+------------------------------------------------------------------------------------------------------+------+-----------------+
| ESRL | co2s (Amon) | 2 | NCL |
+------------------------------+------------------------------------------------------------------------------------------------------+------+-----------------+
| FLUXCOM | gpp (Lmon) | 3 | Python |
Expand Down
34 changes: 34 additions & 0 deletions esmvaltool/cmorizers/obs/cmor_config/ESACCI-WATERVAPOUR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# Common global attributes for Cmorizer output


# Input
# CDR-2
filename: 'ESACCI-WATERVAPOUR-L3S-TCWV-*-05deg-{year}{month}-fv3.1.nc'
# CDR-1
# filename: 'dataset3_1/CDR-1/monthlies/ESACCI-WATERVAPOUR-L3?-TCWV-*-05deg-{year}{month}-fv3.1.nc'
attributes:
dataset_id: ESACCI-WATERVAPOUR
# CDR-2
version: 'CDR2-L3S-05deg_fv3.1'
# CDR-1
# version: 'CDR1-L3-05deg_fv3.1'
tier: 3
modeling_realm: sat
project_id: OBS
source: "ftp.brockmann-consult.de, access currently restricted"
reference: ["esacci-watervapour"]
comment: "Preliminary data."

# Variables to cmorize (here use only filename prefix)
variables:
prw:
mip: Amon
raw: tcwv
# Output automatially added: Amon_<var>_200910-200910.nc
# CDR-2
file: OBS_ESACCI-WATERVAPOUR-CDR2-L3S-TCWV-05deg
# CDR-1
# file: OBS_ESACCI-WATERVAPOUR-CDR1-L3-TCWV-05deg
start_year: 2003
end_year: 2017
84 changes: 84 additions & 0 deletions esmvaltool/cmorizers/obs/cmorize_obs_esacci_watervapour.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
"""ESMValTool CMORizer for ESACCI-WATERVAPOUR data.

Tier
Tier 3: currently still restricted because preliminary.

Source
Marc Schröder, ftp.brockmann-consult.de

Last access
20210329

Download and processing instructions
FTP server: ftp.brockmann-consult.de, access currently restricted
data/tcwv/dataset3_1/CDR-*/...
All files need to be in one directory, not in yearly subdirectories.

Modification history
20210607-weigel_katja: Fix for monthly time bounds.
20210408-weigel_katja: written.

"""

import logging
import os

import iris

from esmvalcore.preprocessor import concatenate
from esmvalcore.cmor.check import _get_time_bounds
from esmvaltool.cmorizers.obs.utilities import (convert_timeunits, fix_coords,
fix_var_metadata,
save_variable, set_global_atts)

logger = logging.getLogger(__name__)


def extract_variable(var_info, raw_info, attrs, year):
"""Extract to all vars."""
cubes = iris.load(raw_info['file'])
rawvar = raw_info['name']

for cube in cubes:
if cube.var_name == rawvar:
fix_var_metadata(cube, var_info)
convert_timeunits(cube, year)
fix_coords(cube, overwrite_time_bounds=False)
set_global_atts(cube, attrs)
# Remove disfunctional ancillary data without sandard name
for ancillary_variable_, dim in cube._ancillary_variables_and_dims:
cube.remove_ancillary_variable(ancillary_variable_)
return cube


def cmorization(in_dir, out_dir, cfg, _):
"""Cmorize data."""
# cmor_table = cfg['cmor_table']
glob_attrs = cfg['attributes']

# run the cmorization
for var, vals in cfg['variables'].items():
var_info = cfg['cmor_table'].get_variable(vals['mip'], var)
glob_attrs['mip'] = vals['mip']
raw_info = {'name': vals['raw'], 'file': vals['file']}
inpfile = os.path.join(in_dir, cfg['filename'])
logger.info("CMORizing var %s from file type %s", var, inpfile)
# years = range(vals['start_year'], vals['end_year'] + 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okease remove commented out code if not needed anymore

months = ["0" + str(mo) for mo in range(1, 10)] + ["10", "11", "12"]
for year in range(vals['start_year'], vals['end_year'] + 1):
monthly_cubes = []
for month in months:
raw_info['file'] = inpfile.format(year=year, month=month)
logger.info("CMORizing var %s from file type %s", var,
raw_info['file'])
monthly_cubes.append(extract_variable(var_info, raw_info,
glob_attrs, year))
yearly_cube = concatenate(monthly_cubes)
# Fix monthly time bounds
time = yearly_cube.coord('time')
time.bounds = _get_time_bounds(time, 'mon')
save_variable(yearly_cube,
var,
out_dir,
glob_attrs,
unlimited_dimensions=['time'])
11 changes: 11 additions & 0 deletions esmvaltool/recipes/examples/recipe_check_obs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,17 @@ diagnostics:
scripts: null


ESACCI-WATERVAPOUR:
description: ESACCI-WV check
variables:
prw:
additional_datasets:
- {dataset: ESACCI-WATERVAPOUR, project: OBS, mip: Amon, tier: 3,
type: sat, version: CDR2-L3S-05deg_fv3.1,
start_year: 2003, end_year: 2017}
scripts: null


GRACE:
description: GRACE check
variables:
Expand Down
10 changes: 10 additions & 0 deletions esmvaltool/references/esacci-watervapour.bibtex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@misc{esacci-watervapour,
doi = {CCIWV.REP.015},
url = {https://climate.esa.int/documents/357/Water_Vapour_cci_D4.2_CRDP_v2.1.pdf},
year = 2020,
month = {october},
publisher = {ESA / ECSAT},
issue = {2.1},
author = {Michaela Hegglin, Olaf Danne, Marc Schröder, Hao Ye},
title = {Climate Research Data Package (CRDP) Water Vapour Climate Change Initiative (WV{\_}cci)- CCI+ Phase 1}
}