Changeset 2715 in lmdz_wrf for trunk


Ignore:
Timestamp:
Sep 30, 2019, 5:57:34 AM (5 years ago)
Author:
lfita
Message:

Adding:

  • `snr_K08': Function to compute the signal-to-noise-ratio after Kendon et al., 2008
  • `gamma_TS_S99': Function to compute a gamma factor from which construct an equivalent T-student distribution from a given numbers of freedom and apair of sigma values after von Storch, H. and Zwiers, F. W. (1999)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r2712 r2715  
    130130# fromanydate_CFYmd: Function to transform from any string format of date to Y-m-d used in
    131131#   CF-conventions
     132# gamma_TS_S99: Function to compute a gamma factor from which construct an equivalent
     133#    T-student distribution from a given numbers of freedom and apair of sigma values
     134#    after von Storch, H. and Zwiers, F. W. (1999)
    132135# gen_impose_gregorian: Function to impose gregorian calendar to a series of times with a
    133136#   non-standard calendar independently from datetime (imposes yr > 1900)
     
    226229# sign: Function to provide the sign of a number
    227230# singleline_printing_class: Function to print all the values of a given class in a single line to be parseavel
     231# snr_K08: Function to compute the signal-to-noise-ratio after Kendon et al., 2008
    228232# stagger_unstagger: Function to de-stagger a variable
    229233# stats_Slist: Function to provide extremes from a string as a list separated by a given character
     
    1718317187    return factor, vals2
    1718417188
     17189def snr_K08(signal,sigx,sigy):
     17190    """ Function to compute the signal-to-noise-ratio after Kendon et al., 2008, J.
     17191        Climate, 21(17):4280–4297
     17192      signal: signal to find the noise ratio
     17193      sigx, sigy: 2 standard deviation to compute the noise
     17194    """
     17195    fname = 'snr_K08'
     17196
     17197    snr = signal/(np.sqrt(sigx**2+sigy**2)/2.)
     17198
     17199    return snr
     17200
     17201def gamma_TS_S99(counts, sigx, sigy):
     17202    """ Function to compute a gamma factor from which construct an equivalent
     17203      T-student distribution from a given numbers of freedom and apair of sigma values
     17204        after von Storch, H. and Zwiers, F. W. (1999). Statistical analysis in
     17205          climate research. Cambridge University Press, page 484.
     17206      counts: number of degrees of freedom
     17207      sigx, sigy: pair of standard deviation
     17208    """
     17209    fname = 'gamma_TS_S99'
     17210
     17211    gamma = (counts-1)*( (1+(sigy/sigx)**2)**2/(1+(sigy/sigx)**4) )
     17212
     17213    return gamma
     17214
    1718517215#quit()
    1718617216
Note: See TracChangeset for help on using the changeset viewer.