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.


In [ ]:
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.


In [ ]:
fp = nv.Flooding()

Running the model

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


In [ ]:
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.


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

plt.show()

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


In [ ]:
fp.table.head()

Saving the model

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


In [ ]:
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.


In [ ]:
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")

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.


In [ ]:
myniche.run()
myniche.plot(18)
plt.show()

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.


In [ ]:
combined = fp.combine(myniche)
combined.plot(18)
plt.show()