This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import h5py | |
import numpy | |
# use the core driver of h5Py to write an hdf file | |
file = h5py.File('myfile_check.hdf5', mode = 'w', driver='core') | |
#file = h5py.File('myfile_check2.hdf5', mode = 'w', driver='log') | |
grp = file.create_group('myGroup') | |
dataset = grp.create_dataset('dataset', (10,10), '=f8', maxshape=(None,None)) | |
file['dataset'] = numpy.ones((10,10)) | |
file.flush() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dolfin import * | |
import numpy | |
mesh = UnitCube(4, 4, 4) | |
# Creating two mesh functions, empty to start with.... | |
a = FacetFunction("double", mesh) | |
b = FacetFunction("double", mesh) | |
result = FacetFunction("double", mesh) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dolfin import * | |
import numpy | |
mesh = UnitSquare(8, 8) | |
# Creating two mesh functions, empty to start with.... | |
a = CellFunction("double", mesh) | |
b = CellFunction("double", mesh) | |
result = CellFunction("double", mesh) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dolfin import * | |
import numpy | |
mesh = UnitSquare(8,8) | |
mesh = refine(mesh) | |
# editor = MeshEditor() | |
# editor.open(mesh,2,2) | |
# editor.add_cell(0,0,1,2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dolfin import * | |
from numpy import * | |
#initialize an empty mesh | |
mesh1 = Mesh() | |
#initialize an empty mesh editor | |
editor1 = MeshEditor() | |
################################################################################# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################## | |
# # | |
# This program creates a VLArray using PyTables. One dimensional numpy arrays of # | |
# varying length are appended as rows # # # | |
# # | |
################################################################################### | |
import tables as tb | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tables import * | |
# Describe a water class | |
class Water(IsDescription): | |
waterbody_name = StringCol(16, pos=1) # 16-character String | |
lati = Int32Col(pos=2) # integer | |
longi = Int32Col(pos=3) # integer | |
airpressure = Float32Col(pos=4) # float (single-precision) | |
temperature = Float64Col(pos=5) # double (double-precision) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import h5py as hp | |
filename='h5py1.h5' | |
#open a file | |
f=hp.File(filename,driver='sec2',mode='w') | |
#create a dataset | |
mydset=f.create_dataset("mydset",(10,10),'=f8',maxshape=(None,None)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tables as tb | |
import numpy as np | |
#initialize | |
filename='earrayEx.h5' | |
atom=tb.StringAtom(itemsize=8) | |
shape=(0,) | |
#open hdf5 file and create an earray | |
fileh=tb.openFile(filename,'w') |