Skip to content

Commit

Permalink
fix print warning to real warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Moodie committed May 25, 2020
1 parent 13cdeae commit 5945ab9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pyDeltaRCM/bmi_delta.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#! /usr/bin/env python
import yaml
import warnings

import numpy as np
import os
Expand Down Expand Up @@ -153,7 +154,8 @@ def initialize(self, filename = 'deltaRCM.yaml'):
user_dict = yaml.load(user_file, Loader = yaml.FullLoader)
user_file.close()
else:
print('The specified input file could not be found. Using default values...')
warnings.warn(UserWarning('The specified input file could not be found.'
' Using default values...'))
user_dict = dict()

# go through and populate input vars with user and default values from
Expand All @@ -165,8 +167,8 @@ def initialize(self, filename = 'deltaRCM.yaml'):
if oo in user_dict and isinstance(user_dict[oo], the_type):
input_file_vars[model_name] = user_dict[oo]
elif oo in user_dict and not isinstance(user_dict[oo], the_type):
print('Input for ' + oo + ' not of the right type. '
+ oo + ' needs to be of type ' + str(the_type))
warnings.warn(UserWarning('Input for ' + oo + ' not of the right type. '
+ oo + ' needs to be of type ' + str(the_type)))
input_file_vars[model_name] = self._input_vars[oo]['default']
else:
input_file_vars[model_name] = self._input_vars[oo]['default']
Expand Down

0 comments on commit 5945ab9

Please sign in to comment.