Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
apps:datastudio:comparescenarioscriptdetails [2021/11/23 13:47] – freddi | apps:datastudio:comparescenarioscriptdetails [2022/01/29 12:15] – freddi | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ==== Requirements ==== | ||
+ | |||
+ | This script needs **matplotlib** and **numpy** installed. For an instruction how to install python-libraries [[howToInstallPythonLibs| click here]]. | ||
+ | |||
==== Description ==== | ==== Description ==== | ||
The " | The " | ||
Line 4: | Line 8: | ||
=== General advice === | === General advice === | ||
- | * Both scenarios should use the same meteorological conditions | + | * Only change one input parameter at once (e.g. for scenario 2: only change |
* The area of interest should exist in both scenarios. | * 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) | * The script output should be shown together with screenshots of both model areas (scenario 1 and scenario 2) | ||
==== Example ==== | ==== Example ==== | ||
+ | |||
+ | === 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 Datafile 1 and Datafile 2 to the atmosphere folder of each scenario. Datafile 1 represents scenario A and Datafile 2 represents scenario B. For each, select a random .EDX-file in the corresponding atmosphere folder. | ||
+ | |||
+ | 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 a appropriate title automatically. | ||
+ | |||
+ | Now click on the script and click "Copy to Python Console" | ||
+ | |||
+ | {{: | ||
+ | |||
=== Model Area === | === Model Area === | ||
Line 21: | Line 39: | ||
z_to = 4 | z_to = 4 | ||
</ | </ | ||
+ | //(lines 16 - 22 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. | 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. | ||
Line 36: | Line 55: | ||
{{: | {{: | ||
- | |||
- | === 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: | ||
- | |||
- | <code python> | ||
- | # define the file and filepath for scenario 1 | ||
- | # as file_1, choose a normal EDX-file from your output folder | ||
- | file_1 = ' | ||
- | # as scenario_1, choose the folder which you would like to analyse (here: atmosphere), | ||
- | scenario_1 = ' | ||
- | |||
- | # define the file and filepath for scenario 2 | ||
- | file_2 = ' | ||
- | scenario_2 = ' | ||
- | </ | ||
== Data index == | == Data index == | ||
Line 65: | Line 65: | ||
data_index = 8 | data_index = 8 | ||
</ | </ | ||
+ | //(line 26 in current script version)// | ||
== Timespan == | == Timespan == | ||
Line 71: | Line 72: | ||
{{: | {{: | ||
- | If both scenarios | + | If both scenarios |
<code python> | <code python> | ||
time_from = 0 | time_from = 0 | ||
- | time_to = 30 | + | time_to = 92 |
</ | </ | ||
+ | //(lines 32 - 33 in current script version)// | ||
With index 0 we start at 23.06.2018 08:00h and with index 30 we end at 24.06.2018 14: | With index 0 we start at 23.06.2018 08:00h and with index 30 we end at 24.06.2018 14: | ||
Line 86: | Line 88: | ||
<code python> | <code python> | ||
time_from = 0 | time_from = 0 | ||
- | time_to = 30 | + | time_to = 92 |
time_from_scen2 = 2 | time_from_scen2 = 2 | ||
- | time_to_scen2 = 32 | + | time_to_scen2 = 94 |
</ | </ | ||
+ | //(lines 40 - 41 in current script version)// | ||
+ | |||
Now the timespteps match again. Otherwise you would compare different timesteps. | Now the timespteps match again. Otherwise you would compare different timesteps. | ||
+ | === Advanced Settings === | ||
+ | |||
+ | There is the option to compare maximum or minimum values instead of the mean values. To do so, change lines 133 - 139 (in current script version) as follows: | ||
+ | == Mean vallues (default) == | ||
+ | <code python> | ||
+ | #vals1 = (np.nanmin(data1, | ||
+ | #vals1 = (np.nanmax(data1, | ||
+ | vals1 = (np.nanmean(data1, | ||
+ | |||
+ | #vals2 = (np.nanmin(data2, | ||
+ | #vals2 = (np.nanmax(data2, | ||
+ | vals2 = (np.nanmean(data2, | ||
+ | </ | ||
+ | |||
+ | == Maximum values == | ||
+ | <code python> | ||
+ | #vals1 = (np.nanmin(data1, | ||
+ | vals1 = (np.nanmax(data1, | ||
+ | #vals1 = (np.nanmean(data1, | ||
+ | |||
+ | #vals2 = (np.nanmin(data2, | ||
+ | vals2 = (np.nanmax(data2, | ||
+ | #vals2 = (np.nanmean(data2, | ||
+ | </ | ||
+ | |||
+ | == Minimum values == | ||
+ | <code python> | ||
+ | vals1 = (np.nanmin(data1, | ||
+ | #vals1 = (np.nanmax(data1, | ||
+ | #vals1 = (np.nanmean(data1, | ||
+ | |||
+ | vals2 = (np.nanmin(data2, | ||
+ | #vals2 = (np.nanmax(data2, | ||
+ | #vals2 = (np.nanmean(data2, | ||
+ | </ | ||
=== Output === | === Output === | ||
If all settings are done, the script is ready to get executed. The output should look like this: | If all settings are done, the script is ready to get executed. 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. |