Thorsten Renk: local weather addon 1.15
Local weather now capable of controling the new scattering and overcast rendering parameters.
This commit is contained in:
parent
717b3da52b
commit
cfe528617c
5 changed files with 524 additions and 71 deletions
|
@ -81,10 +81,16 @@ else
|
|||
print("* can set light saturation: "~result);
|
||||
|
||||
|
||||
if (props.globals.getNode("/rendering/scene/scattering", 0) == nil)
|
||||
{result = "no"; features.can_set_scattering = 0;}
|
||||
else
|
||||
{result = "yes"; features.can_set_scattering = 1;}
|
||||
print("* can set horizon scattering: "~result);
|
||||
|
||||
if (props.globals.getNode("/environment/terrain", 0) == nil)
|
||||
{result = "no"; features.terrain_presampling = 0;}
|
||||
else
|
||||
{result = "yes"; features.terrain_presampling = 1;}
|
||||
{result = "yes"; features.terrain_presampling = 1;setprop("/environment/terrain/area[0]/enabled",1);}
|
||||
print("* hard coded terrain presampling: "~result);
|
||||
|
||||
if ((props.globals.getNode("/environment/terrain/area[0]/enabled",1).getBoolValue() == 1) and (features.terrain_presampling ==1))
|
||||
|
@ -100,10 +106,6 @@ else
|
|||
{result = "yes"; features.can_disable_environment = 1;}
|
||||
print("* can disable global weather: "~result);
|
||||
|
||||
#if (features.terrain_presampling_active == 1)
|
||||
# {
|
||||
# setlistener("/environment/terrain/area[0]/output/valid", func {local_weather.manage_hardcoded_presampling(); });
|
||||
# }
|
||||
|
||||
print("Compatibility layer: tests done.");
|
||||
});
|
||||
|
@ -328,6 +330,32 @@ if (features.can_set_light == 1)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
####################################
|
||||
# set horizon scattering
|
||||
####################################
|
||||
|
||||
var setScattering = func (s) {
|
||||
|
||||
if (features.can_set_scattering == 1)
|
||||
{
|
||||
setprop("/rendering/scene/scattering",s);
|
||||
}
|
||||
}
|
||||
|
||||
####################################
|
||||
# set overcast haze
|
||||
####################################
|
||||
|
||||
var setOvercast = func (o) {
|
||||
|
||||
if (features.can_set_scattering == 1)
|
||||
{
|
||||
setprop("/rendering/scene/overcast",o);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
###########################################################
|
||||
# set wind to given direction and speed
|
||||
###########################################################
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
# set_texture_mix to determine the texture mix between smooth and rough cloud appearance
|
||||
# create_effect_volume to create an effect volume
|
||||
# set_weather_station to specify a weather station for interpolation
|
||||
# set_atmosphere_ipoint to specify an interpolation point for visibility, haze and shading in the atmosphere
|
||||
# set_wind_ipoint to set an aloft wind interpolation point
|
||||
# set_wind_ipoint_metar to set a wind interpolation point from available ground METAR info where aloft is modelled
|
||||
# showDialog to pop up a dialog window
|
||||
|
@ -74,6 +75,7 @@
|
|||
# object purpose
|
||||
|
||||
# weatherStation to store info about weather conditions
|
||||
# atmopshereIpoint to store info about haze and light propagation in the atmosphere
|
||||
# windIpoint to store an interpolation point of the windfield
|
||||
# effectVolume to store effect volume info and provide methods to move and time-evolve effect volumes
|
||||
# thermalLift to store thermal info and provide methods to move and time-evolve a thermal
|
||||
|
@ -109,6 +111,9 @@ return (x*x + y*y);
|
|||
|
||||
var effect_volume_loop = func (index, n_active) {
|
||||
|
||||
|
||||
if (local_weather_running_flag == 0) {return;}
|
||||
|
||||
var n = 25;
|
||||
|
||||
|
||||
|
@ -415,14 +420,11 @@ return f_slow;
|
|||
|
||||
var interpolation_loop = func {
|
||||
|
||||
if (local_weather_running_flag == 0) {return;}
|
||||
|
||||
var viewpos = geo.aircraft_position();
|
||||
|
||||
var sum_alt = 0.0;
|
||||
var sum_vis = 0.0;
|
||||
var sum_T = 0.0;
|
||||
var sum_p = 0.0;
|
||||
var sum_D = 0.0;
|
||||
var sum_norm = 0.0;
|
||||
|
||||
|
||||
var vis_before = getprop(lwi~"visibility-m");
|
||||
|
||||
|
@ -453,6 +455,12 @@ else
|
|||
|
||||
# get an inverse distance weighted average from all defined weather stations
|
||||
|
||||
var sum_alt = 0.0;
|
||||
var sum_vis = 0.0;
|
||||
var sum_T = 0.0;
|
||||
var sum_p = 0.0;
|
||||
var sum_D = 0.0;
|
||||
var sum_norm = 0.0;
|
||||
|
||||
var n_stations = size(weatherStationArray);
|
||||
|
||||
|
@ -502,40 +510,145 @@ var D = sum_D/sum_norm;
|
|||
var T = sum_T/sum_norm;
|
||||
|
||||
|
||||
# get an inverse distance weighted average from all defined atmospheric condition points
|
||||
|
||||
sum_norm = 0.0;
|
||||
var sum_vis_aloft = 0.0;
|
||||
var sum_vis_alt1 = 0.0;
|
||||
var sum_vis_ovcst = 0.0;
|
||||
var sum_ovcst = 0.0;
|
||||
var sum_ovcst_alt_low = 0.0;
|
||||
var sum_ovcst_alt_high = 0.0;
|
||||
var sum_scatt = 0.0;
|
||||
var sum_scatt_alt_low = 0.0;
|
||||
var sum_scatt_alt_high = 0.0;
|
||||
|
||||
var n_iPoints = size(atmosphereIpointArray);
|
||||
|
||||
for (var i = 0; i < n_iPoints; i=i+1) {
|
||||
|
||||
a = atmosphereIpointArray[i];
|
||||
|
||||
|
||||
var apos = geo.Coord.new();
|
||||
apos.set_latlon(a.lat,a.lon,0.0);
|
||||
|
||||
var d = viewpos.distance_to(apos);
|
||||
if (d <100.0) {d = 100.0;} # to prevent singularity at zero
|
||||
|
||||
sum_norm = sum_norm + 1./d * a.weight;
|
||||
sum_vis_aloft = sum_vis_aloft + (a.vis_aloft/d) * a.weight;
|
||||
sum_vis_alt1 = sum_vis_alt1 + (a.vis_alt1/d) * a.weight;
|
||||
sum_vis_ovcst = sum_vis_ovcst + (a.vis_ovcst/d) * a.weight;
|
||||
sum_ovcst = sum_ovcst + (a.ovcst/d) * a.weight;
|
||||
sum_ovcst_alt_low = sum_ovcst_alt_low + (a.ovcst_alt_low/d) * a.weight;
|
||||
sum_ovcst_alt_high = sum_ovcst_alt_high + (a.ovcst_alt_high/d) * a.weight;
|
||||
sum_scatt = sum_scatt + (a.scatt/d) * a.weight;
|
||||
sum_scatt_alt_low = sum_scatt_alt_low + (a.scatt_alt_low/d) * a.weight;
|
||||
sum_scatt_alt_high = sum_scatt_alt_high + (a.scatt_alt_high/d) * a.weight;
|
||||
|
||||
# gradually fade in the interpolation weight of newly added stations to
|
||||
# avoid sudden jumps
|
||||
|
||||
if (a.weight < 1.0) {a.weight = a.weight + 0.02;}
|
||||
|
||||
# automatically delete stations out of range
|
||||
# take care not to unload if weird values appear for a moment
|
||||
# never unload if only one station left
|
||||
if ((d > distance_to_unload) and (d < (distance_to_unload + 20000.0)) and (n_iPoints > 1))
|
||||
{
|
||||
if (debug_output_flag == 1)
|
||||
{print("Distance to atmosphere interpolation point ", d, " m, unloading ...", i);}
|
||||
atmosphereIpointArray = weather_tile_management.delete_from_vector(atmosphereIpointArray,i);
|
||||
i = i-1; n_iPoints = n_iPoints -1;
|
||||
}
|
||||
}
|
||||
|
||||
setprop(lwi~"atmosphere-ipoint-number", i+1);
|
||||
|
||||
|
||||
|
||||
var vis_aloft = sum_vis_aloft/sum_norm;
|
||||
var vis_alt1 = sum_vis_alt1/sum_norm;
|
||||
var vis_ovcst = sum_vis_ovcst/sum_norm;
|
||||
var ovcst_max = sum_ovcst/sum_norm;
|
||||
var ovcst_alt_low = sum_ovcst_alt_low/sum_norm;
|
||||
var ovcst_alt_high = sum_ovcst_alt_high/sum_norm;
|
||||
var scatt_max = sum_scatt/sum_norm;
|
||||
var scatt_alt_low = sum_scatt_alt_low/sum_norm;
|
||||
var scatt_alt_high = sum_scatt_alt_high/sum_norm;
|
||||
|
||||
|
||||
|
||||
|
||||
# altitude model for visibility - increase above the lowest inversion layer to simulate ground haze
|
||||
|
||||
|
||||
var altitude = getprop("position/altitude-ft");
|
||||
|
||||
var current_tile_index = getprop(lw~"tiles/tile[4]/tile-index");
|
||||
|
||||
#if (presampling_flag == 1)
|
||||
# {var current_mean_terrain_elevation = alt_20_array[current_tile_index -1];}
|
||||
#else
|
||||
# {var current_mean_terrain_elevation = getprop(lw~"tmp/tile-alt-offset-ft");}
|
||||
|
||||
current_mean_terrain_elevation = ialt;
|
||||
|
||||
var alt1 = weather_dynamics.tile_convective_altitude[current_tile_index -1];
|
||||
var alt1 = vis_alt1;
|
||||
var alt2 = alt1 + 1500.0;
|
||||
|
||||
|
||||
var inc1 = 0.1;
|
||||
var inc2 = 5.0;
|
||||
var inc3 = 0.5;
|
||||
#var inc1 = 0.15;
|
||||
#var inc2 = 5.0;
|
||||
#var inc3 = 0.7;
|
||||
|
||||
var alt_above_mean = altitude - current_mean_terrain_elevation;
|
||||
# compute the visibility gradients
|
||||
|
||||
var inc1 = 0.1 * (vis_aloft - vis)/(vis_alt1 - ialt);
|
||||
var inc2 = 0.9 * (vis_aloft - vis)/1500.0;
|
||||
var inc3 = (vis_ovcst - vis_aloft)/(ovcst_alt_high - vis_alt1+1500);
|
||||
var inc4 = 0.5;
|
||||
|
||||
# compute the visibility
|
||||
|
||||
if (altitude < alt1)
|
||||
{vis = vis + inc1 * altitude;}
|
||||
else if (altitude < alt2)
|
||||
{
|
||||
vis = vis + inc1 * alt1 + inc2 * (altitude - alt1);
|
||||
}
|
||||
else if (altitude < ovcst_alt_high)
|
||||
{
|
||||
vis = vis + inc1 * alt1 + inc2 * (alt2-alt1) + inc3 * (altitude - alt2);
|
||||
}
|
||||
else if (altitude > ovcst_alt_high)
|
||||
{
|
||||
vis = vis + inc1 * alt1 + inc2 * (alt2-alt1) + inc3 * (ovcst_alt_high - alt2) + inc4 * (altitude - ovcst_alt_high);
|
||||
}
|
||||
|
||||
# compute the horizon shading
|
||||
|
||||
if (altitude < scatt_alt_low)
|
||||
{
|
||||
var scatt = scatt_max;
|
||||
}
|
||||
else if (altitude < scatt_alt_high)
|
||||
{
|
||||
var scatt = scatt_max + (0.95 - scatt_max) * (altitude - scatt_alt_low)/(scatt_alt_high-scatt_alt_low);
|
||||
}
|
||||
else
|
||||
{var scatt = 0.95;}
|
||||
|
||||
|
||||
# compute the overcast haze
|
||||
|
||||
if (altitude < ovcst_alt_low)
|
||||
{
|
||||
var ovcst = ovcst_max;
|
||||
}
|
||||
else if (altitude < ovcst_alt_high)
|
||||
{
|
||||
var ovcst = ovcst_max - ovcst_max * (altitude - ovcst_alt_low)/(ovcst_alt_high-ovcst_alt_low);
|
||||
}
|
||||
else
|
||||
{var ovcst = 0.0;}
|
||||
|
||||
if (alt_above_mean < alt1)
|
||||
{vis = vis + inc1 * alt_above_mean;}
|
||||
else if (alt_above_mean < alt2)
|
||||
{vis = vis + inc1 * alt1 + inc2 * (alt_above_mean - alt1);}
|
||||
else if (alt_above_mean > alt2)
|
||||
{vis = vis + inc1 * alt1 + inc2 * (alt2-alt1) + inc3 * (alt_above_mean - alt2);}
|
||||
|
||||
|
||||
# limit relative changes of the visibility, will make for gradual transitions
|
||||
|
||||
|
||||
if (vis/vis_before > vlimit)
|
||||
{vis = vlimit * vis_before;}
|
||||
else if (vis/vis_before < (2.0-vlimit))
|
||||
|
@ -543,6 +656,7 @@ else if (vis/vis_before < (2.0-vlimit))
|
|||
|
||||
|
||||
|
||||
|
||||
# write all properties into the weather interpolation record in the property tree
|
||||
|
||||
setprop(lwi~"mean-terrain-altitude-ft",ialt);
|
||||
|
@ -552,9 +666,11 @@ setprop(lwi~"dewpoint-degc",D);
|
|||
if (p > 10.0) {setprop(lwi~"pressure-sea-level-inhg",p);}
|
||||
setprop(lwi~"turbulence",0.0);
|
||||
|
||||
compat_layer.setScattering(scatt);
|
||||
compat_layer.setOvercast(ovcst);
|
||||
|
||||
# now check if an effect volume writes the property and set only if not
|
||||
|
||||
#flag = props.globals.getNode("local-weather/effect-volumes/number-active-vis").getValue();
|
||||
flag = getprop("local-weather/effect-volumes/number-active-vis");
|
||||
|
||||
if ((flag ==0) and (vis > 0.0) and (getprop(lw~"lift-loop-flag") == 0))
|
||||
|
@ -564,39 +680,32 @@ if ((flag ==0) and (vis > 0.0) and (getprop(lw~"lift-loop-flag") == 0))
|
|||
compat_layer.setVisibility(vis);
|
||||
}
|
||||
|
||||
#flag = props.globals.getNode("local-weather/effect-volumes/number-active-turb").getValue();
|
||||
flag = getprop("local-weather/effect-volumes/number-active-turb");
|
||||
|
||||
if ((flag ==0))
|
||||
{
|
||||
#cNode.getNode("turbulence").setValue(0.0);
|
||||
setprop(lw~"current/turbulence",0.0);
|
||||
compat_layer.setTurbulence(0.0);
|
||||
}
|
||||
|
||||
|
||||
#flag = props.globals.getNode("local-weather/effect-volumes/number-active-lift").getValue();
|
||||
flag = getprop("local-weather/effect-volumes/number-active-lift");
|
||||
|
||||
if (flag ==0)
|
||||
{
|
||||
#cNode.getNode("thermal-lift").setValue(0.0);
|
||||
setprop(lw~"current/thermal-lift",0.0);
|
||||
}
|
||||
|
||||
# no need to check for these, as they are not modelled in effect volumes
|
||||
|
||||
#cNode.getNode("temperature-degc",1).setValue(T);
|
||||
setprop(lw~"current/temperature-degc",T);
|
||||
compat_layer.setTemperature(T);
|
||||
|
||||
#cNode.getNode("dewpoint-degc",1).setValue(D);
|
||||
setprop(lw~"current/dewpoint-degc", D);
|
||||
compat_layer.setDewpoint(D);
|
||||
|
||||
if (p>0.0)
|
||||
{
|
||||
#cNode.getNode("pressure-sea-level-inhg",1).setValue(p);
|
||||
setprop(lw~"current/pressure-sea-level-inhg",p);
|
||||
compat_layer.setPressure(p);
|
||||
}
|
||||
|
@ -794,6 +903,8 @@ if (getprop(lw~"lift-loop-flag") == 0)
|
|||
|
||||
var thermal_lift_loop = func {
|
||||
|
||||
if (local_weather_running_flag == 0) {return;}
|
||||
|
||||
var apos = geo.aircraft_position();
|
||||
|
||||
var tlat = thermal.lat;
|
||||
|
@ -915,6 +1026,8 @@ if (getprop(lw~"wave-loop-flag") == 0)
|
|||
|
||||
var wave_lift_loop = func {
|
||||
|
||||
if (local_weather_running_flag == 0) {return;}
|
||||
|
||||
var lat = getprop("position/latitude-deg");
|
||||
var lon = getprop("position/longitude-deg");
|
||||
var alt = getprop("position/altitude-ft");
|
||||
|
@ -1719,13 +1832,6 @@ foreach (var m; modelNode)
|
|||
}
|
||||
|
||||
|
||||
|
||||
# clear effect volumes
|
||||
|
||||
#props.globals.getNode("local-weather/effect-volumes", 1).removeChildren("effect-volume");
|
||||
|
||||
|
||||
|
||||
# reset pressure continuity
|
||||
|
||||
weather_tiles.last_pressure = 0.0;
|
||||
|
@ -1745,12 +1851,13 @@ setprop(lw~"convective-loop-flag",0);
|
|||
|
||||
weather_dynamics.convective_loop_kill_flag = 1; # long-running loop needs a different scheme to end
|
||||
|
||||
# also remove rain snow and saturation effects
|
||||
# also remove rain, snow, haze and light effects
|
||||
|
||||
compat_layer.setRain(0.0);
|
||||
compat_layer.setSnow(0.0);
|
||||
compat_layer.setLight(1.0);
|
||||
|
||||
|
||||
# set placement indices to zero
|
||||
|
||||
setprop(lw~"clouds/placement-index",0);
|
||||
|
@ -1783,11 +1890,14 @@ settimer ( func {
|
|||
setsize(weather_dynamics.tile_convective_strength,0);
|
||||
setsize(weatherStationArray,0);
|
||||
setsize(windIpointArray,0);
|
||||
setsize(atmosphereIpointArray,0);
|
||||
setprop(lw~"clouds/buffer-count",0);
|
||||
setprop(lw~"clouds/cloud-scenery-count",0);
|
||||
weather_tile_management.n_cloudSceneryArray = 0;
|
||||
#props.globals.getNode("local-weather/interpolation", 1).removeChildren("wind");
|
||||
compat_layer.setScattering(0.8);
|
||||
compat_layer.setOvercast(0.0);
|
||||
setprop(lwi~"ipoint-number",0);
|
||||
setprop(lwi~"atmosphere-ipoint-number", 0);
|
||||
},1.1);
|
||||
|
||||
setprop(lw~"tmp/presampling-status", "idle");
|
||||
|
@ -1928,6 +2038,8 @@ else
|
|||
|
||||
var cumulus_loop = func (blat, blon, balt, nc, size) {
|
||||
|
||||
if (local_weather_running_flag == 0) {return;}
|
||||
|
||||
var n = int(25/cumulus_efficiency_factor);
|
||||
|
||||
if (nc < 0)
|
||||
|
@ -1939,7 +2051,6 @@ if (nc < 0)
|
|||
return;
|
||||
}
|
||||
|
||||
#print("nc is now: ",nc);
|
||||
create_cumulus(blat, blon, balt, n, size);
|
||||
|
||||
settimer( func {cumulus_loop(blat, blon, balt, nc-n, size) },0);
|
||||
|
@ -1963,6 +2074,13 @@ var detail_flag = detailed_clouds_flag;
|
|||
|
||||
var alpha = getprop(lw~"tmp/tile-orientation-deg") * math.pi/180.0; # the tile orientation
|
||||
|
||||
if (detailed_terrain_interaction_flag == 1)
|
||||
{
|
||||
var alt_min = getprop(lw~"tmp/tile-alt-min-ft");
|
||||
var alt_mean = getprop(lw~"tmp/tile-alt-mean-ft");
|
||||
var alt_var = alt_mean - alt_min;
|
||||
}
|
||||
|
||||
var sec_to_rad = 2.0 * math.pi/86400; # conversion factor for sinusoidal dependence on daytime
|
||||
|
||||
calc_geo(blat);
|
||||
|
@ -2016,9 +2134,26 @@ while (i < nc) {
|
|||
}}
|
||||
else {continue;}
|
||||
|
||||
|
||||
# apply some optional corrections, biases clouds towards higher elevations
|
||||
|
||||
var terrain_altitude_factor = 1.0;
|
||||
|
||||
if (detailed_terrain_interaction_flag == 1)
|
||||
{
|
||||
var elevation_enhancement = (elevation - alt_mean) / 1000.0;
|
||||
|
||||
if (elevation_enhancement > 0.7) {elevation_enhancement = 0.7;}
|
||||
if (elevation_enhancement < -0.7) {elevation_enhancement = -0.7;}
|
||||
|
||||
terrain_altitude_factor = 1.0 + elevation_enhancement;
|
||||
|
||||
}
|
||||
|
||||
|
||||
# then decide if the thermal energy at the spot generates an updraft and a cloud
|
||||
|
||||
if (rand() < (p * cumulus_efficiency_factor)) # we decide to place a cloud at this spot
|
||||
if (rand() < (p * cumulus_efficiency_factor * terrain_altitude_factor)) # we decide to place a cloud at this spot
|
||||
{
|
||||
strength = (1.5 * rand() + (2.0 * p)) * t_factor2; # the strength of thermal activity at the spot
|
||||
if (strength > 1.0)
|
||||
|
@ -2807,6 +2942,7 @@ if (compat_layer.features.terrain_presampling_active == 1)
|
|||
|
||||
var terrain_presampling_loop = func (blat, blon, nc, size, alpha) {
|
||||
|
||||
if ((local_weather_running_flag == 0) and (local_weather_startup_flag == 0)) {return;}
|
||||
|
||||
var n = 25;
|
||||
|
||||
|
@ -2951,6 +3087,7 @@ if (debug_output_flag == 1)
|
|||
setprop(lw~"tmp/tile-alt-offset-ft",alt_20);
|
||||
setprop(lw~"tmp/tile-alt-median-ft",alt_med);
|
||||
setprop(lw~"tmp/tile-alt-min-ft",alt_min);
|
||||
setprop(lw~"tmp/tile-alt-mean-ft",alt_mean);
|
||||
setprop(lw~"tmp/tile-alt-layered-ft",0.5 * (alt_min + alt_20));
|
||||
|
||||
append(alt_50_array, alt_med);
|
||||
|
@ -2965,6 +3102,8 @@ append(alt_20_array, alt_20);
|
|||
|
||||
var wave_detection_loop = func (blat, blon, nx, alpha) {
|
||||
|
||||
if (local_weather_running_flag == 0) {return;}
|
||||
|
||||
var phi = alpha * math.pi/180.0;
|
||||
var elevation = 0.0;
|
||||
var ny = 20;
|
||||
|
@ -3208,6 +3347,27 @@ append(weatherStationArray,s);
|
|||
}
|
||||
|
||||
|
||||
###########################################################
|
||||
# set an atmosphere condition point for interpolation
|
||||
###########################################################
|
||||
|
||||
var set_atmosphere_ipoint = func (lat, lon, vis_aloft, vis_alt1, vis_ovcst, ovcst,ovcst_alt_low, ovcst_alt_high, scatt, scatt_alt_low, scatt_alt_high) {
|
||||
|
||||
var a = atmosphereIpoint.new (lat, lon, vis_aloft, vis_alt1, vis_ovcst, ovcst, ovcst_alt_low, ovcst_alt_high, scatt, scatt_alt_low, scatt_alt_high);
|
||||
a.index = getprop(lw~"tiles/tile-counter");
|
||||
a.weight = 0.02;
|
||||
|
||||
# set a timestamp if needed
|
||||
|
||||
if (dynamics_flag == 1)
|
||||
{
|
||||
a.timestamp = weather_dynamics.time_lw;
|
||||
}
|
||||
append(atmosphereIpointArray,a);
|
||||
|
||||
}
|
||||
|
||||
|
||||
###########################################################
|
||||
# set a wind interpolation point
|
||||
###########################################################
|
||||
|
@ -3516,12 +3676,15 @@ var set_tile = func {
|
|||
|
||||
# check if another instance of local weather is running already
|
||||
|
||||
|
||||
if (local_weather_running_flag == 1)
|
||||
{
|
||||
setprop("/sim/messages/pilot", "Local weather: Local weather is already running, use Clear/End before restarting. Aborting...");
|
||||
return;
|
||||
}
|
||||
|
||||
local_weather_startup_flag = 1;
|
||||
|
||||
|
||||
var type = getprop("/local-weather/tmp/tile-type");
|
||||
|
||||
|
@ -3577,6 +3740,11 @@ if ((presampling_flag == 1) and (getprop(lw~"tmp/presampling-status") == "idle")
|
|||
}
|
||||
|
||||
|
||||
# indicate that we're up and running
|
||||
|
||||
local_weather_startup_flag = 0;
|
||||
local_weather_running_flag = 1;
|
||||
|
||||
# see if we use METAR for weather setup
|
||||
|
||||
if ((getprop("/environment/metar/valid") == 1) and (getprop(lw~"tmp/tile-management") == "METAR"))
|
||||
|
@ -3819,9 +3987,7 @@ if (getprop(lw~"config/buffer-flag") ==1)
|
|||
}
|
||||
}
|
||||
|
||||
# and indicate that we're up and running
|
||||
|
||||
local_weather_running_flag = 1;
|
||||
|
||||
# weather_tile_management.watchdog_loop();
|
||||
|
||||
|
@ -3929,13 +4095,16 @@ var test = func {
|
|||
var lat = getprop("position/latitude-deg");
|
||||
var lon = getprop("position/longitude-deg");
|
||||
|
||||
var pos = geo.aircraft_position();
|
||||
#var pos = geo.aircraft_position();
|
||||
|
||||
debug.dump(geodinfo(lat, lon));
|
||||
|
||||
setprop("/environment/terrain/area[0]/input/latitude-deg", lat );
|
||||
setprop("/environment/terrain/area[0]/input/longitude-deg", lon );
|
||||
# geo.put_model("Models/Astro/Earth.ac",lat, lon);
|
||||
|
||||
setprop("/environment/terrain/area[0]/output/valid", 0 );
|
||||
#setprop("/environment/terrain/area[0]/input/latitude-deg", lat );
|
||||
#setprop("/environment/terrain/area[0]/input/longitude-deg", lon );
|
||||
|
||||
#setprop("/environment/terrain/area[0]/output/valid", 0 );
|
||||
|
||||
}
|
||||
|
||||
|
@ -3957,6 +4126,7 @@ var weatherStation = {
|
|||
s.T = T;
|
||||
s.D = D;
|
||||
s.p = p;
|
||||
s.scattering = 0.8;
|
||||
return s;
|
||||
},
|
||||
move: func {
|
||||
|
@ -3969,6 +4139,32 @@ var weatherStation = {
|
|||
};
|
||||
|
||||
|
||||
var atmosphereIpoint = {
|
||||
new: func (lat, lon, vis_aloft, vis_alt1, vis_ovcst, ovcst, ovcst_alt_low, ovcst_alt_high, scatt, scatt_alt_low, scatt_alt_high){
|
||||
var a = { parents: [atmosphereIpoint] };
|
||||
a.lat = lat;
|
||||
a.lon = lon;
|
||||
a.vis_aloft = vis_aloft;
|
||||
a.vis_alt1 = vis_alt1;
|
||||
a.vis_ovcst = vis_ovcst;
|
||||
a.ovcst = ovcst;
|
||||
a.ovcst_alt_low = ovcst_alt_low;
|
||||
a.ovcst_alt_high = ovcst_alt_high;
|
||||
a.scatt = scatt;
|
||||
a.scatt_alt_low = scatt_alt_low;
|
||||
a.scatt_alt_high = scatt_alt_high;
|
||||
return a;
|
||||
},
|
||||
move: func {
|
||||
var windfield = weather_dynamics.get_windfield(me.index);
|
||||
var dt = weather_dynamics.time_lw - me.timestamp;
|
||||
me.lat = me.lat + windfield[1] * dt * local_weather.m_to_lat;
|
||||
me.lon = me.lon + windfield[0] * dt * local_weather.m_to_lon;
|
||||
me.timestamp = weather_dynamics.time_lw;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
var windIpoint = {
|
||||
new: func (lat, lon, d0, v0, d1, v1, d2, v2, d3, v3, d4, v4, d5, v5, d6, v6, d7, v7, d8, v8) {
|
||||
var w = { parents: [windIpoint] };
|
||||
|
@ -4175,7 +4371,7 @@ var ec = "/environment/config/";
|
|||
|
||||
# a hash map of the strength for convection associated with terrain types
|
||||
|
||||
var landcover_map = {BuiltUpCover: 0.35, Town: 0.35, Freeway:0.35, BarrenCover:0.3, HerbTundraCover: 0.25, GrassCover: 0.2, CropGrassCover: 0.2, EvergreenBroadCover: 0.2, EvergreenNeedleCover: 0.2, Sand: 0.25, Grass: 0.2, Ocean: 0.01, Marsh: 0.05, Lake: 0.01, ShrubCover: 0.15, Landmass: 0.2, CropWoodCover: 0.15, MixedForestCover: 0.1, DryCropPastureCover: 0.25, MixedCropPastureCover: 0.2, IrrCropPastureCover: 0.15, DeciduousBroadCover: 0.1, DeciduousNeedleCover: 0.1, Bog: 0.05, pa_taxiway : 0.35, pa_tiedown: 0.35, pc_taxiway: 0.35, pc_tiedown: 0.35, Glacier: 0.01, DryLake: 0.3, IntermittentStream: 0.2};
|
||||
var landcover_map = {BuiltUpCover: 0.35, Town: 0.35, Freeway:0.35, BarrenCover:0.3, HerbTundraCover: 0.25, GrassCover: 0.2, CropGrassCover: 0.2, EvergreenBroadCover: 0.2, EvergreenNeedleCover: 0.2, Sand: 0.25, Grass: 0.2, Ocean: 0.01, Marsh: 0.05, Lake: 0.01, ShrubCover: 0.15, Landmass: 0.2, CropWoodCover: 0.15, MixedForestCover: 0.1, DryCropPastureCover: 0.25, MixedCropPastureCover: 0.2, IrrCropPastureCover: 0.15, DeciduousBroadCover: 0.1, DeciduousNeedleCover: 0.1, Bog: 0.05, pa_taxiway : 0.35, pa_tiedown: 0.35, pc_taxiway: 0.35, pc_tiedown: 0.35, Glacier: 0.01, DryLake: 0.3, IntermittentStream: 0.2, DryCrop: 0.2, Lava: 0.3};
|
||||
|
||||
# a hash map of average vertical cloud model sizes
|
||||
|
||||
|
@ -4218,10 +4414,11 @@ var thermal = {};
|
|||
var wave = {};
|
||||
|
||||
|
||||
# arrays of currently existing weather stations and wind interpolation points
|
||||
# arrays of currently existing weather stations, wind interpolation and atmospheric condition points
|
||||
|
||||
var weatherStationArray = [];
|
||||
var windIpointArray = [];
|
||||
var atmosphereIpointArray = [];
|
||||
|
||||
|
||||
# a flag for the wind model (so we don't have to do string comparisons all the time)
|
||||
|
@ -4256,7 +4453,9 @@ var dynamical_convection_flag = 1;
|
|||
var debug_output_flag = 1;
|
||||
var metar_flag = 0;
|
||||
var local_weather_running_flag = 0;
|
||||
var fps_control_flag = 1;
|
||||
var local_weather_startup_flag = 0;
|
||||
var fps_control_flag = 0;
|
||||
var detailed_terrain_interaction_flag = 1;
|
||||
|
||||
# globals for framerate controlled cloud management
|
||||
|
||||
|
|
|
@ -63,6 +63,8 @@ return windfield;
|
|||
|
||||
var timing_loop = func {
|
||||
|
||||
if (local_weather.local_weather_running_flag == 0) {return;}
|
||||
|
||||
dt_lw = getprop("/sim/time/delta-sec");
|
||||
time_lw = time_lw + dt_lw;
|
||||
|
||||
|
@ -79,6 +81,7 @@ if (getprop(lw~"timing-loop-flag") ==1) {settimer(timing_loop, 0);}
|
|||
|
||||
var quadtree_loop = func {
|
||||
|
||||
if (local_weather.local_weather_running_flag == 0) {return;}
|
||||
|
||||
var vangle = 0.55 * getprop("/sim/current-view/field-of-view");
|
||||
var viewdir = getprop("/sim/current-view/goal-heading-offset-deg");
|
||||
|
@ -161,6 +164,8 @@ if (getprop(lw~"dynamics-loop-flag") ==1) {settimer(quadtree_loop, 0);}
|
|||
|
||||
var weather_dynamics_loop = func (index, cindex) {
|
||||
|
||||
if (local_weather.local_weather_running_flag == 0) {return;}
|
||||
|
||||
var n = 20;
|
||||
var nc = 1;
|
||||
|
||||
|
@ -241,11 +246,16 @@ if (j >= csize) {cindex = 0;}
|
|||
|
||||
|
||||
|
||||
foreach (s; local_weather.weatherStationArray)
|
||||
foreach (var s; local_weather.weatherStationArray)
|
||||
{
|
||||
s.move();
|
||||
}
|
||||
|
||||
foreach (var a; local_weather.atmosphereIpointArray)
|
||||
{
|
||||
a.move();
|
||||
}
|
||||
|
||||
if (getprop(lw~"dynamics-loop-flag") ==1) {settimer( func {weather_dynamics_loop(index, cindex); },0);}
|
||||
|
||||
}
|
||||
|
@ -257,6 +267,8 @@ if (getprop(lw~"dynamics-loop-flag") ==1) {settimer( func {weather_dynamics_loop
|
|||
|
||||
var convective_loop = func {
|
||||
|
||||
if (local_weather.local_weather_running_flag == 0) {return;}
|
||||
|
||||
# a 30 second loop needs a different strategy to end, otherwise there is trouble if it is restarted while still running
|
||||
|
||||
if (convective_loop_kill_flag == 1)
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
|
||||
var tile_management_loop = func {
|
||||
|
||||
|
||||
if (local_weather.local_weather_running_flag == 0) {return;}
|
||||
|
||||
var tNode = props.globals.getNode(lw~"tiles", 1).getChildren("tile");
|
||||
var viewpos = geo.aircraft_position(); # using viewpos here triggers massive tile ops for tower view...
|
||||
var code = getprop(lw~"tiles/tile[4]/code");
|
||||
|
@ -1093,6 +1096,8 @@ setprop(lw~"tiles/tile[8]/orientation-deg",alpha);
|
|||
|
||||
var buffer_loop = func (index) {
|
||||
|
||||
if (local_weather.local_weather_running_flag == 0) {return;}
|
||||
|
||||
var n = 5;
|
||||
var n_max = size(cloudBufferArray);
|
||||
var s = size(active_tile_list);
|
||||
|
@ -1225,6 +1230,8 @@ if (getprop(lw~"buffer-loop-flag") ==1) {settimer( func {buffer_loop(i)}, 0);}
|
|||
|
||||
var housekeeping_loop = func (index) {
|
||||
|
||||
if (local_weather.local_weather_running_flag == 0) {return;}
|
||||
|
||||
var n = 5;
|
||||
var n_max = size(cloudSceneryArray);
|
||||
n_cloudSceneryArray = n_max;
|
||||
|
|
|
@ -108,9 +108,9 @@ local_weather.set_weather_station(blat, blon, alt_offset, 20000.0, 14.0, 12.0, 2
|
|||
|
||||
# create_2_8_cirrocumulus(blat, blon, 6000.0, 0.0);
|
||||
|
||||
create_detailed_small_stratocumulus_bank(blat, blon,3000.0+alt_offset,0.0);
|
||||
# create_detailed_small_stratocumulus_bank(blat, blon,3000.0+alt_offset,0.0);
|
||||
|
||||
#create_4_8_altocumulus_perlucidus(blat, blon, 10000.0, 0.0);
|
||||
create_4_8_altocumulus_perlucidus(blat, blon, 10000.0, 0.0);
|
||||
|
||||
#local_weather.create_effect_volume(3, blat, blon, 20000.0, 7000.0, alpha, 0.0, 80000.0, -1, -1, -1, -1, 15.0, -3,-1);
|
||||
|
||||
|
@ -118,6 +118,9 @@ create_1_8_contrails(blat, blon, 30000.0, 0.0);
|
|||
|
||||
# store convective altitude and strength
|
||||
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, 45000.0, 10000.0, 45000.0, 0.2, 25000.0, 30000.0, 0.7, 10000.0, 11000.0);
|
||||
|
||||
|
||||
append(weather_dynamics.tile_convective_altitude,3000.0);
|
||||
append(weather_dynamics.tile_convective_strength,0.0);
|
||||
|
||||
|
@ -164,6 +167,7 @@ var p = 1025.0 + rand() * 6.0; p = adjust_p(p);
|
|||
local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_inhg);
|
||||
|
||||
|
||||
|
||||
var alt = spread * 1000;
|
||||
var strength = 0.0;
|
||||
|
||||
|
@ -192,7 +196,9 @@ if (rn > 0.8)
|
|||
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
|
||||
local_weather.generate_thermal_lift_flag = 2;
|
||||
}
|
||||
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, 25000.0, 30000.0, 0.9, alt+alt_offset, alt+alt_offset + 1500.0);
|
||||
}
|
||||
else if (rn > 0.6)
|
||||
{
|
||||
|
@ -204,6 +210,9 @@ else if (rn > 0.6)
|
|||
create_2_8_cirrocumulus(blat, blon, alt + alt_offset + 5000.0, alpha);
|
||||
|
||||
create_2_8_cirrus(blat, blon, alt + alt_offset + 35000.0, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.1, alt+alt_offset +30000.0, alt+alt_offset + 35000.0, 0.9, alt+alt_offset, alt+alt_offset + 1500.0);
|
||||
}
|
||||
else if (rn > 0.4)
|
||||
{
|
||||
|
@ -213,6 +222,10 @@ else if (rn > 0.4)
|
|||
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
|
||||
|
||||
create_4_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 32000.0, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.15, alt+alt_offset +28000.0, alt+alt_offset + 32000.0, 0.9, alt+alt_offset, alt+alt_offset + 1500.0);
|
||||
|
||||
}
|
||||
else if (rn > 0.2)
|
||||
{
|
||||
|
@ -222,6 +235,9 @@ else if (rn > 0.2)
|
|||
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
|
||||
|
||||
create_1_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 32000.0, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.15, alt+alt_offset +28000.0, alt+alt_offset + 32000.0, 0.9, alt+alt_offset, alt+alt_offset + 1500.0);
|
||||
}
|
||||
else if (rn > 0.0)
|
||||
{
|
||||
|
@ -234,6 +250,9 @@ else if (rn > 0.0)
|
|||
|
||||
|
||||
create_1_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 28000.0, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +28000.0, alt+alt_offset + 33000.0, 0.9, alt+alt_offset, alt+alt_offset + 1500.0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -320,6 +339,9 @@ if (rn > 0.8)
|
|||
compat_layer.create_cloud(path, blat + get_lat(x,y,phi), blon+get_lon(x,y,phi), alt + alt_offset +25000.0 + rand() * 5000.0,alpha);
|
||||
}
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +28000.0, alt+alt_offset + 30000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.0);
|
||||
|
||||
}
|
||||
else if (rn > 0.6)
|
||||
{
|
||||
|
@ -329,6 +351,9 @@ else if (rn > 0.6)
|
|||
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
|
||||
|
||||
create_2_8_cirrostratus(blat, blon, alt+alt_offset+25000.0, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.2, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.0);
|
||||
}
|
||||
|
||||
else if (rn > 0.4)
|
||||
|
@ -345,6 +370,10 @@ else if (rn > 0.4)
|
|||
var path = local_weather.select_cloud_model("Cirrocumulus", "large");
|
||||
compat_layer.create_cloud(path, blat + get_lat(x,y,phi), blon+get_lon(x,y,phi), alt + alt_offset +24000,alpha);
|
||||
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 24000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.0);
|
||||
|
||||
}
|
||||
else if (rn > 0.2)
|
||||
{
|
||||
|
@ -354,6 +383,9 @@ else if (rn > 0.2)
|
|||
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
|
||||
|
||||
create_4_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 25000.0, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.15, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.0);
|
||||
}
|
||||
else if (rn > 0.0)
|
||||
{
|
||||
|
@ -365,6 +397,9 @@ else if (rn > 0.0)
|
|||
create_1_8_altocumulus_scattered(blat, blon, alt+alt_offset+10000.0, alpha);
|
||||
|
||||
create_1_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 25000.0, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.0);
|
||||
}
|
||||
|
||||
# store convective altitude and strength
|
||||
|
@ -437,6 +472,10 @@ if (rn > 0.875)
|
|||
y = 2.0 * (rand()-0.5) * 5000;
|
||||
local_weather.create_streak("Altocumulus",blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 12000.0+alt+alt_offset,1500.0,30,1000.0,0.2,1200.0,30,1000.0,0.2,1200.0,alpha ,1.0);
|
||||
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.0);
|
||||
|
||||
}
|
||||
else if (rn > 0.750)
|
||||
{
|
||||
|
@ -451,6 +490,9 @@ else if (rn > 0.750)
|
|||
y = 2.0 * (rand()-0.5) * 10000;
|
||||
local_weather.create_streak("Altocumulus",blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 12000.0+alt+alt_offset,1500.0,22,750.0,0.2,1000.0,8,750.0,0.2,1000.0,alpha ,1.1);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
}
|
||||
else if (rn > 0.625)
|
||||
{
|
||||
|
@ -463,6 +505,9 @@ else if (rn > 0.625)
|
|||
y = 2.0 * (rand()-0.5) * 3000;
|
||||
local_weather.create_streak("Cirrus",blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 22000.0+alt+alt_offset,1500.0,3,9000.0,0.0, 800.0, 1,8000.0,0.0,800,0,alpha ,1.0);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 22000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
}
|
||||
else if (rn > 0.5)
|
||||
{
|
||||
|
@ -478,6 +523,10 @@ else if (rn > 0.5)
|
|||
|
||||
create_cloud_bank("Cumulonimbus", blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), alt+alt_offset, 1600.0, 800.0, 3000.0, 9, alpha);
|
||||
}
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
}
|
||||
else if (rn > 0.375)
|
||||
{
|
||||
|
@ -490,6 +539,9 @@ else if (rn > 0.375)
|
|||
|
||||
local_weather.create_streak("Stratus (structured)",blat, blon, alt+6000.0+alt_offset+size_offset,1000.0,18,0.0,0.3,20000.0,18,0.0,0.3,20000.0,0.0,1.0);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.2, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
}
|
||||
else if (rn > 0.250)
|
||||
{
|
||||
|
@ -510,6 +562,9 @@ else if (rn > 0.250)
|
|||
var path = local_weather.select_cloud_model("Cirrocumulus", "large");
|
||||
compat_layer.create_cloud(path, blat + get_lat(x,y,phi), blon+get_lon(x,y,phi), alt + alt_offset +20000+ alt_variation,alpha+ beta);
|
||||
}
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
else if (rn > 0.125)
|
||||
{
|
||||
|
@ -520,6 +575,9 @@ else if (rn > 0.125)
|
|||
|
||||
create_4_8_cirrocumulus_streaks(blat, blon, alt + 6000.0 + alt_offset, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.05, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
}
|
||||
else if (rn > 0.0)
|
||||
{
|
||||
|
@ -528,6 +586,10 @@ else if (rn > 0.0)
|
|||
create_4_8_altocumulus_perlucidus(blat, blon, alt + 10000.0 + alt_offset, alpha);
|
||||
|
||||
create_2_8_cirrus(blat, blon, alt + 30000.0 + alt_offset, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.25, alt+alt_offset +26000.0, alt+alt_offset + 30000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -605,6 +667,10 @@ if (rn > 0.857)
|
|||
create_detailed_stratocumulus_bank(blat, blon, alt+alt_offset,alpha);
|
||||
|
||||
create_4_8_alttstratus_streaks(blat, blon, alt+alt_offset+4000.0,alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
}
|
||||
else if (rn > 0.714)
|
||||
{
|
||||
|
@ -616,6 +682,9 @@ else if (rn > 0.714)
|
|||
create_6_8_tstratus_undulatus(blat, blon, alt+alt_offset+4000.0,alpha);
|
||||
|
||||
create_2_8_alttstratus(blat, blon, alt+alt_offset+7000.0,alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
else if (rn > 0.571)
|
||||
{
|
||||
|
@ -625,6 +694,9 @@ else if (rn > 0.571)
|
|||
create_detailed_small_stratocumulus_bank(blat, blon, alt+alt_offset,alpha);
|
||||
|
||||
create_4_8_alttstratus_patches(blat, blon, alt+alt_offset+4000.0,alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.7, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
else if (rn > 0.428)
|
||||
{
|
||||
|
@ -634,6 +706,8 @@ else if (rn > 0.428)
|
|||
create_4_8_sstratus_patches(blat, blon, alt+alt_offset,alpha);
|
||||
|
||||
create_2_8_alttstratus(blat, blon, alt+alt_offset+7000.0,alpha);
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.25, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.7, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
else if (rn > 0.285)
|
||||
{
|
||||
|
@ -645,6 +719,9 @@ else if (rn > 0.285)
|
|||
create_4_8_tstratus_patches(blat, blon, alt+alt_offset,alpha);
|
||||
|
||||
create_4_8_cirrocumulus_undulatus(blat, blon, alt+alt_offset + 12000.0,alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.15, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
else if (rn > 0.142)
|
||||
{
|
||||
|
@ -656,6 +733,9 @@ else if (rn > 0.142)
|
|||
create_4_8_tstratus_patches(blat, blon, alt+alt_offset,alpha);
|
||||
|
||||
create_2_8_cirrostratus(blat, blon, alt+alt_offset + 25000.0,alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.3, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -665,6 +745,9 @@ else
|
|||
create_4_8_sstratus_patches(blat, blon, alt+alt_offset,alpha);
|
||||
|
||||
create_2_8_cirrostratus(blat, blon, alt+alt_offset + 25000.0,alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.2, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -710,9 +793,9 @@ calc_geo(blat);
|
|||
|
||||
# get probabilistic values for the weather parameters
|
||||
|
||||
var vis = 8000.0 + rand() * 8000.0;
|
||||
var vis = 7000.0 + rand() * 7000.0;
|
||||
var T = 5.0 + rand() * 10.0;
|
||||
var spread = 1.0 + 2.0 * rand();
|
||||
var spread = 1.5 + 2.5 * rand();
|
||||
var D = T - spread;
|
||||
var p = 1001.0 + rand() * 6.0; p = adjust_p(p);
|
||||
|
||||
|
@ -757,6 +840,9 @@ if (rn > 0.75)
|
|||
|
||||
create_4_8_sstratus_undulatus(blat, blon, alt+alt_offset +3000.0, alpha);
|
||||
create_2_8_tstratus(blat, blon, alt+alt_offset +6000.0, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 17000.0, alt+alt_offset, vis + 22000.0, 0.2, alt+alt_offset +15000.0, alt+alt_offset + 20000.0, 0.7, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
else if (rn >0.5)
|
||||
{
|
||||
|
@ -769,6 +855,10 @@ else if (rn >0.5)
|
|||
local_weather.create_effect_volume(3, blat, blon, 18000.0, 18000.0, 0.0, 0.0, 1800.0, 8000.0, -1, -1, -1, -1, 0,-1);
|
||||
local_weather.create_effect_volume(3, blat, blon, 14000.0, 14000.0, 0.0, 0.0, 1500.0, 6000.0, 0.1, -1, -1, -1,0,-1 );
|
||||
create_2_8_sstratus(blat, blon, alt+alt_offset+3000,alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 17000.0, alt+alt_offset, vis + 25000.0, 0.3, alt+alt_offset +15000.0, alt+alt_offset + 20000.0, 0.6, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
}
|
||||
else if (rn >0.25)
|
||||
{
|
||||
|
@ -780,6 +870,9 @@ else if (rn >0.25)
|
|||
create_4_8_stratus_patches(blat, blon, alt+alt_offset+3000,alpha);
|
||||
create_4_8_sstratus_undulatus(blat, blon, alt+alt_offset+6000,alpha);
|
||||
create_2_8_tstratus(blat, blon, alt+alt_offset+8000,alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 17000.0, alt+alt_offset, vis + 25000.0, 0.35, alt+alt_offset +10000.0, alt+alt_offset + 20000.0, 0.65, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
else if (rn >0.0)
|
||||
{
|
||||
|
@ -789,6 +882,9 @@ else if (rn >0.0)
|
|||
alt = alt + local_weather.cloud_vertical_size_map["Stratus"] * 0.5 * m_to_ft;
|
||||
create_6_8_stratus(blat, blon, alt+alt_offset,alpha);
|
||||
create_2_8_sstratus(blat, blon, alt+alt_offset+6000,alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 15000.0, alt+alt_offset, vis + 24000.0, 0.2, alt+alt_offset +15000.0, alt+alt_offset + 22000.0, 0.6, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
|
||||
# store convective altitude and strength
|
||||
|
@ -834,7 +930,7 @@ calc_geo(blat);
|
|||
|
||||
var vis = 5000.0 + rand() * 5000.0;
|
||||
var T = 3.0 + rand() * 7.0;
|
||||
var spread = 1.0 + 1.0 * rand();
|
||||
var spread = 1.5 + 1.5 * rand();
|
||||
var D = T - spread;
|
||||
var p = 995.0 + rand() * 6.0; p = adjust_p(p);
|
||||
|
||||
|
@ -868,6 +964,9 @@ else
|
|||
if (rn > 0.5){create_4_8_stratus_patches(blat, blon, alt+alt_offset+3000.0, alpha);}
|
||||
else {create_4_8_stratus(blat, blon, alt+alt_offset+3000.0, alpha);}
|
||||
|
||||
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 20000.0, alt+alt_offset, vis + 25000.0, 0.0, alt+alt_offset +15000.0, alt+alt_offset + 22000.0, 0.6, alt+alt_offset, alt+alt_offset + 3000.0);
|
||||
|
||||
# store convective altitude and strength
|
||||
|
||||
append(weather_dynamics.tile_convective_altitude,alt);
|
||||
|
@ -932,6 +1031,9 @@ if (rn > 0.5)
|
|||
# cloud scenario 1: strong Cumulus development
|
||||
strength = 0.8 + rand() * 0.2;
|
||||
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 8000.0, alt+alt_offset, vis + 18000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
|
||||
else if (rn > 0.0)
|
||||
|
@ -953,6 +1055,9 @@ else if (rn > 0.0)
|
|||
compat_layer.create_cloud(path, blat + get_lat(x,y,phi), blon+get_lon(x,y,phi), alt + alt_offset +20000+ alt_variation,alpha+ beta);
|
||||
}
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 8000.0, alt+alt_offset, vis + 18000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
}
|
||||
|
||||
#local_weather.create_effect_volume(3, blat, blon, 20000.0, 7000.0, alpha, 0.0, 80000.0, -1, -1, -1, -1, 15.0, -3,-1);
|
||||
|
@ -994,7 +1099,7 @@ calc_geo(blat);
|
|||
|
||||
# get probabilistic values for the weather parameters
|
||||
|
||||
var vis = 10000.0 + rand() * 8000.0;
|
||||
var vis = 12000.0 + rand() * 10000.0;
|
||||
var T = 16.0 + rand() * 10.0;
|
||||
var spread = 2.0 + 2.0 * rand();
|
||||
var D = T - spread;
|
||||
|
@ -1020,6 +1125,9 @@ if (rn > 0.8)
|
|||
strength = 0.3 + rand() * 0.2;
|
||||
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
|
||||
create_4_8_cirrostratus_patches(blat, blon, alt+alt_offset+25000.0, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 1000.0, alt+alt_offset, vis + 3000.0, 0.3, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
else if (rn > 0.6)
|
||||
{
|
||||
|
@ -1031,6 +1139,9 @@ else if (rn > 0.6)
|
|||
|
||||
create_2_8_sstratus_streak(blat, blon, alt+alt_offset + size_offset + 2000.0, alpha);
|
||||
create_2_8_sstratus_streak(blat, blon, alt+alt_offset + size_offset + 4000.0, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 1000.0, alt+alt_offset, vis + 3000.0, 0.2, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
else if (rn > 0.4)
|
||||
{
|
||||
|
@ -1042,6 +1153,8 @@ else if (rn > 0.4)
|
|||
|
||||
create_4_8_cirrocumulus_bank(blat, blon, alt+alt_offset + size_offset + 7000.0, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 1000.0, alt+alt_offset, vis + 3000.0, 0.35, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
else if (rn > 0.2)
|
||||
{
|
||||
|
@ -1052,6 +1165,9 @@ else if (rn > 0.2)
|
|||
var size_offset = 0.5 * m_to_ft * local_weather.cloud_vertical_size_map["Cirrocumulus"];
|
||||
|
||||
create_4_8_cirrocumulus_undulatus(blat, blon, alt+alt_offset + size_offset + 6000.0, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 1000.0, alt+alt_offset, vis + 3000.0, 0.2, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.72, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
|
||||
else if (rn > 0.0)
|
||||
|
@ -1065,6 +1181,9 @@ else if (rn > 0.0)
|
|||
|
||||
local_weather.create_streak("Stratus (structured)",blat, blon, alt+4000.0+alt_offset+size_offset,1000.0,14,0.0,0.3,20000.0,14,0.0,0.3,20000.0,0.0,1.0);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 2000.0, alt+alt_offset, vis + 4000.0, 0.15, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.73, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
}
|
||||
|
||||
# store convective altitude and strength
|
||||
|
@ -1112,7 +1231,7 @@ calc_geo(blat);
|
|||
|
||||
# get probabilistic values for the weather parameters
|
||||
|
||||
var vis = 10000.0 + rand() * 10000.0;
|
||||
var vis = 9000.0 + rand() * 10000.0;
|
||||
var T = 20.0 + rand() * 15.0;
|
||||
var spread = 3.0 + 2.0 * rand();
|
||||
var D = T - spread;
|
||||
|
@ -1137,6 +1256,9 @@ if (rn > (t_factor * t_factor * t_factor * t_factor)) # call a normal convective
|
|||
{
|
||||
strength = 1.0 + rand() * 0.2;
|
||||
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 15000.0, alt+alt_offset, vis + 20000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.7, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -1172,6 +1294,9 @@ if (rn > 0.2)
|
|||
else
|
||||
{create_small_thunderstorm(blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), alt+alt_offset, alpha);}
|
||||
}
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 12000.0, alt+alt_offset, vis + 20000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.65, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
else if (rn > 0.0)
|
||||
{
|
||||
|
@ -1181,6 +1306,9 @@ else if (rn > 0.0)
|
|||
y = 2.0 * (rand()-0.5) * 12000;
|
||||
|
||||
create_big_thunderstorm(blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), alt+alt_offset, alpha);
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 12000.0, alt+alt_offset, vis + 20000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.65, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1324,6 +1452,9 @@ local_weather.create_effect_volume(3, blat+get_lat(x,y,phi), blon+get_lon(x,y,ph
|
|||
x=0.0; y = 5000.0;
|
||||
local_weather.create_effect_volume(3, blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 20000.0, 8000.0, alpha, 0.0, alt+alt_offset, 10000.0, 0.1, -1, -1, -1,0,-1 );
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 20000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.6, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
# store convective altitude and strength
|
||||
|
||||
append(weather_dynamics.tile_convective_altitude,alt);
|
||||
|
@ -1421,6 +1552,9 @@ for (var i=0; i<6; i=i+1)
|
|||
|
||||
}
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 8000.0, alt+alt_offset, vis + 10000.0, rand() * 0.1, alt+alt_offset +18000.0, alt+alt_offset + 22000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
# store convective altitude and strength
|
||||
|
||||
append(weather_dynamics.tile_convective_altitude,alt);
|
||||
|
@ -1534,6 +1668,10 @@ var y = 8000.0;
|
|||
|
||||
local_weather.create_streak("Stratus",blat +get_lat(x,y,phi), blon+get_lon(x,y,phi), alt+alt_offset +5000.0,1000.0,30,0.0,0.2,20000.0,10,0.0,0.2,12000.0,alpha,1.0);
|
||||
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 6000.0, alt+alt_offset, vis + 8000.0, 0.15 + rand() * 0.15, alt+alt_offset +17000.0, alt+alt_offset + 21000.0, 0.7, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
# store convective altitude and strength
|
||||
|
||||
append(weather_dynamics.tile_convective_altitude,alt);
|
||||
|
@ -1637,6 +1775,10 @@ x=0.0; y = 10000.0;
|
|||
local_weather.create_effect_volume(3, blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 20000.0, 10000.0, alpha, 0.0, alt+alt_offset, vis * 0.5, 0.3, -1, -1, -1,0,-1 );
|
||||
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 6000.0, alt+alt_offset, vis + 8000.0, 0.05 + rand() * 0.05, alt+alt_offset +16000.0, alt+alt_offset + 20000.0, 0.6, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
|
||||
# store convective altitude and strength
|
||||
|
||||
append(weather_dynamics.tile_convective_altitude,alt);
|
||||
|
@ -1736,6 +1878,9 @@ x=0.0; y = -5000.0;
|
|||
local_weather.create_effect_volume(3, blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 20000.0, 15000.0, alpha, 0.0, alt+alt_offset, vis * 0.5, 0.3, -1, -1, -1,0 ,-1);
|
||||
|
||||
|
||||
# and specify the atmosphere
|
||||
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 12000.0, 0.1, alt+alt_offset +16000.0, alt+alt_offset + 20000.0, 0.5, alt+alt_offset, alt+alt_offset + 2500.0);
|
||||
|
||||
# store convective altitude and strength
|
||||
|
||||
append(weather_dynamics.tile_convective_altitude,alt);
|
||||
|
@ -2205,6 +2350,68 @@ var set_METAR_weather_station = func {
|
|||
local_weather.set_weather_station(station_lat, station_lon, metar_alt_offset, vis, T, D, p);
|
||||
|
||||
|
||||
# get cloud layer info for lighting
|
||||
|
||||
var coverage1 = 8 - 2 * getprop("/environment/metar/clouds/layer[0]/coverage-type");
|
||||
var layer_alt1 = getprop("/environment/metar/clouds/layer[0]/elevation-ft");
|
||||
|
||||
var coverage2 = 8 - 2 * getprop("/environment/metar/clouds/layer[1]/coverage-type");
|
||||
var layer_alt2 = getprop("/environment/metar/clouds/layer[1]/elevation-ft");
|
||||
|
||||
var coverage3 = 8 - 2 * getprop("/environment/metar/clouds/layer[2]/coverage-type");
|
||||
var layer_alt3 = getprop("/environment/metar/clouds/layer[2]/elevation-ft");
|
||||
|
||||
var coverage4 = 8 - 2 * getprop("/environment/metar/clouds/layer[3]/coverage-type");
|
||||
var layer_alt4 = getprop("/environment/metar/clouds/layer[3]/elevation-ft");
|
||||
|
||||
|
||||
# determine the altitude of the main shading layer
|
||||
|
||||
# default assumption - the lowest layer shades
|
||||
var alt_shade = layer_alt1; var coverage_shade = coverage1; var coverage_mult = 1.0;
|
||||
|
||||
# if a higher layer is more opaque, it determines the shading unless it is a thin layer
|
||||
if ((coverage2 >= coverage1) and (layer_alt2 < 14000.0))
|
||||
{alt_shade = layer_alt2; coverage_shade = coverage2; coverage_mult = 0.9;}
|
||||
|
||||
if ((coverage3 >= coverage1) and (coverage3 >= coverage2) and (layer_alt3 < 14000.0))
|
||||
{alt_shade = layer_alt3; coverage_shade = coverage3; coverage_mult = 0.8;}
|
||||
|
||||
# determine the amount of shading
|
||||
|
||||
# default assumption: no clouds
|
||||
var shade = 1.0;
|
||||
|
||||
if (coverage_shade < 1) # clear sky, we need to specify an altitude for the model
|
||||
{shade = 0.9; alt_shade = 9000.0;}
|
||||
else if (coverage_shade < 3)
|
||||
{shade = 0.8;}
|
||||
else if (coverage_shade < 5)
|
||||
{shade = 0.7;}
|
||||
else if (coverage_shade < 8)
|
||||
{shade = 0.6;}
|
||||
else if (coverage_shade == 8)
|
||||
{shade = 0.55;}
|
||||
|
||||
shade = shade * coverage_mult;
|
||||
|
||||
# see if we have any high-altitude clouds
|
||||
|
||||
var ovcst = 0.0; var ovcst_alt = 20000.0;
|
||||
|
||||
if (layer_alt1 > 20000.0)
|
||||
{ovcst_alt = layer_alt1; ovcst = ovcst + rand() * 0.1;}
|
||||
if (layer_alt2 > 20000.0)
|
||||
{ovcst_alt = layer_alt2; ovcst = ovcst + rand() * 0.1;}
|
||||
if (layer_alt3 > 20000.0)
|
||||
{ovcst_alt = layer_alt3; ovcst = ovcst + rand() * 0.1;}
|
||||
if (layer_alt4 > 20000.0)
|
||||
{ovcst_alt = layer_alt4; ovcst = ovcst + rand() * 0.1;}
|
||||
|
||||
|
||||
# and specify the atmosphere - currently default only
|
||||
local_weather.set_atmosphere_ipoint(station_lat, station_lon, vis + 10000.0, metar_alt_offset + alt_shade, vis + 20000.0, ovcst, ovcst_alt+metar_alt_offset - 5000.0, ovcst_alt+metar_alt_offset, shade, layer_alt1+metar_alt_offset, alt_shade+metar_alt_offset + 2500.0);
|
||||
|
||||
# if we use aloft interpolated winds with METAR, also set a new wind interpolation point
|
||||
|
||||
if ((local_weather.wind_model_flag == 5) and (getprop(lw~"tiles/tile-counter") !=1))
|
||||
|
@ -2346,12 +2553,12 @@ else
|
|||
if (rain > 0.1)
|
||||
{
|
||||
local_weather.create_effect_volume(3, lat, lon, 20000.0, 20000.0, alpha, 0.0, alt+900.0, 500.0 + (1.0 - 0.5 * rain) * 5500.0, 0.5 * rain , -1, -1, -1,0 ,0.95);
|
||||
local_weather.create_effect_volume(3, lat , lon, 16000.0, 16000.0, alpha, 0.0, alt - 300.0, 500.0 + (1.0-rain) * 5500.0, rain, -1, -1, -1,0 ,0.8);
|
||||
local_weather.create_effect_volume(3, lat , lon, 16000.0, 16000.0, alpha, 0.0, alt - 300.0, 500.0 + (1.0-rain) * 5500.0, rain, -1, -1, -1,0 ,0.9);
|
||||
}
|
||||
else
|
||||
{
|
||||
local_weather.create_effect_volume(3, lat, lon, 20000.0, 20000.0, alpha, alt-1500.0, alt+900.0, 2000.0, -1 , -1, -1, -1,0 ,-1);
|
||||
local_weather.create_effect_volume(3, lat, lon, 20000.0, 20000.0, alpha, 0.0, alt, -1, rain , -1, -1, -1,0 ,0.8);
|
||||
local_weather.create_effect_volume(3, lat, lon, 20000.0, 20000.0, alpha, 0.0, alt, -1, rain , -1, -1, -1,0 ,0.9);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue