当前位置: 首页>>代码示例>>Python>>正文


Python Dataset.dt方法代码示例

本文整理汇总了Python中netCDF4.Dataset.dt方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.dt方法的具体用法?Python Dataset.dt怎么用?Python Dataset.dt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在netCDF4.Dataset的用法示例。


在下文中一共展示了Dataset.dt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Dataset

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import dt [as 别名]
if savedata is not None:
   nc = Dataset(savedata, mode='w', format='NETCDF4_CLASSIC')
   nc.r = models[0].r
   nc.f = models[0].f
   nc.U = models[0].U
   nc.L = models[0].L
   nc.H = models[0].H
   nc.nanals = nanals
   nc.hcovlocal_scale = hcovlocal_scale
   nc.vcovlocal_fact = vcovlocal_fact
   nc.oberrstdev = oberrstdev
   nc.levob = levob
   nc.g = nc_climo.g; nc.theta0 = nc_climo.theta0
   nc.nsq = models[0].nsq
   nc.tdiab = models[0].tdiab
   nc.dt = models[0].dt
   nc.diff_efold = models[0].diff_efold
   nc.diff_order = models[0].diff_order
   nc.filename_climo = filename_climo
   nc.filename_truth = filename_truth
   nc.symmetric = models[0].symmetric
   xdim = nc.createDimension('x',models[0].N)
   ydim = nc.createDimension('y',models[0].N)
   z = nc.createDimension('z',2)
   t = nc.createDimension('t',None)
   obs = nc.createDimension('obs',nobs)
   ens = nc.createDimension('ens',nanals)
   pv_t =\
   nc.createVariable('pv_t',np.float32,('t','z','y','x'),zlib=True)
   pv_b =\
   nc.createVariable('pv_b',np.float32,('t','ens','z','y','x'),zlib=True)
开发者ID:aneeshcs,项目名称:sqgturb,代码行数:33,代码来源:sqg_enkf_imperfect.py

示例2: interval

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import dt [as 别名]
    hcovlocal[nob, :] = taper
covlocal = np.tile(covlocal1, 5)

fhassim = obtimes[1] - obtimes[0]  # assim interval  (assumed constant)
nsteps = int(fhassim * 3600 / models[0].dt)  # time steps in assim interval
print "# fhassim,nsteps = ", fhassim, nsteps

savedata = None
# savedata = 'enkf_twolevel_test.nc'
nout = 0
if savedata is not None:
    ncout = Dataset(savedata, "w", format="NETCDF4_CLASSIC")
    ncout.rsphere = rsphere
    ncout.gridtype = gridtype
    ncout.ntrunc = ntrunc
    ncout.dt = dt
    ncout.nassim = nassim
    ncout.covinflate1 = covinflate1
    ncout.covinflate2 = covinflate2
    ncout.covlocal_scale = covlocal_scale
    ncout.truth_file = truth_file
    ncout.modelclimo_file = modelclimo_file
    ncout.nobs = nobs
    ncout.nobsall = nobsall
    ncout.oberrstdev = oberrstdev
    atts = ["grav", "omega", "cp", "rgas", "p0", "ptop", "delth", "efold", "ndiss", "tdrag", "tdiab", "umax", "jetexp"]
    for att in atts:
        ncout.setncattr(att, models[0].__dict__[att])
    lat = ncout.createDimension("lat", sp.nlats)
    lon = ncout.createDimension("lon", sp.nlons)
    level = ncout.createDimension("level", 2)
开发者ID:jswhit,项目名称:twolevelpe,代码行数:33,代码来源:enkf_twolevel.py

示例3: Dataset

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import dt [as 别名]
psipert = np.where(model.lons[np.newaxis,:,:] > 0., 0, psipert)
psipert[1,:,:] += np.random.normal(scale=1.e6,size=(sp.nlats,sp.nlons))
ug = np.zeros((2,model.nlat,model.nlon),np.float)
vg = np.zeros((2,model.nlat,model.nlon),np.float)
ug[1,:,:] = model.umax*np.sin(2.*model.lats)**model.jetexp
vrtspec, divspec = sp.getvrtdivspec(ug,vg)
vrtspec = vrtspec + model.lap*sp.grdtospec(psipert)
thetaspec = model.nlbalance(vrtspec)
divspec = np.zeros(thetaspec.shape, thetaspec.dtype)

# create netcdf file.
nc = Dataset(output_file,'w',format='NETCDF4_CLASSIC')
nc.rsphere = rsphere
nc.gridtype = gridtype
nc.ntrunc = ntrunc
nc.dt = dt
atts = ['grav','omega','cp','rgas','p0','ptop','delth','efold','ndiss','tdrag','tdiab','umax','jetexp']
for att in atts:
    nc.setncattr(att,model.__dict__[att])
lat = nc.createDimension('lat',sp.nlats)
lon = nc.createDimension('lon',sp.nlons)
layer = nc.createDimension('layer',2)
t = nc.createDimension('t',None)
u = nc.createVariable('u',np.float32,('t','layer','lat','lon'),zlib=True)
u.units = 'meters per second'
v = nc.createVariable('v',np.float32,('t','layer','lat','lon'),zlib=True)
u.units = 'meters per second'
w = nc.createVariable('w',np.float32,('t','lat','lon'),zlib=True)
w.units = 'Pa per second'
theta = nc.createVariable('theta',np.float32,('t','lat','lon'),zlib=True)
theta.units = 'K'
开发者ID:aneeshcs,项目名称:twolevelpe,代码行数:33,代码来源:run_twolevel.py

示例4: Dataset

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import dt [as 别名]
    return im1,im2,txt1,txt2

if savedata:
   filename  = 'data/sqg_N%s.nc' % N # name of netcdf file.
   filename2 = 'data/sqg_N%s_N%s.nc' % (N,Nout) # name of netcdf file.
   nc = Dataset(filename, mode='w', format='NETCDF4_CLASSIC')
   nc2 = Dataset(filename2, mode='w', format='NETCDF4_CLASSIC')
   nc.r = model.r
   nc.f = model.f
   nc.U = model.U
   nc.L = model.L
   nc.H = model.H
   nc.g = g; nc.theta0 = theta0
   nc.nsq = model.nsq
   nc.tdiab = model.tdiab
   nc.dt = model.dt
   nc.diff_efold = model.diff_efold
   nc.diff_order = model.diff_order
   nc.symmetric = int(model.symmetric)
   x = nc.createDimension('x',N)
   y = nc.createDimension('y',N)
   z = nc.createDimension('z',2)
   t = nc.createDimension('t',None)
   pvvar =\
   nc.createVariable('pv',np.float32,('t','z','y','x'),zlib=True)
   pvvar.units = 'K'
   # eady pv scaled by g/(f*theta0) so du/dz = d(pv)/dy
   xvar = nc.createVariable('x',np.float32,('x',))
   xvar.units = 'meters'
   yvar = nc.createVariable('y',np.float32,('y',))
   yvar.units = 'meters'
开发者ID:aneeshcs,项目名称:sqgturb,代码行数:33,代码来源:sqg_nature_run.py

示例5: int

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import dt [as 别名]
obtimes = nc_truth.variables['t'][:]
assim_interval = obtimes[1]-obtimes[0]
assim_timesteps = int(np.round(assim_interval/model.dt))
model.timesteps = assim_timesteps

nc = Dataset(filename, mode='w', format='NETCDF4_CLASSIC')
nc.r = model.r
nc.f = model.f
nc.U = model.U
nc.L = model.L
nc.H = model.H
nc.g = nc_climo.g; nc.theta0 = nc_climo.theta0
nc.nsq = model.nsq
nc.tdiab = model.tdiab
nc.dt = model.dt
nc.diff_efold = model.diff_efold
nc.diff_order = model.diff_order
x = nc.createDimension('x',model.N)
y = nc.createDimension('y',model.N)
z = nc.createDimension('z',2)
t = nc.createDimension('t',None)
pvvar =\
nc.createVariable('pv',np.float32,('t','z','y','x'),zlib=True)
pvvar.units = 'K'
# eady pv scaled by g/(f*theta0) so du/dz = d(pv)/dy
xvar = nc.createVariable('x',np.float32,('x',))
xvar.units = 'meters'
yvar = nc.createVariable('y',np.float32,('y',))
yvar.units = 'meters'
zvar = nc.createVariable('z',np.float32,('z',))
开发者ID:aneeshcs,项目名称:sqgturb,代码行数:32,代码来源:sqg_genperts.py


注:本文中的netCDF4.Dataset.dt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。