metrics.msss

This class is for calculating the MSSS (Mean Squared Skill Score) following the paper of Goddard et al. (2012)

author:Sebastian Illing
contact:sebastian.illing@met.fu-berlin.de

MSSS Module

class metrics.msss.Msss(output='/tmp/msss/output/', output_plots='/tmp/msss/output/', decadals='1960, 1965, 1970, 1975, 1980, 1985, 1990, 1995, 2000', variable='tas', project1='baseline1', product1='output', institute1='mpi-m', model1='mpi-esm-lr', experiment1='decs4e', ensemblemembers1='*', project2='baseline0', product2='output1', institute2='mpi-m', model2='mpi-esm-lr', experiment2='decadal', ensemblemembers2='*', leadtimes='1, 2-9', observation='HadCrut', observation_ensemble='*', maskMissingValues=True, result_grid=None, cache='/tmp/msss/cache/', baseDir='..', timeFreq='mon', basic_output=True, bootstrap=None, bootstrap2=None, obsRemapped=None, leadtimes_mode='yearly', level=None, lonlatbox=None, fieldmean=False, zonalmean=False, colormap='RedBlu', observation_type='REANALYSIS', reanpath='', months=None)[source]

Class to calculate the MSSS. Call method “analyze” to get results

Parameters:
  • output – Path where the results are saved
  • output_plots – Path where the plots are saved
  • decadals – a list with decadal experiments, i.e. [1960,1960,...,1995]
  • variable – CMOR-Name of variable like ‘tas’ (Near Surface Temperature)
  • project1 – CMOR-Name of the project like CMIP5 or BASELINE1
  • product1 – CMOR-Parameter
  • institute1 – CMOR-Name of the institute like MPI-M
  • model1 – CMOR-Name of the used model like MPI-ESM-LR
  • experiment1 – Experiment name like decadal or historical
  • ensemblemembers1 – Comma separated string of esemble members like ‘r1i1p1,r2i1p1,...’
  • project2 – CMOR-Name of the project like CMIP5 or BASELINE1
  • product2 – CMOR-Parameter
  • institute2 – CMOR-Name of the institute like MPI-M
  • model2 – CMOR-Name of the used model like MPI-ESM-LR
  • experiment2 – Experiment name like decs4e or historical
  • ensemblemembers2 – Comma separated string of esemble members like ‘r1i1p1,r2i1p1,...’
  • leadtimes – Leadtimes to analyze, ie. 1,2-9
  • observation – Observation or Reanalysis Experiment, HadCrut or ERA-Int
  • observation_ensemble – If your observation has multiple ensemble members. Not necesary if you use an observation file
  • maskMissingValues – Boolean
  • result_grid – Griddescription of resultgrid like r72x36
  • cache – Path for cachedir during analysis
  • baseDir – Path of Class to find default files
  • timeFreq – Timefrequency of the files, ie ‘mon’ or ‘day’
  • basic_output – Boolean - If true only basic out is produced (Correlation, MSESS, and Conditional Bias).
  • bootstrap
  • bootstrap2
  • obsRemapped
  • level – For 3D-Files –> Select a single level
  • lonlatbox – If you want to select a specific lonlat-Box
  • fieldmean – Boolean - If you want to calculate field means
  • zonalmean – Boolean - If you want to calculate zonal means
  • colormap – Matplotlib Colormap used for ploting
  • observation_type – NOT USED ANYMORE!!!
  • reanpath – NOT USED ANYMORE!!!
  • months – Usefull if your analysing monthly and your experiment name has a month included
analyze()[source]

Main method to calculate the MSSS. Following steps are performed:

  1. Searching for file using solr_search
  2. Remapping Files to coarser grid
  3. Calculating Ensemble Mean
  4. Calculating cross-validated mean
  5. Calculating anomalies for both models
  6. Analyzing different timeranges
analyzeYearRange(input1Anomalies, observationRemapped, input2Anomalies, startYear, endYear)[source]

Calculate the MSSS for given timerange. The following steps are perfomed in this method:

  1. temporal smoothing
  2. calculation of correlation, bias, and msss
  3. calculation of model1 vs. model2
  4. plotting of the 9 fields
Todo :

maybe this could be done in multiprocessing –> so different timeranges at once

Parameters:
  • input1Anomalies – dict with anomalies of model1
  • observationRemapped – dict with anomalies of observations
  • input2Anomalies – dict with anomalies of model2
  • startYear
  • endYear
getInitVsUninit(initResults, uninitResults, flag, outputDir)[source]

Calculates comparing values between two models/modelversions i.e. initialized vs. uninitialized. Following variables are computed:

  • correlation: corr1 - corr2
  • conditional bias: abs(bias1) - abs(bias2)
  • msss: (msss1-msss2)/(1-msss2)
Parameters:
  • initResults – dict with “corr”, “bias”, and “msss” of first model
  • uninitResults – dict with “corr”, “bias”, and “msss” of second model
  • tempRange – start- and endyear –> used for filenames
Returns:

msss filename

getCorrelationAndVariancesAndMSSS(hindcast, observation, flag, outputDir)[source]

Calculates the following quantities:

  • correlation bewtween observation and hindcast
  • temporal variance of hindcast
  • temporal variance of observation
  • conditional bias
  • msss
  • biasSlope so/sh * c
  • std ratio so/sh
Parameters:
  • hindcast – dict of hindcasts
  • observation – dict of observations
  • flag – additional string for filenames
Returns:

dict with “msss”, “bias”, “corr”, “biasSlope, “stdRatio”, “biasSlopeMinusOne”

getMSE(anomalies, obsAnom)[source]

Method calculates the Mean Squared Error.

Note :

method ist not used at the moment

Parameters:
  • anomalies – dictionary with anomalies
  • obsAnom – dict with observation anomalies
Returns:

file with mse field

getRMSS(MSSS, flag, outputDir)[source]

Calculates the RMSSS using the MSSS

Parameters:
  • MSSS – netcdf file
  • flag – name flag
  • outputDir – output path
Returns:

file with RMSSS field

Table Of Contents

Previous topic

MurCSS Tool

Next topic

metrics.crpss

This Page