Requirements

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

Description

The “Compare Locations”-script analyses and compares two user defined locations in the same simulation for a specified variable. The idea of the the script is, that two areas in the same simulation are directly comparable. The script output shows 2 plots, each with two figures. The fist plot shows the mean, maximum and minimum values for each timestep at location A in the upper figure and at location B in the lower figure. The second plot shows the direct comparison between both locations: The upper figure shows the mean values of location A and B and the lower figure shows the absolute difference between the mean values for each timestep.

General advice

  • The script output should be shown together with screenshots of both locations.

Example

Settings

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

File path

The Potential Air Temperture is saved in the atmosphere output folder. Hence, we need to set the Datafile 1 to a random .EDX-file in the atmosphere output folder of our simulation. Datafile 2 keeps empty.

In addition you can also define a diagram-title which will be used in the output figure. Anyway, if you leave the Diagram Title field empty the script generates an appropriate title automatically.

Now click on the script and click “Copy to Python Console” to adjust the remaining settings.

Model Area

The locations we would like to compare are displayed in the following image. Every grid cell inside each cuboid will be taken into account for the corresponding location. To set these areas in the script, change the following lines accordingly:

# define Location A (as bounding box)
x1_from = 9
x1_to = 27
y1_from = 37
y1_to = 47
z1_from = 4
z1_to = 4  
 
# define Location B (as bounding box)
x2_from = 34
x2_to = 52
y2_from = 8
y2_to = 18
z2_from = 4
z2_to = 4  

(lines 16 - 30 in current script version)

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.

Location A and B

Location A is a parking lot behind a building row.

Location B is located at the crossroad in front of buildings.

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

(line 41 in current script version)

Timespan

At last we need to set the timespan for which both locations are compared with each other. 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:

To define the timespan for the comparison, just edit the following lines in the script accordingly. Time_from defines the first timestep and time_to defines the last timestep considered for the comparison.

time_from = 0
time_to = 92

(lines 36 - 37 in current script version)

With index 0 we start at 23.06.2018 08:00h and with index 92 we end at 27.06.2018 04:00h.

Output

If all settings are done, the script is ready to get executed. The second plot is shown when the first plot is closed. The output should look like this:

If you would like to analyse pollutant-data instead, an output for e.g. NO2-concentration could look like this:

Technical Note

Note that the execution-time of the script may be unexpected high, especially when you compare longer time periods or large areas. This is caused by limited implementation options caused by the Delphi-Python-interface. During execution, the GUI might not be reactive.

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