@@ -239,28 +239,28 @@ following code:
239239
240240 # Define the compound datatype with fixed-length ASCII strings and a float32
241241 dt = np.dtype([
242- (' name' , ' S16' ), # Fixed-length ASCII string of 16 bytes
243- (' unit' , ' S16' ), # Fixed-length ASCII string of 16 bytes
244- (' value' , ' <f4' ) # Little-endian 32-bit float
245- ])
242+ (' name' , ' S16' ), # Fixed-length ASCII string of 16 bytes
243+ (' unit' , ' S16' ), # Fixed-length ASCII string of 16 bytes
244+ (' value' , ' <f4' ) # Little-endian 32-bit float
245+ ])
246246
247247 # Create the dataset data as a numpy array
248248 data = np.array([
249249 (b ' G' , b ' none' , 1.0 ),
250- (b ' length' , b ' none' , 1.0 ),
251- (b ' mass' , b ' none' , 1.0 ),
252- (b ' time' , b ' none' , 1.0 ),
253- ], dtype = dt)
250+ (b ' length' , b ' none' , 1.0 ),
251+ (b ' mass' , b ' none' , 1.0 ),
252+ (b ' time' , b ' none' , 1.0 ),
253+ ], dtype = dt)
254254
255255 # Open the HDF5 coefficient file and add the dataset
256256 with h5py.File(' outcoef.disk.runtag' , ' a' ) as f:
257257 # 'a' mode opens file for read/write, creates if not exist
258258
259- # Create dataset 'Units'
260- if 'Units' in f:
259+ # Create dataset 'Units'
260+ if ' Units' in f:
261261 # Optional: remove existing dataset if you want to overwrite
262262 del f[' Units' ]
263- dset = f.create_dataset('Units', data=data, dtype=dt)
263+ dset = f.create_dataset(' Units' , data = data, dtype = dt)
264264
265265 # File is automatically closed on leaving the 'with' block, flush and
266266 # update saved data on disk
0 commit comments