Independent functions

To do:

non-object-based independent functions to support hipims IO


IO.indep_functions.clean_output(case_folder, num_of_sections, file_tag='*')

delete contents in output folder(s)

IO.indep_functions.load_object(file_name)

Read a pickle file as an InputHipims/OutputHipims object

IO.indep_functions.save_as_dict(obj, file_name)

Save all attributes of an input/output object to a pickle

IO.indep_functions.save_object(obj, file_name, compression=True)

Save an InputHipims/OutputHipims object to a pickle file

IO.indep_functions.write_device_setup(case_folder=None, num_of_sections=1, device_values=None)

Generate a device_setup.dat file. The file contains numbers representing the GPU number for each section

Parameters
  • case_folder – string, the path of model

  • num_of_sections – int, the number of GPUs to use

  • device_values – array or list of int, representing the GPU number

IO.indep_functions.write_rain_source(rain_source, case_folder=None, num_of_sections=1)

Write rainfall sources [Independent function from hipims class]

Parameters
  • rain_source – numpy array, The 1st column is time in seconds, the 2nd towards the end columns are rainfall rate in m/s for each source ID in rainfall mask array if for multiple GPU, then copy the rain source file to all domain folders

  • case_folder – string, the path of model

IO.indep_functions.write_times_setup(case_folder=None, num_of_sections=1, time_values=None)

Generate a times_setup.dat file. The file contains numbers representing the start time, end time, output interval, and backup interval in seconds

Parameters

time_values – array or list of int/float, representing time in seconds, default values are [0, 3600, 1800, 3600]