From f3fd15e07715fc1c912272d5e32967fd2ecb380f Mon Sep 17 00:00:00 2001
From: Joe Moorhouse <5102656+joemoorhouse@users.noreply.github.com>
Date: Sun, 15 Sep 2024 21:34:38 +0100
Subject: [PATCH] Reorganize vulnerability on-boarding and update
documentation. (#351)
Signed-off-by: Joe Moorhouse <5102656+joemoorhouse@users.noreply.github.com>
---
docs/user-guide/introduction.ipynb | 18 +-
docs/user-guide/vulnerability_config.ipynb | 169 ++---
.../inundation_jrc}/onboard.ipynb | 0
.../inundation_jrc}/raw.csv | 0
...hysical climate vulnerability factors.json | 0
.../onboard.ipynb | 0
.../raw.csv | 0
.../Table_A2_Impact_Function_Slope.csv | 0
...S2_V_half_individual_fitting_per_event.csv | 0
.../wind_eberenz}/onboard.ipynb | 0
notebooks/.gitkeep | 0
...C global flood depth-damage functions.json | 711 ------------------
tests/conftest.py | 2 +-
.../config_based_uncertainty_test.py | 1 -
.../config_generate_test.py | 6 +-
15 files changed, 92 insertions(+), 815 deletions(-)
rename {notebooks/vulnerability_onboarding/EU JRC global flood depth-damage functions => docs/vulnerability_functions/inundation_jrc}/onboard.ipynb (100%)
rename {notebooks/vulnerability_onboarding/EU JRC global flood depth-damage functions => docs/vulnerability_functions/inundation_jrc}/raw.csv (100%)
rename {notebooks/vulnerability_onboarding/WRI thermal power plant physical climate vulnerability factors => docs/vulnerability_functions/multi_hazard_wri_power_generating_assets}/WRI thermal power plant physical climate vulnerability factors.json (100%)
rename {notebooks/vulnerability_onboarding/WRI thermal power plant physical climate vulnerability factors => docs/vulnerability_functions/multi_hazard_wri_power_generating_assets}/onboard.ipynb (100%)
rename {notebooks/vulnerability_onboarding/WRI thermal power plant physical climate vulnerability factors => docs/vulnerability_functions/multi_hazard_wri_power_generating_assets}/raw.csv (100%)
rename {notebooks/vulnerability_onboarding/Wind => docs/vulnerability_functions/wind_eberenz}/Table_A2_Impact_Function_Slope.csv (100%)
rename {notebooks/vulnerability_onboarding/Wind => docs/vulnerability_functions/wind_eberenz}/Table_S2_V_half_individual_fitting_per_event.csv (100%)
rename {notebooks/vulnerability_onboarding/Wind => docs/vulnerability_functions/wind_eberenz}/onboard.ipynb (100%)
delete mode 100644 notebooks/.gitkeep
delete mode 100644 notebooks/vulnerability_onboarding/EU JRC global flood depth-damage functions/EU JRC global flood depth-damage functions.json
diff --git a/docs/user-guide/introduction.ipynb b/docs/user-guide/introduction.ipynb
index 4b894195..b68f5c8c 100644
--- a/docs/user-guide/introduction.ipynb
+++ b/docs/user-guide/introduction.ipynb
@@ -4,7 +4,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Introduction to Physrisk\n",
+ "# Introduction to Physrisk\n",
+ "\n",
+ "## A brief overview\n",
"Physrisk comprises:\n",
"\n",
"* A `HazardModel` that retrieves *hazard indicators* for different locations.\n",
@@ -19,31 +21,33 @@
"1. Hazard indicator data is stored in [Zarr](https://zarr.readthedocs.io/en/stable/) format (in an arbitrary Zarr store, although S3 is a popular choice).\n",
"2. Hazard indicator data is retrieved via call to an external API. This is mainly used when combining commercial data to the public-domain.\n",
"\n",
- "In case 1, hazard indicators are stored as three dimensional arrays. The array is ordered $(z, y, x)$ where $y$ is the spatial $y$ coordinate, $x$ is the spatial $x$ coordinate and $z$ is an *index* coordinate. The *index* takes on different meanings according to the type of data being stored.\n",
+ "In case 1, hazard indicators are stored as three dimensional arrays. The array is ordered $(z, y, x)$ where $y$ is the spatial $y$ coordinate (e.g. latitude), $x$ is the spatial $x$ coordinate (e.g. longitude) and $z$ is an *index* coordinate. The *index* takes on different meanings according to the type of data being stored.\n",
"\n",
"Indicators can be either:\n",
"\n",
"* Acute (A): the data comprises a set of hazard intensities for different return periods. In this case *index* refers to the different return periods.\n",
"* Parametric (P): the data comprises a set of parameters. Here *index* refers to the different parameters. The parameters may be single values, or *index* might refer to a set of thresholds. Parametric indicators are used for chronic hazards.\n",
"\n",
- "As mentioned above, a `VulnerabilityModel` only specifies the identifier of the hazard indicator that is required, as well as the climate scenario ID and the year of the future projection (in the common case where hints are not used). This means that hazard indicator ID uniquely defines the data. For example, a vulnerability model requesting 'flood depth' could have data returned from a variety of data sets, depending on how the `HazardModel` is configured.\n",
+ "As mentioned above, a `VulnerabilityModel` only specifies the identifier of the hazard indicator that is required, as well as the climate scenario identifier and the year of the future projection (in the common case where hints are not used). This means that hazard indicator identifier uniquely defines the data. For example, a vulnerability model requesting 'flood depth' could have data returned from a variety of data sets, depending on how the `HazardModel` is configured.\n",
"\n",
"In case of stored-down (or 'pre-generated) hazard indicator data, as opposed to data source via an API, configuring which data sets to use is done by defining a `SourcePath`. This is a function that provides the path, a unique identifier, that provides the data set to be used based on the hazard indicator ID, scenario and year. A convenience class `CoreInventorySourcePaths` creates `SourcePath` instances based on a set of rules called 'selectors'. A selector is a rule such as 'use the flood data set from this particular institution'. \n",
"\n",
+ "Some examples of hazard indicators are:\n",
"\n",
"| Hazard class | Indicator ID (type) | Description |\n",
"|---|---|---|\n",
"| CoastalInundation,
PluvialInundation,
RiverineInundation | flood_depth (A) | Unprotected flood depth (m) for available return periods. |\n",
"| CoastalInundation,
PluvialInundation,
RiverineInundation | sop (P) | Standard of protection as return period in years. |\n",
"| Fire | fire_probability (P) | Annual probability that location is in a wildfire zone. |\n",
- "| Heat | mean_degree_days/above/index (p) | Mean mean-temperature degree days per year above a set of temperature threshold indices. |\n",
+ "| Heat | mean_degree_days/above/index (P) | Mean mean-temperature degree days per year above a set of temperature threshold indices. |\n",
"| Drought | months/spei/12m/below/index (P) | Mean months per year where the 12 month SPEI index is below a set of indices. | \n",
"| Wind | max_speed (A) | Maximum 1 minute sustained wind speed for available return periods. |\n",
"\n",
+ "## Event based modelling\n",
+ "The most common use case for physrisk at time of writing is to perform analyses of portfolios but with asset impacts treated separately or with heuristics defining the dependence of asset impacts. In such cases it is possible, and indeed efficient, to derive the marginal probability distribution of the impact of the asset, the `ImpactDistrib`. However to capture more realistic dependence of impacts, event-based modelling is needed. Here the `HazardModel` additionally supplies an array of simulated hazard indicator values to the `VulnerabilityModel` for each asset location, which in turn samples an array of impacts from the vulnerability function. At time of writing, the event-based functionality is not merged into main. Although specific types of `HazardModel` and `VulnerabilityModel` are needed for the event-based case, these do not replace the existing calculation which is appropriate for the separate-asset case: event-based analyses are typically much more computationally intensive. \n",
"\n",
- "Event based modelling\n",
- "---------------------\n",
- "The most common use case for physrisk at time of writing is to perform analyses of portfolios but with asset impacts treated separately or with heuristics defining the dependence of asset impacts. In such cases it is possible, and indeed efficient, to derive the marginal probability distribution of the impact of the asset, the `ImpactDistrib`. However to capture more realistic dependence of impacts, event-based modelling is needed. Here the `HazardModel` additionally supplies an array of simulated hazard indicator values to the `VulnerabilityModel` for each asset location, which in turn samples an array of impacts from the vulnerability function. At time of writing, the event-based functionality is not merged into main. Although specific types of `HazardModel` and `VulnerabilityModel` are needed for the event-based case, these do not replace the existing calculation which is optimized. \n"
+ "## Vulnerability models and configuration\n",
+ "Although it is possible to create bespoke vulnerability models programmatically within physrisk (i.e. adding a new vulnerability model class in code), vulnerability models for different hazards and types of asset are similar enough that it is possible to create generic vulnerability models that are customized via configuration (see Vulnerability Configuration section)."
]
},
{
diff --git a/docs/user-guide/vulnerability_config.ipynb b/docs/user-guide/vulnerability_config.ipynb
index 4cc3bafd..142d8407 100644
--- a/docs/user-guide/vulnerability_config.ipynb
+++ b/docs/user-guide/vulnerability_config.ipynb
@@ -1,58 +1,85 @@
{
"cells": [
- {
- "cell_type": "code",
- "execution_count": 8,
- "metadata": {},
- "outputs": [],
- "source": [
- "# pip install nbformat pandas plotly requests\n",
- "from io import StringIO\n",
- "\n",
- "import plotly.graph_objs as go\n",
- "\n",
- "from dotenv import load_dotenv\n",
- "from plotly.subplots import make_subplots\n",
- "import plotly.io\n",
- "\n",
- "plotly.io.renderers.default = \"notebook\"\n",
- "from physrisk.vulnerability_models.config_based_model import config_items_from_csv, config_items_to_df\n"
- ]
- },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Vulnerability configuration\n",
+ "As discussed in the Introduction, a significant portion of vulnerability models can be represented by a generic vulnerability model and the specification of a model configuration. In particular, damage curves are often used to relate a hazard indicator value (e.g. flood depth) to damage to an asset, to contents/inventory or asset downtime.\n",
"\n",
"## Types of curve\n",
- "\n",
- "Two types:\n",
+ "The configuration comprises two types of vulnerability curve:\n",
"1) *Damage curves* \n",
- "For acute risks, this specifies the fractional damage or disruption (e.g. downtime or efficiency loss), given the occurrence of a hazard with a given indicator value. \n",
- "Most commonly, curve_type: 'indicator/piecewise_linear'. \n",
+ "For acute risks, this specifies the fractional damage or disruption (e.g. downtime or loss of production), given the occurrence of a hazard with a given indicator value.\n",
+ "`curve_type`: `indicator/piecewise_linear`. \n",
"e.g. for riverine flood, the curve $x$ values are depth in metres and the curve $y$ values are damage as fraction of total insurable value.\n",
"\n",
"2) *Threshold curves* \n",
"For chronic risks, this specifies the fractional damage or disruption that occurs for hazard indicator threshold values. This is for hazard indicators that give the mean amount of time per year for which an indicator is greater than a threshold value. \n",
- "Most commonly, curve_type: 'threshold/piecewise_linear'. \n",
+ "`curve_type`: `threshold/piecewise_linear`. \n",
"e.g. for chronic heat, the indicator might be the number of days per year for which the maximum near-surface air temperature is greater than $t$ degrees, $t$ being the threshold values. The curve $x$ values are the thresholds in degrees Celsius and the curve $y$ values are the losses in production that occur for each day for which the maximum temperature is at that value.\n",
"\n",
"## Identifying assets\n",
"Assets are identified by:\n",
- "- asset class (the broad class e.g. real estate asset or power generating asset within which the asset vulnerabilities are modelled in a similar way)\n",
- "- a number of asset attributes\n",
+ "- Asset class. This is the *broad* class of asset e.g. real estate assets or power generating assets within which asset vulnerabilities tend to be modelled in a similar way and which tend to have a common set of attributes. The set of valid asset classes is defined within physrisk itself.\n",
+ "- A number of asset attributes.\n",
+ "Specifying the asset class is optional in that vulnerability curves can be defined for the parent `Asset` type, in which case only asset attributes are relevant.\n",
+ "\n",
+ "### Identifying assets within the configuration \n",
+ "The vulnerability function is associated to an asset by specification of the asset class and by a set of attribute key/value pairs in the form of a comma-separated string: '==,...'. The attributes are matched to those of the asset.\n",
+ "\n",
+ "### Example 1: simple type/location model\n",
+ "We define two special attribute names: `type` and `location`. These are particularly suited for *sectorial* modelling applications or similar where little is known about the asset other than its class, some information about the type within the class and its location. For example, configuration might be provided for real estate assets in the form 'type=Buildings/Commercial,location=Europe'. For sectorial analyses, `type` is based around industry classifications (e.g. NACE codes). \n",
+ "\n",
+ "### Example 2: occupancy identifier and attributes\n",
+ "*Occupancy* classifications are used to group assets with similar characteristics related to valuation and damage, or disruption characteristics. \n",
+ "There are a number of important occupancy schemes, for example Open Exposure Data (OED). Assets can be identified via, `occupancy_scheme`, `occupancy_id` and a set of attributes needed to refine the selection, e.g. number of storeys within a particular occupancy identifier.\n",
+ "\n",
+ "### Example 3: explicit specification of curve\n",
+ "For families of vulnerability functions, we can define a set of curves by, e.g. 'hazus_flood_curve_id=43'.\n",
+ "\n",
+ "In all cases, logic in the code maps an asset's attributes onto the attributes that define the vulnerability function.\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Damage/disruption function specification\n",
+ "\n",
+ "The scheme is designed to allow uncertainly in damage/disruption functions to be specified as well as the deterministic case comprising hazard indicator ($x$) values and the corresponding impact (damage/disruption) ($y$) values. This can be captured by $x$ and $y$ fields each containing an array. A third $z$ field to capture information about the uncertainty in the vulnerability functions.\n",
+ "\n",
+ "### Case 1: deterministic damage curve provided\n",
+ "The hazard indicator values, $x_i$, are given, $i \\in [1 \\dots n]$ and the corresponding impacts $y_i$.\n",
+ "\n",
+ "$x = [x_1, x_2, \\dots, x_n]$ \n",
+ "$y = [y_1, y_2, \\dots, y_n]$ \n",
+ "$z$ is empty\n",
+ "\n",
+ "### Case 2: mean and standard deviation provided\n",
+ "The hazard indicator values, $x_i$, are given, $i \\in [1 \\dots n]$.\n",
+ "\n",
+ "$f_i(y) = \\mathbb{P}(Y=y|x_i)$ \n",
+ "$\\mu_i = \\int f_i(y) y dy$ \n",
+ "$\\sigma_i^2 = \\int f_i(y) y^2 dy - \\mu_i^2$\n",
"\n",
- "### In configuration \n",
- "The vulnerability function is identified by a set of attribute key/value pairs in the form '==,...'. The attributes are matched to those of the asset. \n",
+ "The means are given in $y$ and the standard deviations in $z$.\n",
"\n",
- "### Example 1: assets specified by type/location\n",
- "We can define sets of functions by type and location, e.g. for real estate assets 'type=Buildings/Commercial,location=Europe'\n",
+ "$x = [x_1, x_2, \\dots, x_n ]$ \n",
+ "$y = [\\mu_1, \\mu_2, \\dots, \\mu_n ]$ \n",
+ "$z = [\\sigma_1, \\sigma_2, \\dots, \\sigma_n ]$\n",
"\n",
- "### Example 2: identifier only\n",
- "For families of vulnerability functions, we can define a set of curves by, e.g. 'hazus_id=43'.\n",
+ "### Case 3: discrete piece-wise linear cumulative density function (CDF) provided\n",
+ "The hazard indicator values, $x_i$, are given, $i \\in [1 \\dots n]$.\n",
"\n",
- "In all cases, logic in code maps an asset's attributes onto the attributes that define the vulnerability function.\n"
+ "$F_i(y) = \\mathbb{P}(Y \\leq y|x_i)$\n",
+ "\n",
+ "The CDF, $F_i(y)$, is given for points $y_j$, $j \\in [1 \\dots m]$.\n",
+ "$F_{ij} = \\mathbb{P}(Y \\leq y_j|x_i)$\n",
+ "\n",
+ "$x = [x_1, x_2, \\dots, x_n ]$ \n",
+ "$y = [y_1, y_2, \\dots, y_m ]$ \n",
+ "$z = [[F_{11}, F_{12}, \\dots, F_{1m}], [F_{21}, F_{12}, \\dots, F_{2m}], \\dots, [F_{n1}, F_{n2}, \\dots, F_{nm}]]$"
]
},
{
@@ -71,6 +98,25 @@
"\"\"\""
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# pip install nbformat pandas plotly requests\n",
+ "from io import StringIO\n",
+ "\n",
+ "import plotly.graph_objs as go\n",
+ "\n",
+ "from dotenv import load_dotenv\n",
+ "from plotly.subplots import make_subplots\n",
+ "import plotly.io\n",
+ "\n",
+ "plotly.io.renderers.default = \"notebook\"\n",
+ "from physrisk.vulnerability_models.config_based_model import config_items_from_csv, config_items_to_df"
+ ]
+ },
{
"cell_type": "code",
"execution_count": 3,
@@ -346,63 +392,6 @@
"fig1.update_yaxes(title=\"Damage as fraction of insurable value\", title_font={\"size\": 14}, row=1, col=1)\n",
"fig1.update_yaxes(title=\"Fractional loss of production\", title_font={\"size\": 14}, row=1, col=2)"
]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "In csv, the lines look like (note the \"\" around comma-separated items):\n",
- "\n",
- "Wind,Asset,\"type=Generic,location=Asia\",max_speed,m/s,damage,,indicator/piecewise_linear,\"[20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,130]\",\"[0,0,0,0.01,0.04,0.09,0.17,0.25,0.34,0.42,0.49,0.55,0.61,0.66,0.71,1.0]\",,,"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "\n",
- "\n",
- "In terms of representing curves, I see (at least) 3 use-cases. Perhaps the most frequently-used case will be where we have the hazard intensity ($x$) values and the corresponding impact (damage/disruption) ($y$) values. This can be captured by $x$ and $y$ fields each containing an array. We can add a third $z$ field to capture information about the uncertainty in the vulnerability functions.\n",
- "\n",
- "### Case 1: deterministic damage curve provided\n",
- "The hazard intensity values, $x_i$, are given, $i \\in [1 \\dots n]$ and the corresponding impacts $y_i$.\n",
- "\n",
- "$x = [x_1, x_2, \\dots, x_n]$ \n",
- "$y = [y_1, y_2, \\dots, y_n]$ \n",
- "$z$ is empty\n",
- "\n",
- "### Case 2: mean and standard deviation provided\n",
- "The hazard intensity values, $x_i$, are given, $i \\in [1 \\dots n]$.\n",
- "\n",
- "$f_i(y) = \\mathbb{P}(Y=y|x_i)$ \n",
- "$\\mu_i = \\int f_i(y) y dy$ \n",
- "$\\sigma_i^2 = \\int f_i(y) y^2 dy - \\mu_i^2$\n",
- "\n",
- "The means are given in $y$ and the standard deviations in $z$.\n",
- "\n",
- "$x = [x_1, x_2, \\dots, x_n ]$ \n",
- "$y = [\\mu_1, \\mu_2, \\dots, \\mu_n ]$ \n",
- "$z = [\\sigma_1, \\sigma_2, \\dots, \\sigma_n ]$\n",
- "\n",
- "### Case 3: discrete piece-wise linear cumulative density function (CDF) provided\n",
- "The hazard intensity values, $x_i$, are given, $i \\in [1 \\dots n]$.\n",
- "\n",
- "$F_i(y) = \\mathbb{P}(Y \\leq y|x_i)$\n",
- "\n",
- "The CDF, $F_i(y)$, is given for points $y_j$, $j \\in [1 \\dots m]$.\n",
- "$F_{ij} = \\mathbb{P}(Y \\leq y_j|x_i)$\n",
- "\n",
- "$x = [x_1, x_2, \\dots, x_n ]$ \n",
- "$y = [y_1, y_2, \\dots, y_m ]$ \n",
- "$z = [[F_{11}, F_{12}, \\dots, F_{1m}], [F_{21}, F_{12}, \\dots, F_{2m}], \\dots, [F_{n1}, F_{n2}, \\dots, F_{nm}]]$"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
}
],
"metadata": {
diff --git a/notebooks/vulnerability_onboarding/EU JRC global flood depth-damage functions/onboard.ipynb b/docs/vulnerability_functions/inundation_jrc/onboard.ipynb
similarity index 100%
rename from notebooks/vulnerability_onboarding/EU JRC global flood depth-damage functions/onboard.ipynb
rename to docs/vulnerability_functions/inundation_jrc/onboard.ipynb
diff --git a/notebooks/vulnerability_onboarding/EU JRC global flood depth-damage functions/raw.csv b/docs/vulnerability_functions/inundation_jrc/raw.csv
similarity index 100%
rename from notebooks/vulnerability_onboarding/EU JRC global flood depth-damage functions/raw.csv
rename to docs/vulnerability_functions/inundation_jrc/raw.csv
diff --git a/notebooks/vulnerability_onboarding/WRI thermal power plant physical climate vulnerability factors/WRI thermal power plant physical climate vulnerability factors.json b/docs/vulnerability_functions/multi_hazard_wri_power_generating_assets/WRI thermal power plant physical climate vulnerability factors.json
similarity index 100%
rename from notebooks/vulnerability_onboarding/WRI thermal power plant physical climate vulnerability factors/WRI thermal power plant physical climate vulnerability factors.json
rename to docs/vulnerability_functions/multi_hazard_wri_power_generating_assets/WRI thermal power plant physical climate vulnerability factors.json
diff --git a/notebooks/vulnerability_onboarding/WRI thermal power plant physical climate vulnerability factors/onboard.ipynb b/docs/vulnerability_functions/multi_hazard_wri_power_generating_assets/onboard.ipynb
similarity index 100%
rename from notebooks/vulnerability_onboarding/WRI thermal power plant physical climate vulnerability factors/onboard.ipynb
rename to docs/vulnerability_functions/multi_hazard_wri_power_generating_assets/onboard.ipynb
diff --git a/notebooks/vulnerability_onboarding/WRI thermal power plant physical climate vulnerability factors/raw.csv b/docs/vulnerability_functions/multi_hazard_wri_power_generating_assets/raw.csv
similarity index 100%
rename from notebooks/vulnerability_onboarding/WRI thermal power plant physical climate vulnerability factors/raw.csv
rename to docs/vulnerability_functions/multi_hazard_wri_power_generating_assets/raw.csv
diff --git a/notebooks/vulnerability_onboarding/Wind/Table_A2_Impact_Function_Slope.csv b/docs/vulnerability_functions/wind_eberenz/Table_A2_Impact_Function_Slope.csv
similarity index 100%
rename from notebooks/vulnerability_onboarding/Wind/Table_A2_Impact_Function_Slope.csv
rename to docs/vulnerability_functions/wind_eberenz/Table_A2_Impact_Function_Slope.csv
diff --git a/notebooks/vulnerability_onboarding/Wind/Table_S2_V_half_individual_fitting_per_event.csv b/docs/vulnerability_functions/wind_eberenz/Table_S2_V_half_individual_fitting_per_event.csv
similarity index 100%
rename from notebooks/vulnerability_onboarding/Wind/Table_S2_V_half_individual_fitting_per_event.csv
rename to docs/vulnerability_functions/wind_eberenz/Table_S2_V_half_individual_fitting_per_event.csv
diff --git a/notebooks/vulnerability_onboarding/Wind/onboard.ipynb b/docs/vulnerability_functions/wind_eberenz/onboard.ipynb
similarity index 100%
rename from notebooks/vulnerability_onboarding/Wind/onboard.ipynb
rename to docs/vulnerability_functions/wind_eberenz/onboard.ipynb
diff --git a/notebooks/.gitkeep b/notebooks/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/notebooks/vulnerability_onboarding/EU JRC global flood depth-damage functions/EU JRC global flood depth-damage functions.json b/notebooks/vulnerability_onboarding/EU JRC global flood depth-damage functions/EU JRC global flood depth-damage functions.json
deleted file mode 100644
index 6618bed7..00000000
--- a/notebooks/vulnerability_onboarding/EU JRC global flood depth-damage functions/EU JRC global flood depth-damage functions.json
+++ /dev/null
@@ -1,711 +0,0 @@
-{
- "items": [
- {
- "asset_type": "Buildings/Residential",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.25,
- 0.4,
- 0.5,
- 0.6,
- 0.75,
- 0.85,
- 0.95,
- 1.0
- ],
- "impact_std": [],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Europe"
- },
- {
- "asset_type": "Buildings/Residential",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.201804543,
- 0.443269857,
- 0.582754693,
- 0.682521912,
- 0.783957148,
- 0.854348922,
- 0.923670101,
- 0.958522773,
- 1.0
- ],
- "impact_std": [
- 0.0,
- 0.168357605,
- 0.141121464,
- 0.137452367,
- 0.166725182,
- 0.14072086,
- 0.129131694,
- 0.102073428,
- 0.059134697,
- 0.0
- ],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.01,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "North America"
- },
- {
- "asset_type": "Buildings/Residential",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.490885951,
- 0.711294067,
- 0.842026011,
- 0.949369096,
- 0.983636977,
- 1.0,
- 1.0,
- 1.0
- ],
- "impact_std": [
- 0.0,
- 0.209427814,
- 0.135409866,
- 0.081630245,
- 0.060853453,
- 0.024070255,
- 0.0,
- 0.0,
- 0.0
- ],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "South America"
- },
- {
- "asset_type": "Buildings/Residential",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.326556502,
- 0.494050324,
- 0.616572124,
- 0.720711764,
- 0.869528213,
- 0.931487084,
- 0.983604148,
- 1.0
- ],
- "impact_std": [
- 0.0,
- 0.251622626,
- 0.215442216,
- 0.214468998,
- 0.207322898,
- 0.167536629,
- 0.124508994,
- 0.047803103,
- 0.0
- ],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Asia"
- },
- {
- "asset_type": "Buildings/Residential",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.219925401,
- 0.378226846,
- 0.530589082,
- 0.635636733,
- 0.81693978,
- 0.903434688,
- 0.957152173,
- 1.0
- ],
- "impact_std": [
- 0.0,
- 0.042003678,
- 0.114296315,
- 0.198396224,
- 0.207821558,
- 0.205246932,
- 0.141856441,
- 0.076208799,
- 0.0
- ],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Africa"
- },
- {
- "asset_type": "Buildings/Residential",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.475418119,
- 0.640393124,
- 0.714614662,
- 0.787726348,
- 0.928779884,
- 0.967381853,
- 0.982795444,
- 1.0
- ],
- "impact_std": [
- 0.088039918,
- 0.141050712,
- 0.163528188,
- 0.169484243,
- 0.166855806,
- 0.112877499,
- 0.058153405,
- 0.03589275,
- 0.0
- ],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Oceania"
- },
- {
- "asset_type": "Buildings/Residential",
- "event_type": "RiverineInundation",
- "impact_mean": [],
- "impact_std": [],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Global"
- },
- {
- "asset_type": "Buildings/Commercial",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.15,
- 0.3,
- 0.45,
- 0.55,
- 0.75,
- 0.9,
- 1.0,
- 1.0
- ],
- "impact_std": [],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Europe"
- },
- {
- "asset_type": "Buildings/Commercial",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.018404908,
- 0.239263804,
- 0.374233129,
- 0.466257669,
- 0.552147239,
- 0.687116564,
- 0.82208589,
- 0.90797546,
- 1.0
- ],
- "impact_std": [],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.01,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "North America"
- },
- {
- "asset_type": "Buildings/Commercial",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.611477587,
- 0.839531094,
- 0.923588457,
- 0.991972477,
- 1.0,
- 1.0,
- 1.0,
- 1.0
- ],
- "impact_std": [
- 0.0,
- 0.077023435,
- 0.035924027,
- 0.026876525,
- 0.016055046,
- 0.0,
- 0.0,
- 0.0,
- 0.0
- ],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "South America"
- },
- {
- "asset_type": "Buildings/Commercial",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.376789623,
- 0.537681619,
- 0.659336684,
- 0.762845232,
- 0.883348656,
- 0.941854895,
- 0.98075938,
- 1.0
- ],
- "impact_std": [
- 0.0,
- 0.240462285,
- 0.240596279,
- 0.243605156,
- 0.250253511,
- 0.171703625,
- 0.11240992,
- 0.052781064,
- 0.0
- ],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Asia"
- },
- {
- "asset_type": "Buildings/Commercial",
- "event_type": "RiverineInundation",
- "impact_mean": [],
- "impact_std": [],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Africa"
- },
- {
- "asset_type": "Buildings/Commercial",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.238953575,
- 0.481199682,
- 0.673795091,
- 0.864583333,
- 1.0,
- 1.0,
- 1.0,
- 1.0
- ],
- "impact_std": [
- 0.0,
- 0.142878204,
- 0.204113206,
- 0.190903594,
- 0.178000078,
- 0.0,
- 0.0,
- 0.0,
- 0.0
- ],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Oceania"
- },
- {
- "asset_type": "Buildings/Commercial",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.323296918,
- 0.506529105,
- 0.63459558,
- 0.744309656,
- 0.864093044,
- 0.932788157,
- 0.977746968,
- 1.0
- ],
- "impact_std": [],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Global"
- },
- {
- "asset_type": "Buildings/Industrial",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.15,
- 0.27,
- 0.4,
- 0.52,
- 0.7,
- 0.85,
- 1.0,
- 1.0
- ],
- "impact_std": [],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Europe"
- },
- {
- "asset_type": "Buildings/Industrial",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.025714286,
- 0.322857143,
- 0.511428571,
- 0.637142857,
- 0.74,
- 0.86,
- 0.937142857,
- 0.98,
- 1.0
- ],
- "impact_std": [],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.01,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "North America"
- },
- {
- "asset_type": "Buildings/Industrial",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.6670194,
- 0.888712522,
- 0.946737213,
- 1.0,
- 1.0,
- 1.0,
- 1.0,
- 1.0
- ],
- "impact_std": [
- 0.0,
- 0.174459885,
- 0.098191042,
- 0.046492655,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0
- ],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "South America"
- },
- {
- "asset_type": "Buildings/Industrial",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.283181524,
- 0.481615653,
- 0.629218894,
- 0.717240588,
- 0.85667503,
- 0.908577004,
- 0.955327463,
- 1.0
- ],
- "impact_std": [
- 0.0,
- 0.243322302,
- 0.295987071,
- 0.300583358,
- 0.268517907,
- 0.234498136,
- 0.159197865,
- 0.079457988,
- 0.0
- ],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Asia"
- },
- {
- "asset_type": "Buildings/Industrial",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.062682043,
- 0.247196046,
- 0.403329984,
- 0.494488633,
- 0.684652389,
- 0.918589786,
- 1.0,
- 1.0
- ],
- "impact_std": [],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Africa"
- },
- {
- "asset_type": "Buildings/Industrial",
- "event_type": "RiverineInundation",
- "impact_mean": [],
- "impact_std": [],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Oceania"
- },
- {
- "asset_type": "Buildings/Industrial",
- "event_type": "RiverineInundation",
- "impact_mean": [
- 0.0,
- 0.297148022,
- 0.479790559,
- 0.60328579,
- 0.694345844,
- 0.820265484,
- 0.922861929,
- 0.987065493,
- 1.0
- ],
- "impact_std": [],
- "impact_type": "Damage",
- "intensity": [
- 0.0,
- 0.5,
- 1.0,
- 1.5,
- 2.0,
- 3.0,
- 4.0,
- 5.0,
- 6.0
- ],
- "intensity_units": "m",
- "location": "Global"
- }
- ]
-}
diff --git a/tests/conftest.py b/tests/conftest.py
index cd5bd9eb..4d99d06c 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -107,7 +107,7 @@ def vulnerability_onboarding_dir():
Returns:
str: Directory path.
"""
- path = Path(__file__).parents[1] / "notebooks" / "vulnerability_onboarding"
+ path = Path(__file__).parents[1] / "docs" / "vulnerability_functions"
return path
diff --git a/tests/vulnerability_models/config_based_uncertainty_test.py b/tests/vulnerability_models/config_based_uncertainty_test.py
index 77042446..ccf83e95 100644
--- a/tests/vulnerability_models/config_based_uncertainty_test.py
+++ b/tests/vulnerability_models/config_based_uncertainty_test.py
@@ -76,7 +76,6 @@ def __init__(
impact_grid (np.ndarray): array_like, (`m`,).
If kind is 'beta' or 'trunc_gauss', defines the impact values on which
the CDF is calculated, otherwise unused.
- the CDF is calculated, otherwise unused.
"""
if x.ndim != 1 or y.ndim != 1:
raise ValueError("`x` and `y` must be 1 dimensional.")
diff --git a/tests/vulnerability_models/config_generate_test.py b/tests/vulnerability_models/config_generate_test.py
index cc2873d4..2ee111ed 100644
--- a/tests/vulnerability_models/config_generate_test.py
+++ b/tests/vulnerability_models/config_generate_test.py
@@ -43,11 +43,7 @@ def flood_config_jrc(vulnerability_onboarding_dir):
vulnerability_onboarding_dir (_type_): Path to vulnerability on-boarding data directory.
"""
# raw data is actually a reformatting of the original Excel spreadsheet to facilitate loading.
- raw_data = (
- vulnerability_onboarding_dir
- / "EU JRC global flood depth-damage functions"
- / "raw.csv"
- )
+ raw_data = vulnerability_onboarding_dir / "inundation_jrc" / "raw.csv"
df = pd.read_csv(raw_data)
# consistent with physrisk continent definition