def _realizations(args): ensemble_size = ERT.enkf_facade.get_ensemble_size() mask = BoolVector(default_value=False, initial_size=ensemble_size) if args.realizations is None: default = "0-{}".format(ensemble_size - 1) mask.updateActiveMask(default) return mask validator = RangeStringArgument(ensemble_size) validated = validator.validate(args.realizations) if validated.failed(): raise ArgumentTypeError( "Defined realizations is not within range of ensemble size: {}". format(args.realizations)) mask.updateActiveMask(args.realizations) return mask
def valid_realizations(user_input): validator = RangeStringArgument() validated = validator.validate(user_input) if validated.failed(): strip_error_message_and_raise_exception(validated) return user_input