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 takes a numpy array and feeds it into a hyperslab in a CArray. The numpy array # | |
# is then changed to a different shape and fed into a hyperslab in a VLArray. The end result # | |
# is that one has two differently shaped hyperslabs of the same data. # | |
# # | |
################################################################################################# | |
import sys | |
import tables as tb |
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 sys | |
import numpy | |
from numpy import * | |
from tables import * | |
filename = 'arrayEx.h5' | |
fileh=openFile(filename,mode="w") | |
root=fileh.root |
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 sys | |
import numpy as np | |
import tables as tb | |
filename='carrayEx1.h5' | |
fileh=tb.openFile(filename, 'w') | |
carray = fileh.createCArray(fileh.root, 'carray', tb.UInt32Atom(), shape=(200,300)) |
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') |
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
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
################################################################################## | |
# # | |
# 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 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
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) |
OlderNewer