ResSimpy.Nexus.nexus_file_operations

Functions

check_for_and_populate_common_input_data

Loop through lines of Nexus input file content looking for common input data, e.g., units such as ENGLISH or METRIC, temperature units such as FAHR or CELSIUS, DATEFORMAT, etc., as defined in Nexus manual.

check_list_tokens

Checks a list of tokens for whether it exists in a string and returns the token that matched.

check_property_in_line

Given a line of Nexus input file content looking for common input data, e.g., units such as ENGLISH or METRIC, temperature units such as FAHR or CELSIUS, DATEFORMAT, etc., as defined in Nexus manual.

check_token

Checks if the text line contains the supplied token and is not commented out :param token: keyword value to search the line for :type token: str :param line: string to search the token in :type line: str

clean_up_string

Removes unwanted characters from a string

correct_datatypes

Takes a value and returns the value but converted to specified type. if na_to_none True then will

create_templated_file

Creates a new text file at the requested destination substituting the supplied values.

expand_include

Expands out include files.

get_expected_next_value

Gets the next non blank value in a list of lines.

get_expected_token_value

Function that returns the result of get_token_value if a value is found, otherwise it raises a ValueError.

get_full_file_path

Returns the full file path including the base directories if they aren't present in the string.

get_multiple_sequential_values

Returns a sequential list of values as long as the number of tokens requested.

get_next_value

Gets the next non blank value in a list of lines.

get_previous_value

Gets the previous non blank value in a list of lines.

get_table_header

Gets the table headers for a given line in a file.

get_token_value

Gets the value following a token if supplied with a line containing the token.

load_file_as_list

Reads the text file into a variable.

load_table_to_objects

Loads a table row by row to an object provided in the row_object.

looks_like_grid_array

Returns true if a Nexus include file begins with one of the Nexus grid array keywords.

nexus_token_found

Checks if a valid Nexus token has been found in the supplied line.

read_table_to_df

From a list of strings that represents a table, generate a Pandas dataframe representation of the table.

strip_file_of_comments

Strips all of the inline, single and multi line comments out of a file.

table_line_reader

Reads in a line from a nexus table with a given set of headers and populates each of those values into a corresponding dictionary.

value_in_file

Returns true if a token is found in the specified file.