Skip to content

Commit

Permalink
Merge pull request #454 from ua-snap/fix-param-util-bug
Browse files Browse the repository at this point in the history
Change comparison operator to address warnings given by Python 3
  • Loading branch information
tobeycarman authored Feb 19, 2021
2 parents 06eebee + db9c4fa commit f2e5567
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/param_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def get_pftnames(data):
csvreader = csv.reader(data, dialect='excel', strict=True, skipinitialspace=True)
for row in csvreader:
if 'pft name' in row:
if row.index('pft name') is not 0:
if row.index('pft name') != 0:
print("WARNING! pft name column not in the proper place. Returned PFT names might be incorrect.")
if len(row[1:]) > 10:
print("WARNING! appears there are too many PFT columns!")
Expand Down Expand Up @@ -166,7 +166,7 @@ def find_section_starts(data):
sections = []
for i, row in enumerate(csvreader):
if all(x == '' for x in row[1:]):
if row[0] is not '':
if row[0] != '':
if row[0].isupper():
#print(i, row)
starts.append(i)
Expand Down Expand Up @@ -571,9 +571,9 @@ def parse_header_line(linedata):


def get_pft_verbose_name(cmtkey=None, pftkey=None, cmtnum=None, pftnum=None, lookup_path=None):
if lookup_path is "relative_to_dvmdostem":
if lookup_path == "relative_to_dvmdostem":
path2params = os.path.join(os.path.split(os.path.dirname(os.path.realpath(__file__)))[0], 'parameters/')
elif lookup_path is "relative_to_curdir":
elif lookup_path == "relative_to_curdir":
path2params = os.path.join(os.path.abspath(os.path.curdir), 'parameters/')
else:
msg = "ERROR!: lookup_path parameter must be one of 'relative_to_dvmdostem' or 'relative_to_curdir', not {}".format(lookup_path)
Expand Down

0 comments on commit f2e5567

Please sign in to comment.