SupplyChain class#
[1]:
import numpy as np
import pandas as pd
from climada.util.api_client import Client
from climada_petals.engine import SupplyChain
from climada.entity import ImpfTropCyclone, ImpactFuncSet
from climada.engine.impact_calc import ImpactCalc
client = Client()
This tutorial shows how to use the SupplyChain
class of CLIMADA. This class allows assessing indirect impacts via Input-Output (IO) modeling. Before diving into this class, it is highly recommended that the user first understands how direct impact is calculated with CLIMADA. This requires getting familiar with the Exposures
, Hazard
and Impact
classes.
This tutorial shows how to set up a global supply chain risk analysis due to tropical cyclones hitting the United States.
1. Calculate direct economic impacts#
The first step is to conduct a direct impact analysis. To do so, we need to define an exposure, an hazard and a vulnerability. In this tutorial we will load the LitPop exposure for the USA from CLIMADA Data API.
[2]:
exp_usa = client.get_litpop('USA')
2023-09-27 15:06:38,917 - climada.entity.exposures.base - INFO - Reading /Users/aciullo/climada/data/exposures/litpop/LitPop_150arcsec_USA/v2/LitPop_150arcsec_USA.hdf5
/Users/aciullo/opt/anaconda3/envs/climada_env/lib/python3.9/pickle.py:1717: UserWarning: Unpickling a shapely <2.0 geometry object. Please save the pickle again; shapely 2.1 will not have this compatibility.
setstate(state)
Then, we load a probabilistic hazard set of tropical cyclones for the USA from the CLIMADA Data API.
[3]:
tc_usa = client.get_hazard('tropical_cyclone', properties={'country_iso3alpha':'USA', 'climate_scenario':'historical'})
2023-09-27 15:06:49,402 - climada.hazard.base - INFO - Reading /Users/aciullo/climada/data/hazard/tropical_cyclone/tropical_cyclone_10synth_tracks_150arcsec_USA_1980_2020/v2/tropical_cyclone_10synth_tracks_150arcsec_USA_1980_2020.hdf5
Then we define vulnerability by loading impact functions for tropical cyclone in the USA:
[4]:
# Define impact function
impf_tc = ImpfTropCyclone.from_emanuel_usa()
impf_set = ImpactFuncSet()
impf_set.append(impf_tc)
impf_set.check()
And we finally calculate impacts.
[5]:
# Calculate direct impacts to the USA due to TC
imp_calc = ImpactCalc(exp_usa, impf_set, tc_usa)
direct_impact_usa = imp_calc.impact()
2023-09-27 15:06:49,555 - climada.entity.exposures.base - INFO - No specific impact function column found for hazard TC. Using the anonymous 'impf_' column.
2023-09-27 15:06:49,555 - climada.entity.exposures.base - INFO - Matching 643099 exposures with 503715 centroids.
2023-09-27 15:06:49,562 - climada.util.coordinates - INFO - No exact centroid match found. Reprojecting coordinates to nearest neighbor closer than the threshold = 100
2023-09-27 15:06:50,515 - climada.util.coordinates - WARNING - Distance to closest centroid is greater than 100km for 129140 coordinates.
2023-09-27 15:06:50,542 - climada.engine.impact_calc - INFO - Calculating impact for 1327884 assets (>0) and 43560 events.
2. Calculate indirect economic impacts#
2.1 Instantiate a SupplyChain
object by loading the Multi-Regional Input-Output Table of interest.#
SupplyChain
computes indirect economic impacts via Input-Output (IO) modeling. At the core of IO modeling lies an Input-Output Table. SupplyChain
uses the pymrio python package to download, parse and save Multi-Regional Input Output Tables (MRIOTs). In principle, any IO table can be loaded and used, as long as the structure is consistent with those internally supported by SupplyChain
, which are: -
EXIOBASE3 (1995-2011; 44 countries; 163 industries) - WIOD16 (2000-2014; 43 countries; 56 industries) - OECD21 (1995-2018; 66 countries; 45 industries)
These MRIOTs can be downloaded, parsed and saved automatically.
The first step is to instantiate a SupplyChain
class. This can be done by passing a customized MRIOT or by calling the from_mriot
class method to use one of the supported MRIOTs.
[6]:
supchain = SupplyChain.from_mriot(mriot_type='WIOD16', mriot_year=2011)
2023-09-27 15:06:51,329 - climada.util.files_handler - INFO - Downloading https://dataverse.nl/api/access/datafile/199104 to file /Users/aciullo/climada/data/MRIOT/WIOD16/downloads/199104
898kKB [00:47, 19.0kKB/s]
The instatiated class now has an mriot
attribute, which is a pymrio IOSystem
object. As such, one can access several info of the MRIOT incl. regions, sectors, total production, transaction matrix and final demand. Please see the pymrio project on how to make best use of all the provided functions.
For example, one can access regions, sectors and IOT data:
[7]:
# regions
supchain.mriot.get_regions()
[7]:
Index(['AUS', 'AUT', 'BEL', 'BGR', 'BRA', 'CAN', 'CHE', 'CHN', 'CYP', 'CZE',
'DEU', 'DNK', 'ESP', 'EST', 'FIN', 'FRA', 'GBR', 'GRC', 'HRV', 'HUN',
'IDN', 'IND', 'IRL', 'ITA', 'JPN', 'KOR', 'LTU', 'LUX', 'LVA', 'MEX',
'MLT', 'NLD', 'NOR', 'POL', 'PRT', 'ROU', 'RUS', 'SVK', 'SVN', 'SWE',
'TUR', 'TWN', 'USA', 'ROW'],
dtype='object', name='region')
[8]:
# sectors
supchain.mriot.get_sectors()
[8]:
Index(['Crop and animal production, hunting and related service activities',
'Forestry and logging', 'Fishing and aquaculture',
'Mining and quarrying',
'Manufacture of food products, beverages and tobacco products',
'Manufacture of textiles, wearing apparel and leather products',
'Manufacture of wood and of products of wood and cork, except furniture; manufacture of articles of straw and plaiting materials',
'Manufacture of paper and paper products',
'Printing and reproduction of recorded media',
'Manufacture of coke and refined petroleum products ',
'Manufacture of chemicals and chemical products ',
'Manufacture of basic pharmaceutical products and pharmaceutical preparations',
'Manufacture of rubber and plastic products',
'Manufacture of other non-metallic mineral products',
'Manufacture of basic metals',
'Manufacture of fabricated metal products, except machinery and equipment',
'Manufacture of computer, electronic and optical products',
'Manufacture of electrical equipment',
'Manufacture of machinery and equipment n.e.c.',
'Manufacture of motor vehicles, trailers and semi-trailers',
'Manufacture of other transport equipment',
'Manufacture of furniture; other manufacturing',
'Repair and installation of machinery and equipment',
'Electricity, gas, steam and air conditioning supply',
'Water collection, treatment and supply',
'Sewerage; waste collection, treatment and disposal activities; materials recovery; remediation activities and other waste management services ',
'Construction',
'Wholesale and retail trade and repair of motor vehicles and motorcycles',
'Wholesale trade, except of motor vehicles and motorcycles',
'Retail trade, except of motor vehicles and motorcycles',
'Land transport and transport via pipelines', 'Water transport',
'Air transport',
'Warehousing and support activities for transportation',
'Postal and courier activities',
'Accommodation and food service activities', 'Publishing activities',
'Motion picture, video and television programme production, sound recording and music publishing activities; programming and broadcasting activities',
'Telecommunications',
'Computer programming, consultancy and related activities; information service activities',
'Financial service activities, except insurance and pension funding',
'Insurance, reinsurance and pension funding, except compulsory social security',
'Activities auxiliary to financial services and insurance activities',
'Real estate activities',
'Legal and accounting activities; activities of head offices; management consultancy activities',
'Architectural and engineering activities; technical testing and analysis',
'Scientific research and development',
'Advertising and market research',
'Other professional, scientific and technical activities; veterinary activities',
'Administrative and support service activities',
'Public administration and defence; compulsory social security',
'Education', 'Human health and social work activities',
'Other service activities',
'Activities of households as employers; undifferentiated goods- and services-producing activities of households for own use',
'Activities of extraterritorial organizations and bodies'],
dtype='object', name='sector')
[9]:
# transaction matrix
supchain.mriot.Z
[9]:
region | AUS | ... | ROW | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sector | Crop and animal production, hunting and related service activities | Forestry and logging | Fishing and aquaculture | Mining and quarrying | Manufacture of food products, beverages and tobacco products | Manufacture of textiles, wearing apparel and leather products | Manufacture of wood and of products of wood and cork, except furniture; manufacture of articles of straw and plaiting materials | Manufacture of paper and paper products | Printing and reproduction of recorded media | Manufacture of coke and refined petroleum products | ... | Scientific research and development | Advertising and market research | Other professional, scientific and technical activities; veterinary activities | Administrative and support service activities | Public administration and defence; compulsory social security | Education | Human health and social work activities | Other service activities | Activities of households as employers; undifferentiated goods- and services-producing activities of households for own use | Activities of extraterritorial organizations and bodies | |
region | sector | |||||||||||||||||||||
AUS | Crop and animal production, hunting and related service activities | 10954.209508 | 337.318807 | 166.404066 | 410.533435 | 23137.486536 | 498.613588 | 4.624214 | 2.635747 | 1.592439 | 0.850784 | ... | 5.702333 | 0.0 | 0.574232 | 22.914001 | 4.833452 | 17.818997 | 21.617131 | 9.703475 | 0.0 | 1.159407e-06 |
Forestry and logging | 113.905445 | 127.867760 | 0.588653 | 20.834686 | 2.496693 | 0.193944 | 1458.441418 | 57.134150 | 3.066086 | 1.055167 | ... | 0.006981 | 0.0 | 0.000691 | 0.017126 | 0.019646 | 0.015224 | 0.012279 | 0.024694 | 0.0 | 5.846157e-08 | |
Fishing and aquaculture | 22.267974 | 0.025312 | 21.871529 | 7.780646 | 388.947468 | 32.476194 | 0.302724 | 0.290594 | 0.264986 | 0.214344 | ... | 0.132873 | 0.0 | 0.000007 | 0.000029 | 0.002032 | 0.086917 | 0.024285 | 0.036828 | 0.0 | 4.824417e-09 | |
Mining and quarrying | 232.437685 | 2.323883 | 8.353050 | 11305.879190 | 645.526758 | 19.184141 | 64.479442 | 99.190650 | 40.675856 | 12437.829210 | ... | 3.125064 | 0.0 | 7.220349 | 3.832179 | 21.010887 | 23.183020 | 42.104660 | 15.832950 | 0.0 | 5.314913e-04 | |
Manufacture of food products, beverages and tobacco products | 1662.225516 | 4.046841 | 78.987732 | 324.106374 | 12908.033161 | 305.968696 | 11.279065 | 18.659012 | 9.042004 | 5.859550 | ... | 2.109958 | 0.0 | 1.408069 | 0.971246 | 15.274674 | 23.276147 | 21.356355 | 26.949427 | 0.0 | 1.579590e-05 | |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
ROW | Education | 1.305193 | 0.022124 | 0.093113 | 19.406213 | 6.600711 | 0.683306 | 0.391899 | 0.911419 | 0.776923 | 0.909038 | ... | 184.998529 | 0.0 | 111.704454 | 275.103411 | 2928.841882 | 5458.479001 | 901.834914 | 283.139286 | 0.0 | 5.338385e-03 |
Human health and social work activities | 0.535337 | 0.038688 | 0.141195 | 3.483453 | 3.362211 | 0.861746 | 1.215619 | 1.110087 | 0.995861 | 0.183099 | ... | 11.443401 | 0.0 | 17.244464 | 13.649976 | 780.123840 | 268.995847 | 4363.233769 | 85.398007 | 0.0 | 3.905298e-04 | |
Other service activities | 1.856064 | 0.058495 | 0.149588 | 16.013345 | 5.855415 | 0.346651 | 0.257664 | 0.644754 | 0.360074 | 0.418569 | ... | 662.923912 | 0.0 | 1583.310837 | 1823.500084 | 11328.214047 | 6798.108893 | 4401.062672 | 15253.490477 | 0.0 | 7.981605e-01 | |
Activities of households as employers; undifferentiated goods- and services-producing activities of households for own use | 0.027816 | 0.000064 | 0.000191 | 2.084145 | 0.355832 | 0.034880 | 0.035656 | 0.163347 | 0.058402 | 0.023192 | ... | 0.000000 | 0.0 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.0 | 0.000000e+00 | |
Activities of extraterritorial organizations and bodies | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | ... | 0.000000 | 0.0 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.0 | 0.000000e+00 |
2464 rows × 2464 columns
[10]:
# final demand
supchain.mriot.Y
[10]:
final demand | ||
---|---|---|
region | sector | |
AUS | Crop and animal production, hunting and related service activities | 14467.050267 |
Forestry and logging | 342.352502 | |
Fishing and aquaculture | 1787.071582 | |
Mining and quarrying | 19445.035584 | |
Manufacture of food products, beverages and tobacco products | 51480.063474 | |
... | ... | ... |
ROW | Education | 483744.763934 |
Human health and social work activities | 382325.468496 | |
Other service activities | 234071.579585 | |
Activities of households as employers; undifferentiated goods- and services-producing activities of households for own use | 14600.614007 | |
Activities of extraterritorial organizations and bodies | 33.142482 |
2464 rows × 1 columns
[11]:
# total production
supchain.mriot.x
[11]:
total production | ||
---|---|---|
region | sector | |
AUS | Crop and animal production, hunting and related service activities | 69566.630223 |
Forestry and logging | 2719.293635 | |
Fishing and aquaculture | 3113.703184 | |
Mining and quarrying | 250207.439237 | |
Manufacture of food products, beverages and tobacco products | 92033.592425 | |
... | ... | ... |
ROW | Education | 508147.713351 |
Human health and social work activities | 399362.733830 | |
Other service activities | 367396.468789 | |
Activities of households as employers; undifferentiated goods- and services-producing activities of households for own use | 22003.013824 | |
Activities of extraterritorial organizations and bodies | 33.142482 |
2464 rows × 1 columns
2.2 Assign stock exposure and impact to MRIOT countries-sectors#
After loading the MRIOT, one needs to translate the direct impacts previously calculated - which are defined at an arbitrary spatial resolution - into impacts to sectors and countries defined by the MRIOT. To do this one needs to know what countries and sectors the used exposure represents.
The first is straightforward, as exposure contains latitude and longitude information, and even a regional id that often defines the country of interest.
The latter needs input from the user, who needs to know/assess what sectors in the MRIOT the used exposure represents. For example, assuming the LitPop
exposure is representative of the service sector, and assuming that sub-sectors at positions 26 to 56 in WIOD16
do represent this sector, then one can translate spatially disaggregated impacts into country/sector impacts as follows:
[12]:
impacted_secs = supchain.mriot.get_sectors()[range(26,56)].tolist()
supchain.calc_shock_to_sectors(exp_usa, direct_impact_usa, impacted_secs)
Which creates the attributes self.secs_exp
, self.secs_imp
, and self.secs_shock
. The first two show Exposure
and Impact
values at the country-sector level. This translation is accomplished assuming that exposure/impact of an affected sector is proportional to this sector’s contribution to the overall production of all affected sectors. For example, if the total (spatially distributed) exposed value is 100, and there are two affected sectors, A (whose production is 2) and B
(whose production is 8), then sector A has an exposure of 20 and sector B has an exposure of 80. The same reasoning is applied to the distributions of direct impacts.
One can easily check that self.secs_exp
, self.secs_imp
have the same total values of Exposure
and Impact
and that this only involves the directly hit countries-sectors :
[13]:
# exposure
print(
exp_usa.gdf.value.sum(),
supchain.secs_exp.sum().sum(),
supchain.secs_exp.loc[:, ('USA', impacted_secs)].sum().sum(),
)
# impact
print(supchain.secs_imp.sum().sum(),
supchain.secs_imp.loc[:, ('USA', impacted_secs)].sum().sum(),
direct_impact_usa.imp_mat.sum().sum())
65384554304412.63 65384554304412.64 65384554304412.64
16543899066892.074 16543899066892.07 16543899066892.068
The attribute self.secs_shock
is proportional to the ratio between self.secs_imp
and self.secs_exp
, so self.secs_shock
is a number between 0 and 1. self.secs_shock
will be used in the indirect impact calculation to assses how much production loss is experienced by each sector.
In terms of structure, it is a dataframe with columns the MRIOT’s columns, and with index the event-ids of the hazard events that have non-zero impacts:
[14]:
supchain.secs_shock.loc[:, ('USA', impacted_secs)].head()
[14]:
region | USA | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sector | Construction | Wholesale and retail trade and repair of motor vehicles and motorcycles | Wholesale trade, except of motor vehicles and motorcycles | Retail trade, except of motor vehicles and motorcycles | Land transport and transport via pipelines | Water transport | Air transport | Warehousing and support activities for transportation | Postal and courier activities | Accommodation and food service activities | ... | Scientific research and development | Advertising and market research | Other professional, scientific and technical activities; veterinary activities | Administrative and support service activities | Public administration and defence; compulsory social security | Education | Human health and social work activities | Other service activities | Activities of households as employers; undifferentiated goods- and services-producing activities of households for own use | Activities of extraterritorial organizations and bodies |
event_id | |||||||||||||||||||||
10594 | 0.000352 | 0.000352 | 0.000352 | 0.000352 | 0.000352 | 0.000352 | 0.000352 | 0.000352 | 0.000352 | 0.000352 | ... | 0.000352 | 0.000352 | 0.000352 | 0.000352 | 0.000352 | 0.000352 | 0.000352 | 0.000352 | 0.000352 | 0.0 |
10597 | 0.000634 | 0.000634 | 0.000634 | 0.000634 | 0.000634 | 0.000634 | 0.000634 | 0.000634 | 0.000634 | 0.000634 | ... | 0.000634 | 0.000634 | 0.000634 | 0.000634 | 0.000634 | 0.000634 | 0.000634 | 0.000634 | 0.000634 | 0.0 |
10600 | 0.000694 | 0.000694 | 0.000694 | 0.000694 | 0.000694 | 0.000694 | 0.000694 | 0.000694 | 0.000694 | 0.000694 | ... | 0.000694 | 0.000694 | 0.000694 | 0.000694 | 0.000694 | 0.000694 | 0.000694 | 0.000694 | 0.000694 | 0.0 |
10603 | 0.000032 | 0.000032 | 0.000032 | 0.000032 | 0.000032 | 0.000032 | 0.000032 | 0.000032 | 0.000032 | 0.000032 | ... | 0.000032 | 0.000032 | 0.000032 | 0.000032 | 0.000032 | 0.000032 | 0.000032 | 0.000032 | 0.000032 | 0.0 |
10604 | 0.000071 | 0.000071 | 0.000071 | 0.000071 | 0.000071 | 0.000071 | 0.000071 | 0.000071 | 0.000071 | 0.000071 | ... | 0.000071 | 0.000071 | 0.000071 | 0.000071 | 0.000071 | 0.000071 | 0.000071 | 0.000071 | 0.000071 | 0.0 |
5 rows × 30 columns
By default, self.secs_shock
is exactly the ratio between Impact
and Exposure
, which results in the same shock across sectors for a given event:
[15]:
# let's try the first three events
for event_id in supchain.secs_shock.index[:3]:
imp_event = direct_impact_usa.at_event[direct_impact_usa.event_id == event_id][0]
print(imp_event / exp_usa.gdf.value.sum(), supchain.secs_shock.loc[event_id, ('USA', impacted_secs)].values[0])
0.0003524059371639781 0.0003524059371639781
0.0006340759642834555 0.0006340759642834556
0.0006936414424383894 0.0006936414424383894
This practically means that the fraction of production losses is assumed to be equal to the fractions of stock losses, since Impact
and Exposure
typically refer to stocks in CLIMADA. However, since depending on the sector one can reasonably expect production losses to be proportionally higher or lower than stock losses, a shock_factor
argument can also be passed to define - for each sector - how much should production shocks be higher/lower than stocks shocks (i.e., the mere
Impact
/ Exposure
ratio):
[16]:
shock_factor = pd.DataFrame(np.repeat(1, supchain.mriot.x.shape[0]),
index=supchain.mriot.x.index,
columns=['shock'])
# randomly generated for this tutorial
shock_facs_service_USA = np.array([
0.38324804, 1.15930626, 0.73846477, 0.5430206 , 0.54147014,
0.28362671, 0.53829353, 1.95367016, 1.33675622, 0.42285787,
0.86974667, 1.4685637 , 1.24804793, 0.56915521, 0.43723048,
0.23372398, 0.69268485, 0.74130451, 0.74739106, 1.18719852,
1.02203697, 1.0412411 , 0.09315484, 1.23612412, 0.55947349,
0.8608431, 0.58983156, 1.13137055, 0.93014364, 0.39092134
])
shock_factor.loc[('USA', impacted_secs), :] = shock_facs_service_USA
# supply shock factors when calculating sectorial shocks
supchain.calc_shock_to_sectors(exp_usa, direct_impact_usa, impacted_secs, shock_factor.values.flatten())
[17]:
supchain.secs_shock.loc[:, ('USA', impacted_secs)].head()
[17]:
region | USA | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sector | Construction | Wholesale and retail trade and repair of motor vehicles and motorcycles | Wholesale trade, except of motor vehicles and motorcycles | Retail trade, except of motor vehicles and motorcycles | Land transport and transport via pipelines | Water transport | Air transport | Warehousing and support activities for transportation | Postal and courier activities | Accommodation and food service activities | ... | Scientific research and development | Advertising and market research | Other professional, scientific and technical activities; veterinary activities | Administrative and support service activities | Public administration and defence; compulsory social security | Education | Human health and social work activities | Other service activities | Activities of households as employers; undifferentiated goods- and services-producing activities of households for own use | Activities of extraterritorial organizations and bodies |
event_id | |||||||||||||||||||||
10594 | 0.000135 | 0.000409 | 0.000260 | 0.000191 | 0.000191 | 0.000100 | 0.000190 | 0.000688 | 0.000471 | 0.000149 | ... | 0.000360 | 0.000367 | 0.000033 | 0.000436 | 0.000197 | 0.000303 | 0.000208 | 0.000399 | 0.000328 | 0.0 |
10597 | 0.000243 | 0.000735 | 0.000468 | 0.000344 | 0.000343 | 0.000180 | 0.000341 | 0.001239 | 0.000848 | 0.000268 | ... | 0.000648 | 0.000660 | 0.000059 | 0.000784 | 0.000355 | 0.000546 | 0.000374 | 0.000717 | 0.000590 | 0.0 |
10600 | 0.000266 | 0.000804 | 0.000512 | 0.000377 | 0.000376 | 0.000197 | 0.000373 | 0.001355 | 0.000927 | 0.000293 | ... | 0.000709 | 0.000722 | 0.000065 | 0.000857 | 0.000388 | 0.000597 | 0.000409 | 0.000785 | 0.000645 | 0.0 |
10603 | 0.000012 | 0.000037 | 0.000024 | 0.000017 | 0.000017 | 0.000009 | 0.000017 | 0.000062 | 0.000043 | 0.000013 | ... | 0.000033 | 0.000033 | 0.000003 | 0.000039 | 0.000018 | 0.000027 | 0.000019 | 0.000036 | 0.000030 | 0.0 |
10604 | 0.000027 | 0.000082 | 0.000052 | 0.000039 | 0.000038 | 0.000020 | 0.000038 | 0.000139 | 0.000095 | 0.000030 | ... | 0.000072 | 0.000074 | 0.000007 | 0.000088 | 0.000040 | 0.000061 | 0.000042 | 0.000080 | 0.000066 | 0.0 |
5 rows × 30 columns
Even though the default values (all one) for the shock factors are correct only in the (uncommon) case in which CLIMADA’s direct impacts already express production losses, a proper assignment of the shock factors requires extensive expert knowledge on how a sector’s production responds to the sector’s stock losses. Therefore, it is recommended to change these values only when detailed knowledge about the relationship between stock and production losses is available.
2.3 Calculate the propagation of production losses#
After sectorial production shocks are defined, one can calculate the extent of the shocks and how these propagate through the supply chain. This can be done with the via the self.calc_impacts
method by specifying the ghosh
or leontief
approach. Both approached can be run on the same instantiation of SupplyChain
and results are stored in a dictionary with keys equal to the method’s name. In addition, self.calc_impacts
calls self.calc_shock_to_sectors
if self.secs_exp
,
self.secs_imp
and self.secs_shock
are not defined, in which case the respective arguments need to be passed to self.calc_impacts
.
[18]:
supchain.calc_impacts(io_approach='ghosh')
supchain.calc_impacts(io_approach='leontief')
This creates the supchain_imp
dictionary:
[19]:
supchain.supchain_imp.keys()
[19]:
dict_keys(['ghosh', 'leontief'])
[20]:
supchain.supchain_imp['ghosh'].head()
[20]:
region | AUS | ... | ROW | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sector | Crop and animal production, hunting and related service activities | Forestry and logging | Fishing and aquaculture | Mining and quarrying | Manufacture of food products, beverages and tobacco products | Manufacture of textiles, wearing apparel and leather products | Manufacture of wood and of products of wood and cork, except furniture; manufacture of articles of straw and plaiting materials | Manufacture of paper and paper products | Printing and reproduction of recorded media | Manufacture of coke and refined petroleum products | ... | Scientific research and development | Advertising and market research | Other professional, scientific and technical activities; veterinary activities | Administrative and support service activities | Public administration and defence; compulsory social security | Education | Human health and social work activities | Other service activities | Activities of households as employers; undifferentiated goods- and services-producing activities of households for own use | Activities of extraterritorial organizations and bodies |
event_id | |||||||||||||||||||||
10594 | 0.108493 | 0.003844 | 0.005600 | 0.375871 | 0.163791 | 0.016370 | 0.017644 | 0.023483 | 0.019950 | 0.045949 | ... | 1.831726 | 0.0 | 0.698952 | 1.212268 | 3.918551 | 4.494818 | 2.555403 | 2.139706 | 0.0 | 0.000542 |
10597 | 0.195209 | 0.006916 | 0.010075 | 0.676297 | 0.294706 | 0.029454 | 0.031746 | 0.042252 | 0.035895 | 0.082674 | ... | 3.295782 | 0.0 | 1.257608 | 2.181207 | 7.050559 | 8.087423 | 4.597877 | 3.849924 | 0.0 | 0.000976 |
10600 | 0.213548 | 0.007566 | 0.011022 | 0.739829 | 0.322391 | 0.032220 | 0.034728 | 0.046221 | 0.039267 | 0.090441 | ... | 3.605390 | 0.0 | 1.375748 | 2.386111 | 7.712893 | 8.847160 | 5.029805 | 4.211588 | 0.0 | 0.001068 |
10603 | 0.009819 | 0.000348 | 0.000507 | 0.034016 | 0.014823 | 0.001481 | 0.001597 | 0.002125 | 0.001805 | 0.004158 | ... | 0.165769 | 0.0 | 0.063254 | 0.109709 | 0.354624 | 0.406776 | 0.231261 | 0.193641 | 0.0 | 0.000049 |
10604 | 0.021834 | 0.000774 | 0.001127 | 0.075643 | 0.032963 | 0.003294 | 0.003551 | 0.004726 | 0.004015 | 0.009247 | ... | 0.368630 | 0.0 | 0.140662 | 0.243966 | 0.788597 | 0.904569 | 0.514267 | 0.430610 | 0.0 | 0.000109 |
5 rows × 2464 columns
[21]:
supchain.supchain_imp['leontief'].head()
[21]:
region | AUS | ... | ROW | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sector | Crop and animal production, hunting and related service activities | Forestry and logging | Fishing and aquaculture | Mining and quarrying | Manufacture of food products, beverages and tobacco products | Manufacture of textiles, wearing apparel and leather products | Manufacture of wood and of products of wood and cork, except furniture; manufacture of articles of straw and plaiting materials | Manufacture of paper and paper products | Printing and reproduction of recorded media | Manufacture of coke and refined petroleum products | ... | Scientific research and development | Advertising and market research | Other professional, scientific and technical activities; veterinary activities | Administrative and support service activities | Public administration and defence; compulsory social security | Education | Human health and social work activities | Other service activities | Activities of households as employers; undifferentiated goods- and services-producing activities of households for own use | Activities of extraterritorial organizations and bodies |
event_id | |||||||||||||||||||||
10594 | 0.046333 | 0.004260 | 0.001743 | 0.921647 | 0.053181 | 0.014059 | 0.007054 | 0.031176 | 0.010033 | 0.045333 | ... | 0.455992 | 0.450742 | 0.459801 | 10.275136 | 0.308279 | 0.250009 | 0.502068 | 0.801998 | 0.020219 | 0.0 |
10597 | 0.083367 | 0.007665 | 0.003136 | 1.658299 | 0.095688 | 0.025295 | 0.012692 | 0.056094 | 0.018053 | 0.081567 | ... | 0.820456 | 0.811010 | 0.827310 | 18.487818 | 0.554679 | 0.449835 | 0.903360 | 1.443016 | 0.036379 | 0.0 |
10600 | 0.091198 | 0.008385 | 0.003431 | 1.814080 | 0.104677 | 0.027671 | 0.013884 | 0.061364 | 0.019749 | 0.089230 | ... | 0.897531 | 0.887197 | 0.905028 | 20.224575 | 0.606786 | 0.492093 | 0.988222 | 1.578574 | 0.039796 | 0.0 |
10603 | 0.004193 | 0.000386 | 0.000158 | 0.083408 | 0.004813 | 0.001272 | 0.000638 | 0.002821 | 0.000908 | 0.004103 | ... | 0.041267 | 0.040792 | 0.041612 | 0.929888 | 0.027899 | 0.022626 | 0.045437 | 0.072580 | 0.001830 | 0.0 |
10604 | 0.009324 | 0.000857 | 0.000351 | 0.185479 | 0.010703 | 0.002829 | 0.001420 | 0.006274 | 0.002019 | 0.009123 | ... | 0.091767 | 0.090711 | 0.092534 | 2.067842 | 0.062040 | 0.050314 | 0.101040 | 0.161400 | 0.004069 | 0.0 |
5 rows × 2464 columns
values of the dictionary are pandas.DataFrame
with indexes equal to the hazard events id leading to non-zero impact and columns representing the countries-sectors in the MRIOT. Numbers are expressed in the same unit as the used MRIOT and they represent global production losses due to tropical cyclones in the USA.
The unit can be checked by doing:
[22]:
supchain.mriot.unit
[22]:
unit | ||
---|---|---|
region | sector | |
AUS | Crop and animal production, hunting and related service activities | M.EUR |
Forestry and logging | M.EUR | |
Fishing and aquaculture | M.EUR | |
Mining and quarrying | M.EUR | |
Manufacture of food products, beverages and tobacco products | M.EUR | |
... | ... | ... |
ROW | Education | M.EUR |
Human health and social work activities | M.EUR | |
Other service activities | M.EUR | |
Activities of households as employers; undifferentiated goods- and services-producing activities of households for own use | M.EUR | |
Activities of extraterritorial organizations and bodies | M.EUR |
2464 rows × 1 columns
As an example, the 10 largest impacted Swiss sectors from such events according to Ghosh are:
[23]:
supchain.supchain_imp['ghosh'].loc[:,('CHE', slice(None))].max(0).sort_values(ascending=False)[:10]
[23]:
region sector
CHE Manufacture of basic pharmaceutical products and pharmaceutical preparations 43.403808
Wholesale trade, except of motor vehicles and motorcycles 19.367726
Computer programming, consultancy and related activities; information service activities 10.181569
Financial service activities, except insurance and pension funding 8.498905
Land transport and transport via pipelines 8.182419
Manufacture of computer, electronic and optical products 7.778191
Insurance, reinsurance and pension funding, except compulsory social security 6.988161
Construction 6.603282
Electricity, gas, steam and air conditioning supply 6.543271
Human health and social work activities 5.958961
dtype: float64
While for Leontief are:
[24]:
supchain.supchain_imp['leontief'].loc[:,('CHE', slice(None))].max(0).sort_values(ascending=False)[:10]
[24]:
region sector
CHE Insurance, reinsurance and pension funding, except compulsory social security 75.087467
Manufacture of computer, electronic and optical products 21.647353
Wholesale trade, except of motor vehicles and motorcycles 13.481617
Manufacture of basic pharmaceutical products and pharmaceutical preparations 12.788959
Manufacture of chemicals and chemical products 10.844197
Legal and accounting activities; activities of head offices; management consultancy activities 10.724539
Financial service activities, except insurance and pension funding 9.149769
Electricity, gas, steam and air conditioning supply 7.972747
Manufacture of furniture; other manufacturing 5.372191
Manufacture of fabricated metal products, except machinery and equipment 5.251315
dtype: float64