Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roughness map files starting with a digit #105

Open
CyprienBosserelle opened this issue Mar 19, 2024 · 1 comment
Open

Roughness map files starting with a digit #105

CyprienBosserelle opened this issue Mar 19, 2024 · 1 comment

Comments

@CyprienBosserelle
Copy link
Owner

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
Copy link
Owner Author

#102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant