py4sci

Previous topic

calibrate

Next topic

Hosts

This Page

hdf - Functions for Accessing HDF5 Files

Convenience functions that read or write to the HDF5 file

puq.hdf.data_description(hf, var)[source]

Returns the description of an output variable. If the description is empty, returns the variable name.

Parameters:
  • hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
  • var – Output variable name.
puq.hdf.get_output_names(hf)[source]

Returns a list of the output variables names in the HDF5 file.

Parameters:hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
Returns:A sorted list of the output variable names in the HDF5 file.
puq.hdf.get_param_names(hf)[source]

Returns a list of the input parameter names in the HDF5 file.

Parameters:hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
puq.hdf.get_params(hf)[source]

Returns a list of arrays of input parameter values.

Parameters:hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
puq.hdf.get_response(hf, var)[source]

Returns the response function for an output variable.

Parameters:
  • hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
  • var – Output variable name.
puq.hdf.get_result(hf, var=None)[source]

Returns an array containing the values of the output variable.

Parameters:
  • hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
  • var – Output variable name. Only required if there is more than one output variable.
Returns:

An array

Raises:

ValueError – if var is not found or var is None and there are multiple output variables.

puq.hdf.param_description(hf, var)[source]

Returns the description of an input variable. If the description is empty, returns the variable name.

Parameters:
  • hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
  • var – Input parameter name.
puq.hdf.set_result(hf, var, data, desc='')[source]

Sets values of the output variable in the HDF5 file. Writes array to ‘/output/data/var‘.

Parameters:
  • hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
  • var – Output variable name.
  • data – Array of data to write.
  • desc – Description.