Example #1
0
(covlocal_scale/1000., covinflate1, covinflate2)
thetaobsall = np.empty((nassim,nobsall),np.float)
utruth = np.empty((nassim,2,nlats,nlons),np.float)
vtruth = np.empty((nassim,2,nlats,nlons),np.float)
wtruth = np.empty((nassim,nlats,nlons),np.float)
thetatruth = np.empty((nassim,nlats,nlons),np.float)
oberrvar = np.empty(nobs,np.float); oberrvar[:] = oberrstdev**2
obtimes = np.empty((nassim),np.float)
for n in range(nassim):
    # flip latitude direction so lats are increasing (needed for interpolation)
    vrtspec_tmp,divspec_tmp =\
    spin.getvrtdivspec(nct.variables['u'][n],nct.variables['v'][n])
    w = models[0].dp*spin.spectogrd(divspec_tmp[1]-divspec_tmp[0])
    obtimes[n] = nct.variables['t'][n]
    thetaobsall[n] =\
    bilintrp(nct.variables['theta'][n,::-1,:],lons,lats[::-1],oblonsall,oblatsall)
    if samegrid:
       utruth[n] = nct.variables['u'][n]
       vtruth[n] = nct.variables['v'][n]
       thetatruth[n] = nct.variables['theta'][n]
       wtruth[n] = w
    else:
       utruth[n], vtruth[n] =\
       regriduv(spin,spout,nct.variables['u'][n],nct.variables['v'][n])
       thetatruth[n] = regrid(spin,spout,nct.variables['theta'][n],levs=1)
       wtruth[n] = regrid(spin,spout,w,levs=1)
nct.close()

# create initial ensemble by randomly sampling climatology
# of forecast model.
ncm = Dataset(modelclimo_file)
Example #2
0
print "# %s obs to assimilate (out of %s) with ob err stdev = %s" % (nobs, nobsall, oberrstdev)
print "# covlocal_scale=%s km, covinflate1=%s covinflate2=%s" % (covlocal_scale / 1000.0, covinflate1, covinflate2)
thetaobsall = np.empty((nassim, nobsall), np.float)
utruth = np.empty((nassim, 2, nlats, nlons), np.float)
vtruth = np.empty((nassim, 2, nlats, nlons), np.float)
wtruth = np.empty((nassim, nlats, nlons), np.float)
thetatruth = np.empty((nassim, nlats, nlons), np.float)
oberrvar = np.empty(nobs, np.float)
oberrvar[:] = oberrstdev ** 2
obtimes = np.empty((nassim), np.float)
for n in range(nassim):
    # flip latitude direction so lats are increasing (needed for interpolation)
    vrtspec_tmp, divspec_tmp = spin.getvrtdivspec(nct.variables["u"][n], nct.variables["v"][n])
    w = models[0].dp * spin.spectogrd(divspec_tmp[1] - divspec_tmp[0])
    obtimes[n] = nct.variables["t"][n]
    thetaobsall[n] = bilintrp(nct.variables["theta"][n, ::-1, :], lons, lats[::-1], oblonsall, oblatsall)
    if samegrid:
        utruth[n] = nct.variables["u"][n]
        vtruth[n] = nct.variables["v"][n]
        thetatruth[n] = nct.variables["theta"][n]
        wtruth[n] = w
    else:
        utruth[n], vtruth[n] = regriduv(spin, spout, nct.variables["u"][n], nct.variables["v"][n])
        thetatruth[n] = regrid(spin, spout, nct.variables["theta"][n], levs=1)
        wtruth[n] = regrid(spin, spout, w, levs=1)
nct.close()

# create initial ensemble by randomly sampling climatology
# of forecast model.
ncm = Dataset(modelclimo_file)
indx = np.random.choice(np.arange(len(ncm.variables["t"])), nanals, replace=False)
Example #3
0
thetaobsall = np.empty((nassim, nobsall), np.float)
utruth = np.empty((nassim, 2, nlats, nlons), np.float)
vtruth = np.empty((nassim, 2, nlats, nlons), np.float)
wtruth = np.empty((nassim, nlats, nlons), np.float)
thetatruth = np.empty((nassim, nlats, nlons), np.float)
oberrvar = np.empty(nobs, np.float)
oberrvar[:] = oberrstdev**2
obtimes = np.empty((nassim), np.float)
for n in range(nassim):
    # flip latitude direction so lats are increasing (needed for interpolation)
    theta = nct.variables['theta'][n, ::-1, :]
    vrtspec_tmp,divspec_tmp =\
    spin.getvrtdivspec(nct.variables['u'][n,...],nct.variables['v'][n,...])
    w = models[0].dp * spin.spectogrd(divspec_tmp[1] - divspec_tmp[0])
    obtimes[n] = nct.variables['t'][n]
    thetaobsall[n] = bilintrp(theta, lons, lats[::-1], oblonsall, oblatsall)
    if samegrid:
        utruth[n] = nct.variables['u'][n]
        vtruth[n] = nct.variables['v'][n]
        wtruth[n] = w
        thetatruth[n] = nct.variables['theta'][n]
    else:
        utruth[n], vtruth[n] =\
        regriduv(spin,spout,nct.variables['u'][n],nct.variables['v'][n])
        thetatruth[n] = regrid(spin, spout, nct.variables['theta'][n], levs=1)
        wtruth[n] = regrid(spin, spout, w, levs=1)
nct.close()

# create initial ensemble by randomly sampling climatology
# of forecast model.
ncm = Dataset(modelclimo_file)
Example #4
0
(covlocal_scale/1000., covinflate, obshr_interval)
thetaobsall = np.empty((nassim,nobsall),np.float)
utruth = np.empty((nassim,2,nlats,nlons),np.float)
vtruth = np.empty((nassim,2,nlats,nlons),np.float)
wtruth = np.empty((nassim,nlats,nlons),np.float)
thetatruth = np.empty((nassim,nlats,nlons),np.float)
oberrvar = np.empty(nobs,np.float); oberrvar[:] = oberrstdev**2
obtimes = np.empty((nassim),np.float)
for n in range(nassim):
    # flip latitude direction so lats are increasing (needed for interpolation)
    theta = nct.variables['theta'][n,::-1,:]
    vrtspec_tmp,divspec_tmp =\
    spin.getvrtdivspec(nct.variables['u'][n,...],nct.variables['v'][n,...])
    w = models[0].dp*spin.spectogrd(divspec_tmp[1]-divspec_tmp[0])
    obtimes[n] = nct.variables['t'][n]
    thetaobsall[n] = bilintrp(theta,lons,lats[::-1],oblonsall,oblatsall)
    if samegrid:
       utruth[n] = nct.variables['u'][n]
       vtruth[n] = nct.variables['v'][n]
       wtruth[n] = w
       thetatruth[n] = nct.variables['theta'][n]
    else:
       utruth[n], vtruth[n] =\
       regriduv(spin,spout,nct.variables['u'][n],nct.variables['v'][n])
       thetatruth[n] = regrid(spin,spout,nct.variables['theta'][n],levs=1)
       wtruth[n] = regrid(spin,spout,w,levs=1)
nct.close()

# create initial ensemble by randomly sampling climatology
# of forecast model.
ncm = Dataset(modelclimo_file)