Skip to content

Commit 944c6ec

Browse files
committed
correct pylint
1 parent 3d547b7 commit 944c6ec

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

climada/entity/exposures/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ def plot(self, ignore_zero=True, pop_name=True, buffer_deg=1.0,
148148
if 'reduce_C_function' not in kwargs:
149149
kwargs['reduce_C_function'] = np.sum
150150

151-
return plot.geo_bin_from_array(self.value, self.coord, cbar_label,
152-
title, pop_name, buffer_deg, ignore_zero, **kwargs)
151+
return plot.geo_bin_from_array(self.value, self.coord, cbar_label, \
152+
title, pop_name, buffer_deg, ignore_zero, **kwargs)
153153

154154
def read(self, files, descriptions='', var_names=None):
155155
"""Read and check exposures.

climada/entity/exposures/black_marble.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,9 @@ def _get_income_group(cntry_info, ref_year, shp_file):
375375
attribute for every country.
376376
"""
377377
# check if file with income groups exists in SYSTEM_DIR, download if not
378+
fn_ig = os.path.join(os.path.abspath(SYSTEM_DIR), 'OGHIST.xls')
379+
dfr_wb = pd.DataFrame()
378380
try:
379-
fn_ig = os.path.join(os.path.abspath(SYSTEM_DIR), 'OGHIST.xls')
380381
if not glob.glob(fn_ig):
381382
file_down = download_file(WORLD_BANK_INC_GRP)
382383
shutil.move(file_down, fn_ig)
@@ -387,8 +388,8 @@ def _get_income_group(cntry_info, ref_year, shp_file):
387388
except (IOError, requests.exceptions.ConnectionError):
388389
LOGGER.warning('Internet connection failed while downloading ' +
389390
'historical income groups.')
390-
dfr_wb = pd.DataFrame()
391391

392+
list_records = list(shp_file.records())
392393
for cntry_iso, cntry_val in cntry_info.items():
393394
try:
394395
cntry_dfr = dfr_wb.loc[cntry_iso]
@@ -401,13 +402,12 @@ def _get_income_group(cntry_info, ref_year, shp_file):
401402

402403
except (KeyError, IndexError):
403404
# take value from natural earth repository
404-
list_records = list(shp_file.records())
405405
for info in list_records:
406406
if info.attributes['ADM0_A3'] == cntry_iso:
407407
close_inc = info.attributes['INCOME_GRP']
408-
try:
409-
close_inc_val = INCOME_GRP_NE_TABLE[int(close_inc[0])]
410-
except (KeyError, IndexError):
408+
break
409+
close_inc_val = INCOME_GRP_NE_TABLE.get(int(close_inc[0]))
410+
if close_inc_val is None:
411411
LOGGER.error("No income group for country %s found.",
412412
cntry_iso)
413413
raise ValueError

0 commit comments

Comments
 (0)