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


Python Dataset.variables['waterThickness'][0,:]方法代码示例

本文整理汇总了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

开发者ID:MPAS-Dev,项目名称:MPAS-Release,代码行数:30,代码来源:setup_hydro-ramp_initial_conditions.py

示例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

开发者ID:MPAS-Dev,项目名称:MPAS-Release,代码行数:31,代码来源:setup_hydro-shmip_experimentA_initial_conditions.py

示例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

开发者ID:MPAS-Dev,项目名称:MPAS-Release,代码行数:31,代码来源:setup_hydro-radial_initial_conditions.py

示例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

开发者ID:MPAS-Dev,项目名称:MPAS-Release,代码行数:31,代码来源:setup_hydro-shmip_experimentE_initial_conditions.py


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