Skip to content

Commit

Permalink
Merge pull request #12 from Deltares/fiat_compatibility
Browse files Browse the repository at this point in the history
Fiat raster compatibility
  • Loading branch information
DirkEilander authored Oct 21, 2021
2 parents 147819c + 6d88a05 commit 91b2b67
Show file tree
Hide file tree
Showing 56 changed files with 12,563 additions and 12,267 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ jobs:
- name: Setup environment
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: envs/hydromt-fiat.yml
python-version: "3.9"
activate-environment: hydromt-fiat
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
environment-file: envs/hydromt-fiat-dev.yml
activate-environment: hydromt-fiat-dev

- name: Install hydromt-fiat
run: flit install
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ jobs:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
environment-file: envs/hydromt-fiat.yml
python-version: ${{ matrix.python-version }}
activate-environment: hydromt-fiat
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
environment-file: envs/hydromt-fiat-dev.yml
activate-environment: hydromt-fiat-dev

- name: Conda info
run: |
conda info
conda list
- name: Install fiat
- name: Install hydromt_fiat
run: flit install

- name: Test
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ hydroMT-fiat: FIAT plugin for hydroMT
:target: https://deltares.github.io/hydromt_fiat/stable
:alt: Stable docs last release

.. image:: https://pypip.in/v/hydromt_fiat/badge.png
.. image:: https://badge.fury.io/py/hydromt_fiat.svg
:target: https://pypi.org/project/hydromt_fiat/
:alt: Latest PyPI version

Expand Down
15 changes: 13 additions & 2 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@ All notable changes to this project will be documented in this page.
The format is based on `Keep a Changelog`_, and this project adheres to
`Semantic Versioning`_.

[Unreleased]
------------
v0.1.9 (21 October 2021)
------------------------

This version is compatible with new FIAT raster (xarray) version

Added
^^^^^
- scaling functions for economic and population growth

Fixed
^^^^^
- bugfix resampling in buildings workflow


v0.0.1 (20 May 2021)
--------------------
Expand Down
9 changes: 4 additions & 5 deletions envs/hydromt-fiat.yml → envs/hydromt-fiat-dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: hydromt-fiat
name: hydromt-fiat-dev

channels:
- conda-forge
Expand All @@ -15,6 +15,7 @@ dependencies:
- flit>=3.2
- gdal>=3.1
- geopandas
- hydromt
- jupyterlab # to run examples
- netcdf4
- matplotlib # to run examples
Expand All @@ -36,7 +37,5 @@ dependencies:
- sphinx # docs
- sphinx_rtd_theme # docs
- xarray
- zarr
- pip:
- hydromt>=0.4.1

- xlsxwriter
- zarr
55 changes: 43 additions & 12 deletions examples/fiat_flood.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,51 @@
[global]
artifact_data = True # use latest artifact data
artifact_data = True # use latest artifact data

[setup_config]
case = baseline # name of case
country = Italy # Country name or ISO3 tag, see hydromt_fiat/data/global_configuration.xlsx for options
hazard_type = flooding # for now only 'flooding'
unit = m # 'm' or 'ft'
case = baseline # name of case
strategy = base # name of strategy (optional)
scenario = base # name of scenario (optional)
year = 2021 # case year (optional)
country = Italy # country name or ISO3 tag, see hydromt_fiat/data/global_configuration.xlsx for options
hazard_type = flooding # description of the hazard type (for now only 'flooding')
hazard_unit = m # unit of the hazard map values ('m' or 'ft')
output_unit = USD # unit in which the damage (and risk) numbers are expressed
category_output = True # indicator that specifies whether the results per category should be included in the output (default is True)
total_output = True # indicator that specifies whether the total results should be included in the output (default is True)
risk_output = True # indicator that specifies whether a risk calculation has to be conducted (default is True)
map_output = True # indicator that specifies whether the result maps should be included in the output (default is True)

[setup_hazard1]
map_fn = data/flood_hand/hand_050cm_rp02.tif # path to hazard file
return_period = 2 # hazard return period (optional)
map_fn = data/flood_hand/hand_050cm_rp02.tif # absolute or relative (with respect to the configuration.ini) path to the hazard file
map_type = water_depth # description of the hazard file type
rp = 2 # hazard return period in years, required for a risk calculation (optional)
crs = 3452 # coordinate reference system of the hazard file (optional)
nodata = -9999 # value that is assigned as nodata (optional)
var = None # hazard variable name in NetCDF input files (optional)
chunks = 100 # chunk sizes along each dimension used to load the hazard file into a dask array (default is 'auto') (optional)

[setup_hazard2]
map_fn = data/flood_hand/hand_150cm_rp50.tif # path to second hazard file ...
return_period = 50
map_fn = data/flood_hand/hand_150cm_rp50.tif # absolute or relative (with respect to the configuration.ini) path to the hazard file
map_type = water_depth # description of the hazard file type
rp = 50 # hazard return period in years, required for a risk calculation (optional)
crs = 3452 # coordinate reference system of the hazard file (optional)
nodata = -9999 # value that is assigned as nodata (optional)
var = None # hazard variable name in NetCDF input files (optional)
chunks = 100 # chunk sizes along each dimension used to load the hazard file into a dask array (default is 'auto') (optional)

[setup_exposure_buildings]
bld_fn = guf_bld_2012 # building footpring map {'guf_bld_2012', 'wsf_bld_2015'}
pop_fn = ghs_pop_2015_54009 # population count map {'ghs_pop_2015_54009', 'ghs_pop_2015'}
[setup_buildings_value]
bld_fn = guf_bld_2012 # name tag of or absolute or relative (with respect to the configuration file) path to the building footprint file (default is 'wsf_bld_2015')
pop_fn = ghs_pop_2015_54009 # name tag of or absolute or relative (with respect to the configuration file) path to the population count file (default is 'ghs_pop_2015')
chunks = 100 # chunk sizes along each dimension used to load the building footprint and population count files into a dask arrays (default is 'auto') (optional)
function_fn = None # absolute or relative (with respect to the configuration file or susceptibility_dp) path to the susceptibility file (default is the JCR continental susceptibilty function (https://publications.jrc.ec.europa.eu/repository/handle/JRC105688) related to the country parameter) (optional)
scale_factor = 1 # scaling factor of the exposure values (default is 1) (optional)
weight_factor = 1 # weight factor of the exposure values in the total damage and risk results (default is 1) (optional)

# Alternatives to conduct a risk calculation (triggered by a multiple hazard input):
# [setup_hazard]
# map_fn = [hazard/RP_2.tif, hazard/RP_100.tif] # TODO: Not properly working yet, input is '[.., ..]' instead of ['..', '..']
# rp = [2, 100] # TODO: Not properly working yet, input is not parseble.

# Alternative to derive rp from filename:
# [setup_hazard1]
# map_fn = hazard/RP_*.tif
Binary file modified examples/fiat_flood/exposure/buildings_count.tif
Binary file not shown.
Binary file modified examples/fiat_flood/exposure/buildings_value.tif
Binary file not shown.
Binary file modified examples/fiat_flood/exposure/population_buildings_count.tif
Binary file not shown.
Binary file modified examples/fiat_flood/exposure/population_count.tif
Binary file not shown.
51 changes: 51 additions & 0 deletions examples/fiat_flood/fiat_configuration.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[setup_config]
case = baseline
strategy = base
scenario = base
year = 2021
country = ITA
hazard_type = flooding
output_unit = USD
hazard_dp = hazard
exposure_dp = exposure
susceptibility_dp = susceptibility
output_dp = output
category_output = True
total_output = True
risk_output = True
map_output = True

[setup_hazard1]
usage = True
map_fn = hand_050cm_rp02.tif
map_type = water_depth
rp = 2
crs = EPSG:4326
nodata = -9999
var = None
chunks = 100

[setup_hazard2]
usage = True
map_fn = hand_150cm_rp50.tif
map_type = water_depth
rp = 50
crs = EPSG:4326
nodata = -9999
var = None
chunks = 100

[setup_exposure1]
usage = True
map_fn = buildings_value.tif
category = buildings_value
subcategory = None
unit = USD
crs = EPSG:4326
nodata = 0
chunks = 100
function_fn = {'water_depth': 'EU000.csv'}
comp_alg = max
scale_factor = 1
weight_factor = 1

Binary file removed examples/fiat_flood/fiat_configuration.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 0 additions & 3 deletions examples/fiat_flood/risk.csv

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Water Depth [m],Factor
0,0
0.0,0.0
0.01,0.0049
0.02,0.0098
0.03,0.0146
Expand Down
4 changes: 2 additions & 2 deletions hydromt_fiat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from os.path import dirname, join, abspath


__version__ = "0.1.2"
# NOTE version number without "v"
__version__ = "0.1.9"

DATADIR = join(dirname(abspath(__file__)), "data")

Expand Down
Loading

0 comments on commit 91b2b67

Please sign in to comment.