def compute_climate_indices(E, index_name, climatology_option='NODA', hostname='taurus', verbose=False): """ This subroutine computes various simple climate indices for a dataset defined by an experiment dictionary. Currently supporting the following indices: + 'Aleutian Low' index of Garfinkel et al. (2010) + 'East European High' index of Garfinkel et al. (2010) + 'AO Proxy' -- Polar Cap GPH Anomaly at 500hPa -- it's a proxy for the AO suggested by Cohen et al. (2002) * note however that we define the polar cap as everything north of 70N, I think Cohen et al do 60N + 'Vortex Strength' -- Polar Cap GPH Anomaly averaged 3-30hPa -- it's a measure of vortex strength suggested by Garfinkel et al. 2012 """ # modify the experiment dictionary to retrieve the right index EI = dart.climate_index_dictionaries(index_name) E['levrange'] = EI['levrange'] E['latrange'] = EI['latrange'] E['lonrange'] = EI['lonrange'] E['variable'] = EI['variable'] # for all indices defined so far, compute the anomaly # with respect to climatology # this uses an anomaly subroutine from the MJO module A, C, lat, lon, lev = mjo.ano(E, climatology_option=climatology_option, verbose=verbose) # Aleutian Low and East European high indices are single points, so just return the anomaly if (index_name == 'Aleutian Low') or (index_name == 'East European High'): index_out = A # for the Polar Cap GPH -based indices, average over latitude and longitude # here can use a subroutine written for MJO stuff in the MJO module if (index_name == 'AO Proxy') or (index_name == 'Vortex Strength'): lat1, lon1, Aave = mjo.aave(E, A, lat, lon, season=None, variable_name=None, averaging_dimension='all') # for the AO proxy, reverse the sign so that it's more intuitive -- a positive GPH anomaly is related to a negative AO if (index_name == 'AO Proxy') or (index_name == 'Vortex Strength'): index_out = -Aave # for vortex strength, average between 3 and 30 hPa if (index_name == 'Vortex Strength'): index_out = np.nanmean(Aave, axis=0) # return index over desired daterange return index_out
def compute_climate_indices(E,index_name,climatology_option = 'NODA',hostname='taurus',verbose=False): """ This subroutine computes various simple climate indices for a dataset defined by an experiment dictionary. Currently supporting the following indices: + 'Aleutian Low' index of Garfinkel et al. (2010) + 'East European High' index of Garfinkel et al. (2010) + 'AO Proxy' -- Polar Cap GPH Anomaly at 500hPa -- it's a proxy for the AO suggested by Cohen et al. (2002) * note however that we define the polar cap as everything north of 70N, I think Cohen et al do 60N + 'Vortex Strength' -- Polar Cap GPH Anomaly averaged 3-30hPa -- it's a measure of vortex strength suggested by Garfinkel et al. 2012 """ # modify the experiment dictionary to retrieve the right index EI = dart.climate_index_dictionaries(index_name) E['levrange'] = EI['levrange'] E['latrange'] = EI['latrange'] E['lonrange'] = EI['lonrange'] E['variable'] = EI['variable'] # for all indices defined so far, compute the anomaly # with respect to climatology # this uses an anomaly subroutine from the MJO module A,C,lat,lon,lev = mjo.ano(E,climatology_option = climatology_option,verbose=verbose) # Aleutian Low and East European high indices are single points, so just return the anomaly if (index_name == 'Aleutian Low') or (index_name == 'East European High'): index_out = A # for the Polar Cap GPH -based indices, average over latitude and longitude # here can use a subroutine written for MJO stuff in the MJO module if (index_name == 'AO Proxy') or (index_name == 'Vortex Strength'): lat1,lon1,Aave = mjo.aave(E,A,lat,lon,season=None,variable_name=None,averaging_dimension='all') # for the AO proxy, reverse the sign so that it's more intuitive -- a positive GPH anomaly is related to a negative AO if (index_name == 'AO Proxy') or (index_name == 'Vortex Strength'): index_out = -Aave # for vortex strength, average between 3 and 30 hPa if (index_name == 'Vortex Strength'): index_out = np.nanmean(Aave,axis=0) # return index over desired daterange return index_out