In [15]:
import numpy as np
import matplotlib.pyplot as plt

In [24]:
experiment_ids = ['djznw', 'djzny', 'djznq', 'djzns', 'dkjxq', 'dklyu', 'dkmbq', 'dklwu', 'dklzq', 'dkbhu', 'djznu', 'dkhgu' ] # All 12

In [31]:
import linecache

def PrintException():
    exc_type, exc_obj, tb = sys.exc_info()
    f = tb.tb_frame
    lineno = tb.tb_lineno
    filename = f.f_code.co_filename
    linecache.checkcache(filename)
    line = linecache.getline(filename, lineno, f.f_globals)
    print 'EXCEPTION IN ({}, LINE {} "{}"): {}'.format(filename, lineno, line.strip(), exc_obj)

In [41]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib
WARNING: pylab import has clobbered these variables: ['diag']
`%pylab --no-import-all` prevents importing * from pylab and numpy

In [99]:
diag='avg.5216'
fig=plt.figure(figsize=(14,8.5))
ax = fig.add_subplot(2,1,1)

experiment_ids_p = ['djznw', 'djzny', 'djznq', 'dklzq', 'dkmbq', 'dkjxq' ] # Most of Params
experiment_ids_e = ['dklwu', 'dklyu', 'djzns', 'dkbhu', 'djznu', 'dkhgu'] # Most of Explicit    

import imp
model_name_convert_legend = imp.load_source('util', '/nfs/see-fs-01_users/eepdw/python_scripts/modules/model_name_convert_legend.py')

for experiment_id in experiment_ids_p:

    expmin1 = experiment_id[:-1]
    
    try:
    
        pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_poylgon_monsoon_trough_0_200.npz" % (expmin1, experiment_id, experiment_id, diag))
    #pdf_line = np.load('/nfs/a90/eepdw/Data/EMBRACE/djzn/djznw/djznw_avg.5216_pdf_poylgon_monsoon_trough.npz')
        #ax.plot(pdf_line['bins'], (np.array(pdf_line['pdf'], dtype=float))/float(pdf_line['pdf'].sum()), label='%sPar' % (model_name_convert_legend.main(experiment_id)), linestyle='--')
        ax.plot(pdf_line['bins'], pdf_line['pdf'], label='%sPar' % (model_name_convert_legend.main(experiment_id)), linestyle='--')

        #print pdf_line['bins']
        #print pdf_line['pdf']
        #print pdf_line
        
    except Exception:
        PrintException()
        print experiment_id
        # Exception handling, with line number and stuff

for experiment_id in experiment_ids_e:

    expmin1 = experiment_id[:-1]
    
    try:
    
        pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_poylgon_monsoon_trough_0_200.npz" % (expmin1, experiment_id, experiment_id, diag))
    #pdf_line = np.load('/nfs/a90/eepdw/Data/EMBRACE/djzn/djznw/djznw_avg.5216_pdf_poylgon_monsoon_trough.npz')
        #ax.plot(pdf_line['bins'], (np.array(pdf_line['pdf'], dtype=float))/float(pdf_line['pdf'].sum()), label='%sExp' % (model_name_convert_legend.main(experiment_id)))
        ax.plot(pdf_line['bins'], pdf_line['pdf'], label='%sExp' % (model_name_convert_legend.main(experiment_id)))
        #ax.scatter(pdf_line['bins'], pdf_line['pdf'], label='%sExp' % (model_name_convert_legend.main(experiment_id)))
        #print pdf_line['bins']
        #print pdf_line['pdf']
        #print pdf_line
        
    except Exception:
        PrintException()
        print experiment_id
        
trmm_pdf=np.load(
'/nfs/a90/eepdw/Data/Observations/Satellite/TRMM/Rainfall_Intensity/EMBRACE_Monsoon_Trough_Rainfall_Intensity_PDF.npz')
#ax.plot(trmm_pdf['bins'], (np.array(trmm_pdf['pdf'], dtype=float))/float(trmm_pdf['pdf'].sum()), label='TRMM', color='k', linewidth=3)
ax.plot(trmm_pdf['bins'], trmm_pdf['pdf']*2, label='TRMM', color='k', linewidth=3)
ax.set_yscale('log')
ax.set_xlim(0,200)
ax.set_xlabel('mm/h')
ax.set_title('No. hourly mean grid point occurrences at 24km regrid in "monsoon trough"')
ax.legend()
fig.show()


EXCEPTION IN (<ipython-input-99-9bdbdad7d6a1>, LINE 37 "pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_poylgon_monsoon_trough_0_200.npz" % (expmin1, experiment_id, experiment_id, diag))"): [Errno 2] No such file or directory: '/nfs/a90/eepdw/Data/EMBRACE/dkbh/dkbhu/dkbhu_avg.5216_pdf_poylgon_monsoon_trough_0_200.npz'
dkbhu
EXCEPTION IN (<ipython-input-99-9bdbdad7d6a1>, LINE 37 "pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_poylgon_monsoon_trough_0_200.npz" % (expmin1, experiment_id, experiment_id, diag))"): [Errno 2] No such file or directory: '/nfs/a90/eepdw/Data/EMBRACE/djzn/djznu/djznu_avg.5216_pdf_poylgon_monsoon_trough_0_200.npz'
djznu
EXCEPTION IN (<ipython-input-99-9bdbdad7d6a1>, LINE 37 "pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_poylgon_monsoon_trough_0_200.npz" % (expmin1, experiment_id, experiment_id, diag))"): [Errno 2] No such file or directory: '/nfs/a90/eepdw/Data/EMBRACE/dkhg/dkhgu/dkhgu_avg.5216_pdf_poylgon_monsoon_trough_0_200.npz'
dkhgu

In [115]:
# Land and Sea

diag='avg.5216'


experiment_ids_p = ['djznw', 'djzny', 'djznq', 'dklzq', 'dkmbq', 'dkjxq' ] # Most of Params
experiment_ids_e = ['dklwu', 'dklyu', 'djzns', 'dkbhu', 'djznu', 'dkhgu'] # Most of Explicit    

import imp
model_name_convert_legend = imp.load_source('util', '/nfs/see-fs-01_users/eepdw/python_scripts/modules/model_name_convert_legend.py')

for ls in ['land', 'sea']: 
  fig=plt.figure(figsize=(14,8.5))
  ax = fig.add_subplot(2,1,1)
        
  max_y=0
    
  for experiment_id in experiment_ids_p:

    expmin1 = experiment_id[:-1]
    
    try:
    
        pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_map_%s.npz" % (expmin1, experiment_id, experiment_id, diag, ls))
    #pdf_line = np.load('/nfs/a90/eepdw/Data/EMBRACE/djzn/djznw/djznw_avg.5216_pdf_poylgon_monsoon_trough.npz')
        ax.plot(pdf_line['bins'], pdf_line['pdf'], label='%sPar' % (model_name_convert_legend.main(experiment_id)), linestyle='--')
        #print pdf_line['bins']
        #print pdf_line['pdf']
        #print pdf_line
        if max_y<pdf_line['pdf'].max():
            max_y=pdf_line['pdf'].max()
        
    except Exception:
        PrintException()
        print experiment_id
        # Exception handling, with line number and stuff

  for experiment_id in experiment_ids_e:

    expmin1 = experiment_id[:-1]
    
    try:
    
        pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_map_%s.npz" % (expmin1, experiment_id, experiment_id, diag, ls))
    #pdf_line = np.load('/nfs/a90/eepdw/Data/EMBRACE/djzn/djznw/djznw_avg.5216_pdf_poylgon_monsoon_trough.npz')
        ax.plot(pdf_line['bins'], pdf_line['pdf'], label='%sExp' % (model_name_convert_legend.main(experiment_id)))
        #print pdf_line['pdf'].sum()
        if max_y<pdf_line['pdf'].max():
            max_y=pdf_line['pdf'].max()
        #ax.scatter(pdf_line['bins'], pdf_line['pdf'], label='%sExp' % (model_name_convert_legend.main(experiment_id)))
        #print pdf_line['bins']
        #print pdf_line['pdf']
        #print pdf_line
        
    except Exception:
        PrintException()
        print experiment_id
        
  trmm_pdf=np.load(
'/nfs/a90/eepdw/Data/Observations/Satellite/TRMM/Rainfall_Intensity/EMBRACERainfall_Intensity_PDF_dkbhu_latlon_%s.npz' % ls)
#ax.plot(trmm_pdf['bins'], (np.array(trmm_pdf['pdf'], dtype=float))/float(trmm_pdf['pdf'].sum()), label='TRMM', color='k', linewidth=3)
  ax.plot(trmm_pdf['bins'], trmm_pdf['pdf']*2, label='TRMM', color='k', linewidth=3)
    
  if max_y<trmm_pdf['pdf'].max():
            max_y=trmm_pdf['pdf'].max()
            
            
  print trmm_pdf['pdf'].sum()

  
  
            
  ax.set_xlabel('mm/h')
  ax.set_title('No. hourly mean grid point occurrences at 24km regrid over %s' % ls)
  ax.legend()
  #ax.set_yscale('log')
  ax.set_xlim(0,10)
  #ax.set_ylim(0,max_y+10000000)
            
  fig.show()


EXCEPTION IN (<ipython-input-115-d879cd42bdc3>, LINE 44 "pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_map_%s.npz" % (expmin1, experiment_id, experiment_id, diag, ls))"): [Errno 2] No such file or directory: '/nfs/a90/eepdw/Data/EMBRACE/dkbh/dkbhu/dkbhu_avg.5216_pdf_map_land.npz'
dkbhu
EXCEPTION IN (<ipython-input-115-d879cd42bdc3>, LINE 44 "pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_map_%s.npz" % (expmin1, experiment_id, experiment_id, diag, ls))"): [Errno 2] No such file or directory: '/nfs/a90/eepdw/Data/EMBRACE/djzn/djznu/djznu_avg.5216_pdf_map_land.npz'
djznu
EXCEPTION IN (<ipython-input-115-d879cd42bdc3>, LINE 44 "pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_map_%s.npz" % (expmin1, experiment_id, experiment_id, diag, ls))"): [Errno 2] No such file or directory: '/nfs/a90/eepdw/Data/EMBRACE/dkhg/dkhgu/dkhgu_avg.5216_pdf_map_land.npz'
dkhgu
1570538.59423
EXCEPTION IN (<ipython-input-115-d879cd42bdc3>, LINE 44 "pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_map_%s.npz" % (expmin1, experiment_id, experiment_id, diag, ls))"): [Errno 2] No such file or directory: '/nfs/a90/eepdw/Data/EMBRACE/dkbh/dkbhu/dkbhu_avg.5216_pdf_map_sea.npz'
dkbhu
EXCEPTION IN (<ipython-input-115-d879cd42bdc3>, LINE 44 "pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_map_%s.npz" % (expmin1, experiment_id, experiment_id, diag, ls))"): [Errno 2] No such file or directory: '/nfs/a90/eepdw/Data/EMBRACE/djzn/djznu/djznu_avg.5216_pdf_map_sea.npz'
djznu
EXCEPTION IN (<ipython-input-115-d879cd42bdc3>, LINE 44 "pdf_line = np.load("/nfs/a90/eepdw/Data/EMBRACE/%s/%s/%s_%s_pdf_map_%s.npz" % (expmin1, experiment_id, experiment_id, diag, ls))"): [Errno 2] No such file or directory: '/nfs/a90/eepdw/Data/EMBRACE/dkhg/dkhgu/dkhgu_avg.5216_pdf_map_sea.npz'
dkhgu
2434761.40577