Adjust snow line based on METAR. Snow level is only adjusted when METAR reports snow below the user set altitude.
This commit is contained in:
parent
729e3b2e36
commit
f852529e56
3 changed files with 127 additions and 98 deletions
|
@ -70,7 +70,6 @@ var initialize = func {
|
||||||
var ground_term_Node = props.globals.getNode("/environment/terminator-relative-position-m" , 1);
|
var ground_term_Node = props.globals.getNode("/environment/terminator-relative-position-m" , 1);
|
||||||
ground_term_Node.setDoubleValue(60000);
|
ground_term_Node.setDoubleValue(60000);
|
||||||
|
|
||||||
|
|
||||||
# ################## listeners ####################
|
# ################## listeners ####################
|
||||||
#
|
#
|
||||||
setlistener("/environment/sea/surface/wind-speed-kt", func (n) {
|
setlistener("/environment/sea/surface/wind-speed-kt", func (n) {
|
||||||
|
@ -111,7 +110,7 @@ var initialize = func {
|
||||||
},
|
},
|
||||||
1,
|
1,
|
||||||
0);# end listener
|
0);# end listener
|
||||||
|
|
||||||
print("weather util initialized ...");
|
print("weather util initialized ...");
|
||||||
loop();
|
loop();
|
||||||
|
|
||||||
|
@ -157,3 +156,26 @@ setlistener("sim/signals/fdm-initialized", initialize);
|
||||||
|
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
###
|
||||||
|
# Adjust snow line to match METAR
|
||||||
|
#
|
||||||
|
|
||||||
|
var snowLineDefault = 3200;
|
||||||
|
|
||||||
|
_setlistener("/environment/metar/valid", func {
|
||||||
|
var snowCover = getprop("/environment/metar/snow-cover");
|
||||||
|
var snowLine = getprop("/environment/snow-level-m");
|
||||||
|
|
||||||
|
# Put the snow line slightly below the station's elevation,
|
||||||
|
# so the station is completely covered with snow
|
||||||
|
var stationElev = getprop("/environment/metar/station-elevation-ft") * globals.FT2M - 50;
|
||||||
|
|
||||||
|
if (snowCover == 1){
|
||||||
|
if (stationElev > snowLineDefault) { snowLine = snowLineDefault; }
|
||||||
|
if ((stationElev <= snowLineDefault) and (snowLine > stationElev)) { snowLine = stationElev; }
|
||||||
|
}
|
||||||
|
setprop("/environment/snow-level-m",snowLine);
|
||||||
|
});
|
||||||
|
|
||||||
|
#
|
||||||
|
###
|
|
@ -418,81 +418,6 @@
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group>
|
|
||||||
<layout>hbox</layout>
|
|
||||||
<text>
|
|
||||||
<label>Other</label>
|
|
||||||
<halign>left</halign>
|
|
||||||
<enable>
|
|
||||||
<property>/sim/rendering/shaders/quality-level</property>
|
|
||||||
</enable>
|
|
||||||
</text>
|
|
||||||
<hrule>
|
|
||||||
<stretch>true</stretch>
|
|
||||||
</hrule>
|
|
||||||
</group>
|
|
||||||
|
|
||||||
<group>
|
|
||||||
<layout>hbox</layout>
|
|
||||||
<halign>right</halign>
|
|
||||||
|
|
||||||
<text>
|
|
||||||
<label>Snow line</label>
|
|
||||||
<enable>
|
|
||||||
<and>
|
|
||||||
<property>/sim/rendering/shaders/quality-level</property>
|
|
||||||
<or>
|
|
||||||
<property>/sim/rendering/shaders/crop</property>
|
|
||||||
<property>/sim/rendering/shaders/landmass</property>
|
|
||||||
<property>/sim/rendering/shaders/transition</property>
|
|
||||||
<property>/sim/rendering/shaders/urban</property>
|
|
||||||
</or>
|
|
||||||
</and>
|
|
||||||
</enable>
|
|
||||||
</text>
|
|
||||||
|
|
||||||
<slider>
|
|
||||||
<name>snow-level</name>
|
|
||||||
<enable>
|
|
||||||
<and>
|
|
||||||
<property>/sim/rendering/shaders/quality-level</property>
|
|
||||||
<or>
|
|
||||||
<property>/sim/rendering/shaders/crop</property>
|
|
||||||
<property>/sim/rendering/shaders/landmass</property>
|
|
||||||
<property>/sim/rendering/shaders/transition</property>
|
|
||||||
<property>/sim/rendering/shaders/urban</property>
|
|
||||||
</or>
|
|
||||||
</and>
|
|
||||||
</enable>
|
|
||||||
<min>0.0</min>
|
|
||||||
<max>5000.0</max>
|
|
||||||
<property>/environment/snow-level-m</property>
|
|
||||||
<binding>
|
|
||||||
<command>dialog-apply</command>
|
|
||||||
<object-name>snow-level</object-name>
|
|
||||||
</binding>
|
|
||||||
</slider>
|
|
||||||
|
|
||||||
<text>
|
|
||||||
<halign>left</halign>
|
|
||||||
<enable>
|
|
||||||
<and>
|
|
||||||
<property>/sim/rendering/shaders/quality-level</property>
|
|
||||||
<or>
|
|
||||||
<property>/sim/rendering/shaders/crop</property>
|
|
||||||
<property>/sim/rendering/shaders/landmass</property>
|
|
||||||
<property>/sim/rendering/shaders/transition</property>
|
|
||||||
<property>/sim/rendering/shaders/urban</property>
|
|
||||||
</or>
|
|
||||||
</and>
|
|
||||||
</enable>
|
|
||||||
<label>12345678</label>
|
|
||||||
<format>%.fm</format>
|
|
||||||
<live>true</live>
|
|
||||||
<property>/environment/snow-level-m</property>
|
|
||||||
</text>
|
|
||||||
</group>
|
|
||||||
|
|
||||||
<group>
|
<group>
|
||||||
<layout>hbox</layout>
|
<layout>hbox</layout>
|
||||||
<text>
|
<text>
|
||||||
|
|
|
@ -416,7 +416,7 @@
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group>
|
<group>
|
||||||
<layout>hbox</layout>
|
<layout>vbox</layout>
|
||||||
<halign>fill</halign>
|
<halign>fill</halign>
|
||||||
<group>
|
<group>
|
||||||
<layout>table</layout>
|
<layout>table</layout>
|
||||||
|
@ -424,23 +424,18 @@
|
||||||
<row>0</row>
|
<row>0</row>
|
||||||
<col>0</col>
|
<col>0</col>
|
||||||
<label>Rain</label>
|
<label>Rain</label>
|
||||||
<enable>
|
<halign>left</halign>
|
||||||
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
<enable>
|
||||||
</enable>
|
<equals>
|
||||||
</text>
|
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
||||||
|
<value type="int">1</value>
|
||||||
<text>
|
</equals>
|
||||||
<row>0</row>
|
|
||||||
<col>1</col>
|
|
||||||
<label>Snow</label>
|
|
||||||
<enable>
|
|
||||||
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
|
||||||
</enable>
|
</enable>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<slider>
|
<slider>
|
||||||
<row>1</row>
|
<row>0</row>
|
||||||
<col>0</col>
|
<col>1</col>
|
||||||
<live>true</live>
|
<live>true</live>
|
||||||
<halign>fill</halign>
|
<halign>fill</halign>
|
||||||
<property>/environment/rain-norm</property>
|
<property>/environment/rain-norm</property>
|
||||||
|
@ -455,6 +450,19 @@
|
||||||
</equals>
|
</equals>
|
||||||
</enable>
|
</enable>
|
||||||
</slider>
|
</slider>
|
||||||
|
|
||||||
|
<text>
|
||||||
|
<row>1</row>
|
||||||
|
<col>0</col>
|
||||||
|
<label>Snow</label>
|
||||||
|
<halign>left</halign>
|
||||||
|
<enable>
|
||||||
|
<equals>
|
||||||
|
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</equals>
|
||||||
|
</enable>
|
||||||
|
</text>
|
||||||
|
|
||||||
<slider>
|
<slider>
|
||||||
<row>1</row>
|
<row>1</row>
|
||||||
|
@ -478,7 +486,7 @@
|
||||||
<row>0</row>
|
<row>0</row>
|
||||||
<col>3</col>
|
<col>3</col>
|
||||||
<label>QNH (inHg)</label>
|
<label>QNH (inHg)</label>
|
||||||
<enable>
|
<enable>
|
||||||
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
||||||
</enable>
|
</enable>
|
||||||
</text>
|
</text>
|
||||||
|
@ -501,19 +509,93 @@
|
||||||
<object-name>pressure-sea-level-inhg</object-name>
|
<object-name>pressure-sea-level-inhg</object-name>
|
||||||
</binding>
|
</binding>
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
<empty>
|
<text>
|
||||||
|
<label>Snow line</label>
|
||||||
<row>2</row>
|
<row>2</row>
|
||||||
<col>0</col>
|
<col>0</col>
|
||||||
<colspan>3</colspan>
|
<enable>
|
||||||
<pref-height>30</pref-height>
|
<and>
|
||||||
</empty>
|
<property>/sim/rendering/shaders/quality-level</property>
|
||||||
|
<or>
|
||||||
|
<property>/sim/rendering/shaders/crop</property>
|
||||||
|
<property>/sim/rendering/shaders/landmass</property>
|
||||||
|
<property>/sim/rendering/shaders/transition</property>
|
||||||
|
<property>/sim/rendering/shaders/urban</property>
|
||||||
|
</or>
|
||||||
|
</and>
|
||||||
|
</enable>
|
||||||
|
</text>
|
||||||
|
|
||||||
|
<slider>
|
||||||
|
<name>snow-level</name>
|
||||||
|
<row>2</row>
|
||||||
|
<col>1</col>
|
||||||
|
<enable>
|
||||||
|
<and>
|
||||||
|
<property>/sim/rendering/shaders/quality-level</property>
|
||||||
|
<or>
|
||||||
|
<property>/sim/rendering/shaders/crop</property>
|
||||||
|
<property>/sim/rendering/shaders/landmass</property>
|
||||||
|
<property>/sim/rendering/shaders/transition</property>
|
||||||
|
<property>/sim/rendering/shaders/urban</property>
|
||||||
|
</or>
|
||||||
|
</and>
|
||||||
|
</enable>
|
||||||
|
<min>-425.0</min>
|
||||||
|
<max>5000.0</max>
|
||||||
|
<live>true</live>
|
||||||
|
<property>/environment/snow-level-m</property>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>snow-level</object-name>
|
||||||
|
</binding>
|
||||||
|
</slider>
|
||||||
|
|
||||||
|
<text>
|
||||||
|
<row>2</row>
|
||||||
|
<col>2</col>
|
||||||
|
<enable>
|
||||||
|
<and>
|
||||||
|
<property>/sim/rendering/shaders/quality-level</property>
|
||||||
|
<or>
|
||||||
|
<property>/sim/rendering/shaders/crop</property>
|
||||||
|
<property>/sim/rendering/shaders/landmass</property>
|
||||||
|
<property>/sim/rendering/shaders/transition</property>
|
||||||
|
<property>/sim/rendering/shaders/urban</property>
|
||||||
|
</or>
|
||||||
|
</and>
|
||||||
|
</enable>
|
||||||
|
<label>12345678</label>
|
||||||
|
<format>%.fm</format>
|
||||||
|
<live>true</live>
|
||||||
|
<property>/environment/snow-level-m</property>
|
||||||
|
</text>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<empty>
|
<empty>
|
||||||
<stretch>true</stretch>
|
<stretch>true</stretch>
|
||||||
</empty>
|
</empty>
|
||||||
|
|
||||||
|
<text>
|
||||||
|
<visible>
|
||||||
|
<not>
|
||||||
|
<equals>
|
||||||
|
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</equals>
|
||||||
|
</not>
|
||||||
|
</visible>
|
||||||
|
<label>Disable METAR to manually edit weather settings.</label>
|
||||||
|
<halign>left</halign>
|
||||||
|
<color>
|
||||||
|
<red>1.0</red>
|
||||||
|
<green>0.6</green>
|
||||||
|
<blue>0.6</blue>
|
||||||
|
</color>
|
||||||
|
</text>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<!-- Precipitation End -->
|
<!-- Precipitation End -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue