本文整理汇总了Python中netCDF4.Dataset.variables['waterThickness'][0,:]方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.variables['waterThickness'][0,:]方法的具体用法?Python Dataset.variables['waterThickness'][0,:]怎么用?Python Dataset.variables['waterThickness'][0,:]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类netCDF4.Dataset
的用法示例。
在下文中一共展示了Dataset.variables['waterThickness'][0,:]方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import variables['waterThickness'][0,:] [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
示例2: value
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import variables['waterThickness'][0,:] [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
示例3:
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import variables['waterThickness'][0,:] [as 别名]
layerThicknessFractions[:] = 1.0 / nVertLevels
# melt
gridfile.variables['basalMeltInput'][:] = 0.0
gridfile.variables['basalMeltInput'][:] = 0.2 / (365.0*24.0*3600.0) * 1000.0 # 20 cm/yr as SI mass rate
# Use this line to only add a source term to the center cell - useful for debugging divergence
#gridfile.variables['basalMeltInput'][0,r==0.0] = 4.0e-10 * 1000.0 *100 # value from ramp
# velocity
gridfile.variables['uReconstructX'][:] = 0.0
velo = r*0.0
velo = v0 * (r-R1)**5 / (L - R1)**5
velo[r<R1]=0.0
gridfile.variables['uReconstructX'][0,:,-1] = velo
gridfile.variables['uReconstructX'][0,thickness[0,:]==0.0,:] = 0.0
# IC on thickness
gridfile.variables['waterThickness'][0,:] = 0.0
gridfile.variables['waterThickness'][0,:] = 0.01 # set some small initial value to keep adaptive time stepper from taking a huge time step initially
#gridfile.variables['waterThickness'][0,:] = (r-R1)/R0 * 0.05 # set some arbitrary but small linear profile
#gridfile.variables['waterThickness'][0,gridfile.v0; % m actual margin location# zero negative values
#gridfile.variables['waterThickness'][0,:] = 0.
gridfile.variables['waterPressure'][0,:] = 0.0
gridfile.close()
print 'Successfully added initial conditions to: ', options.filename
示例4:
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import variables['waterThickness'][0,:] [as 别名]
gridfile.sync()
# Setup layerThicknessFractions
gridfile.variables['layerThicknessFractions'][:] = 1.0 / nVertLevels
# Water input
waterInput = gridfile.variables['externalWaterInput'][0,:]
waterInput[:] = 0.0
waterInput[thickness[:]>0.0] = 1.158e-6 * 1000.0 # Convert from m/s to kg/m2/s
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 water thickness
gridfile.variables['waterThickness'][0,:] = 0.005 * np.absolute(xCell[:] - 6.0e3)/6.0e3 # start with something very small but nonzero 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,:] = 0.05 * 9.81 * 910.0 * thickness[:] # start with something small to avoid unphysical gradients
gridfile.close()
print 'Successfully added initial conditions to: ', options.filename