本文整理汇总了Python中netCDF4.Dataset.variables['uReconstructX'][:]方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.variables['uReconstructX'][:]方法的具体用法?Python Dataset.variables['uReconstructX'][:]怎么用?Python Dataset.variables['uReconstructX'][:]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类netCDF4.Dataset
的用法示例。
在下文中一共展示了Dataset.variables['uReconstructX'][:]方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import variables['uReconstructX'][:] [as 别名]
bedTopography[:] = 0.0
# Setup layerThicknessFractions
layerThicknessFractions[:] = 1.0 / nVertLevels
# boundary conditions
# Sample values to use, or comment these out for them to be 0.
SMB[:] = 0.0
#beta[:] = 50000.
#SMB[:] = 2.0/1000.0 * (thickness[:] + bedTopography[:]) - 1.0 # units: m/yr, lapse rate of 1 m/yr with 0 at 500 m
# Convert from units of m/yr to kg/m2/s using an assumed ice density
SMB[:] = SMB[:] *910.0/(3600.0*24.0*365.0)
#Tsfc[:,0] = -5.0/1000.0 * (thickness[0,:] + bedTopography[0,:]) # lapse rate of 5 deg / km
#G = 0.01
#BMB[:] = -20.0 # units: m/yr
hydro=False
if hydro:
gridfile.variables['uReconstructX'][:] = 5.0/(3600.0*24.0*365.0)
gridfile.variables['basalMeltInput'][:] = 0.06 / 335000.0 * 50.0
gridfile.variables['externalWaterInput'][:] = 0.0
gridfile.variables['waterThickness'][:] = 0.08
gridfile.close()
print 'Successfully added dome initial conditions to: ', options.filename
示例2:
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import variables['uReconstructX'][:] [as 别名]
# thickness is a ramp
thickness[0,:] = (1000000.0-np.absolute(xCell[:])) * 0.001 + 0.0 # 0.0111 = 100 Pa/m
#thickness[0, thickness[0,:]<0.0 ]=0.0
thickness[0, np.absolute(xCell[:])>1000000.0]=0.0 # make a margin
# flat bed - make last cell floating in order to get N=0 lateral BC required
minH = np.unique(thickness[0,:])[1] # 0.0 will the the smallset - get the next smallest
bedTopography[:] = -900.0/1000.0 * minH - 1.0 # subtract one extra meter to make sure we float here
# Setup layerThicknessFractions
layerThicknessFractions[:] = 1.0 / nVertLevels
# melt
gridfile.variables['basalMeltInput'][:] = 2.0e-10 * 1000.0 # From Ian's email, 9/21/12
gridfile.variables['externalWaterInput'][:] = 2.0e-10 * 1000.0 # From Ian's email, 9/21/12
# velocity
gridfile.variables['uReconstructX'][:] = 1.0e-7 # doesn't matter because no sliding opening in the test case
# IC on thickness
gridfile.variables['waterThickness'][0,:] = (1000000.0 - np.absolute(xCell[:])) * 0.0 / 1000000.0
#gridfile.variables['waterThickness'][0,gridfile.variables['waterThickness'][0,:]<0.0] = 0.0
gridfile.close()
print 'Successfully added initial conditions to: ', options.filename
示例3: float
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import variables['uReconstructX'][:] [as 别名]
# For now approximate boundary conditions with 0 velocity.
print "Defining velocity boundary conditions."
# This is not correct.
# west boundary should be dh/dx=ds/dx=0.
# north and south boundaries should be no slip lateral boundaries.
# Dirichlet velocity mask
kinbcmask = np.zeros((1, nCells, nVertInterfaces))
kinbcmask[:, np.nonzero(yCell == yCell.min()), : ] = 1 # south row
kinbcmask[:, np.nonzero(yCell == yCell.max()), : ] = 1 # north row
###kinbcmask[:, np.nonzero(xCell < 0.0), : ] = 1 # west boundary
gridfile.variables['dirichletVelocityMask'][:] = kinbcmask
# Dirichlet velocity values
gridfile.variables['uReconstructX'][:] = 0.0
gridfile.variables['uReconstructY'][:] = 0.0
# beta is not correct
print "Defining beta."
#gridfile.variables['beta'][:] = 1.0e7 / 3.14e7**(1.0/m) # For the basal friction law being used, beta holds the 'C' coefficient in Pa m^-1/3 s^1/3
gridfile.variables['beta'][:] = 31880.0 # For the basal friction law being used, beta holds the 'C' coefficient. The beta units in MPAS are a mess right now. This value translates to 10^7 Pa m^-1/3 s^1/3
# Setup layerThicknessFractions
gridfile.variables['layerThicknessFractions'][:] = 1.0 / float(nVertLevels)
gridfile.sync()
gridfile.close()
print 'Successfully added MISMIP3D initial conditions to: ', options.filename
示例4: value
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import variables['uReconstructX'][:] [as 别名]
# Setup layerThicknessFractions
layerThicknessFractions[:] = 1.0 / nVertLevels
print "Using water input value (m/s) of:", a_params[options.number]
waterInput = gridfile.variables['externalWaterInput'][0,:]
waterInput[:] = a_params[options.number] * 1000.0 # Convert from m/s to kg/m2/s
#scale down the source term in the 'tents' in the N and S rows - there is no x-dir throughflow here so excess water is introduced
scaleFactor = 2.0/3.0 # for perfect hexagon
waterInput[np.nonzero(yCell[:]==np.unique(yCell[:])[0])] = a_params[options.number] * 1000.0 * scaleFactor
waterInput[np.nonzero(yCell[:]==np.unique(yCell[:])[-1])] = a_params[options.number] * 1000.0 * scaleFactor
gridfile.variables['externalWaterInput'][0,:] = waterInput
# melt
gridfile.variables['basalMeltInput'][:] = 0.0 * 1000.0 # no basal melting
# velocity
gridfile.variables['uReconstructX'][:] = 1.0e-6 # all tests use this velocity
# initial thickness
gridfile.variables['waterThickness'][0,:] = 0.05 * np.absolute(xCell[:] - 100.0e3)/100.0e3 # start with something to avoid weird adapative time steps initially
# initial waterPressure
#gridfile.variables['waterPressure'][:] = 0.5 * 9.81 * 910.0 * thickness[:] * (0.97 + 0.03 * np.random.rand(thickness[:].size)) # start with half of Pice. Last factor adds some random noise to disrupt symmetry.
gridfile.variables['waterPressure'][:] = 0.5 * 9.81 * 910.0 * thickness[:]
gridfile.close()
print 'Successfully added initial conditions to: ', options.filename