cint_trth = 1
       cflevs_trth =  np.arange(cbar_min_trth, cbar_max_trth, cint_trth)
       #cflevs_trth_cntrs = cflevs_trth[0:12]
       cflevs_trth_cntrs = cflevs_trth
       cflevs_trth_ticks = np.arange(cbar_min_trth,cbar_max_trth,4*cint_trth)
       cmap_opt = plt.cm.jet
       #cmap_opt = plt.cm.Blues_r

       trth = ndimage.gaussian_filter(trth,0.75)
       
       trth = um.filter_numeric_nans(trth,trth_thresh+cint_trth,trth_thresh+cint_trth,'high')
         
       
       plotvar = trth
       mstats(plotvar)
          	    
       #plotvar, lons = um.addcyclic(trth[tt,:,:].squeeze(), lonin)	    	    	    	    
       #plotvar = ndimage.gaussian_filter(plotvar,0.75)   
       
       titletext1 = 'Tropopause potential temperature gradient %s at %s UTC' % (dt.strftime('%d %b %Y'), dt.strftime('%H00'))        
   if plot_field == 'trpr' :
 
       cbarlabel = 'Pressure (hPa)'    
       
       cint_trth = 20
       cbar_max_trth = 800.
       cbar_min_trth = 300.
       cflevs_trth =  np.arange(cbar_min_trth, cbar_max_trth, cint_trth)
       #cflevs_trth_cntrs = cflevs_trth[0:12]
       cflevs_trth_cntrs = cflevs_trth
# How to read in a file and extract the years of analysis
###########################
ab = np.loadtxt(datadir+infile1, skiprows=1)       
years_april = ab[:,0]
slp_april = ab[:,1]

inds = np.where( (years_april>=analysis_years[0]) & (years_april<=analysis_years[1]))
tmp = slp_april[inds]
del slp_april
slp_april = tmp
del tmp

years = years_april[inds]

# to check statistics, make sure mstats.m is in this directory and type:
mstats(slp_april)

###########################
# If you want to calculate a running mean, do something like this:
###########################
#new_array = np.zeros(len(slp_april)) # create a new array with all zeros
#new_array[0:nyears] = float('NaN') # change to zeros in the years where you can't compute a 5-y mean to NaNs
#for ii in range(nyears,len(new_array)):
#        new_array[ii] = np.nanmean(slp_april[ii:ii+nyears+1])

###########################
# To calculate the long-term climatology, try something like:
###########################
#inds_climo = np.where( (years>=climo_years[0]) & (years<=climo_years[1]))
#myarray_climo = np.nanmean(myarray[inds_climo])
Lv = 2.5*10**(6.0) # J kg-1

###########################
# Read file, compute stuff
###########################
if read_temperature_fromfile == 'True':
    ab = np.loadtxt(datadir+infile1, skiprows=0)       
    lats = ab[:,0]
    T1 = ab[:,1]
    [refind] = np.where(lats==reference_latitude)
    print refind
else:
    T1 = np.arange(-40,41,0.25)+273.15 # Virtual temperatures
    [refind] = np.where(T1 == 273.15)
# Check to make sure it read in correctly
mstats(T1)    
es1 = wm.claus_clap(T1) # saturation vapor pressure
ws1 = (epsi*es1)/(pres1-es1) # saturation mixing ratio

# Compute moist adiabatic lapse rate, first in z-coords
sat_lapse = (9.81/cp)*(( (1 + (Lv*ws1)/(Rd*T1))) / (1 + (ws1*(Lv**2)/(cp*Rv*T1**2.0)) ) )
Rho=pres1/(Rv*T1) # Density, moist air
sat_lapse_isobaric = -sat_lapse/(Rho*9.81) # Convert to p-coords

# Temperature at top of ascent layer (T2) is equal to what it was initially (T1) plus slope (-gamma_m) * deltap
T2 = T1 - (sat_lapse_isobaric)*(pres2-pres1) 

# Convert to Celsius (needed for plot if not reading from file)
T1C = T1 - 273.15
T2C = T2 - 273.15
	    cbar_labels = 'Standard deviations' 
	    titlestring = "Standardized Eliassen-Palm flux divergence " + date_string

	    cmap_opt = plt.cm.RdBu		    
    else:
        cint = -0.01
        cbar_min = -0.1
        cbar_max = 0.1+(cint/2)            
        
	cbar_labels = ''
	titlestring = "Eliassen-Palm flux divergence " + date_string
	
	cmap_opt = plt.cm.RdBu 

    mstats(plot_cross)

elif plot_option == 9:
    plot_cross = geop_cross / 9.81
    
    if plot_anomaly == 'true':
        plot_cross = geop_cross_anom / 9.81
        cint = 50
        cbar_min = -500
        cbar_max = 500+(cint/2)     
	
	cbar_labels = 'meters'
	titlestring = "Geopotential height anomaly " + date_string
	
	cmap_opt = plt.cm.RdBu_r		   
        if standardize_anomaly == 'true':            
		cmap_opt = plt.cm.RdBu_r
	else:
            cint = 3
            cbar_min = -45
            cbar_max = 45+(cint/2)            

	    cbar_labels = 'meters'
	    titlestring = "Geopotential height " + date_string

	    cmap_opt = plt.cm.RdBu_r 	

	figname = "erainterim_cross_section_analysis_ghgt_" + orient	        
    elif plot_option == 10:
	plot_cross = w_cross
	mstats(plot_cross)

	if plot_anomaly == 'true':
            plot_cross = w_cross_anom
            cint = 0.01
            cbar_min = -0.1
            cbar_max = 0.1+(cint/2)     

	    cbar_labels = 'Pa s-1'
	    titlestring = "Vertical velocity anomaly " + date_string

	    cmap_opt = plt.cm.RdBu		   
            if standardize_anomaly == 'true':            
        	cint = 0.1
        	cbar_min = -2 
        	cbar_max = 2 + (cint/2)