|
16 | 16 | import shapely.vectorized |
17 | 17 | from cartopy.io import shapereader |
18 | 18 | from iso3166 import countries as iso_cntry |
| 19 | +import warnings |
19 | 20 |
|
20 | 21 | from climada.entity.exposures.base import Exposures |
21 | 22 | from climada.util.files_handler import download_file |
@@ -164,7 +165,7 @@ def _set_one_country(cntry_info, nightlight, coord_nl, fn_nl, res_fact, |
164 | 165 | _filter_admin1(exp_bkmrb, admin1) |
165 | 166 |
|
166 | 167 | exp_bkmrb.id = np.arange(1, exp_bkmrb.value.size+1) |
167 | | - exp_bkmrb.region_id = np.ones(exp_bkmrb.value.shape) * cntry_info[0] |
| 168 | + exp_bkmrb.region_id = np.ones(exp_bkmrb.value.shape, int)*cntry_info[0] |
168 | 169 | exp_bkmrb.impact_id = np.ones(exp_bkmrb.value.size, int) |
169 | 170 | exp_bkmrb.ref_year = cntry_info[3] |
170 | 171 | exp_bkmrb.tag.description = ("{} {:d} GDP: {:.3e} income group: {:d}"+\ |
@@ -341,10 +342,9 @@ def add_sea(exp, sea_res): |
341 | 342 | np.append(exp.coord.lon, lon_mgrid[on_land])]).transpose() |
342 | 343 | exp.value = np.append(exp.value, lat_mgrid[on_land]*0) |
343 | 344 | exp.id = np.arange(1, exp.value.size+1) |
344 | | - exp.region_id = np.append(exp.region_id, lat_mgrid[on_land]*0-1) |
| 345 | + exp.region_id = np.append(exp.region_id, lat_mgrid[on_land].astype(int)*0 |
| 346 | + - 1) |
345 | 347 | exp.impact_id = np.ones(exp.value.size, int) |
346 | | - exp.deductible = np.zeros(exp.value.size) |
347 | | - exp.cover = exp.value.copy() |
348 | 348 |
|
349 | 349 | def _fill_admin1_geom(iso3, admin1_rec, prov_list): |
350 | 350 | """Get admin1 polygons for each input province of country iso3. |
@@ -449,7 +449,9 @@ def _get_gdp(cntry_info, ref_year, shp_file): |
449 | 449 | wb_gdp_ind = 'NY.GDP.MKTP.CD' |
450 | 450 | for cntry_iso, cntry_val in cntry_info.items(): |
451 | 451 | try: |
452 | | - cntry_gdp = wb.download(indicator=wb_gdp_ind, country=cntry_iso, |
| 452 | + with warnings.catch_warnings(): |
| 453 | + warnings.simplefilter("ignore") |
| 454 | + cntry_gdp = wb.download(indicator=wb_gdp_ind, country=cntry_iso, |
453 | 455 | start=1960, end=2030) |
454 | 456 | years = np.array([int(year) \ |
455 | 457 | for year in cntry_gdp.index.get_level_values('year')]) |
|
0 commit comments