32 if os.environ.get(
'LIBDIR')
is not None:
33 sys.path.append(os.environ[
'LIBDIR'])
60 name =
"Example-02-python.hdf5",
61 mode = ioda.Engines.BackendCreateModes.Truncate_If_Exists)
74 intatt1 = g.atts.create(name=
"int-att-1", dtype=ioda.Types.int32, dims=[1])
89 intatt1.writeDatum.int32(1)
92 intatt2 = g.atts.create(
"int-att-2", ioda.Types.int32, [2])
96 intatt2.writeVector.int32([1, 2])
99 intatt3 = g.atts.create(
"int-att-3", ioda.Types.int32, [3])
100 intatt3.writeVector.int32([1, 2, 3])
104 float1 = g.atts.create(
"float-1", ioda.Types.float, [2])
105 float1.writeVector.float([3.1159, 2.78])
108 g.atts.create(
"double-1", ioda.Types.double, [4]).writeVector.double([1.1,2.2,3.3,4.4])
112 g.atts.create(
"str-1", ioda.Types.str, [1]).writeVector.str([
"This is a test."])
116 attlist = g.atts.list()
118 if len(attlist) != 6:
119 raise Exception(
"Wrong size for g.atts.list!")
122 f1 = g.atts.open(
'float-1')
123 d1 = g.atts.open(
'double-1')
137 if f1_dims.dimensionality != 1:
138 raise Exception(
"Unexpected dimensionality")
140 if f1_dims.dimsCur[0] != 2:
141 raise Exception(
"Unexpected size")
143 if f1_dims.dimsMax[0] != 2:
144 raise Exception(
"Unexpected size")
146 if f1_dims.numElements != 2:
147 raise Exception(
"Unexpected size")
150 a2_reopened = g.atts.open(
'int-att-2')
157 if float1.isA.float() !=
True:
158 raise Exception(
"Unexpected type")
160 if g.atts.open(
'int-att-1').isA2(ioda.Types.int32) !=
True:
161 raise Exception(
"Unexpected type")
170 i2vals = a2_reopened.readVector.int32()
172 raise Exception(
"Wrong length")
IODA_DL Group createFile(const std::string &filename, BackendCreateModes mode, HDF5_Version_Range compat=defaultVersionRange())
Create a ioda::Group backed by an HDF5 file.