in3Utils.cfgUtils

Utilities for handling configuration files and simulation naming

This module provides functions for: - Configuration file reading, writing, and merging - Configuration comparison and hashing - Simulation name parsing and construction

Simulation Name Format

AvaFrame uses structured simulation names with two supported formats:

New format (with module name):

relName_simHash_modName_defID_[frictIndi]_simType_modelType[_resType][_timeStep]

Old format (without module name):

relName_simHash_[defID]_[frictIndi]_simType_modelType[_resType][_timeStep]

Where:
  • relName: Release area scenario name (required)

  • simHash: Configuration hash (required, 10 characters)

  • modName: Short module name - “com1”, “com2”, etc. (new format only)

  • defID: Default indicator - “C” or “D” (defaults to “C”) (required)

  • frictIndi: Friction calibration - “S”, “M”, or “L” (optional)

  • simType: Simulation type - “null”, “ent”, “res”, “entres” (required)

  • modelType: Model type - “dfa”, etc. (required)

  • resType: Result type - “ppr”, “pft”, “pfv”, etc. (filename only)

  • timeStep: Time step value (filename only)

The module name in the new format uses SHORT form only (e.g., “com1” not “com1DFA”). This was implemented in 2025-12 to support better organization and filtering of simulations.

Use parseSimName() to extract components from any simulation name. Backward compatibility is maintained - old format names are still supported.

Functions

appendCgf2DF

append simulation configuration to the simulation dataframe append all sections to the dataframe

appendTcpu2DF

append Tcpu dictionary to the dataframe

cfgHash

UID hash of a config.

cfgToRcf

Convert configuration object to RCF format file (used by NGI MoT).

compareTwoConfigs

compare locCfg to defCfg and return a cfg object and modification dict Values are merged from locCfg to defCfg: - parameters already in defCfg get the value from locCfg - additional values in locCfg get added in the resulting Cfg

convertConfigParserToDict

create dictionary from configparser object

convertDF2numerics

convert a string DF to a numerical one

convertDictToConfigParser

create configParser object from dict

convertToCfgList

convert a list into a string where individual list items are separated by |

createConfigurationInfo

Read configurations from all simulations configuration ini files from directory

getDefaultModuleConfig

Returns the default configuration for a given module returns a configParser object

getGeneralConfig

Returns the general configuration for avaframe returns a configParser object

getModPathName

get the path and name of a module from imported module

getModuleConfig

Returns the configuration for a given module returns a configParser object OR pathlib.Path (when batchCfgDir is used)

getNumberOfProcesses

Determine how many CPU cores to take for parallel tasks

parseSimName

Parse simulation name handling both old and new formats.

readAllConfigurationInfo

Read allConfigurations.csv file as dataFrame from directory

readCfgFile

Read configuration from ini file, if module is provided, module configuration is read from Ouputs, if fileName is provided configuration is read from fileName

readCompareConfig

Read and optionally compare configuration files (if a local and default are both provided) and inform user of the eventual differences.

readConfigurationInfoFromDone

Check avaName/Outputs/com1DFA/configurationFilesDone and pass names of all files found in this directory and create corresponding simDF this is useful if e.g.

renameDuplicates

Rename duplicate column names in the given DataFrame.

setStrnanToNan

set pandas element to np.nan if it is a string nan

writeAllConfigurationInfo

Write cfg configuration to allConfigurations.csv

writeCfgFile

Save configuration used to text file in Outputs/moduleName/configurationFiles/modName.ini or optional to filePath and with fileName

writeDictToJson

write a dictionary to a json file

writeReleaseCsvFile

When release is time dependent, save time dependent release values in Outputs/configurationFiles.