plotthresh = False
threshtest = False

fyear1 = 2065
fyear2 = 2099

xplots = 4
yplots = 7

### Get directories
bkdir = cwd + "/../../../CTdata/"
qsdir = bkdir + "quick_arche/"
botdir = bkdir + "metbot_multi_dset/"

figdir = botdir + "olrhist_allCMIPplot/"
my.mkdir_p(figdir)

if group:
    grcls = [
        'fuchsia', 'b', 'r', 'blueviolet', 'springgreen', 'gold', 'darkorange'
    ]

# Set up plot
print "Setting up plot..."

plt.figure(figsize=[9, 12])

cnt = 1

### Dsets
dsets = 'all'
示例#2
0
seas = 'NDJFM'
if seas == 'NDJFM':
    mons = [11, 12, 1, 2, 3]
    nmon = len(mons)
    mon1 = 11
    mon2 = 3

# domain for getting lat band
sub = 'latband'

### Get directories
bkdir = cwd + "/../../../../CTdata/"
botdir = bkdir + "metbot_multi_dset/"
txtdir = botdir + "/revplay/harmonics_table/"
figdir = botdir + "/revplay/harmonics_plot/"
my.mkdir_p(txtdir)
my.mkdir_p(figdir)

### Display options for plot
cols = ['k', 'g', 'r', 'c', 'm', 'gold', 'b', \
        'g', 'r', 'c', 'm', 'gold', 'b', 'indigo', \
        'g', 'r', 'c', 'm', 'gold', 'b', 'indigo', \
        'g', 'r', 'c', 'm', 'gold', 'b', 'indigo']
styls = ["solid", "solid", "solid", "solid", "solid", "solid", "solid", \
         "dashed", "dashed", "dashed", "dashed", "dashed", "dashed", "dashed", \
         "dotted", "dotted", "dotted", "dotted", "dotted", "dotted", "dotted", \
         "-.", "-.", "-.", "-.", "-.", "-.", "-."]
lws = np.full((28), 2)
lws[0] = 5
zorders = np.full((28), 2)
zorders[0] = 3
    figdim = [9, 11]
elif subrain == 'UM_FOC':
    figdim = [9, 11]
elif subrain == 'SA_TR':
    figdim = [10, 7]

if group:
    grcls = [
        'fuchsia', 'b', 'r', 'blueviolet', 'springgreen', 'gold', 'darkorange'
    ]

### Get directories
bkdir = cwd + "/../../../CTdata/"
botdir = bkdir + "metbot_multi_dset/"
prdir = botdir + "change_precip_figs_allCMIP/"
my.mkdir_p(prdir)

### If ttt plot loop domains
for do in range(len(doms)):
    dom = doms[do]
    print 'Running on domain ' + dom

    ### If heavy plot loop heavythres
    for he in range(len(hvthrs)):
        hvthr = hvthrs[he]
        print 'Running on heavythres ' + hvthr

        # Loop tsteps
        print 'Looping seas or mon options '
        print tstep
        for t in range(len(tlist)):
示例#4
0
        ### Location for olr input & outputs
        indir = bkdir + dset + "/"
        if future:
            infile = indir + name + ".olr.day.mean.rcp85." + ys + ".nc"
        else:
            infile = indir + name + ".olr.day.mean." + ys + ".nc"
        print infile

        # Check if OLR file exists for this model
        if os.path.exists(infile):

            outdir = indir + name + "/"
            if testyear: outdir = outdir + 'test/'
            else: outdir = outdir
            my.mkdir_p(outdir)
            outsuf = outdir + name + '_'
            if future:
                outsuf = outsuf + 'fut_rcp85_'

            ### Open OLR data
            v = dset + "-olr-0-0"
            daset, globv, lev, drv = v.split('-')
            ncout = mync.open_multi(infile,globv,name,\
                                                        dataset=dset,subs=sub)
            ndim = len(ncout)
            if ndim == 5:
                olr, time, lat, lon, dtime = ncout
            elif ndim == 6:
                olr, time, lat, lon, lev, dtime = ncout
                olr = np.squeeze(olr)
示例#5
0
    edays = [0]

#drawnest=True
drawnest = False
nestbox_cont = [23, 35, -35, -20]  # WESN
nestbox_mada = [35, 50, -25, -11]  # WESN

### Get directories
bkdir = cwd + "/../../CTdata/"
thisdir = bkdir + "/hpaperplot/"
botdir = bkdir + "metbot_multi_dset/"

compdir = thisdir + "comp4paper_contour/"
if lag:
    compdir = thisdir + "comp4paper_contour_lags/"
my.mkdir_p(compdir)

# variable
v = 0
globv = varlist[v]
print "Running on " + globv

# levels - if levsel is false this will just be 1 level
l = 0
print "Running on " + globv + " at pressure level " + choosel[l]

# Loop sampling options
for r in range(len(runs)):

    if runs[r] == 'opt1':
        sample = 'blon'
示例#6
0
domain = 'nglob'
if domain == 'polar':
    sub = 'SH'
elif domain == 'swio':
    sub = 'SA'
elif domain == 'nglob':
    sub = 'bigtrop'
elif domain == 'mac_wave':
    sub = 'SASA'

### Get directories
bkdir = cwd + "/../../../CTdata/"
botdir = bkdir + "metbot_multi_dset/"

outsuf = botdir + "plot_ALLdays4anim/"
my.mkdir_p(outsuf)

### Multi dset?
dsets = 'spec'  # "all" or "spec" to choose specific dset(s)
if dsets == 'all':
    ndset = len(dset_mp.dset_deets)
    dsetnames = list(dset_mp.dset_deets)
elif dsets == 'spec':  # edit for the dset you want
    ndset = 1
    dsetnames = ['noaa']
ndstr = str(ndset)

for d in range(ndset):
    dset = dsetnames[d]
    dcnt = str(d + 1)
    print 'Running on ' + dset
    f_seas = [11, 11]
    l_seas = [3, 3]

# How many plots do you want?
if size == '20':
    nplot = int(size)
    xplots = 4
    yplots = 5

### Get directories
bkdir = cwd + "/../../../CTdata/"
botdir = bkdir + "metbot_multi_dset/"
thisdir = bkdir + "hpaperplot/plot_all_sampled_days"

my.mkdir_p(thisdir)

### Multi dset?
dsets = 'spec'  # "all" or "spec" to choose specific dset(s)
if dsets == 'all':
    ndset = len(dset_mp.dset_deets)
    dsetnames = list(dset_mp.dset_deets)
elif dsets == 'spec':  # edit for the dset you want
    #ndset=1
    #dsetnames=['ncep']
    ndset = 2
    dsetnames = ['noaa', 'cmip5']
ndstr = str(ndset)

for d in range(ndset):
    dset = dsetnames[d]
示例#8
0
            mnames = ['cdr2']
            nmod = len(mnames)
        elif dset == 'cmip5':
            nmod = len(dsetdict.dset_deets[dset])
            mnames = list(dsetdict.dset_deets[dset])
    nmstr = str(nmod)

    for mo in range(nmod):
        name = mnames[mo]
        mcnt = str(mo + 1)
        print 'Running on ' + name
        print 'This is model ' + mcnt + ' of ' + nmstr + ' in list'

        botpath = bkdir + dset + '/' + name + '/'
        txtdir = botpath + 'samples/txtfiles/'
        my.mkdir_p(txtdir)

        # Get threshold
        print 'getting threshold....'
        with open(threshtxt) as f:
            for line in f:
                if dset + '\t' + name in line:
                    thresh = line.split()[2]
                    print 'thresh=' + str(thresh)
        thresh = int(thresh)
        if threshtest:
            lowert = thresh - 5
            uppert = thresh + 5
            threshs = [lowert, thresh, uppert]
            thnames = ['lower', 'actual', 'upper']
        else:
示例#9
0
    #dsetnames=['noaa']
    ndset = 6
    dsetnames = ['noaa', 'ncep', 'era', '20cr', 'um', 'cmip5']
    dsetstr = '_'.join(dsetnames)
    if mods == 'spec':  # edit for the models you want
        nmod = 1
        mnames = ['anqjn']
        nallmod = nmod

### Directory
indir = cwd + "/../../../CTdata/metbot_multi_dset/"
txtdir = indir + "play_output/scatter_nTTT_precip/text/"
picdir = indir + "play_output/scatter_nTTT_precip/plot/"

### Some basics before we start looping
my.mkdir_p(txtdir)
my.mkdir_p(picdir)
globp = 'pr'
if threshtest:
    thnames = ['lower', 'actual', 'upper']
else:
    thnames = ['actual']
nthresh = len(thnames)
if dsets == ['all']:
    ndset = len(dsetdict.dset_deets)
    dsetnames = list(dsetdict.dset_deets)
    dsetstr = 'all_dset'
ndstr = str(ndset)
print 'Running on datasets:'
print dsetnames
### Count total number of models - if using all
示例#10
0
    messr = 0  # added to first CB to change which 5 are selected

# part c - centroids

# part d - CV map
whichdays = 'cbonly'  # 'all' for all days in period
# 'cbonly' for only days with flagged cbs
# use different input netcdf files
whichstat = 'cvper'  # 'std' - standard deviation
# 'cv' - coefficient of variation
# 'cvper' - coefficient of variation as a percentage

### Get directories
bkdir = cwd + "/../../../../CTdata/metbot_multi_dset/"
figdir = bkdir + "/histpaper_v2_figs/CBvar"
my.mkdir_p(figdir)
tmpdir = bkdir + "/tmp_dump/"
my.mkdir_p(tmpdir)
threshtxt = bkdir + '/histpaper_txt/thresholds.fmin.noaa_cmip5.txt'

# Running details
xplots = 2
yplots = 2
globv = 'olr'

# Lon and lat spacing
latsp = 15.
lonsp = 20.

dset = 'noaa'
name = 'cdr2'
示例#11
0
            ys = moddct['yrfname']
        if testyear:
            beginatyr = moddct['testyr']
        else:
            beginatyr = moddct['startyr']
        units = moddct['olrtimeunit']
        cal = moddct['calendar']

        ### Location for olr input & outputs
        indir = bkdir + dset + "/"
        infile = indir + name + ".olr.day.mean." + ys + ".nc"
        print infile
        outdir = indir + name + "/"
        if testyear: outdir = outdir + 'test/'
        else: outdir = outdir
        my.mkdir_p(outdir)
        outsuf = outdir + name + '_'

        ### Open olr nc file
        v = dset + "-olr-0-0"
        daset, globv, lev, drv = v.split('-')
        ncout = mync.open_multi(infile,globv,name,\
                                                    dataset=dset,subs=sub)
        ndim = len(ncout)
        if ndim == 5:
            olr, time, lat, lon, dtime = ncout
        elif ndim == 6:
            olr, time, lat, lon, lev, dtime = ncout
            olr = np.squeeze(olr)
        else:
            print 'Check number of levels in ncfile'
#doms=['All']
doms = ['All', 'nCont', 'nMada', 'nOcea']  # doms for TTT days selected
varlist = ['qflux']
v = 0  # for now don't loop variables, just one
levsel = True
if levsel:
    choosel = ['850']  # can add a list
else:
    choosel = ['1']
l = 0  # for now don't loop variables, just one
interp = True
int_res = 3.5

bkdir = cwd + "/../../../CTdata/metbot_multi_dset/"
vardir = bkdir + varlist[v] + "_figs/"
my.mkdir_p(vardir)

### Multi dset?
dsets = 'spec'  # "all" or "spec" to choose specific dset(s)
if dsets == 'all':
    ndset = len(dsetdict.dset_deets)
    dsetnames = list(dsetdict.dset_deets)
elif dsets == 'spec':  # edit for the dset you want
    ndset = 1
    dsetnames = ['noaa']
ndstr = str(ndset)

for d in range(ndset):
    dset = dsetnames[d]
    dcnt = str(d + 1)
    print 'Running on ' + dset
refkey = '0'  # for MetBot

## Info for options
if domain == 'swio':
    sub = 'SA'
    figdim = [9, 11]

import dsets_paper_28_4plot as dset_mp

### Get directories
bkdir = cwd + "/../../../CTdata/"
thisdir = bkdir + "/hpaperplot/"
botdir = bkdir + "metbot_multi_dset/"

plotdir = thisdir + "cb_outlines/"
my.mkdir_p(plotdir)

if seas == 'NDJFM':
    f_mon = 11
    l_mon = 3

# Loop sampling options
for r in range(len(runs)):

    if runs[r] == 'opt1':
        sample = 'blon'
        from_event = 'first'
    elif runs[r] == 'opt2':
        sample = 'blon2'
        from_event = 'all'
    elif runs[r] == 'opt3':
示例#14
0
            ys = moddct['yrfname']
        if testyear:
            beginatyr = moddct['testyr']
        else:
            beginatyr = moddct['startyr']
        units = moddct['olrtimeunit']
        cal = moddct['calendar']

        ### Location for olr input & outputs
        indir = bkdir + dset + "/"
        infile = indir + name + ".olr.day.mean." + ys + ".nc"
        print infile
        outdir = indir + name + "/"
        if testyear: outdir = outdir + 'test/'
        else: outdir = outdir
        my.mkdir_p(outdir)
        outsuf = outdir + name + '_'

        ### Open rain data
        globp = 'pr'
        if dset == 'noaa':
            raindset = 'trmm'
            rainmod = 'trmm_3b42v7'
            rmoddct = dsetdict.dset_deets[raindset][rainmod]
            runits = rmoddct['prtimeunit']
            rcal = rmoddct['calendar']
            if testfile:
                rys = rmoddct['testfileyr']
            else:
                rys = rmoddct['yrfname']
            if testyear: