1. PyPontem ppl parsing

pplParser: Class which holds the ppl parser functions

Functions:
  1. metadata: to extract metadata from a ppl file

  2. branch_names: to extract branch names from a ppl file

  3. branch_profiles: to extract branch profile information from a ppl file

  4. parse_number_of_variables: to extract the number of variables present in a ppl file

  5. extract_catalog: to extract the catalog information from a ppl file

  6. search_catalog: to extract the information from the catalog of the variable specified

  7. extract_profile: to extract profiles in a ppl file

  8. extract_profiles_join_nodes: to join nodes of the profiles extracted from a ppl file

metadata:

metadata(Args = None)

Extracts metadata from the content stored in the object and returns it as a pandas DataFrame.

Arguments:
  • None

Returns:
  • metadata (pd.DataFrame): A DataFrame containing the extracted metadata with keys as column headers

branch_names:

branch_names(Args = None)

Extracts and prints the names of all branches in the given ppl file.

Arguments:
  • None.

Returns:
  • branch_names (list): A list of extracted branch names as strings.

branch_profiles:

branch_profiles(target_branch = None)

Extracts and displays elevation for a specific branch or all branches in the file.

Arguments:
  • target_branch (str, optional): The specific branch to display data for. Defaults to None.

Returns:
  • branch_profiles (dictionary): A dictionary containing the profiles of the specified branch or all the branches if none specified.

n_vars:

n_vars(Args = None)

Parses the number of variables from a given file path.

Arguments:
  • None

Returns:
  • n_vars (int): The number of variables if found, else None.

catalog:

catalog(Args = None)

Extract variable information from the provided content using a regular expression pattern.

Arguments:
  • None.

Returns:
  • returned_catalog (pd.DataFrame): A DataFrame containing all the catalog information available in the ppl file.

search_catalog:

search_catalog(var_name=None, loc_name=None, pipe_name=None)

Searches for variables containing a keyword in their names within a DataFrame.

Arguments:
  • var_name (str): The variable name

  • loc_name (str): The location of the variable you want to search for

  • pipe_name (str): The pipe name of the variable name specified located at the location

Returns:
  • searched_catalog (pd.DataFrame): A dataframe containing catalog information of the variable specified at the location and pipe name provided.

extract_profile:

extract_profile(input_matrix: pd.DataFrame)

Extracts and processes profile data from an input matrix, performing unit conversions and time filtering.

Arguments:
  • input_matrix (pd.DataFrame): The matrix containing input data, including variable names, branches, units, and time specifications. Click to view the input matrix template. This is a required argument.

Returns:
  • profiles (pd.DataFrame): A combined DataFrame containing the processed profile data with converted units and filtered time ranges.

Extracts and processes profile data for branches, combining boundary and section data.

Arguments:
  • input_matrix (pd.DataFrame): The matrix containing information for various branches with columns [‘branchname’, ‘varname’, ‘out_unit’, ‘out_unit_profile’, ‘time_unit’]. Click to view the input matrix template. This is a required argument.

  • branch_matrix (pd.DataFrame): The matrix containing information about branch connections with columns [‘branch_in’, ‘branch_out’].

Returns:
  • joined_profiles (pd.DataFrame): A combined DataFrame containing processed profile data for the specified branches, including boundary and section data, with consistent units and profiles.

2. pypontem ppl batch parsing

pplBatchParser: A class to handle batch processing of ppl files

Note that: ppl batch parsing functionality only works for files of the same batch of simulations with the same branch names and structure, otherwise this will raise an error.

Functions:
  1. extract_profiles: To extract profiles from a list of ppl files

  2. join_batch_nodes: To join nodes of branches extracted from a list of ppl files

Function to extract profiles from a batch of ppl files

Arguments:
  • Input_matrix (pd.DataFrame): The matrix containing variable names, branch names, and pipe names. Click to view the Input matrix template. This is a required argument.

Returns
  • batch_profiles (pd.DataFrame): DataFrame containing extracted profiles from ppl files

join_batch_nodes:

join_batch_nodes(input_matrix: pd.DataFrame, branch_matrix: pd.DataFrame)

Extracts and processes profile data for branches, combining boundary and section data from a list of ppl files.

Arguments:
  • input_matrix (pd.DataFrame): The matrix containing information for various branches with columns [‘branchname’, ‘varname’, ‘out_unit’, ‘out_unit_profile’, ‘time_unit’]. Click to view the Input matrix template. This is arequired argument

  • branch_matrix (pd.DataFrame): The matrix containing information about branch connections with columns [‘branch_in’, ‘branch_out’].

Returns:
  • joined_nodes (pd.DataFrame): A combined DataFrame containing processed profile data for the specified branches, including boundary and section data, with consistent units and profiles.