A python toolkit for direct damage assessments for natural hazards. Even though the method is initially developed for flood damage assessments, it can calculate damages for any hazard for which you just require a vulnerability curve (i.e. a one-dimensional relation).

Background

This package is (loosely) based on the original DamageScanner, which calculated potential flood damages based on inundation depth and land use using depth-damage curves in the Netherlands. The DamageScanner was originally developed for the ‘Netherlands Later’ project (Klijn et al., 2007). The original land-use classes were based on the Land-Use Scanner in order to evaluate the effect of future land-use change on flood damages.

Creating a testing environment

Recommended option is to use a miniconda environment to work in for this project, relying on conda to handle some of the trickier library dependencies.


# Add conda-forge channel for extra packages
conda config --add channels conda-forge

# Create a conda environment for the project and install packages
conda env create -f environment.yml
activate ds_env

Installation

workflow pypi badge

Requirements: NumPy, pandas, geopandas, matplotlib, rasterio, tqdm, xarray, pyproj

  1. Open the python environment in your command prompt or bash in which you want to install this package.
  2. Type pip install damagescanner and it should install itself into your python environment.
  3. Now you can import the package like any other package!

OR:

  1. Clone the repository or download the package on your computer and extract the folder.
  2. Go to the DamageScanner folder in your command prompt or bash.
  3. Type python setup.py install and it should install itself into your python environment.
  4. Now you can import the package like any other package!

Documentation

Please refer to the ReadTheDocs of this project for the full documentation of all functions.

Running a raster-based approach

1
2
3
4
5
6
7
8
9
10
11
12
13
    import os
    
    # import the RasterScanner
    from damagescanner.core import RasterScanner
    
    # set paths to the data
    inun_map = os.path.join(data_path,'data','inundation','inundation_map.tif')
    landuse_map = os.path.join(data_path,'data','landuse','landuse_map.tif')
    curve_path = os.path.join(data_path,'data','curves','curves.csv')
    maxdam_path = os.path.join(data_path,'data','curves','maxdam.csv')
        
    # run the RasterScanner and return a pandas DataFrame with loss per land-use class
    loss_df = RasterScanner(landuse_map,inun_map,curve_path,maxdam_path)[0]


Running a vector-based approach

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
    # import necessary packages
    import os
    import numpy
    import pandas 
       
    # import the RasterScanner
    from damagescanner.core import VectorScanner
    
    # set paths to the data
    inun_map = os.path.join(data_path,'data','inundation','inundation_map.tif')
    landuse_map = os.path.join(data_path,'data','landuse','landuse.shp')

    # Create maximum damage dictionary
    maxdam = {"grass":5,
        "forest":10,
        "orchard":50,
        "residential":200,
        "industrial":300,
        "retail":300,
        "farmland":10,
        "cemetery":15,
        "construction":10,
        "meadow":5,
        "farmyard":5,
        "scrub":5,
        "allotments":10,
        "reservoir":5,
        "static_caravan":100,
        "commercial":300}
        
    # Create some dummy curves that will match the land-use classes
    curves = numpy.array(
            [[0,0],
            [50,0.2],
            [100,0.4],
            [150,0.6],
            [200,0.8],
            [250,1]])  
    
    curves = numpy.concatenate((curves,
                                numpy.transpose(numpy.array([curves[:,1]]*(len(maxdam)-1)))),
                               axis=1)
    
    curves = pandas.DataFrame(curves)
    curves.columns = ['depth']+list(maxdam.keys())
    curves.set_index('depth',inplace=True)    

    # run the VectorScanner and return the landuse map with damage values
    loss_df = VectorScanner(landuse,inun_map,curves,maxdam)