rho = getrho(f)
        dz = getdz(f)
        f.close()
        nz, nx, ny = w.shape
        azz = np.argmin(np.absolute(height - 8000))
        bzz = nz - 1
        advw = rho * w
        upw = copy.deepcopy(advw)
        upw[w < 1] = 0.
        updraft[t] = dx * dy * dt * (np.sum(advw[azz, :, :]) -
                                     np.sum(advw[bzz, :, :]))
        onlyup[t] = dx * dy * dt * (np.sum(upw[azz, :, :]) -
                                    np.sum(upw[bzz, :, :]))
    return updraft, onlyup


allupdrafts = {}
gt1up = {}

maindir = '/nobackup/rstorer/convperts/revu/'
modeldirs = pert75()
dx = 250
dy = 250
dt = 300
for xdir in modeldirs:
    print xdir
    allupdrafts[xdir], gt1up[xdir] = budgetplot(maindir, xdir, dx, dy, dt)

np.savez('budget-timeseries-dryairmassflux.npz', **allupdrafts)
np.savez('budget-timeseries-dryairmassflux-wgt1.npz', **gt1up)
示例#2
0
    return xl, yl, Rsqr, slope


def modelvars(fil, arg):
    graup = (getvar(fil, 'VAPGRAUT') + getvar(fil, 'VAPHAILT')) * 2 * 1000.
    ice = (getvar(fil, 'VAPPRIST') + getvar(fil, 'VAPSNOWT') +
           getvar(fil, 'VAPAGGRT')) * 2 * 1000.
    rain = (getvar(fil, 'VAPRAINT') + getvar(fil, 'VAPDRIZT')) * 2 * 1000.
    cloud = (getvar(fil, 'VAPCLDT')) * 2 * 1000.
    temp = (getvar(fil, 'THETA') * getvar(fil, 'PI') / 1004.)[:, 10, 10]
    w = getvar(fil, 'WP')
    return graup[arg:, :, :], ice[arg:, :, :], rain[arg:, :, :], cloud[
        arg:, :, :], w[arg:, :, :], temp[arg:]


alldirs = pert75()
alldirs = ['aug17-control', 'feb23-control', 'aug11-control']
height = getvar(
    '/nobackup/rstorer/convperts/revu/feb23-control/feb23-control-revu-001.h5',
    'z_coords')
h5km = np.argmin(np.abs(height - 5000.))
minarray = np.arange(-80, 0, 5) + 273.15

alphavals = {}
rvals = {}

for xdir in alldirs:
    alphavals[xdir] = np.zeros_like(minarray)
    rvals[xdir] = np.zeros_like(minarray)
    outgraup = []
    outice = []
示例#3
0
import matplotlib

matplotlib.use("Agg")
import numpy as np
from rachelutils.hdfload import getvar
from rachelutils.thermo import get_cape, satmixratio
from rachelutils.dumbnaming import pert75
import matplotlib.pyplot as plt

prevcape = np.load('../filesnpz/cape.npz')

dirs = pert75()

prev = np.zeros(75)
new = np.zeros(75)

mix = {}
sfc = {}
mu = {}

for i, xdir in enumerate(dirs):
    filename = '/nobackup/rstorer/convperts/revu/' + xdir + '/' + xdir + '-revu-001.h5'
    capemixed, parcel = get_cape(filename, 'mixed')
    capesfc, parcel = get_cape(filename, 'sfc')
    capemu, parcel = get_cape(filename, 'mu')
    print xdir, capemixed, capesfc, capemu, prevcape[xdir]
    prev[i] = prevcape[xdir]
    new[i] = capemixed
    mix[xdir] = capemixed
    sfc[xdir] = capesfc
    mu[xdir] = capemu
示例#4
0

def rankvar(var,dirs):
    nv = len(dirs)
    v = np.zeros(nv)
    for i,k in enumerate(dirs):
        v[i] = var[k]
    order = np.argsort(v)
    vrank = []
    for i in range(nv):
        vrank.append(dirs[order[i]])
    vsort = sorted(v)
    return vsort,vrank

cases = case25()
names = pert75()

rhprofsinit = {}
vapprofsinit = {}
rhprofsfinal = {}
vapprofsfinal = {}
rhdiffs = {}
vapdiffs = {}
tinit = {}
tfinal = {}
tdiff = {}

tlow = {}
thigh = {}
vlow = {}
vhigh = {}
示例#5
0
import numpy as np
from rachelutils.hdfload import getvar
import glob
from rachelutils.dumbnaming import pert75

runs = pert75()
for dir in runs:
    files = sorted(
        glob.glob('/nobackup/rstorer/convperts/revu/' + dir + '/' + dir + '*'))
    print dir
    f = files[1]
    s = getvar(f, 'rshort')
    print s.max(), s.min(), s.mean()
    f = files[-1]
    s = getvar(f, 'rshort')
    print s.max(), s.min(), s.mean()

#files = sorted(glob.glob('/nobackup/rstorer/convperts/revu/aug11-control/aug*'))
#for f in files:
#    s=getvar(f,'albedt')
#    print s.max(), s.min(), s.mean()
示例#6
0
import numpy as np
from rachelutils.dumbnaming import pert75
from rachelutils.hdfload import getvar
import glob

perts = pert75()
#
#wout = {}
#
#for p in perts:
#    files = sorted(glob.glob('/nobackup/rstorer/convperts/revu/'+p+'/'+p+'*'))
#    allw = []
#    for f in files:
#        allw.extend(getvar(f,'w'))
#    l=np.percentile(np.array(allw),99)
#    print p, l, np.max(np.array(allw))
#    wout[p]=l
#
#np.savez('w99.npz',**wout)

maxw = np.load('maxwpoints.npz')
w99 = np.load('w99.npz')

for p in perts:
    print p, maxw[p], w99[p]

v = np.zeros(75)
for i,k in enumerate(perts):
    v[i] = w99[k]
    order = np.argsort(v)
    vrank = []