pywrdrb.utils.hdf5.get_n_scenarios_from_pywrdrb_output_file

pywrdrb.utils.hdf5.get_n_scenarios_from_pywrdrb_output_file#

pywrdrb.utils.hdf5.get_n_scenarios_from_pywrdrb_output_file(file_path)#

Determine the number of scenarios (n_scenarios) from datasets in an HDF5 file.

This function assumes that datasets have the shape (len(datetime), len(n_scenarios)). It skips a specific dataset named ‘time’ and ignores non-dataset objects. This is used by pywrdrb.load.Output() class to determine the number of scenarios in a pywrdrb output file.

Parameters:

file_path (str) – Path to the HDF5 file.

Returns:

  • int – The number of scenarios (n_scenarios), determined from the second dimension of the first relevant dataset.

  • Raises

  • ——

  • ValueError – If no valid dataset is found in the file.