Python: Enforce checking on script name to make sure conversion between camelCase and snake_case works correctly

* #12044 Python: Add Non-Darcy properties available in Python

* #12049 Python: Add checking for multiple consecutive upper case letters
The scripting keyword is transformed to snake_case for use in Python. When data in Python is sent back to ResInsight, the opposite operation happens. This concept works well for most variants of keywords, but there are some corner cases that is not working.

Add compile time checking to make sure that the scripting keywords are formatted correctly.

Fix keyword that has been formatted the wrong way and has never worked.

* Avoid running test if ResInsight executable path is not defined in env
* Make sure dash is allowed in enumeration text string
This commit is contained in:
Magne Sjaastad
2025-01-10 18:25:46 +01:00
committed by GitHub
parent 90a1642326
commit da69c1f049
9 changed files with 320 additions and 94 deletions

View File

@@ -51,26 +51,49 @@ RimWbsParameters::RimWbsParameters()
"",
"Data source for Non-Reservoir Pore Pressure",
"" );
CAF_PDM_InitScriptableField( &m_userDefinedPPShale, "UserPPNonReservoir", 1.0, " Multiplier of hydrostatic PP" );
CAF_PDM_InitScriptableFieldWithScriptKeyword( &m_userDefinedPPShale,
"UserPPNonReservoir",
"UserPpNonReservoir",
1.0,
" Multiplier of hydrostatic PP" );
CAF_PDM_InitScriptableFieldNoDefault( &m_poissonRatioSource, "PoissionRatioSource", "Poisson Ratio", "", "Data source for Poisson Ratio", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_ucsSource, "UcsSource", "Uniaxial Compressive Strength", "", "Data source for UCS", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_OBG0Source, "OBG0Source", "Initial Overburden Gradient", "", "Data source for OBG0", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_DFSource, "DFSource", "Depletion Factor (DF)", "", "Data source for Depletion Factor", "" );
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_OBG0Source,
"OBG0Source",
"ObgSource",
"Initial Overburden Gradient",
"",
"Data source for OBG0",
"" );
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_DFSource,
"DFSource",
"DfSource",
"Depletion Factor (DF)",
"",
"Data source for Depletion Factor",
"" );
CAF_PDM_InitScriptableFieldNoDefault( &m_K0SHSource,
"K0SHSource",
"K0_SH",
"",
"SH from Matthews & Kelly = K0_SH * (OBG0-PP0) + PP0 + DF * "
"(PP-PP0)\nK0_SH = "
"(SH - PP)/(OBG-PP)",
"" );
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_K0SHSource,
"K0SHSource",
"KshSource",
"K0_SH",
"",
"SH from Matthews & Kelly = K0_SH * (OBG0-PP0) + PP0 + DF * "
"(PP-PP0)\nK0_SH = "
"(SH - PP)/(OBG-PP)",
"" );
CAF_PDM_InitScriptableFieldNoDefault( &m_FGShaleSource, "FGShaleSource", "FG in Shale Calculation" );
CAF_PDM_InitScriptableFieldNoDefault( &m_K0FGSource, "K0FGSource", "K0_FG", "", "FG in shale = K0_FG * (OBG0-PP0)\nK0_FG = (FG-PP)/(OBG-PP)", "" );
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_FGShaleSource, "FGShaleSource", "FgShaleSource", "FG in Shale Calculation" );
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_K0FGSource,
"K0FGSource",
"KfgSource",
"K0_FG",
"",
"FG in shale = K0_FG * (OBG0-PP0)\nK0_FG = (FG-PP)/(OBG-PP)",
"" );
CAF_PDM_InitFieldNoDefault( &m_waterDensitySource, "WaterDensitySource", "Water Density" );
m_waterDensitySource.uiCapability()->setUiHidden( true );
@@ -86,10 +109,17 @@ RimWbsParameters::RimWbsParameters()
// Typical UCS for Shale is 5 - 100 MPa -> 50 - 1000 bar.
CAF_PDM_InitScriptableField( &m_userDefinedUcs, "UserUcs", 100.0, "User Defined UCS [bar]", "", "User Defined UCS [bar]", "" );
CAF_PDM_InitScriptableField( &m_userDefinedDF, "UserDF", 0.7, "User Defined DF", "", "User Defined Depletion Factor", "" );
CAF_PDM_InitScriptableField( &m_userDefinedK0FG, "UserK0FG", 0.75, "User Defined K0_FG" );
CAF_PDM_InitScriptableField( &m_userDefinedK0SH, "UserK0SH", 0.65, "User Defined K0_SH" );
CAF_PDM_InitScriptableField( &m_FGShaleMultiplier, "FGMultiplier", 1.05, "SH Multiplier for FG in Shale", "", "FG in Shale = Multiplier * SH", "" );
CAF_PDM_InitScriptableFieldWithScriptKeyword( &m_userDefinedDF, "UserDF", "UserDf", 0.7, "User Defined DF", "", "User Defined Depletion Factor", "" );
CAF_PDM_InitScriptableFieldWithScriptKeyword( &m_userDefinedK0FG, "UserK0FG", "UserKfg", 0.75, "User Defined K0_FG" );
CAF_PDM_InitScriptableFieldWithScriptKeyword( &m_userDefinedK0SH, "UserK0SH", "UserKsh", 0.65, "User Defined K0_SH" );
CAF_PDM_InitScriptableFieldWithScriptKeyword( &m_FGShaleMultiplier,
"FGMultiplier",
"FgMultiplier",
1.05,
"SH Multiplier for FG in Shale",
"",
"FG in Shale = Multiplier * SH",
"" );
CAF_PDM_InitScriptableField( &m_userDefinedDensity, "WaterDensity", 1.03, "Density of Sea Water [g/cm^3]", "", "Units: g/cm^3", "" );