Skip to content

Commit

Permalink
MNT: Convert some string concatenations to f-strings
Browse files Browse the repository at this point in the history
  • Loading branch information
dopplershift committed Aug 26, 2020
1 parent 82627d1 commit ad3cf42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/metpy/interpolate/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def natural_neighbor_point(xp, yp, variable, grid_loc, tri, neighbors, circumcen
except (ZeroDivisionError, qhull.QhullError) as e:
message = ('Error during processing of a grid. '
'Interpolation will continue but be mindful '
'of errors in output. ') + str(e)
f'of errors in output. {e}')

log.warning(message)
return np.nan
Expand Down Expand Up @@ -270,7 +270,7 @@ def inverse_distance_to_points(points, values, xi, r, gamma=None, kappa=None, mi
img[idx] = barnes_point(dists, values_subset, kappa, gamma)

else:
raise ValueError(str(kind) + ' interpolation not supported.')
raise ValueError(f'{kind} interpolation not supported.')

return img

Expand Down
6 changes: 3 additions & 3 deletions src/metpy/io/nexrad.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def _decode_msg18(self, msg_hdr):
msg_fmt = DictStruct(fields, '>')
self.rda = msg_fmt.unpack(data)
for num in (11, 21, 31, 32, 300, 301):
attr = 'VCPAT' + str(num)
attr = f'VCPAT{num}'
dat = self.rda[attr]
vcp_hdr = self.vcp_fmt.unpack_from(dat, 0)
off = self.vcp_fmt.size
Expand Down Expand Up @@ -1703,8 +1703,8 @@ def __init__(self, filename):
log.debug('Product description block: %s', self.prod_desc)

# Convert thresholds and dependent values to lists of values
self.thresholds = [getattr(self.prod_desc, 'thr' + str(i)) for i in range(1, 17)]
self.depVals = [getattr(self.prod_desc, 'dep' + str(i)) for i in range(1, 11)]
self.thresholds = [getattr(self.prod_desc, f'thr{i}') for i in range(1, 17)]
self.depVals = [getattr(self.prod_desc, f'dep{i}') for i in range(1, 11)]

# Set up some time/location metadata
self.metadata['msg_time'] = nexrad_to_datetime(self.header.date,
Expand Down

0 comments on commit ad3cf42

Please sign in to comment.