BG_Flood icon indicating copy to clipboard operation
BG_Flood copied to clipboard

Roughness map files starting with a digit

Open CyprienBosserelle opened this issue 3 months ago • 1 comments

The issue

Users cannot use roughness map if the file name starts with a digit

Why

Roughness map can be used using the same keyword as constant values. This is helpful in many situation where one doesn't have to remember a different keywords for maps or cst values.

However BG_Flood has to determine whether the user input is a file or a number. At the moment the code checks whether the first character is a number. If not it must be a file!

if (!parametervalue.empty())
	{
		if (std::isdigit(parametervalue[0]) == false)
		{
			forcing.cf = readfileinfo(parametervalue, forcing.cf);
		}
	}

It is a problem

When the user forgets about the quirk above and use a digit in the first character of the file this becomes a silent issue where a value not intended is used for roughness.

Solution?

change the std::isdigit(parametervalue[0]) == false to:

  • NOT (all characters are digits (or "."))
  • any character that is not "." is non-digit
  • more than one non-digit character

CyprienBosserelle avatar Mar 19 '24 00:03 CyprienBosserelle

#102

CyprienBosserelle avatar Mar 19 '24 01:03 CyprienBosserelle