simpeg.utils.validate_integer#

simpeg.utils.validate_integer(property_name, var, min_val=-inf, max_val=inf)[source]#

Validate integer property

Parameters:
property_namestr

The name of the property being set

varint or float

The input variable

min_valint or float, optional

Minimum value

max_valint or float, optional

Maximum value

Returns:
int

Returns the input variable as a int once validated

Notes

The variable is casted to an int, therefore if a float is passed, the decimal value is discarded and a valid integer is returned.