nwm_eval.utils#

Utility functions for the NGEN verification package.

Functions

check_columns_dataframe

Check if the required columns are present in the file.

clean_data

Clean the data by replacing inf values with NaN and dropping rows with NaN in the specified column.

convert_enum_to_value

Recursively convert Enum values to their .value (string) for YAML serialization.

convert_paths_to_str

Recursively convert Path objects to strings in dicts/lists.

create_time_sequence

Create a sequence of timestamps between start and end dates with specified frequency and hours.

expand_with_lists

Expand a string with list placeholders using Cartesian product.

flatten_dict

Flatten a nested dictionary.

get_key_from_value

Get the key from a dictionary given a value.

get_n_workers

Determine the number of workers to use for parallel jobs dynamically based on system resources available.

read_data

Read data from a csv or parquet file.

read_parquet_auto

Automatically read a parquet file as a DataFrame or GeoDataFrame.

recursive_substitute

Recursively substitute placeholders in nested structures.

remove_nulls

Remove nulls.

save_data

Save data to disk in an appropriate format based on its type and file extension.