|
9 | 9 | import shutil |
10 | 10 | import logging |
11 | 11 | import math |
| 12 | +import warnings |
12 | 13 | import numpy as np |
13 | 14 | from scipy import ndimage |
14 | 15 | import pandas as pd |
15 | 16 | import requests |
16 | 17 | import shapely.vectorized |
17 | 18 | from cartopy.io import shapereader |
18 | 19 | from iso3166 import countries as iso_cntry |
19 | | -import warnings |
20 | 20 |
|
21 | 21 | from climada.entity.exposures.base import Exposures |
22 | 22 | from climada.util.files_handler import download_file |
@@ -295,6 +295,7 @@ def get_nightlight(ref_year, cntry_info, res_km, from_hr=None): |
295 | 295 | req_files, nl_year) |
296 | 296 | fn_nl = [file.replace('*', str(nl_year)) for idx, file \ |
297 | 297 | in enumerate(nl_utils.BM_FILENAMES) if req_files[idx]] |
| 298 | + fn_nl = ' + '.join(fn_nl) |
298 | 299 | else: |
299 | 300 | nl_year = ref_year |
300 | 301 | if ref_year < 1992: |
@@ -451,15 +452,15 @@ def _get_gdp(cntry_info, ref_year, shp_file): |
451 | 452 | try: |
452 | 453 | with warnings.catch_warnings(): |
453 | 454 | warnings.simplefilter("ignore") |
454 | | - cntry_gdp = wb.download(indicator=wb_gdp_ind, country=cntry_iso, |
455 | | - start=1960, end=2030) |
| 455 | + cntry_gdp = wb.download(indicator=wb_gdp_ind, \ |
| 456 | + country=cntry_iso, start=1960, end=2030) |
456 | 457 | years = np.array([int(year) \ |
457 | 458 | for year in cntry_gdp.index.get_level_values('year')]) |
458 | 459 | close_gdp = cntry_gdp.iloc[ \ |
459 | 460 | np.abs(years-ref_year).argsort()].dropna() |
460 | 461 | close_gdp_val = float(close_gdp.iloc[0].values) |
461 | 462 | LOGGER.info("GDP {} {:d}: {:.3e}.".format(cntry_iso, \ |
462 | | - int(close_gdp.iloc[0].name[1]), close_gdp_val)) |
| 463 | + int(close_gdp.iloc[0].name[1]), close_gdp_val)) |
463 | 464 |
|
464 | 465 | except (ValueError, IndexError, requests.exceptions.ConnectionError) \ |
465 | 466 | as err: |
|
0 commit comments