本文整理汇总了Python中spatialdata.geocoords.CSCart.CSCart.setSpaceDim方法的典型用法代码示例。如果您正苦于以下问题:Python CSCart.setSpaceDim方法的具体用法?Python CSCart.setSpaceDim怎么用?Python CSCart.setSpaceDim使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spatialdata.geocoords.CSCart.CSCart
的用法示例。
在下文中一共展示了CSCart.setSpaceDim方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reverse
# 需要导入模块: from spatialdata.geocoords.CSCart import CSCart [as 别名]
# 或者: from spatialdata.geocoords.CSCart.CSCart import setSpaceDim [as 别名]
# (negative, y is negative)
tractions_bg_normal = density*gacc*(vertices[:,1])
# Background shear tractions are reverse (in 2-D right-lateral is negative)
# because the normal tractions are negative.
tractions_bg_shear = coef_friction*tractions_bg_normal
# Combine traction changes and background tractions
tractions_shear = tractions_bg_shear + tractions_change[:,0]
tractions_normal = tractions_bg_normal + tractions_change[:,1]
# Create coordinate system for spatial database
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs._configure()
cs.setSpaceDim(2)
# Create writer for spatial database file
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
writer = SimpleIOAscii()
writer.inventory.filename = "afterslip_tractions.spatialdb"
writer._configure()
writer.write({'points': vertices,
'coordsys': cs,
'data_dim': 1,
'values': [{'name': "traction-shear",
'units': "Pa",
'data': tractions_shear},
{'name': "traction-normal",
'units': "Pa",
'data': tractions_normal}]})
示例2: CSCart
# 需要导入模块: from spatialdata.geocoords.CSCart import CSCart [as 别名]
# 或者: from spatialdata.geocoords.CSCart.CSCart import setSpaceDim [as 别名]
#!/usr/bin/env python
"""
This script creates a spatial database for the initial stress and state
variables for a Drucker-Prager 3D elastoplastic material.
"""
material = "dp3d"
import numpy
import h5py
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs._configure()
cs.setSpaceDim(3)
filenameH5 = "output/grav_static_%s-visco.h5" % material
filenameDB = "grav_statevars-%s.spatialdb" % material
# Open HDF5 file and get coordinates, cells, and stress.
h5 = h5py.File(filenameH5, "r")
vertices = h5['geometry/vertices'][:]
cells = numpy.array(h5['topology/cells'][:], dtype=numpy.int)
stress = h5['cell_fields/stress'][0,:,:]
strain = h5['cell_fields/total_strain'][0,:,:]
strainPlastic = h5['cell_fields/plastic_strain'][0,:,:]
h5.close()
# Get cell centers for output.
cellCoords = vertices[cells,:]