def load_LE(fdict,casename='historical',conv=1,season=None,timesel1='1979-01-01,1989-12-31',timesel2='2002-01-01,2012-12-31'):
    

    ledatc = le.load_LEdata(fdict,casename,timesel=timesel1, 
                            rettype='ndarray',conv=conv,ftype='fullts',local=True,verb=False)
    ledatp = le.load_LEdata(fdict,casename,timesel=timesel2, 
                            rettype='ndarray',conv=conv,ftype='fullts',local=True,verb=False)
    lediff = ledatp-ledatc

    print lediff.shape
    leclimo,_ = cutl.climatologize(lediff.T)
    print leclimo.shape

    return leclimo
def load_field(fdict,casename,timesel,seas,ftype='fullts',conv=1,local=False,verb=False):
    
    """ TAKEN FROM load_field() in canesm_le_composite.py

        returns [numens x space.flat] or [numens]

    """

    ledat = le.load_LEdata(fdict,casename,timesel=timesel, 
                           rettype='ndarray',conv=conv,ftype=ftype,local=local,verb=verb)

    # time needs to be first dimension
    try:
        if ledat.ndim==2:
            ledat = ledat.T
        elif ledat.ndim==3:
            ledat = np.transpose(ledat,(1,0,2))
        else:
            print 'Loaded data is not 2 or 3 dimensions. Do not understand.'
            raise Exception
    except:
        raise

    lesea = cutl.seasonalize_monthlyts(ledat,season=seas).mean(axis=0)  # numens x space.flat

    return lesea
def load_field(fdict,casename,timesel,seas,ftype='fullts',conv=1,local=False,verb=False):
    
    """ 
        returns [numens x space.flat] or [numens]

    """

    ledat = le.load_LEdata(fdict,casename,timesel=timesel, 
                           rettype='ndarray',conv=conv,ftype=ftype,local=local,verb=verb)

    print '@@@ ledat.shape ' + str(ledat.shape) # why does the 3d data have space flattened already...

    # time needs to be first dimension
    try:
        if ledat.ndim==2:
            ledat = ledat.T
        elif ledat.ndim==3:
            ledat = np.transpose(ledat,(1,0,2))
        else:
            print 'Loaded data is not 2 or 3 dimensions. Do not understand.'
            raise Exception
    except:
        raise

    lesea = cutl.seasonalize_monthlyts(ledat,season=seas).mean(axis=0)  # numens x space.flat

    return lesea
Example #4
0
# These time selections start with month of eruption
## timselagung ='1963-02-01,1965-12-31'
## timselchichon = '1982-04-01,1984-12-31'
## timselpinatubo = '1991-06-01,1993-12-31'

# These time selections start with beginning of year of eruption
#  (so can easily remove seasonal cycle)
# index into time series for eruption month, and index of eruption month (in a year)
timselagung ='1962-01-01,1968-12-31'; agstidx=13; ageridx=1 
timselchichon = '1981-01-01,1987-12-31'; chstidx=15; cheridx=3
timselpinatubo = '1990-01-01,1996-12-31'; pistidx=17; pieridx=5


# Need to remove each run's annual cycle: get seasonal cycle climo
natclimo = le.load_LEdata(fdict,'historicalNat',ftype='1950-2020_climo',rettype='ndarray',conv=conv)
#@@@histclimo = le.load_LEdata(fdict,'historical',ftype='1950-2020_climo',rettype='ndarray',conv=conv)

# Get months surrounding each volcano
agungdat=le.load_LEdata(fdict,'historicalNat',timesel=timselagung, rettype='ndarray',conv=conv)
chichondat=le.load_LEdata(fdict,'historicalNat',timesel=timselchichon, rettype='ndarray',conv=conv)
pinatubodat=le.load_LEdata(fdict,'historicalNat',timesel=timselpinatubo, rettype='ndarray',conv=conv)

flist=le.build_filenames(fdict,'historicalNat',ftype='fullts')
numens=len(flist)

fname = flist[0]

lev = cnc.getNCvar(fname,'plev')
lat = cnc.getNCvar(fname,'lat')
nlev=len(lev)
Example #5
0
        timeselc='1979-01-01,1989-12-31'
        timeselp='2002-01-01,2012-12-31'

        lefield1='zg50000.00'; lencfield1='zg'; comp1='Amon'; leconv1=1 #region1='bksmori'
        lefield2='tas'; lencfield2='tas'; comp2='Amon'; #region2='eurasiamori'
        fdict1 = {'field': lefield1+region1, 'ncfield': lencfield1, 'comp': comp1}
        fdict2 = {'field': lefield2+region2, 'ncfield': lencfield2, 'comp': comp2}


        ftype='fullts' # 'fullclimo' or 'climo' or 'fullts'
        lefdict1 = {'field': lefield1+region1, 'ncfield': lencfield1, 'comp': comp1}
        lefdict2 = {'field': lefield2+region2, 'ncfield': lencfield2, 'comp': comp2}

        # historical
        lecdat1 = le.load_LEdata(fdict1,'historical',timesel=timeselc, rettype='ndarray',conv=leconv1,ftype=ftype)
        (numens1,ntime1) = lecdat1.shape
        lepdat1=le.load_LEdata(fdict1,'historical',timesel=timeselp, rettype='ndarray',conv=leconv1,ftype=ftype)
        lecsea1 = cutl.seasonalize_monthlyts(lecdat1.T,season=sea1).T
        lepsea1 = cutl.seasonalize_monthlyts(lepdat1.T,season=sea1).T
        lefld1=lepsea1.mean(axis=1)-lecsea1.mean(axis=1)

        lecdat2 = le.load_LEdata(fdict2,'historical',timesel=timeselc, rettype='ndarray',conv=conv2,ftype=ftype)
        (numens2,ntime2) = lecdat1.shape
        lepdat2=le.load_LEdata(fdict2,'historical',timesel=timeselp, rettype='ndarray',conv=conv2,ftype=ftype)
        lecsea2 = cutl.seasonalize_monthlyts(lecdat2.T,season=sea2).T
        lepsea2 = cutl.seasonalize_monthlyts(lepdat2.T,season=sea2).T
        lefld2=lepsea2.mean(axis=1)-lecsea2.mean(axis=1)

        obs=plt.scatter(erareg.mean(),gisreg.mean(),color='blue',marker='s',s=8**2)