This is an old revision of the document!


Requirements

This script needs matplotlib and numpy installed. For an instruction how to install python-libraries click here.

Description

The “Compare Scenario Script” analyses an user defined area of interest and compares the values inside this area between two given simulation outputs. The idea of the script is, that the impact of two different planning scenarios on an area of interest is directly compareable. Hence, the script output shows two figures. The upper figure directly compares the values inside the area of interest from scenario 1 with the values inside the area of interest from scenario 2 for each timestep. The lower figure shows the absolute difference between scenario 1 and scenario 2 for each timestep.

General advice

  • Both scenarios should use the same meteorological conditions to keep the results compareable
  • The area of interest should exist in both scenarios.
  • The script output should be shown together with screenshots of both model areas (scenario 1 and scenario 2)

Example

Model Area

The area we would like to compare in both scenarios is displayed in red in the following images. Every grid cell inside this red cuboid will be taken into account. To set this area in the script, change the following lines accordingly:

# define the location you would like to compare (as bounding box)
x_from = 50
x_to = 60
y_from = 30
y_to = 50
z_from = 1
z_to = 4

x and y defines the horizontal position of the area of interst in your model area and z defines the vertical extend of your area of interest. You can use Spaces or Leonardo to look up the x, y and z values of your area of interest.

Scenario 1

Scenario 1 shows a greened model area with city parks and urban trees.

Scenario 2

In Scenario 2 the greened areas are replaced by paved ground.

Settings

In this example, we would like to compare the Potential Air Temperature [°C] between both scenarios in the defined area.

File path

The Potential Air Temperture is saved in the atmosphere output folder. Hence, we need to set the folder location of the atmosphere output folder and a single EDX-file from the folder for both scenarios:

# define the file and filepath for scenario 1
# as file_1, choose a normal EDX-file from your output folder 
file_1 = 'D:/enviprojects/Leonardo_Scripts_DummyProject/DummyProject_Leonardo_output/atmosphere/DummyProject_Leonardo_AT_2018-06-23_10.00.01.EDX'
# as scenario_1, choose the folder which you would like to analyse (here: atmosphere), provide an absolute path and be sure that every "\" is replaced by a "/"
scenario_1 = 'D:/enviprojects/Leonardo_Scripts_DummyProject/DummyProject_Leonardo_output/atmosphere'
 
# define the file and filepath for scenario 2
file_2 = 'D:/enviprojects/Leonardo_Scripts_DummyProject_Scen2/DummyProject_Leonardo_Scen2_output/atmosphere/DummyProject_Leonardo_Scen2_AT_2018-06-23_10.00.01.EDX'
scenario_2 = 'D:/enviprojects/Leonardo_Scripts_DummyProject_Scen2/DummyProject_Leonardo_Scen2_output/atmosphere'
Data index

The data indexes are printed on the console for the given output folder if you run the script. For the atmosphere output, the indexes are as follows:

Potential Air Temperature is at index 8, so we need to set:

data_index = 8
Timespan

At last we need to set the timespan for which the area of interest is compared between both scenarios. The time variables are also index based. The first output-EDX-file in a folder has index 0. The second one has index 1. The following image illustrates the indexes:

If both scenarios were simulated for the same time period, the indexes between both output folders should match (e.g. the 0 index in both folders(scenario 1 atmosphere folder, scenario 2 atmosphere folder) is dated to 23.06.2018 08:00h). In this case it is enough to edit the following lines:

time_from = 0
time_to = 30

With index 0 we start at 23.06.2018 08:00h and with index 30 we end at 24.06.2018 14:00h.

Anyway, if the simulation periods between both scenarios do not match, we need to define the indexes separately for each folder (scenario). Example: Your first scenario simulation started at 23.06.2018 at 07:00h, so your first output (with index 0) is 23.06.2018 08:00h. Your second scenario simulation started at 23.06.2018 at 05:00h, so your first output (with index 0) is 23.06.2018 6:00h Then you need to define the indexes separately as follows:

time_from = 0
time_to = 30
 
time_from_scen2 = 2
time_to_scen2 = 32

Now the timespteps match again. Otherwise you would compare different timesteps.

Output

If all settings are done, the script is ready to get executed. The output should look like this:

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies