output_data

This module contains functions to save solving results of models.

prepshot.output_data.create_data_array(data, dims, unit, model)[source]

Create a xarray DataArray with specified data, dimensions, coordinates and units.

Parameters
  • data (dict) -- The data to be included in the DataArray.

  • dims (list) -- The list of dimentions of the data.

  • unit (str) -- The unit of the data.

  • model (object) -- The model object.

Returns

A DataArray with the specified data, dimensions, coordinates and units.

Return type

xr.DataArray

prepshot.output_data.extract_results_hydro(model)[source]

Extracts results for hydro models.

Parameters

model (object) -- Model solved already.

Returns

A Dataset containing DataArrays for each attribute of the model.

Return type

xr.Dataset

prepshot.output_data.extract_results_non_hydro(model)[source]

Extracts results for non-hydro models.

Parameters

model (object) -- Model object sloved already.

Returns

A Dataset containing DataArrays for each attribute of the model.

Return type

xr.Dataset

prepshot.output_data.save_result(model)[source]

Extracts results from the provided model.

Parameters

model (object) -- The model object to extract results from and save.

Return type

None

prepshot.output_data.save_to_excel(ds, output_filename)[source]

Save the results to an Excel file.

Parameters
  • ds (xr.Dataset) -- Dataset containing the results.

  • output_filename (str) -- The name of the output file.

Return type

None

prepshot.output_data.update_output_filename(output_filename, args)[source]

Update the output filename based on the arguments.

Parameters
  • output_filename (str) -- The name of the output file.

  • args (argparse.Namespace) -- Arguments parsed by argparse.

Returns

The updated output filename.

Return type

str