Flooding module

Niche Vlaanderen also contains a module to model the influence of flooding more precisely. This is done using the Flooding class.

The first step is importing the niche_vlaanderen module. For convenience, we will be importing as nv.

[1]:
import niche_vlaanderen as nv
%matplotlib inline
import matplotlib.pyplot as plt

Creating a Flooding model

Here the Flooding class is created. Like in Niche Vlaanderen, when creating the class, the model with its codetables is initialized.

[2]:
fp = nv.Flooding()

Running the model

The calculate method of the class takes four arguments: the depths (as grid), frequency, period and duration.

[3]:
fp.calculate(depth_file="../testcase/flooding/ff_bt_t10_h_0.asc",
             frequency="T10", period="summer", duration=1)

Inspecting the model

The results can be plotted per vegetation type. Note that not all vegetation types of Niche are supported by the flooding module.

[4]:
fp.plot(1)
fp.plot(25)

plt.show()
_images/flooding_7_0.png
_images/flooding_7_1.png

Like for the niche model, it is also possible to generate a summary table.

[5]:
fp.table.head()
[5]:
vegetation presence_code presence area_ha
0 1 4 no information or flooding 821.36
1 1 2 moderate tolerant to flooding 110.92
2 1 1 poorly tolerant to flooding 67.72
3 2 4 no information or flooding 821.36
4 2 2 moderate tolerant to flooding 110.92

Saving the model

Comparable to the niche model, the resulting grids can be saved using the write method.

[6]:
fp.write("_output", overwrite_files=True)

Combining the output with niche

The output of a Flooding model can be combined with a Niche model, by using the combine method.

We will create a new niche model and set the inputs.

[7]:
myniche = nv.Niche()
input = "../testcase/dijle/"
myniche.set_input("soil_code", input +"bodemv.asc")
myniche.set_input("msw", input +"gvg_0_cm.asc")
myniche.set_input("mlw", input +"glg_0_cm.asc")
myniche.set_input("mhw", input +"ghg_0_cm.asc")
myniche.set_input("seepage", input +"kwel_mm_dag.asc")

myniche.set_input("management", input +"beheer_int.asc")


myniche.set_input("nitrogen_atmospheric", input +"depositie_def.asc")
myniche.set_input("nitrogen_animal", input +"bemest_dier.asc")
myniche.set_input("nitrogen_fertilizer", input +"bemest_kunst.asc")

myniche.set_input("inundation_vegetation", input +"overstr_veg.asc")
myniche.set_input("inundation_acidity", input +"ovrstr_t10_50.asc")
myniche.set_input("inundation_nutrient", input +"ovrstr_t10_50.asc")

myniche.set_input("minerality", input + "minerality.asc")

myniche.set_input("rainwater", input +"nulgrid.asc")
Warning: CRS definitions are not equal!
Warning: CRS definitions are not equal!
Warning: CRS definitions are not equal!
Warning: CRS definitions are not equal!
Warning: CRS definitions are not equal!
Warning: CRS definitions are not equal!
Warning: CRS definitions are not equal!
Warning: CRS definitions are not equal!
Warning: CRS definitions are not equal!
Warning: CRS definitions are not equal!
Warning: CRS definitions are not equal!
Warning: CRS definitions are not equal!
Warning: CRS definitions are not equal!

Note that the niche model must be run prior to combining - otherwise this will raise an error.

In this example we also plot the result to allow comparison with the combined map.

[8]:
myniche.run()
myniche.plot(18)
plt.show()
_images/flooding_15_0.png

Finally, we run the actual combine method. The resulting object is a Flooding object, so we can use the same method for plotting the results.

[9]:
combined = fp.combine(myniche)
combined.plot(18)
plt.show()
Warning: CRS definitions are not equal!
_images/flooding_17_1.png