index_calculator.outputwriter

class index_calculator.outputwriter(postproc_obj=None, output_name=True, output_dir='.', drs=True, **kwargs)

Class for writing xarray.Dataset to disk. Get default project-specific output name.

Parameters:
  • postproc_obj (index_calculator.postprocessing or list) – index_calculator.postprocessing object

  • output_name (bool or str (default: True), optional) – If True get project-specific output name. If str set output_name to that string.

  • output_dir (str (default: “.”), optional) – Set output directory

  • drs (bool (default: True), optional) – If True create project-specific directory structure

Example

Write climate indicator dataset to disk:

from pyhomogenize import open_xrdataset
from index_calculator import preprocessing
from index_calculator import processing
from index_calculator import postprocessing
from index_calculator import outputwriter

netcdf_file = "tas_EUR-11_MPI-M-MPI-ESM-LR_historical_r3i1p1_"
              "GERICS-REMO2015_v1_day_20010101-20051231.nc"
ds = open_xrdataset(netcdf_file)

preproc = preprocessing(ds)
proc = processing(index="TG", preproc_obj=preproc)
postproc = postprocessing(
    project="CORDEX",
    proc_obj=proc,
    institution="Helmholtz-Zentrum hereon GmbH,"
                "Climate Service Center Germany",
    institution_id="GERICS",
    contact="gerics-cordex@hereon.de",
)
outputwriter(postproc_obj=postproc)

--> File written: cordex/climdex/EUR-11/GERICS/GERICS/MPI-M-MPI-ESM-LR/
                  historical/r3i1p1/GERICS-REMO2015/v1/year/TG/
                  TG_EUR-11_MPI-M-MPI-ESM-LR_historical_r3i1p1_
                  GERICS-REMO2015_v1_day_GERICS_year_2001-2005.nc
__init__(postproc_obj=None, output_name=True, output_dir='.', drs=True, **kwargs)

Methods

__init__([postproc_obj, output_name, ...])