LitPop class

This class is a data model of economic asset exposure. It models countries’ gridded asset exposure by disaggregating a macroeconomic indicator (e.g. total asset value or GDP) proportional to the product of night light intensities (“Lit”) and gridded population count (“Pop”) per country. Asset value is distributed to the grid proportzonal to \(Lit^m Pop^n\), computed at each grid cell:

\(Lit^mPop^n = Lit^m * Pop^n\), with \(exponents = [m, n] \in \N_0\) (Default values are \(m=n=1\)).

For more information please refer to the related publication (under review): https://doi.org/10.5194/essd-2019-189

Input data:

All required data except for the population data (GPW) is acquired automatically when LitPop is initiated.

Nithlights: Black Marble 2016 annual composite of the VIIRS day-night band (DNB) at 15 arcsec resolution is downloaded from the NASA Earth Observatory: https://earthobservatory.nasa.gov/Features/NightLights (available for 2012 and 2016 at 15 arcsec resolution (~500m))

Population: Gridded Population of the World (GPW), v4: Population Count, v4.10, v4.11 or later versions (2000, 2005, 2010, 2015, 2020), available from http://sedac.ciesin.columbia.edu/data/collection/gpw-v4/sets/browse.

The GPW file of the year closest to the target year is required. To download GPW data you need to register on the SEDAC website (for free). Then you can access the download site, i.e.: http://sedac.ciesin.columbia.edu/data/set/gpw-v4-population-count-rev11/data-download. There, choose the settings as shown, ticking the box of the years you need: Screenshot%202019-04-18%20at%2010.52.04.png The population data from GWP needs to be downloaded manually as TIFF from this site and placed in the system data folder of climada, i.e.: climada_python/data/system/gpw_v4_population_count_rev11_2015_30_sec.tif.

Direct download links are avilable, also for older versions, i.e.: - v4.11: http://sedac.ciesin.columbia.edu/downloads/data/gpw-v4/gpw-v4-population-count-rev11/gpw-v4-population-count-rev11_2015_30_sec_tif.zip - v4.10: http://sedac.ciesin.columbia.edu/downloads/data/gpw-v4/gpw-v4-population-count-rev10/gpw-v4-population-count-rev10_2015_30_sec_tif.zip, - Overview over all versions of GPW v.4: https://beta.sedac.ciesin.columbia.edu/data/collection/gpw-v4/sets/browse

Macroeconomic indicator: Available macroeconomic indicators can be selected via the variable fin_mode: - ‘pc’: produced capital (Source: World Bank DataBank), incl. manufactured or built assets such as machinery, equipment, and physical structures (pc is in constant 2014 USD, data is available for the years 1995, 2000, 2005, 2010, 2014). The pc-data is stored in the subfolder data/system/Wealth-Accounts_CSV/. Source: https://datacatalog.worldbank.org/dataset/wealth-accounting - ‘gdp’: gross-domestic product (Source: World Bank) - ‘income_group’: gdp multiplied by country’s income group+1 - ‘nfw’: households’ non-financial wealth (Source: Credit Suisse, of households only) - ‘tw’: households’ total wealth (Source: Credit Suisse, of households only)

Regarding the GDP (nominal GDP at current USD) and income group values, they are obtained from the World Bank using the pandas-datareader API. If a value is missing, the value of the closest year is considered. When no values are provided from the World Bank, we use the Natural Earth repository values.

Downloading existing LitPop asset exposure data

Readily computed LitPop asset exposure data based on \(Lit^1Pop^1\) for 224 countries, distributing produced capital / non-financial wealth of 2014 at a resolution of 30 arcsec can be downloaded from the ETH Research Repository: https://doi.org/10.3929/ethz-b-000331316. The dataset contains gridded data for more than 200 countries as CSV files. [These can be imported into Python using the Exposures class, i.e. Exposures(pd.read_csv(file_name))]

Please refer to and quote the related publication if you are using LitPop exposure data in your studies: https://doi.org/10.5194/essd-2019-189.

Initiating LitPop()

The LitPop class inherits from the `Exposures <climada_entity_Exposures.ipynb#Exposures-class>`__ class. It provides a set_country() method which enables to compute exposure data for a country using different settings and input data. The first time a nightlight image is used, it is downloaded and stored locally. This might take some time.

[3]:
# Import required packages:
import numpy as np
import pandas as pd
from matplotlib import colors
from iso3166 import countries as iso_cntry

from climada.entity.exposures.litpop import LitPop
2020-01-31 10:59:32,239 - climada - DEBUG - Loading default config file: /Users/eberenzs/Documents/Projects/climada_python/climada/conf/defaults.conf

Country Exposure

In the following, we will create exposure data sets and plots for a variety of countries, comparing different settings. ### Default Settings

[4]:
# Initiate a default LitPop exposure entity for Switzerland (ISO3-Code 'CHE'):
ent = LitPop()
ent.set_country('CHE')

""" In case you encounter an error here, because the GPW data is missing: The gridded population count data used are the following:
- Gridded Population of the World (GPW), v4: Population Count, v4.10 or later (2000, 2005, 2010, 2015, 2020).
http://sedac.ciesin.columbia.edu/data/collection/gpw-v4/sets/browse
The population data from GWP needs to be downloaded manually as TIFF
from this site and placed in the system data folder of climada,
i.e.: climada_python/data/system/gpw_v4_population_count_rev10_2015_30_sec.tif
"""
2020-01-31 10:59:39,788 - climada.entity.exposures.litpop - INFO - Generating LitPop data at a resolution of 30.0 arcsec.
2020-01-31 10:59:57,140 - climada.entity.exposures.gpw_import - INFO - Reference year: 2016. Using nearest available year for GWP population data: 2015
2020-01-31 10:59:57,142 - climada.entity.exposures.gpw_import - INFO - GPW Version v4.11
2020-01-31 11:00:13,215 - climada.util.finance - INFO - GDP CHE 2014: 7.092e+11.
2020-01-31 11:00:13,862 - climada.util.finance - INFO - GDP CHE 2016: 6.713e+11.
2020-01-31 11:00:15,008 - climada.entity.exposures.litpop - INFO - Creating the LitPop exposure took 36 s
2020-01-31 11:00:15,009 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2020-01-31 11:00:15,010 - climada.entity.exposures.base - INFO - centr_ not set.
2020-01-31 11:00:15,010 - climada.entity.exposures.base - INFO - deductible not set.
2020-01-31 11:00:15,011 - climada.entity.exposures.base - INFO - cover not set.
2020-01-31 11:00:15,012 - climada.entity.exposures.base - INFO - category_id not set.
2020-01-31 11:00:15,015 - climada.entity.exposures.base - INFO - geometry not set.
[4]:
' In case you encounter an error here, because the GPW data is missing: The gridded population count data used are the following:\n- Gridded Population of the World (GPW), v4: Population Count, v4.10 or later (2000, 2005, 2010, 2015, 2020).\nhttp://sedac.ciesin.columbia.edu/data/collection/gpw-v4/sets/browse\nThe population data from GWP needs to be downloaded manually as TIFF\nfrom this site and placed in the system data folder of climada,\ni.e.: climada_python/data/system/gpw_v4_population_count_rev10_2015_30_sec.tif\n'

Plotting

The exposure entity was initiated using the default setting, i.e. a resolution of 30 arcsec and produced capital ‘pc’ as total asset value, using the exponents \([1, 1]\).

If the init worked, we can now plot a map of Switzerland’s exposure. We can get a good impression of the exposure distribution in Switzerland by comparing plots with linear and log-normal colormaps:

(please refer to the exposure tutorial climada_entity_Exposures.ipynb for more info on the visualization of exposure data.)

[3]:
ent.set_geometry_points()
# plot exposure with linear colormap and major towns (pop_name=True):
ent.plot_hexbin(pop_name=True)
# plot exposure with log-normal colormap:
norm=colors.LogNorm(vmin=500, vmax=4.0e9)
ent.plot_hexbin(norm=norm)
2019-10-29 21:58:30,870 - climada.util.coordinates - INFO - Setting geometry points.
/Users/aznarsig/Documents/Python/climada_python/climada/util/plot.py:318: UserWarning: Tight layout not applied. The left and right margins cannot be made large enough to accommodate all axes decorations.
  fig.tight_layout()
[3]:
<cartopy.mpl.geoaxes.GeoAxesSubplot at 0x1c21b13978>
../_images/tutorial_climada_entity_LitPop_5_3.png
../_images/tutorial_climada_entity_LitPop_5_4.png

Settings: fin_mode

Instead on produced capital, we can also downscale other available macroeconomic indicators as estimates of asset value. The indicator can be set via the variable fin_mode:

'pc': produced capital (Source: World Bank DataBank), incl. manufactured or built assets such as machinery, equipment, and physical structures (pc is in constant 2014-USD, data available for the years 1995, 2000, 2005, 2010, 2014)
'gdp': gross-domestic product (Source: World Bank)
'income_group': gdp multiplied by country's income group+1
'nfw': households' non-financial wealth (Source: Credit Suisse, of households only)
'tw': households' total wealth (Source: Credit Suisse, of households only)

Let’s initiate the entity for Switzerland with the financial mode “income_group”:

[4]:
# Initiate a default LitPop exposure entity for Switzerland (ISO3-Code 'CHE'):

ent = LitPop()
ent.set_country('CHE', fin_mode='income_group') # try other fin_modes: 'gdp', 'nfw', 'pc'
# plot exposure:
ent.plot_hexbin(pop_name=True)
2019-10-29 21:58:49,445 - climada.entity.exposures.litpop - INFO - Generating LitPop data at a resolution of 30.0 arcsec.
2019-10-29 21:59:04,285 - climada.entity.exposures.gpw_import - INFO - Reference year: 2016. Using nearest available year for GWP population data: 2015
2019-10-29 21:59:04,286 - climada.entity.exposures.gpw_import - INFO - GPW Version v4.11
2019-10-29 21:59:16,684 - climada.util.finance - INFO - GDP CHE 2016: 6.702e+11.
2019-10-29 21:59:16,885 - climada.util.finance - INFO - Income group CHE 2016: 4.
2019-10-29 21:59:17,871 - climada.entity.exposures.litpop - INFO - Creating the LitPop exposure took 29 s
2019-10-29 21:59:17,872 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2019-10-29 21:59:17,872 - climada.entity.exposures.base - INFO - centr_ not set.
2019-10-29 21:59:17,873 - climada.entity.exposures.base - INFO - deductible not set.
2019-10-29 21:59:17,873 - climada.entity.exposures.base - INFO - cover not set.
2019-10-29 21:59:17,875 - climada.entity.exposures.base - INFO - category_id not set.
2019-10-29 21:59:17,875 - climada.entity.exposures.base - INFO - geometry not set.
/Users/aznarsig/Documents/Python/climada_python/climada/util/plot.py:318: UserWarning: Tight layout not applied. The left and right margins cannot be made large enough to accommodate all axes decorations.
  fig.tight_layout()
[4]:
<cartopy.mpl.geoaxes.GeoAxesSubplot at 0x1c233521d0>
../_images/tutorial_climada_entity_LitPop_7_3.png

This map shows like the default one above, the only difference is the absolute value per pixel: Note that the range of the color scale has changed because the total asset value estimated with the income_group mode is larger than produced capital stock.

Settings: resolution (res_arcsec) and reference_year

We can also change the resolution in arc seconds to one of these values: 30, 60, 120, 300, 600, 3600.

\(30 arcsec \approx 1 km\).

\(3600 arcsec = 1\degree \approx 110 km\).

Additionally, we can change the year our exposure is supposed to represent. For this, nightlight and population data are used that are closest to the requested years. Macroeconomic indicators like produced capital are interpolated from available data or scaled proportional to GDP.

Let’s estimate a produced capital exposure map for Switzerland in 2017 with a resolution of 300 arcsec:

[5]:
ent = LitPop()
ent.set_country('CHE', fin_mode='pc', res_arcsec=300, reference_year=2017)
ent.set_geometry_points()
# plot exposure with larger line width for better visibility:
ent.plot_hexbin(linewidth=7)
# Instead of linewight, the gridsize can be adjusted for better visibility (low values --> big markers).
# Warning: If gridsize is changed, the plot doesn't reflect the actual data's grid anymore,
# (please refer to the exposure tutorial *climada_entity_Exposures.ipynb*
# for more info on the visualization of exposure data.)
ent.plot_hexbin(gridsize=20)
2019-10-29 21:59:26,035 - climada.entity.exposures.litpop - INFO - Generating LitPop data at a resolution of 300 arcsec.
2019-10-29 21:59:29,302 - climada.entity.exposures.gpw_import - INFO - Reference year: 2017. Using nearest available year for GWP population data: 2015
2019-10-29 21:59:29,304 - climada.entity.exposures.gpw_import - INFO - GPW Version v4.11
2019-10-29 21:59:42,513 - climada.util.finance - INFO - GDP CHE 2014: 7.092e+11.
2019-10-29 21:59:42,972 - climada.util.finance - INFO - GDP CHE 2017: 6.790e+11.
2019-10-29 21:59:43,165 - climada.entity.exposures.litpop - INFO - Creating the LitPop exposure took 18 s
2019-10-29 21:59:43,167 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2019-10-29 21:59:43,168 - climada.entity.exposures.base - INFO - centr_ not set.
2019-10-29 21:59:43,169 - climada.entity.exposures.base - INFO - deductible not set.
2019-10-29 21:59:43,170 - climada.entity.exposures.base - INFO - cover not set.
2019-10-29 21:59:43,171 - climada.entity.exposures.base - INFO - category_id not set.
2019-10-29 21:59:43,172 - climada.entity.exposures.base - INFO - geometry not set.
2019-10-29 21:59:43,186 - climada.util.coordinates - INFO - Setting geometry points.
/Users/aznarsig/Documents/Python/climada_python/climada/util/plot.py:318: UserWarning: Tight layout not applied. The left and right margins cannot be made large enough to accommodate all axes decorations.
  fig.tight_layout()
[5]:
<cartopy.mpl.geoaxes.GeoAxesSubplot at 0x1c22c63710>
../_images/tutorial_climada_entity_LitPop_9_3.png
../_images/tutorial_climada_entity_LitPop_9_4.png

As can you can read from the logger output above the plot, the following data time steps were used to estimate 2017’s exposure: - GPW Population of 2015 (closest year) - BlackMarble Nightlights of 2016 (closest year) - Produced capital of 2014 (closest year), inflated proportional to the GDP increase from 2014 to 2017. This is an inflation of roughly 4.5% in this case.

Settings: exponents of \(Lit^mPop^n\)

LitPop per pixel is the product of the exponents of nightlights+1 (Lit) and Population count (Pop).

\(Lit^mPop^n = Lit^m * Pop^n\), with \(exponents = [m, n] \in \N_0\) (Default values are \(m=n=1\)).

We can also change m and n.

For countries with badly resolved population data (i.e. Jamaica or Uzbekistan), it can make sense to use nightlights only, i.e. an high exponent of Lit instead of LitPop. Note that if Pop is not used, \(Lit = nightlights\) instead of \(nightlights+1\).

Let’s compare exposure maps for \(LitPop=Lit^1Pop^1\) (default); \(Lit^4\); and \(Pop^1\) Jamaica at a resolution of 60 arcsec.

Please execute one cell after the other:

[7]:
ent = LitPop()
res = 30
country = 'JAM' # Try different countries, i.e. 'JAM', 'CHE', 'RWA', 'MEX'
markersize = 3
gridsize = 70
buffer_deg=.04
# The arguments 'exponent' is used to set the power with which Lit and Pop go into LitPop:
ent.set_country(country, res_arcsec=res, reference_year=2014, exponents=[0, 1])  # Population only
ent.set_geometry_points()
ent.plot_hexbin(gridsize = gridsize, linewidth=markersize, buffer=buffer_deg)
# note: buffer_deg adds a buffer around the plotted data to show the whole country
"""Lit^0 * Pop^1"""
2020-01-31 11:01:50,815 - climada.entity.exposures.litpop - INFO - Generating LitPop data at a resolution of 30 arcsec.
2020-01-31 11:02:06,744 - climada.entity.exposures.gpw_import - INFO - Reference year: 2014. Using nearest available year for GWP population data: 2015
2020-01-31 11:02:06,744 - climada.entity.exposures.gpw_import - INFO - GPW Version v4.11
2020-01-31 11:02:18,417 - climada.entity.exposures.litpop - INFO - Creating the LitPop exposure took 28 s
2020-01-31 11:02:18,418 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2020-01-31 11:02:18,419 - climada.entity.exposures.base - INFO - centr_ not set.
2020-01-31 11:02:18,419 - climada.entity.exposures.base - INFO - deductible not set.
2020-01-31 11:02:18,420 - climada.entity.exposures.base - INFO - cover not set.
2020-01-31 11:02:18,421 - climada.entity.exposures.base - INFO - category_id not set.
2020-01-31 11:02:18,422 - climada.entity.exposures.base - INFO - geometry not set.
2020-01-31 11:02:18,440 - climada.util.coordinates - INFO - Setting geometry points.
[7]:
'Lit^0 * Pop^1'
../_images/tutorial_climada_entity_LitPop_11_2.png
[8]:
# JAMAICA continued:
ent.set_country(country, res_arcsec=res, reference_year=2014, exponents=[4, 0]) # Nightlights^4 only
ent.set_geometry_points()
ent.plot_hexbin(gridsize = gridsize, linewidth=markersize, buffer=buffer_deg)
"""Lit^4 Pop^0"""
2020-01-31 11:02:33,332 - climada.entity.exposures.litpop - INFO - Generating LitPop data at a resolution of 30 arcsec.
2020-01-31 11:02:49,014 - climada.entity.exposures.gpw_import - INFO - Reference year: 2014. Using nearest available year for GWP population data: 2015
2020-01-31 11:02:49,014 - climada.entity.exposures.gpw_import - INFO - GPW Version v4.11
2020-01-31 11:03:00,815 - climada.entity.exposures.litpop - INFO - Creating the LitPop exposure took 28 s
2020-01-31 11:03:00,816 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2020-01-31 11:03:00,816 - climada.entity.exposures.base - INFO - centr_ not set.
2020-01-31 11:03:00,817 - climada.entity.exposures.base - INFO - deductible not set.
2020-01-31 11:03:00,817 - climada.entity.exposures.base - INFO - cover not set.
2020-01-31 11:03:00,818 - climada.entity.exposures.base - INFO - category_id not set.
2020-01-31 11:03:00,820 - climada.entity.exposures.base - INFO - geometry not set.
2020-01-31 11:03:00,840 - climada.util.coordinates - INFO - Setting geometry points.
[8]:
'Lit^4 Pop^0'
../_images/tutorial_climada_entity_LitPop_12_2.png
[9]:
ent.set_country(country, res_arcsec=res, reference_year=2014, exponents=[1, 1]) # Default LitPop [1, 1]
ent.set_geometry_points()
ent.plot_hexbin(gridsize = gridsize, linewidth=markersize, buffer=buffer_deg)
"""Lit^1 * Pop^1"""
2020-01-31 11:03:21,832 - climada.entity.exposures.litpop - INFO - Generating LitPop data at a resolution of 30 arcsec.
2020-01-31 11:03:38,586 - climada.entity.exposures.gpw_import - INFO - Reference year: 2014. Using nearest available year for GWP population data: 2015
2020-01-31 11:03:38,587 - climada.entity.exposures.gpw_import - INFO - GPW Version v4.11
2020-01-31 11:03:50,603 - climada.entity.exposures.litpop - INFO - Creating the LitPop exposure took 30 s
2020-01-31 11:03:50,604 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2020-01-31 11:03:50,604 - climada.entity.exposures.base - INFO - centr_ not set.
2020-01-31 11:03:50,605 - climada.entity.exposures.base - INFO - deductible not set.
2020-01-31 11:03:50,605 - climada.entity.exposures.base - INFO - cover not set.
2020-01-31 11:03:50,606 - climada.entity.exposures.base - INFO - category_id not set.
2020-01-31 11:03:50,608 - climada.entity.exposures.base - INFO - geometry not set.
2020-01-31 11:03:50,626 - climada.util.coordinates - INFO - Setting geometry points.
[9]:
'Lit^1 * Pop^1'
../_images/tutorial_climada_entity_LitPop_13_2.png

For Switzerland, population is resolved on the 3rd administrative level, with 2538 distinct geographical units. Therefore, the purely population-based map is highly resolved.

For Jamaica, population is only resolved on the 1st administrative level, with only 14 distinct geographical units. Therefore, the purely population-based map shows large monotonous patches. The combination of Lit and Pop results in a concentration of asset value estimates around the capital city Kingston.

 Multiple countries

Computing LitPop-entities for a list of countries and plot a log-normal exposure map:

[9]:
# Initiate GDP-Entity for Tanzania, Rwanda, and Burundi:
ent = LitPop()
countries_list = ['BDI', 'RWA', 'TZA']
ent.set_country(countries_list, res_arcsec=120, reference_year=2014, fin_mode='gdp')
ent.set_geometry_points()
2019-10-29 22:01:13,699 - climada.entity.exposures.litpop - INFO - Generating LitPop data at a resolution of 120 arcsec.
2019-10-29 22:01:18,024 - climada.entity.exposures.gpw_import - INFO - Reference year: 2014. Using nearest available year for GWP population data: 2015
2019-10-29 22:01:18,024 - climada.entity.exposures.gpw_import - INFO - GPW Version v4.11
2019-10-29 22:01:31,881 - climada.util.finance - INFO - GDP TZA 2014: 4.996e+10.
2019-10-29 22:01:32,613 - climada.util.finance - INFO - GDP RWA 2014: 8.017e+09.
2019-10-29 22:01:33,412 - climada.util.finance - INFO - GDP BDI 2014: 2.706e+09.
2019-10-29 22:01:34,918 - climada.entity.exposures.litpop - INFO - Creating the LitPop exposure took 24 s
2019-10-29 22:01:34,919 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2019-10-29 22:01:34,920 - climada.entity.exposures.base - INFO - centr_ not set.
2019-10-29 22:01:34,921 - climada.entity.exposures.base - INFO - deductible not set.
2019-10-29 22:01:34,922 - climada.entity.exposures.base - INFO - cover not set.
2019-10-29 22:01:34,924 - climada.entity.exposures.base - INFO - category_id not set.
2019-10-29 22:01:34,927 - climada.entity.exposures.base - INFO - geometry not set.
2019-10-29 22:01:34,971 - climada.util.coordinates - INFO - Setting geometry points.
[10]:
# Plot GDP-Entity for Tanzania, Rwanda, and Burundi:
# ent.plot_hexbin(linewidth=2, buffer=.3) # plot using linear colormap
# ent.plot_hexbin(linewidth=2, buffer=.3, bins='log') # plot using logarithmic colormap
norm=colors.LogNorm(vmin=1.5e2, vmax=1.5e9) # setting range for the log-normal scale
ent.plot_hexbin(linewidth=2, buffer=.3, norm=norm) # log-normal colormap from USD 150 to USD 1'500'000'000.
"""GDP downscaling with LitPop for Tanzania, Rwanda, and Burundi (2014)"""
/Users/aznarsig/Documents/Python/climada_python/climada/util/plot.py:318: UserWarning: Tight layout not applied. The left and right margins cannot be made large enough to accommodate all axes decorations.
  fig.tight_layout()
[10]:
'GDP downscaling with LitPop for Tanzania, Rwanda, and Burundi (2014)'
../_images/tutorial_climada_entity_LitPop_17_2.png

Sub-national (admin-1) GDP as intermediate downscaling layer

In order to improve downscaling for countries with large regional differences within, a subnational breakdown of GDP can be used as an intermediate downscaling layer wherever available.

The sub-national (admin-1) GDP-breakdown needs to be added manually as a “.xls”-file to the folder data/system/GSDP/ in the CLIMADA-directory. Currently, such data is provided for more than 10 countries, including USA, India, and China.

The xls-file requires at least the following columns (with names specified in row 1): - State_Province: Names of admin-1 regions, i.e. states, cantons, provinces. Names need to match the naming of admin-1 shapes in the data used by the python package cartopy.io (c.f. shapereader.natural_earth(name=’admin_1_states_provinces’)) - GSDP_ref: value of sub-national GDP to be used (absolute or relative values) - Postal (optional): Alternative identifier of region, if names do not match wioth cartopy. Needs to correspond to the Postal-identifiers used in the shapereader of cartopy.io.

Please note that while admin1-GDP will per definition improve the downscaling of GDP, it might not neccessarily improve the downscaling quality for other asset bases like produced capital (pc).

How To:

The intermediadte downscaling layer can be activated with the option admin1_calc.

The option adm1_scatter produces a scatter plot to compare the modelled and observed GDP per admin-1 region.

[11]:
# Initiate GDP-Entity for Switzerland, with and without admin1_calc:

ent_adm0 = LitPop()
ent_adm0.set_country('CHE', res_arcsec=30, fin_mode='gdp', admin1_calc=False)
ent_adm0.set_geometry_points()

ent_adm1 = LitPop()
ent_adm1.set_country('CHE', res_arcsec=30, fin_mode='gdp', admin1_calc=True)

ent_adm0.check()
ent_adm0.set_geometry_points()
ent_adm1.check()
ent_adm1.set_geometry_points()
print('Done.')
2019-10-29 22:01:47,537 - climada.entity.exposures.litpop - INFO - Generating LitPop data at a resolution of 30 arcsec.
2019-10-29 22:02:01,615 - climada.entity.exposures.gpw_import - INFO - Reference year: 2016. Using nearest available year for GWP population data: 2015
2019-10-29 22:02:01,616 - climada.entity.exposures.gpw_import - INFO - GPW Version v4.11
2019-10-29 22:02:12,732 - climada.util.finance - INFO - GDP CHE 2016: 6.702e+11.
2019-10-29 22:02:13,800 - climada.entity.exposures.litpop - INFO - Creating the LitPop exposure took 27 s
2019-10-29 22:02:13,801 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2019-10-29 22:02:13,802 - climada.entity.exposures.base - INFO - centr_ not set.
2019-10-29 22:02:13,803 - climada.entity.exposures.base - INFO - deductible not set.
2019-10-29 22:02:13,806 - climada.entity.exposures.base - INFO - cover not set.
2019-10-29 22:02:13,807 - climada.entity.exposures.base - INFO - category_id not set.
2019-10-29 22:02:13,808 - climada.entity.exposures.base - INFO - geometry not set.
2019-10-29 22:02:13,852 - climada.util.coordinates - INFO - Setting geometry points.
2019-10-29 22:02:17,135 - climada.entity.exposures.litpop - INFO - Generating LitPop data at a resolution of 30 arcsec.
2019-10-29 22:02:32,488 - climada.entity.exposures.gpw_import - INFO - Reference year: 2016. Using nearest available year for GWP population data: 2015
2019-10-29 22:02:32,489 - climada.entity.exposures.gpw_import - INFO - GPW Version v4.11
2019-10-29 22:02:44,186 - climada.util.finance - INFO - GDP CHE 2016: 6.702e+11.
2019-10-29 22:02:54,177 - climada.entity.exposures.litpop - INFO - Creating the LitPop exposure took 38 s
2019-10-29 22:02:54,177 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2019-10-29 22:02:54,178 - climada.entity.exposures.base - INFO - centr_ not set.
2019-10-29 22:02:54,179 - climada.entity.exposures.base - INFO - deductible not set.
2019-10-29 22:02:54,179 - climada.entity.exposures.base - INFO - cover not set.
2019-10-29 22:02:54,180 - climada.entity.exposures.base - INFO - category_id not set.
2019-10-29 22:02:54,181 - climada.entity.exposures.base - INFO - geometry not set.
2019-10-29 22:02:54,228 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2019-10-29 22:02:54,230 - climada.entity.exposures.base - INFO - centr_ not set.
2019-10-29 22:02:54,231 - climada.entity.exposures.base - INFO - deductible not set.
2019-10-29 22:02:54,231 - climada.entity.exposures.base - INFO - cover not set.
2019-10-29 22:02:54,232 - climada.entity.exposures.base - INFO - category_id not set.
2019-10-29 22:02:54,233 - climada.util.coordinates - INFO - Setting geometry points.
2019-10-29 22:02:56,458 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2019-10-29 22:02:56,459 - climada.entity.exposures.base - INFO - centr_ not set.
2019-10-29 22:02:56,461 - climada.entity.exposures.base - INFO - deductible not set.
2019-10-29 22:02:56,461 - climada.entity.exposures.base - INFO - cover not set.
2019-10-29 22:02:56,462 - climada.entity.exposures.base - INFO - category_id not set.
2019-10-29 22:02:56,464 - climada.entity.exposures.base - INFO - geometry not set.
2019-10-29 22:02:56,464 - climada.util.coordinates - INFO - Setting geometry points.
Done.
[12]:
# Plotting:
norm=colors.LogNorm(vmin=1.5e4, vmax=1.5e9) # setting range for the log-normal scale
ent_adm0.plot_hexbin(buffer=.3, norm=norm)
ent_adm1.plot_hexbin(buffer=.3, norm=norm)
print('admin-0: First figure')
print('admin-1: Second figure')
'''Note the small differences in eastern Switzerland.'''
/Users/aznarsig/Documents/Python/climada_python/climada/util/plot.py:318: UserWarning: Tight layout not applied. The left and right margins cannot be made large enough to accommodate all axes decorations.
  fig.tight_layout()
admin-0: First figure
admin-1: Second figure
[12]:
'Note the small differences in eastern Switzerland.'
../_images/tutorial_climada_entity_LitPop_20_3.png
../_images/tutorial_climada_entity_LitPop_20_4.png

Export Exposure Data to CSV

The method ent.to_csv() can be used to export any CLIMADA exposure entity to a CSV-file.

Please refer to the exposure tutorial climada_entity_Exposures.ipynb for more info on the export of exposure data!

[13]:
# Export LitPop based entity to CSV:
# set output path:
import os
from climada.util.constants import DATA_DIR # default CLIMADA-data directory
output_path = os.path.join(DATA_DIR, 'export') # subfolder export
if not os.path.isdir(output_path): # create output folder if it does not exist
    os.mkdir(output_path)
# set output file path:
output_path = os.path.join(output_path, 'LitPop_Exposure_Burundi_Tanzania_Rwanda.csv')
# Export data:
ent.to_csv(output_path, sep=',')

# display('Exposure entity exported to' + output_path)

# Note that the variable "region_id" in the exported CSV file is a number identifying the country, i.e.:
display('Examples for region_id:')
display('Burundi: ' + str(iso_cntry.get('BDI').numeric))
display('Tanzania: ' + str(iso_cntry.get('TZA').numeric))
display('Rwanda: ' + str(iso_cntry.get('RWA').numeric))

'Examples for region_id:'
'Burundi: 108'
'Tanzania: 834'
'Rwanda: 646'

Map exposure points to Admin1-Regions

The method litpop.exposure_set_admin1() can be used to map the data points in any gridded CLIMADA exposure entity to admin1-regions, i.e. cantons, states, districts, etc.

Warning: the resolution handed over as a parameter needs to match the resolution of the exposure grid in arc seconds.

[14]:
from climada.entity.exposures import litpop as lp
from climada.entity import Exposures
# Map LitPop exposure to districts for Bangladesh:
country_name = ['BGD']
resolution = 600
ent = lp.LitPop()
ent.set_country(country_name, res_arcsec=resolution)
ent = lp.exposure_set_admin1(ent, resolution)
# Print first 10 entries:
print(ent.iloc[0:10])
# Select district of Rangpur only and plot exposure:
ent_rangpur = Exposures(ent[ent.admin1 == 'Rangpur'])
ent_rangpur.check()
ent_rangpur.plot_raster()

2019-10-29 22:03:15,488 - climada.entity.exposures.litpop - INFO - Generating LitPop data at a resolution of 600 arcsec.
2019-10-29 22:03:21,535 - climada.entity.exposures.gpw_import - INFO - Reference year: 2016. Using nearest available year for GWP population data: 2015
2019-10-29 22:03:21,536 - climada.entity.exposures.gpw_import - INFO - GPW Version v4.11
2019-10-29 22:03:32,723 - climada.util.finance - INFO - GDP BGD 2014: 1.729e+11.
2019-10-29 22:03:33,166 - climada.util.finance - INFO - GDP BGD 2016: 2.214e+11.
2019-10-29 22:03:33,306 - climada.entity.exposures.litpop - INFO - Creating the LitPop exposure took 18 s
2019-10-29 22:03:33,307 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2019-10-29 22:03:33,308 - climada.entity.exposures.base - INFO - centr_ not set.
2019-10-29 22:03:33,308 - climada.entity.exposures.base - INFO - deductible not set.
2019-10-29 22:03:33,309 - climada.entity.exposures.base - INFO - cover not set.
2019-10-29 22:03:33,310 - climada.entity.exposures.base - INFO - category_id not set.
2019-10-29 22:03:33,311 - climada.entity.exposures.base - INFO - geometry not set.
          value   latitude  longitude  region_id  if_    admin1  admin1_ID
0  6.807907e+07  25.916667  88.083333         50    1   Rangpur     5492.0
1  6.550797e+08  24.750000  88.083333         50    1  Rajshahi     3255.0
2  3.208497e+07  26.083333  88.250000         50    1   Rangpur     5492.0
3  9.725386e+07  25.916667  88.250000         50    1   Rangpur     5492.0
4  4.105827e+07  24.750000  88.250000         50    1  Rajshahi     3255.0
5  3.375228e+08  24.583333  88.250000         50    1  Rajshahi     3255.0
6  2.811290e+07  26.250000  88.416667         50    1   Rangpur     5492.0
7  1.662658e+09  26.083333  88.416667         50    1   Rangpur     5492.0
8  2.946573e+07  25.916667  88.416667         50    1   Rangpur     5492.0
9  6.430862e+07  25.750000  88.416667         50    1   Rangpur     5492.0
2019-10-29 22:03:34,063 - climada.entity.exposures.base - INFO - crs set to default value: {'init': 'epsg:4326', 'no_defs': True}
2019-10-29 22:03:34,063 - climada.entity.exposures.base - INFO - Hazard type not set in if_
2019-10-29 22:03:34,064 - climada.entity.exposures.base - INFO - centr_ not set.
2019-10-29 22:03:34,065 - climada.entity.exposures.base - INFO - deductible not set.
2019-10-29 22:03:34,065 - climada.entity.exposures.base - INFO - cover not set.
2019-10-29 22:03:34,066 - climada.entity.exposures.base - INFO - category_id not set.
2019-10-29 22:03:34,067 - climada.entity.exposures.base - INFO - geometry not set.
2019-10-29 22:03:34,069 - climada.util.coordinates - INFO - Raster from resolution 0.16666666666662877 to 0.16666666666662877.
/Users/aznarsig/Documents/Python/climada_python/climada/util/plot.py:318: UserWarning: Tight layout not applied. The left and right margins cannot be made large enough to accommodate all axes decorations.
  fig.tight_layout()
[14]:
<cartopy.mpl.geoaxes.GeoAxesSubplot at 0x1c279c0940>
../_images/tutorial_climada_entity_LitPop_24_3.png