1
0
Fork 0

Advanced Weather v1.5

This commit is contained in:
Flightgear Development 2012-06-11 11:47:00 +03:00 committed by Frederic Bouvier
parent 23536748f7
commit 4df011cd63
7 changed files with 813 additions and 1646 deletions

File diff suppressed because it is too large Load diff

View file

@ -159,6 +159,85 @@ for (var i=0; i<ny; i=i+1)
}
###########################################################
# place a Cumulus alley pattern
###########################################################
var create_developing_cumulus_alleys = func (blat, blon, balt, alt_var, nx, xoffset, edgex, x_var, ny, yoffset, edgey, y_var, und_strength, direction, tri) {
var flag = 0;
var path = "Models/Weather/blank.ac";
local_weather.calc_geo(blat);
var dir = direction * math.pi/180.0;
var ymin = -0.5 * ny * yoffset;
var xmin = -0.5 * nx * xoffset;
var xinc = xoffset * (tri-1.0) /ny;
var jlow = int(nx*edgex);
var ilow = int(ny*edgey);
var und = 0.0;
var und_array = [];
var spacing = 0.0;
var spacing_array = [];
for (var i=0; i<ny; i=i+1)
{
und = und + 2.0 * (rand() -0.5) * und_strength;
append(und_array,und);
}
for (var i=0; i<nx; i=i+1)
{
spacing = spacing + 2.0 * (rand() -0.5) * 0.5 * xoffset;
append(spacing_array,spacing);
}
for (var i=0; i<ny; i=i+1)
{
var y = ymin + i * yoffset;
var xshift = 2.0 * (rand() -0.5) * 0.5 * xoffset;
x_var = 0.0; xshift = 0.0;
for (var j=0; j<nx; j=j+1)
{
var y0 = y + y_var * 2.0 * (rand() -0.5);
var x = xmin + j * (xoffset + i * xinc) + x_var * 2.0 * (rand() -0.5) + spacing_array[j] + und_array[i];
var lat = blat + m_to_lat * (y0 * math.cos(dir) - x * math.sin(dir));
var lon = blon + m_to_lon * (x * math.cos(dir) + y0 * math.sin(dir));
var alt = balt + alt_var * 2 * (rand() - 0.5);
flag = 0;
var strength = 0.0;
var rn = 6.0 * rand();
if (((j<jlow) or (j>(nx-jlow-1))) and ((i<ilow) or (i>(ny-ilow-1)))) # select a small or no cloud
{
if (rn > 2.0) {flag = 1;} else {strength = 0.1 + rand() * 0.5;}
}
if ((j<jlow) or (j>(nx-jlow-1)) or (i<ilow) or (i>(ny-ilow-1)))
{
if (rn > 5.0) {flag = 1;} else {strength = 0.4 + rand() * 0.5;}
}
else { # select a large cloud
if (rn > 5.0) {flag = 1;} else {strength = 0.6 + rand() * 0.6;}
}
if (flag==0){create_detailed_cumulus_cloud(lat, lon, alt, strength); }
}
}
}
###########################################################
# place a cloud layer
###########################################################
@ -241,3 +320,44 @@ if (local_weather.hardcoded_clouds_flag == 1) {balt = balt + local_weather.offse
} # end if (rainflag ==1)
}
###########################################################
# place a Cumulus layer with excluded regions
# to avoid placing cumulus underneath a thunderstorm
###########################################################
var cumulus_exclusion_layer = func (blat, blon, balt, n, size_x, size_y, alpha, s_min, s_max, n_ex, exlat, exlon, exrad) {
var strength = 0;
var flag = 1;
var phi = alpha * math.pi/180.0;
var i_max = int(0.35*n);
for (var i =0; i< i_max; i=i+1)
{
var x = (2.0 * rand() - 1.0) * size_x;
var y = (2.0 * rand() - 1.0) * size_y;
var lat = blat + (y * math.cos(phi) - x * math.sin(phi)) * m_to_lat;
var lon = blon + (x * math.cos(phi) + y * math.sin(phi)) * m_to_lon;
flag = 1;
for (var j=0; j<n_ex; j=j+1)
{
if (calc_d_sq(lat, lon, exlat[j], exlon[j]) < (exrad[j] * exrad[j])) {flag = 0;}
}
if (flag == 1)
{
strength = s_min + rand() * (s_max - s_min);
create_detailed_cumulus_cloud(lat, lon, balt, strength);
}
} # end for i
}

View file

@ -154,34 +154,22 @@ local_weather.startup();
var setDefaultCloudsOff = func {
if (features.can_disable_environment == 1)
{
var layers = props.globals.getNode("/environment/clouds").getChildren("layer");
var layers = props.globals.getNode("/environment/clouds").getChildren("layer");
foreach (l; layers)
{
l.getNode("coverage-type").setValue(5);
}
}
else
foreach (l; layers)
{
var layers = props.globals.getNode("/environment/clouds").getChildren("layer");
foreach (l; layers)
{
l.getNode("coverage").setValue("clear");
}
l.getNode("coverage-type").setValue(5);
}
if (local_weather.hardcoded_clouds_flag == 1)
{
# we store that information ourselves, so this should be zero, but rain forces us to go for an offset
setprop("/environment/clouds/layer[0]/elevation-ft",0.0);
# we store that information ourselves, so this should be zero, but rain forces us to go for an offset
setprop("/environment/clouds/layer[0]/elevation-ft",0.0);
# layer wrapping off
setprop("/sim/rendering/clouds3d-wrap",0);
# layer wrapping off
setprop("/sim/rendering/clouds3d-wrap",0);
}
@ -194,33 +182,13 @@ if (local_weather.hardcoded_clouds_flag == 1)
var setVisibility = func (vis) {
if (features.can_disable_environment == 1)
{
setprop("/environment/visibility-m",vis);
}
else
{
# this is a workaround for systems which lack hard-coded support
# essentially we update all entries in config and reinit environment
var entries_aloft = props.globals.getNode("environment/config/aloft", 1).getChildren("entry");
foreach (var e; entries_aloft) {
e.getNode("visibility-m",1).setValue(vis);
}
var entries_boundary = props.globals.getNode("environment/config/boundary", 1).getChildren("entry");
foreach (var e; entries_boundary) {
e.getNode("visibility-m",1).setValue(vis);
}
fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}
setprop("/environment/visibility-m",vis);
}
var setVisibilitySmoothly = func (vis) {
if (features.can_disable_environment == 0)
{setVisibility(vis); return;}
visibility_target = vis;
visibility_current = getprop("/environment/visibility-m");
@ -273,19 +241,7 @@ setprop("/environment/local-weather-lift-fps",lift);
var setRain = func (rain) {
if (features.can_disable_environment == 1)
{
setprop("/environment/rain-norm", rain);
}
else
{
# setting the lowest cloud layer to 30.000 ft is a workaround
# as rain is only created below that layer in default
setprop("/environment/clouds/layer[0]/elevation-ft", 30000.0);
setprop("/environment/metar/rain-norm",rain);
}
setprop("/environment/rain-norm", rain);
}
####################################
@ -294,18 +250,7 @@ else
var setSnow = func (snow) {
if (features.can_disable_environment == 1)
{
setprop("/environment/snow-norm", snow);
}
else
{
# setting the lowest cloud layer to 30.000 ft is a workaround
# as snow is only created below that layer in default
setprop("environment/clouds/layer[0]/elevation-ft", 30000.0);
setprop("environment/metar/snow-norm",snow);
}
setprop("/environment/snow-norm", snow);
}
@ -314,37 +259,9 @@ else
####################################
var setTurbulence = func (turbulence) {
if (features.can_disable_environment == 1)
{
setprop("/environment/turbulence/magnitude-norm",turbulence);
setprop("/environment/turbulence/rate-hz",3.0);
}
else
{
# this is a workaround for systems which lack hard-coded support
# essentially we update all entries in config and reinit environment
var entries_aloft = props.globals.getNode("environment/config/aloft", 1).getChildren("entry");
foreach (var e; entries_aloft) {
e.getNode("turbulence/magnitude-norm",1).setValue(turbulence);
e.getNode("turbulence/rate-hz",1).setValue(3.0);
e.getNode("turbulence/factor",1).setValue(1.0);
}
# turbulence is slightly reduced in boundary layers
var entries_boundary = props.globals.getNode("environment/config/boundary", 1).getChildren("entry");
var i = 1;
foreach (var e; entries_boundary) {
e.getNode("turbulence/magnitude-norm",1).setValue(turbulence * 0.25*i);
e.getNode("turbulence/rate-hz",1).setValue(5.0);
e.getNode("turbulence/factor",1).setValue(1.0);
i = i + 1;
}
fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}
setprop("/environment/turbulence/magnitude-norm",turbulence);
setprop("/environment/turbulence/rate-hz",3.0);
}
@ -354,19 +271,7 @@ else
var setTemperature = func (T) {
if (features.can_disable_environment == 1)
{
setprop("/environment/temperature-sea-level-degc",T);
}
else
{
# this is a workaround for systems which lack hard-coded support
# essentially we update the entry in config and reinit environment
setprop(ec~"boundary/entry[0]/temperature-degc",T);
fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}
setprop("/environment/temperature-sea-level-degc",T);
}
####################################
@ -375,19 +280,7 @@ else
var setPressure = func (p) {
if (features.can_disable_environment == 1)
{
setprop("/environment/pressure-sea-level-inhg",p);
}
else
{
# this is a workaround for systems which lack hard-coded support
# essentially we update the entry in config and reinit environment
setprop(ec~"boundary/entry[0]/pressure-sea-level-inhg",p);
setprop(ec~"aloft/entry[0]/pressure-sea-level-inhg",p);
fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}
setprop("/environment/pressure-sea-level-inhg",p);
}
####################################
@ -396,18 +289,7 @@ else
var setDewpoint = func (D) {
if (features.can_disable_environment == 1)
{
setprop("/environment/dewpoint-sea-level-degc",D);
}
else
{
# this is a workaround for systems which lack hard-coded support
# essentially we update the entry in config and reinit environment
setprop(ec~"boundary/entry[0]/dewpoint-degc",D);
fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}
setprop("/environment/dewpoint-sea-level-degc",D);
}
####################################
@ -416,17 +298,11 @@ else
var setLight = func (s) {
if (features.can_set_light == 1)
{
setprop("/rendering/scene/saturation",s);
}
setprop("/rendering/scene/saturation",s);
}
var setLightSmoothly = func (s) {
if (features.can_set_light == 0)
{return;}
light_target = s;
light_current = getprop("/rendering/scene/saturation");
@ -468,10 +344,7 @@ settimer( func {light_loop(); },0);
var setScattering = func (s) {
if (features.can_set_scattering == 1)
{
setprop("/rendering/scene/scattering",s);
}
setprop("/rendering/scene/scattering",s);
}
####################################
@ -480,10 +353,7 @@ if (features.can_set_scattering == 1)
var setOvercast = func (o) {
if (features.can_set_scattering == 1)
{
setprop("/rendering/scene/overcast",o);
}
setprop("/rendering/scene/overcast",o);
}
@ -496,7 +366,6 @@ var setSkydomeShader = func (r, m, d) {
setprop("/sim/rendering/rayleigh", r);
setprop("/sim/rendering/mie", m);
setprop("/sim/rendering/dome-density",d);
}
###########################################################
@ -506,38 +375,13 @@ setprop("/sim/rendering/dome-density",d);
var setWind = func (dir, speed) {
if (features.can_disable_environment == 1)
{
setprop("/environment/wind-from-heading-deg",dir);
setprop("/environment/wind-speed-kt",speed);
}
setprop("/environment/wind-from-heading-deg",dir);
setprop("/environment/wind-speed-kt",speed);
# this is needed to trigger the cloud drift to pick up the new wind setting
if (local_weather.hardcoded_clouds_flag == 1)
{
setprop("/environment/clouds/layer[0]/elevation-ft",0.0);
}
else
{
# this is a workaround for systems which lack hard-coded support
# essentially we update all entries in config and reinit environment
setprop("/environment/clouds/layer[0]/elevation-ft",0.0);
var entries_aloft = props.globals.getNode("environment/config/aloft", 1).getChildren("entry");
foreach (var e; entries_aloft) {
e.getNode("wind-from-heading-deg",1).setValue(dir);
e.getNode("wind-speed-kt",1).setValue(speed);
}
var entries_boundary = props.globals.getNode("environment/config/boundary", 1).getChildren("entry");
foreach (var e; entries_boundary) {
e.getNode("wind-from-heading-deg",1).setValue(dir);
e.getNode("wind-speed-kt",1).setValue(speed);
}
fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}
}
###########################################################
@ -548,53 +392,10 @@ else
var setWindSmoothly = func (dir, speed) {
if (features.can_disable_environment == 1)
{
setWind(dir, speed);
}
else
{
var entries_aloft = props.globals.getNode("environment/config/aloft", 1).getChildren("entry");
var dir_old = entries_aloft[0].getNode("wind-from-heading-deg",1).getValue();
var speed_old = entries_aloft[0].getNode("wind-speed-kt",1).getValue();
var dir = dir * math.pi/180.0;
var dir_old = dir_old * math.pi/180.0;
var vx = speed * math.sin(dir);
var vx_old = speed_old * math.sin(dir_old);
var vy = speed * math.cos(dir);
var vy_old = speed_old * math.cos(dir_old);
smooth_wind_loop(vx,vy,vx_old, vy_old, 4, 4);
}
setWind(dir, speed);
}
var smooth_wind_loop = func (vx, vy, vx_old, vy_old, counter, count_max) {
var time_delay = 0.9/count_max;
if (counter == 0) {return;}
var f = (counter -1)/count_max;
var vx_set = f * vx_old + (1-f) * vx;
var vy_set = f * vy_old + (1-f) * vy;
var speed_set = math.sqrt(vx_set * vx_set + vy_set * vy_set);
var dir_set = math.atan2(vx_set,vy_set) * 180.0/math.pi;
setWind(dir_set,speed_set);
settimer( func {smooth_wind_loop(vx,vy,vx_old,vy_old,counter-1, count_max); },time_delay);
}
###########################################################
# place a single cloud
###########################################################
@ -635,31 +436,7 @@ else if (find("congestus",path) != -1)
# first check if the cloud should be stored in the buffer
# we keep it if it is in visual range or at high altitude (where visual range is different)
if (buffer_flag == 1)
{
# calculate the distance to the aircraft
var pos = geo.aircraft_position();
var cpos = geo.Coord.new();
cpos.set_latlon(lat,long,0.0);
var d = pos.distance_to(cpos);
if ((d > d_max) and (alt < 20000.0)) # we buffer the cloud
{
var b = weather_tile_management.cloudBuffer.new(lat, long, alt, path, heading, tile_counter, convective_flag);
if (local_weather.dynamics_flag ==1)
{
b.timestamp = weather_dynamics.time_lw;
if (convective_flag !=0) # Cumulus clouds get some extra info
{
b.evolution_timestamp = cloud_evolution_timestamp;
b.flt = cloud_flt;
b.rel_alt = alt - cloud_mean_altitude;
}
}
append(weather_tile_management.cloudBufferArray,b);
return;
}
}
# now check if we are writing from the buffer, in this case change tile index
# to buffered one
@ -731,13 +508,6 @@ if (local_weather.dynamics_flag == 1)
cs.timestamp = weather_dynamics.time_lw;
cs.write_index = placement_index;
if (convective_flag !=0) # Cumulus clouds get some extra info
{
cs.evolution_timestamp = cloud_evolution_timestamp;
cs.flt = cloud_flt;
cs.rel_alt = alt - cloud_mean_altitude;
cs.target_alt = alt;
}
if (getprop(lw~"tmp/buffer-status") == "placing")
{
@ -830,8 +600,8 @@ var p = props.Node.new({ "layer" : 0,
"num-textures-y": c.num_tex_y,
"min-cloud-width-m": c.min_cloud_width,
"max-cloud-width-m": c.min_cloud_width,
"min-cloud-height-m": c.min_cloud_height,
"max-cloud-height-m": c.min_cloud_height,
"min-cloud-height-m": c.min_cloud_height + c.min_cloud_height * 0.2 * local_weather.height_bias,
"max-cloud-height-m": c.min_cloud_height + c.min_cloud_height * 0.2 * local_weather.height_bias,
"z-scale": c.z_scale,
"height-map-texture": 0,
"alt-ft" : c.alt });
@ -931,8 +701,6 @@ var create_new_cloud_array = func (i, cloudArray)
#if (getprop(lw~"tmp/thread-status") != "placing") {return;}
#if (getprop(lw~"tmp/convective-status") != "idle") {return;}
if ((i < 0) or (i==0))
{
@ -941,7 +709,6 @@ if ((i < 0) or (i==0))
return;
}
#print("Hello world! i is now: ",i);
var k_max = 20;
var s = size(cloudArray);

View file

@ -427,7 +427,8 @@ var viewpos = geo.aircraft_position();
var vis_before = getprop(lwi~"visibility-m");
#var vis_before = getprop(lwi~"visibility-m");
var vis_before = interpolated_conditions.visibility_m;
# if applicable, do some work for fps sampling
@ -448,10 +449,9 @@ else
# if we can set environment without a reset, the loop can run a bit faster for smoother interpolation
# so determine the suitable timing
if (compat_layer.features.can_disable_environment == 1)
{var interpolation_loop_time = 0.2; var vlimit = 1.01;}
else
{var interpolation_loop_time = 1.0; var vlimit = 1.05;}
var interpolation_loop_time = 0.1;
var vlimit = 1.01;
# get an inverse distance weighted average from all defined weather stations
@ -638,9 +638,6 @@ if (vis > max_vis_range)
if (scattering_shader_flag == 1)
{
#var rayleigh = 0.0003 ;
#var mie = 0.003;
#var density = 0.3;
# values to be used with new exposure filter
var rayleigh = 0.0003;
@ -650,25 +647,7 @@ if (scattering_shader_flag == 1)
var vis_factor = (vis - 30000.0)/90000.0;
if (vis_factor < 0.0) {vis_factor = 0.0;}
if (vis_factor > 1.0) {vis_factor = 1.0;}
#if (altitude < 30000.0)
# {
# rayleigh = 0.0004 - altitude/30000.0 * 0.0001;
# mie = 0.004 - altitude/30000.0 * 0.001;
# mie = 0.002 - altitude/30000.0 * 0.001;
# }
#else if (altitude < 60000.0)
# {
# rayleigh = 0.0003 - (altitude-30000.0)/30000.0 * 0.0001;
# mie = 0.003 - (altitude-30000.0)/30000.0 * 0.001;
# }
#else if (altitude < 85000.0)
# {
# rayleigh = 0.0002 - (altitude-60000.0)/25000.0 * 0.0001;
# mie = 0.002;
# }
#else
# {rayleigh = 0.0001; mie = 0.002;}
if (altitude < 36000.0)
{
@ -698,9 +677,7 @@ if (scattering_shader_flag == 1)
}
# otherwise compute normal skydome shader parameters
# compute the horizon shading
@ -730,6 +707,15 @@ else
{var ovcst = 0.0;}
# compute base turbulence
var base_turbulence = 0.0;
if (altitude < alt1)
{
base_turbulence = lowest_layer_turbulence;
}
# limit relative changes of the visibility, will make for gradual transitions
@ -742,14 +728,20 @@ else if (vis/vis_before < (2.0-vlimit))
# write all properties into the weather interpolation record in the property tree
# write all properties into the weather interpolation record
setprop(lwi~"mean-terrain-altitude-ft",ialt);
if (vis > 0.0) {setprop(lwi~"visibility-m",vis);} # a redundancy check
setprop(lwi~"temperature-degc",T);
setprop(lwi~"dewpoint-degc",D);
if (p > 10.0) {setprop(lwi~"pressure-sea-level-inhg",p);}
setprop(lwi~"turbulence",0.0);
# if (vis > 0.0) {setprop(lwi~"visibility-m",vis);} # a redundancy check
# setprop(lwi~"temperature-degc",T);
# setprop(lwi~"dewpoint-degc",D);
# if (p > 10.0) {setprop(lwi~"pressure-sea-level-inhg",p);}
# setprop(lwi~"turbulence",0.0);
if (vis > 0.0) interpolated_conditions.visibility_m = vis;
interpolated_conditions.temperature_degc = T;
interpolated_conditions.dewpoint_degc = D;
if (p>10.0) interpolated_conditions.pressure_sea_level_inhg = p;
if (scattering_shader_flag == 1)
@ -769,39 +761,24 @@ flag = getprop("local-weather/effect-volumes/number-active-vis");
if ((flag ==0) and (vis > 0.0) and (getprop(lw~"lift-loop-flag") == 0) and (compat_layer.smooth_visibility_loop_flag == 0))
{
setprop(lw~"current/visibility-m",vis);
compat_layer.setVisibility(vis);
}
flag = getprop("local-weather/effect-volumes/number-active-turb");
if ((flag ==0))
{
setprop(lw~"current/turbulence",0.0);
compat_layer.setTurbulence(0.0);
}
flag = getprop("local-weather/effect-volumes/number-active-lift");
if (flag ==0)
{
setprop(lw~"current/thermal-lift",0.0);
#setprop(lw~"current/thermal-lift",0.0);
}
# no need to check for these, as they are not modelled in effect volumes
setprop(lw~"current/temperature-degc",T);
compat_layer.setTemperature(T);
setprop(lw~"current/dewpoint-degc", D);
compat_layer.setDewpoint(D);
if (p>0.0)
{
setprop(lw~"current/pressure-sea-level-inhg",p);
compat_layer.setPressure(p);
}
if (p>0.0) {compat_layer.setPressure(p);}
# now determine the local wind
@ -852,6 +829,11 @@ wind.surface = [wind.cloudlayer[0], wind.cloudlayer[1] * get_slowdown_fraction()
var altitude_agl = getprop("/position/altitude-agl-ft");
if (altitude_agl < 50.0)
{
base_turbulence = base_turbulence * altitude_agl/50.0;
}
if (presampling_flag == 0)
{
@ -917,8 +899,9 @@ if (gust_frequency > 0.0)
var gust_relative_strength = getprop(lw~"tmp/gust-relative-strength");
var gust_angvar = getprop(lw~"tmp/gust-angular-variation-deg");
var winddir_last = getprop(lwi~"wind-from-heading-deg");
# var winddir_last = getprop(lwi~"wind-from-heading-deg");
var winddir_last = interpolated_conditions.wind_from_heading_deg;
var alt_scaling_factor = 1.2 * windspeed / 10.0;
if (alt_scaling_factor < 1.0) {alt_scaling_factor = 1.0;}
@ -952,12 +935,8 @@ if (gust_frequency > 0.0)
compat_layer.setWindSmoothly(winddir, windspeed_current);
setprop(lwi~"wind-from-heading-deg", winddir);
setprop(lwi~"wind-speed-kt",windspeed_current);
setprop(lw~"current/wind-from-heading-deg",winddir);
setprop(lw~"current/wind-speed-kt",windspeed_current);
interpolated_conditions.wind_from_heading_deg = winddir;
interpolated_conditions.windspeed_kt = windspeed_current;
# hack to get access to the water shader
@ -966,15 +945,27 @@ setprop("/environment/config/boundary/entry[0]/wind-speed-kt",windspeed_ground);
# end hack
# set turbulence
flag = getprop("local-weather/effect-volumes/number-active-turb");
var wind_enhancement_factor = windspeed_current/15.0;
if (wind_enhancement_factor > 1.5) {wind_enhancement_factor = 1.5;}
if ((flag ==0))
{compat_layer.setTurbulence(base_turbulence * wind_enhancement_factor);}
# set scattering on the ground - this doesn't affect fog but is diffuse and specular light reduction
# so it is stronger than normal scattering
var scatt_ground = 2.0 * (scatt_max - 0.5);
var scatt_ground = (scatt_max - 0.4)/0.6;
if (scatt_ground < 0.0) {scatt_ground = 0.0;}
setprop("/environment/surface/scattering", scatt_ground);
if (getprop(lw~"interpolation-loop-flag") ==1) {settimer(interpolation_loop, interpolation_loop_time);}
if (getprop(lw~"interpolation-loop-flag") ==1) {settimer(interpolation_loop, 0.0);}
}
@ -1059,7 +1050,9 @@ if (getprop(lw~"wave-loop-flag") ==1)
# compute a reduction in visibility when entering the cloudbase
var vis = getprop(lw~"interpolation/visibility-m");
#var vis = getprop(lw~"interpolation/visibility-m");
var vis = interpolated_conditions.visibility_m;
if (alt > 0.9 * thermal.height)
{
@ -1313,12 +1306,11 @@ if (ev.vis_flag == 1)
# leave property at current because new definitions are already active and should not
# be cancelled
if (n_active ==1){var vis = props.globals.getNode(lw~"interpolation/visibility-m").getValue();}
else if ((n_active -1) == n_entry) #{var vis = ev.getNode("restore/visibility-m").getValue();}
if (n_active ==1){var vis = interpolated_conditions.visibility_m;}
else if ((n_active -1) == n_entry)
{var vis = ev.vis_r;}
else {var vis = cNode.getNode("visibility-m").getValue();}
cNode.getNode("visibility-m").setValue(vis);
#compat_layer.setVisibility(vis);
compat_layer.setVisibilitySmoothly(vis);
# and subtract from the counter
@ -1329,8 +1321,8 @@ if (ev.rain_flag == 1)
var n_active = getprop(lw~"effect-volumes/number-active-rain");
var n_entry = ev.n_entry_rain;
if (n_active ==1){var rain = props.globals.getNode(lw~"interpolation/rain-norm").getValue();}
else if ((n_active -1) == n_entry)# {var rain = ev.getNode("restore/rain-norm").getValue();}
if (n_active ==1){var rain = interpolated_conditions.rain_norm;}
else if ((n_active -1) == n_entry)
{var rain = ev.rain_r;}
else {var rain = cNode.getNode("rain-norm").getValue();}
cNode.getNode("rain-norm").setValue(rain);
@ -1343,7 +1335,7 @@ if (ev.snow_flag == 1)
var n_active = getprop(lw~"effect-volumes/number-active-snow");
var n_entry = ev.n_entry_snow;
if (n_active ==1){var snow = props.globals.getNode(lw~"interpolation/snow-norm").getValue();}
if (n_active ==1){var snow = interpolated_conditions.snow_norm;}
else if ((n_active -1) == n_entry)
{var snow = ev.snow_r;}
else {var snow = cNode.getNode("snow-norm").getValue();}
@ -1356,7 +1348,7 @@ if (ev.turb_flag == 1)
{
var n_active = getprop(lw~"effect-volumes/number-active-turb");
var n_entry = ev.n_entry_turb;
if (n_active ==1){var turbulence = props.globals.getNode(lw~"interpolation/turbulence").getValue();}
if (n_active ==1){var turbulence = interpolated_conditions.turbulence;}
else if ((n_active -1) == n_entry)
{var turbulence = ev.turb_r;}
else {var turbulence = cNode.getNode("turbulence").getValue();}
@ -1381,7 +1373,7 @@ if (ev.lift_flag == 1)
{
var n_active = getprop(lw~"effect-volumes/number-active-lift");
var n_entry = ev.n_entry_lift;
if (n_active ==1){var lift = props.globals.getNode(lw~"interpolation/thermal-lift").getValue();}
if (n_active ==1){var lift = interpolated_conditions.thermal_lift;}
else if ((n_active -1) == n_entry)
{var lift = ev.lift_r;}
else {var lift = cNode.getNode("thermal-lift").getValue();}
@ -1714,93 +1706,17 @@ local_weather_running_flag = 0;
var create_detailed_cumulus_cloud = func (lat, lon, alt, size) {
# various distribution biases
var edge_bias = convective_texture_mix;
size = size + convective_size_bias;
height_bias = 1.0;
if (edge_bias > 0.0) {height_bias = height_bias + 15.0 *edge_bias + 20.0 * rand() * edge_bias;}
if (hardcoded_clouds_flag == 0)
{
if (size > 2.0)
{
if (rand() > (size - 2.0))
{create_cumulonimbus_cloud(lat, lon, alt, size); }
else
{create_cumulonimbus_cloud_rain(lat, lon, alt, size, 0.1 + 0.2* rand());}
return;
}
#height_bias = 6.0;
else if (size>1.5)
{
var type = "Congestus";
var btype = "Congestus bottom";
var height = 400;
var n = 8;
var n_b = 4;
var x = 1000.0;
var y = 300.0;
var edge = 0.3;
}
else if (size>1.1)
{
var type = "Cumulus (cloudlet)";
var btype = "Cumulus bottom";
var height = 200;
var n = 8;
var n_b = 1;
var x = 400.0;
var y = 200.0;
var edge = 0.3;
}
else if (size>0.8)
{
var type = "Cumulus (cloudlet)";
var btype = "Cumulus bottom";
var height = 150;
var n = 6;
var x = 300.0;
var y = 200.0;
var edge = 0.3;
}
else if (size>0.4)
{
var type = "Cumulus (cloudlet)";
var btype = "Cumulus bottom";
var height = 100;
var n = 4;
var x = 200.0;
var y = 200.0;
var edge = 1.0;
}
else
{
var type = "Cumulus (whisp)";
var btype = "Cumulus bottom";
var height = 100;
var n = 1;
var x = 100.0;
var y = 100.0;
var edge = 1.0;
}
var alpha = rand() * 180.0;
edge = edge + edge_bias;
create_streak(type,lat,lon, alt+ 0.5* (height +cloud_vertical_size_map["Cumulus"] * ft_to_m), height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0);
# for large clouds, add a bottom
if ((size > 1.1) and (edge < 0.4))
{
create_streak(btype,lat,lon, alt, 100.0,n_b,0.0,edge,0.3*x,1,0.0,0.0,0.3*y,alpha,1.0);
}
}
else
{
if (size > 2.0)
{
if (rand() > (size - 2.0))
@ -1827,19 +1743,20 @@ else
var type = "Cu (volume)";
var height = 400;
var n = 10;
var n = 10 + int(height_bias);
var x = 1400.0;
var y = 400.0;
var edge = 0.2;
edge = edge + edge_bias;
create_streak(type,lat,lon, alt+ 0.3* (height )-offset_map["Congestus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0);
create_streak(type,lat,lon, alt+ 0.5* (height * height_bias )-offset_map["Cumulus"], height * height_bias ,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0);
var btype = "Congestus bottom";
var n_b = 6;
height_bias = 1.0;
create_streak(btype,lat,lon, alt -offset_map["Congestus"] -200.0, 100.0,n_b,0.0,edge,0.3*x,1,0.0,0.0,0.3*y,alpha,1.0);
create_streak(btype,lat,lon, alt -offset_map["Congestus"] -900.0, 100.0,n_b,0.0,edge,0.3*x,1,0.0,0.0,0.3*y,alpha,1.0);
}
else if (size>1.1)
@ -1847,7 +1764,7 @@ else
var type = "Cumulus (cloudlet)";
var btype = "Cumulus bottom";
var height = 200;
var n = 6;
var n = 6 + int(height_bias);
var n_b = 2;
var x = 900.0;
var y = 200.0;
@ -1855,8 +1772,9 @@ else
var alpha = rand() * 180.0;
edge = edge + edge_bias;
create_streak(type,lat,lon, alt+ 0.3* (height )-offset_map["Cumulus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0);
create_streak(type,lat,lon, alt+ 0.5* (height* height_bias )-offset_map["Cumulus"], height * height_bias,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0);
height_bias = 1.0;
create_streak(btype,lat,lon, alt -offset_map["Cumulus"] - 200.0, 100.0,n_b,0.0,edge,0.3*x,1,0.0,0.0,0.3*y,alpha,1.0);
}
@ -1864,34 +1782,34 @@ else
{
var type = "Cumulus (cloudlet)";
var height = 150;
var n = 4;
var n = 4 + int(height_bias);
var x = 300.0;
var y = 300.0;
var edge = 0.3;
var alpha = rand() * 180.0;
edge = edge + edge_bias;
create_streak(type,lat,lon, alt+ 0.3* (height )-offset_map["Cumulus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0);
create_streak(type,lat,lon, alt+ 0.5* (height * height_bias )-offset_map["Cumulus"], height * height_bias,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0);
n = 2;
x = 700.0;
y = 200.0;
edge = 1.0;
create_streak(type,lat,lon, alt+ 0.3* (height )-offset_map["Cumulus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0);
create_streak(type,lat,lon, alt+ 0.5* (height*height_bias )-offset_map["Cumulus"], height * height_bias,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0);
}
else if (size>0.4)
{
var type = "Cumulus (cloudlet)";
var height = 100;
var n = 2;
var n = 2 + int(height_bias * 0.5);
var x = 600.0;
var y = 100.0;
var edge = 1.0;
var alpha = rand() * 180.0;
edge = edge + edge_bias;
create_streak(type,lat,lon, alt+ 0.3* (height)-offset_map["Cumulus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0);
create_streak(type,lat,lon, alt+ 0.5* (height * height_bias)-offset_map["Cumulus"], height * height_bias,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0);
}
else
{
@ -1906,11 +1824,6 @@ else
edge = edge + edge_bias;
create_streak(type,lat,lon, alt+ 0.3* (height )-offset_map["Cumulus"], height,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0);
}
}
}
###########################################################
@ -1919,12 +1832,8 @@ else
var create_cumulonimbus_cloud = func(lat, lon, alt, size) {
if (hardcoded_clouds_flag == 1)
{create_cloudbox("Cb_box", lat, lon, alt, 2500.0,2000.0, 1000.0,14, 0.2, 0.1, 3.4, 8, 0.8, 0.1, 8);}
else
{create_cloudbox("Cb_box", lat, lon, alt, 2500.0,2000.0, 1000.0,14, 0.2, 0.1, 1.4, 4, 0.9, 0.2, 8);}
create_cloudbox("Cb_box", lat, lon, alt, 2500.0,2000.0, 1000.0,14, 0.2, 0.1, 3.4, 8, 0.8, 0.1, 8);
}
@ -1934,10 +1843,9 @@ else
var create_cumulonimbus_cloud_rain = func(lat, lon, alt, size, rain) {
if (hardcoded_clouds_flag == 1)
{create_cloudbox("Cb_box", lat, lon, alt, 2500.0,2000.0, 1000.0,14, 0.2, 0.1, 3.4, 8, 0.8, 0.1, 8);}
else
{create_cloudbox("Cb_box", lat, lon, alt, 2500.0,2000.0, 1000.0,14, 0.2, 0.1, 1.4, 4, 0.9, 0.2, 8);}
create_cloudbox("Cb_box", lat, lon, alt, 2500.0,2000.0, 1000.0,14, 0.2, 0.1, 3.4, 8, 0.8, 0.1, 8);
# place a rain texture
@ -2000,6 +1908,7 @@ if (nc < 0)
setprop(lw~"tmp/convective-status", "idle");
assemble_effect_array();
convective_size_bias = 0.0;
height_bias = 1.0;
return;
}
@ -2067,7 +1976,7 @@ var t_factor2 = 0.5 * (1.0-math.cos((t * sec_to_rad)-0.9));
nc = t_factor1 * nc * math.cos(blat/180.0*math.pi);
var thermal_conditions = getprop(lw~"config/thermal-properties");
# var thermal_conditions = getprop(lw~"config/thermal-properties");
while (i < nc) {
@ -2156,13 +2065,7 @@ while (i < nc) {
var rn = rand();
strength = (1.5 * rn + (2.0 * p * terrain_strength_factor)) * t_factor2;
if (strength > 1.0)
{
# we place a large cloud, and we generate lift
path = select_cloud_model("Cumulus","large"); place_lift_flag = 1;
}
else {path = select_cloud_model("Cumulus","small");}
# the terrain effect cannot create Cb development, so we have to curb
# the strength if it would not have been Cb otherwise
@ -2173,22 +2076,17 @@ while (i < nc) {
}
if (strength > 1.0) {place_lift_flag = 1;}
cloud_mean_altitude = place_alt;
cloud_fractional_lifetime = rand();
cloud_evolution_timestamp = weather_dynamics.time_lw;
if (generate_thermal_lift_flag != 3) # no clouds if we produce blue thermals
{
if (thread_flag == 1)
{
if (detail_flag == 0){create_cloud_vec(path,lat,lon, place_alt, 0.0);}
else {create_detailed_cumulus_cloud(lat, lon, place_alt, strength);}
}
else
{
if (detail_flag == 0){compat_layer.create_cloud(path, lat, lon, place_alt, 0.0);}
else {create_detailed_cumulus_cloud(lat, lon, place_alt, strength);}
}
create_detailed_cumulus_cloud(lat, lon, place_alt, strength);
}
# now see if we need to create a thermal - first check the flag
@ -2272,7 +2170,7 @@ var t_factor2 = 0.5 * (1.0-math.cos((t * sec_to_rad)-0.9));
nc = t_factor1 * nc * math.cos(blat/180.0*math.pi);
var thermal_conditions = getprop(lw~"config/thermal-properties");
# var thermal_conditions = getprop(lw~"config/thermal-properties");
var alt_base = alt_20_array[tile_index -1];
@ -2416,62 +2314,6 @@ while (i < nc) {
###########################################################
# place a Cumulus layer with excluded regions
# to avoid placing cumulus underneath a thunderstorm
###########################################################
var cumulus_exclusion_layer = func (blat, blon, balt, n, size_x, size_y, alpha, s_min, s_max, n_ex, exlat, exlon, exrad) {
var strength = 0;
var flag = 1;
var phi = alpha * math.pi/180.0;
var detail_flag = detailed_clouds_flag;
if (detail_flag == 1) {var i_max = int(0.25*n);} else {var i_max = int(1.0*n);}
for (var i =0; i< i_max; i=i+1)
{
var x = (2.0 * rand() - 1.0) * size_x;
var y = (2.0 * rand() - 1.0) * size_y;
var lat = blat + (y * math.cos(phi) - x * math.sin(phi)) * m_to_lat;
var lon = blon + (x * math.cos(phi) + y * math.sin(phi)) * m_to_lon;
flag = 1;
for (var j=0; j<n_ex; j=j+1)
{
if (calc_d_sq(lat, lon, exlat[j], exlon[j]) < (exrad[j] * exrad[j])) {flag = 0;}
}
if (flag == 1)
{
strength = s_min + rand() * (s_max - s_min);
if (strength > 1.0) {var path = select_cloud_model("Cumulus","large"); }
else {var path = select_cloud_model("Cumulus","small");}
if (thread_flag == 1)
{
if (detail_flag == 0){create_cloud_vec(path,lat,lon, balt, 0.0);}
else {create_detailed_cumulus_cloud(lat, lon, balt, strength);}
}
else
{
if (detail_flag == 0){compat_layer.create_cloud(path, lat, lon, balt, 0.0);}
else {create_detailed_cumulus_cloud(lat, lon, balt, strength);}
}
} # end if flag
} # end for i
}
###########################################################
@ -3297,12 +3139,15 @@ else {print("Wind model not implemented!"); wind_model_flag =1;}
var set_texture_mix = func {
var thermal_properties = getprop(lw~"config/thermal-properties");
thermal_conditions = thermal_properties;
convective_texture_mix = -(thermal_properties - 1.0) * 0.4;
if (convective_texture_mix < -0.2) {convective_texture_mix = -0.2;}
if (convective_texture_mix > 0.2) {convective_texture_mix = 0.2;}
lowest_layer_turbulence = 0.7 - thermal_properties;
if (lowest_layer_turbulence < 0.0) {lowest_layer_turbulence = 0.0;}
}
###########################################################
@ -4046,7 +3891,7 @@ if (dynamics_flag ==1)
if (getprop(lw~"dynamics-loop-flag") == 0)
{
setprop(lw~"dynamics-loop-flag",1);
weather_dynamics.quadtree_loop();
# weather_dynamics.quadtree_loop();
weather_dynamics.weather_dynamics_loop(0,0);
}
if ((getprop(lw~"convective-loop-flag") == 0) and (getprop(lw~"config/dynamical-convection-flag") ==1))
@ -4065,7 +3910,7 @@ if (buffer_flag == 1)
{
if (getprop(lw~"buffer-loop-flag") == 0)
{
setprop(lw~"buffer-loop-flag",1); weather_tile_management.buffer_loop(0);
# setprop(lw~"buffer-loop-flag",1); weather_tile_management.buffer_loop(0);
setprop(lw~"housekeeping-loop-flag",1); weather_tile_management.housekeeping_loop(0,0);
}
}
@ -4095,29 +3940,45 @@ calc_geo(lat);
# copy weather properties at startup to local weather
setprop(lw~"interpolation/visibility-m",getprop(ec~"boundary/entry[0]/visibility-m"));
setprop(lw~"interpolation/pressure-sea-level-inhg",getprop(ec~"boundary/entry[0]/pressure-sea-level-inhg"));
setprop(lw~"interpolation/temperature-degc",getprop(ec~"boundary/entry[0]/temperature-degc"));
setprop(lw~"interpolation/wind-from-heading-deg",getprop(ec~"boundary/entry[0]/wind-from-heading-deg"));
setprop(lw~"interpolation/wind-speed-kt",getprop(ec~"boundary/entry[0]/wind-speed-kt"));
setprop(lw~"interpolation/turbulence",getprop(ec~"boundary/entry[0]/turbulence/magnitude-norm"));
#setprop(lw~"interpolation/visibility-m",getprop(ec~"boundary/entry[0]/visibility-m"));
#setprop(lw~"interpolation/pressure-sea-level-inhg",getprop(ec~"boundary/entry[0]/pressure-sea-level-inhg"));
#setprop(lw~"interpolation/temperature-degc",getprop(ec~"boundary/entry[0]/temperature-degc"));
#setprop(lw~"interpolation/wind-from-heading-deg",getprop(ec~"boundary/entry[0]/wind-from-heading-deg"));
#setprop(lw~"interpolation/wind-speed-kt",getprop(ec~"boundary/entry[0]/wind-speed-kt"));
#setprop(lw~"interpolation/turbulence",getprop(ec~"boundary/entry[0]/turbulence/magnitude-norm"));
#setprop(lw~"interpolation/rain-norm",0.0);
#setprop(lw~"interpolation/snow-norm",0.0);
#setprop(lw~"interpolation/thermal-lift",0.0);
setprop(lw~"interpolation/rain-norm",0.0);
setprop(lw~"interpolation/snow-norm",0.0);
setprop(lw~"interpolation/thermal-lift",0.0);
interpolated_conditions.visibility_m = getprop(ec~"boundary/entry[0]/visibility-m");
interpolated_conditions.pressure_sea_level_inhg = getprop(ec~"boundary/entry[0]/pressure-sea-level-inhg");
interpolated_conditions.temperature_degc = getprop(ec~"boundary/entry[0]/temperature-degc");
interpolated_conditions.dewpoint_degc = getprop(ec~"boundary/entry[0]/dewpoint-degc");
interpolated_conditions.wind_from_heading_deg = getprop(ec~"boundary/entry[0]/wind-from-heading-deg");
interpolated_conditions.wind_speed_kt = getprop(ec~"boundary/entry[0]/wind-speed-kt");
interpolated_conditions.turbulence = getprop(ec~"boundary/entry[0]/turbulence/magnitude-norm");
interpolated_conditions.rain_norm = 0.0;
interpolated_conditions.snow_norm = 0.0;
interpolated_conditions.thermal_lift = 0.0;
# before interpolation starts, these are also initially current
setprop(lw~"current/visibility-m",getprop(lwi~"visibility-m"));
setprop(lw~"current/pressure-sea-level-inhg",getprop(lw~"interpolation/pressure-sea-level-inhg"));
setprop(lw~"current/temperature-degc",getprop(lw~"interpolation/temperature-degc"));
setprop(lw~"current/wind-from-heading-deg",getprop(lw~"interpolation/wind-from-heading-deg"));
setprop(lw~"current/wind-speed-kt",getprop(lw~"interpolation/wind-speed-kt"));
setprop(lw~"current/rain-norm",getprop(lw~"interpolation/rain-norm"));
setprop(lw~"current/snow-norm",getprop(lw~"interpolation/snow-norm"));
setprop(lw~"current/thermal-lift",getprop(lw~"interpolation/thermal-lift"));
setprop(lw~"current/turbulence",getprop(lwi~"turbulence"));
setprop(lw~"current/visibility-m",interpolated_conditions.visibility_m);
setprop(lw~"current/rain-norm",0.0);
setprop(lw~"current/snow-norm",0.0);
setprop(lw~"current/thermal-lift", 0.0);
setprop(lw~"current/turbulence",interpolated_conditions.turbulence);
#setprop(lw~"current/visibility-m",getprop(lwi~"visibility-m"));
#setprop(lw~"current/pressure-sea-level-inhg",getprop(lw~"interpolation/pressure-sea-level-inhg"));
#setprop(lw~"current/temperature-degc",getprop(lw~"interpolation/temperature-degc"));
#setprop(lw~"current/wind-from-heading-deg",getprop(lw~"interpolation/wind-from-heading-deg"));
#setprop(lw~"current/wind-speed-kt",getprop(lw~"interpolation/wind-speed-kt"));
#setprop(lw~"current/rain-norm",getprop(lw~"interpolation/rain-norm"));
#setprop(lw~"current/snow-norm",getprop(lw~"interpolation/snow-norm"));
#setprop(lw~"current/thermal-lift",getprop(lw~"interpolation/thermal-lift"));
#setprop(lw~"current/turbulence",getprop(lwi~"turbulence"));
# create default properties for METAR system, should be overwritten by real-weather-fetch
@ -4186,9 +4047,9 @@ var lat = getprop("position/latitude-deg");
var lon = getprop("position/longitude-deg");
var alt = getprop("position/altitude-ft");
thread_flag = 0;
dynamics_flag = 0;
presampling_flag = 0;
# thread_flag = 0;
# dynamics_flag = 0;
# presampling_flag = 0;
#if (compat_layer.features.can_disable_environment ==1)
@ -4208,37 +4069,19 @@ presampling_flag = 0;
# debug.dump(geodinfo(lat, lon));
#create_cumulonimbus_cloud(lat, lon, 6000.0, 2.5);
earthview.place_earth_model("Models/Astro/earth.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
earthview.place_earth_model("Models/Astro/cloudsphere.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
#setprop("/environment/terrain/area[0]/input/latitude-deg", lat );
#setprop("/environment/terrain/area[0]/input/longitude-deg", lon );
var info = {};
for (var i = 0; i< 100000; i=i+1)
{
info = geodinfo(lat, lon);
}
#setprop("/environment/terrain/area[0]/output/valid", 0 );
# elttest();
}
var elttest = func {
var lat_uncertainty = 0.001;
var lon_uncertainty = 0.001;
#var lat = getprop("/position/latitude-deg") + lat_uncertainty * 0.5 - rand();
#var lon = getprop("/position/longitude-deg") + lon_uncertainty * 0.5 - rand();
var lat = getprop("/position/latitude-string");
var lon = getprop("/position/longitude-string");
var aircraft = getprop("sim/description");
var callsign = getprop("sim/multiplay/callsign");
var help_string = "ELT AutoMessage: " ~ aircraft ~ " " ~ callsign ~ " " ~lat~" LAT "~lon~" LON, requesting SAR service";
setprop("/sim/multiplay/chat", help_string);
}
#################################################################
# object classes
@ -4549,10 +4392,13 @@ var alt_mean_array = [];
var effectVolumeArray = [];
var n_effectVolumeArray = 0;
# the thermal and the wave hash
# global weather hashes
var thermal = {};
var wave = {};
var interpolated_conditions = {};
var current_conditions = {};
# the wind hash stores the current winds
@ -4575,9 +4421,13 @@ var wind_model_flag = 1;
# globals governing properties of the Cumulus system
var convective_texture_mix = 0.0;
var height_bias = 1.0;
var convective_size_bias = 0.0;
var cumulus_efficiency_factor = 1.0;
var cloud_mean_altitude = 0.0;
var thermal_conditions = getprop(lw~"config/thermal-properties");
var lowest_layer_turbulence = 0.6 - thermal_conditions;
if (lowest_layer_turbulence < 0.0) {lowest_layer_turbulence = 0.0;}
# global keeping track of lighting

View file

@ -24,19 +24,24 @@ var seaColorPoint = {
var init_sea_colors = func {
var viewpos = geo.aircraft_position();
var ppos = geo.Coord.new();
# St. Tropez
var s = seaColorPoint.new(43.20, 6.47, 1.0,0.03, 0.22, 0.46);
var ppos = geo.Coord.new();
ppos.set_latlon(s.lat,s.lon,0.0);
s.distance = viewpos.distance_to(ppos);
append(interpolation_vector,s);
# St. Maarten
s = seaColorPoint.new(18.03, -63.11, 1.0,0.08, 0.40, 0.425,0.66);
var ppos = geo.Coord.new();
# Hawaii
var s = seaColorPoint.new(22.0, -165.0, 1.0,0.03, 0.22, 0.46);
ppos.set_latlon(s.lat,s.lon,0.0);
s.distance = viewpos.distance_to(ppos);
append(interpolation_vector,s);
# St. Maarten
s = seaColorPoint.new(18.03, -63.11, 1.0,0.08, 0.40, 0.425);
ppos.set_latlon(s.lat,s.lon,0.0);
s.distance = viewpos.distance_to(ppos);
append(interpolation_vector,s);

View file

@ -14,7 +14,7 @@
# create_neighbours to initialize the 8 neighbours of the initial tile
# buffer_loop to manage the buffering of faraway clouds in an array
# housekeeping_loop to shift clouds from the scenery into the buffer
# wathcdog loop (debug helping structure)
# watchdog loop (debug helping structure)
# calc_geo to get local Cartesian geometry for latitude conversion
# get_lat to get latitude from Cartesian coordinates
# get_lon to get longitude from Cartesian coordinates
@ -45,7 +45,8 @@ var d_min = 100000.0;
var i_min = 0;
# var distance_to_load = getprop(lw~"config/distance-to-load-tile-m");
# var distance_to_remove = getprop(lw~"config/distance-to-remove-tile-m");
var current_visibility = getprop(lw~"interpolation/visibility-m");
# var current_visibility = getprop(lw~"interpolation/visibility-m");
var current_visibility = local_weather.interpolated_conditions.visibility_m;
var current_heading = getprop("orientation/heading-deg");
var loading_flag = getprop(lw~"tmp/asymmetric-tile-loading-flag");
var this_frame_action_flag = 0; # use this flag to avoid overlapping tile operations
@ -1106,138 +1107,6 @@ setprop(lw~"tiles/tile[8]/orientation-deg",alpha);
}
###############################
# buffer loop
###############################
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);
setprop(lw~"clouds/buffer-count",n_max);
# don't do anything as long as the buffer is empty
if (n_max == 0) # nothing to do, loop over
{if (getprop(lw~"buffer-loop-flag") ==1) {settimer( func {buffer_loop(index)}, 0);} return;}
# don't process the buffer if a tile call is writing clouds into the scenery
if (getprop(lw~"tmp/thread-status") == "placing")
{if (getprop(lw~"buffer-loop-flag") ==1) {settimer( func {buffer_loop(index)}, 0);} return;}
# lock the system status for buffer operations and get flags
setprop(lw~"tmp/buffer-status", "placing");
var asymmetric_buffering_flag = getprop(lw~"config/asymmetric-buffering-flag");
if (asymmetric_buffering_flag ==1)
{
var buffering_angle = getprop(lw~"config/asymmetric-buffering-angle-deg");
var buffering_reduction = getprop(lw~"config/asymmetric-buffering-reduction");
var current_heading = getprop("orientation/heading-deg");
}
# now process the buffer
if (index > n_max-1) {index = 0;}
var i_max = index + n;
if (i_max > n_max) {i_max = n_max;}
for (var i = index; i < i_max; i = i+1)
{
var c = cloudBufferArray[i];
# check if the cloud is still part of an active tile, if not remove from buffer
var flag = 0;
for (var j = 0; j < s; j = j+1)
{
if (active_tile_list[j] == c.index) {flag = 1; break;}
}
if (flag == 0)
{
cloudBufferArray = delete_from_vector(cloudBufferArray,i);
i = i -1; i_max = i_max - 1; n_max = n_max - 1;
continue;
}
# if wind drift is on, move the cloud
if (local_weather.dynamics_flag == 1)
{
c.move();
}
# check distance and decide if the cloud should be created
var d = c.get_distance();
var d_comp = cloud_view_distance + 1000.0;
if (asymmetric_buffering_flag == 1)
{
var dir = c.get_course();
var angle = abs(dir-current_heading);
if ((angle > 180.0 - 0.5 * buffering_angle) and (angle < 180 + 0.5 * buffering_angle))
{
d_comp = buffering_reduction * d_comp;
}
}
if (d < d_comp) # insert the cloud into scenery and delete from buffer
{
compat_layer.buffered_tile_index = c.index;
if (local_weather.dynamics_flag == 1) # assemble the current tile coordinates for insertion into quadtree
{
for (var j = 0; j < 9; j=j+1)
{
if (getprop(lw~"tiles/tile["~j~"]/tile-index") == c.index)
{
compat_layer.buffered_tile_latitude = getprop(lw~"tiles/tile["~j~"]/latitude-deg");
compat_layer.buffered_tile_longitude = getprop(lw~"tiles/tile["~j~"]/longitude-deg");
compat_layer.buffered_tile_alpha=getprop(lw~"tiles/tile["~j~"]/orientation-deg");
break;
}
}
}
if ((c.type !=0) and (local_weather.dynamics_flag == 1)) # set additional info for Cumulus clouds
{
compat_layer.cloud_mean_altitude = c.alt - c.rel_alt;
compat_layer.cloud_flt = c.flt;
compat_layer.cloud_evolution_timestamp = c.evolution_timestamp;
}
compat_layer.create_cloud(c.path, c.lat, c.lon, c.alt, c.orientation);
n_cloudSceneryArray = n_cloudSceneryArray +1;
cloudBufferArray = delete_from_vector(cloudBufferArray,i);
i = i -1; i_max = i_max - 1; n_max = n_max - 1;
deleted_flag = 1;
}
} # end for i
# unlock the system status for buffer operations
setprop(lw~"tmp/buffer-status", "idle");
if (getprop(lw~"buffer-loop-flag") ==1) {settimer( func {buffer_loop(i)}, 0);}
}
###############################
@ -1264,14 +1133,6 @@ if ((n_max == 0) and (m_max == 0)) # nothing to do, loop over
# parse the flags
var asymmetric_buffering_flag = getprop(lw~"config/asymmetric-buffering-flag");
if (asymmetric_buffering_flag ==1)
{
var buffering_angle = getprop(lw~"config/asymmetric-buffering-angle-deg");
var buffering_reduction = getprop(lw~"config/asymmetric-buffering-reduction");
var current_heading = getprop("orientation/heading-deg");
}
# now process the Scenery array
@ -1299,32 +1160,6 @@ for (var i = index; i < i_max; i = i+1)
n_cloudSceneryArray = n_cloudSceneryArray -1;
continue;
}
var d = c.get_distance();
var alt = c.get_altitude();
d_comp = cloud_view_distance + 1000.0;
if (asymmetric_buffering_flag == 1)
{
var dir = c.get_course();
var angle = abs(dir-current_heading);
if ((angle > 180.0 - 0.5 * buffering_angle) and (angle < 180 + 0.5 * buffering_angle))
{
d_comp = buffering_reduction * d_comp;
}
}
if ((d > d_comp) and (alt < 20000.0))
{
append(cloudBufferArray,c.to_buffer());
cloudSceneryArray = delete_from_vector(cloudSceneryArray,i);
i = i -1; i_max = i_max - 1; n_max = n_max - 1;
n_cloudSceneryArray = n_cloudSceneryArray -1;
continue;
}
}

View file

@ -100,9 +100,11 @@ calc_geo(blat);
# first weather info for tile center (lat, lon, visibility, temperature, dew point, pressure)
local_weather.set_weather_station(blat, blon, alt_offset, 30000.0, 14.0, 12.0, 29.78);
local_weather.set_weather_station(blat, blon, alt_offset, 45000.0, 14.0, 12.0, 29.78);
alt_offset = 0.0;
#alt_offset = 0.0;
var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft");
#var strength = 0.5;
#local_weather.create_cumosys(blat,blon, 3000.0, get_n(strength), 20000.0);
@ -115,8 +117,8 @@ alt_offset = 0.0;
#create_4_8_cirrostratus_patches(blat, blon, 5000+alt_offset, alpha) ;
#create_4_8_cirrocumulus_streaks(blat, blon, 10000.0 + alt_offset, alpha);
# create_4_8_alttstratus_streaks(blat, blon, 5000+alt_offset, alpha) ;
# create_4_8_alttstratus_streaks(blat, blon, 5000+alt_offset, alpha) ;
#create_4_8_alttstratus_streaks(blat, blon, 5000+alt_offset, alpha) ;
#create_4_8_alttstratus_streaks(blat, blon, 5000+alt_offset, alpha) ;
# create_2_8_cirrocumulus_patches(blat, blon, 13000+alt_offset, alpha) ;
# create_8_8_nimbus_rain(blat, blon, 3000.0, alpha, 0.3) ;
@ -135,16 +137,19 @@ alt_offset = 0.0;
# create_detailed_stratocumulus_bank(blat, blon, 4000,alpha);
local_weather.top_shade = 0.6;
#create_4_8_tstratus_undulatus(blat, blon, 10000.0, alpha);
create_4_8_cumulus_alleys(blat, blon, 3000.0, alpha);
#local_weather.top_shade = 0.9;
#create_4_8_small_cumulus_alleys(blat, blon, 3000.0, alpha);
# create_4_8_cirrostratus_undulatus(blat, blon, 25000.0, alpha);
#store convective altitude and strength
local_weather.set_atmosphere_ipoint(blat, blon, 45000.0, 15000.0, 45000.0, 0.0, 15000.0, 17000.0, 0.8, 12000.0, 17000.0);
var strength=0.5;
local_weather.create_cumosys(blat,blon, 3000.0, get_n(strength), 20000.0);
local_weather.set_atmosphere_ipoint(blat, blon, 45000.0, 3000.0, 45000.0, 0.0, 15000.0, 17000.0, 0.8, 12000.0, 17000.0);
append(weather_dynamics.tile_convective_altitude,3000.0);
@ -210,9 +215,9 @@ if (rand() < small_scale_persistence)
else
{rnd_store = rn;}
# rn = 0.1;
if (rn > 0.875)
if (rn > 0.888)
{
# cloud scenario 1: weak cumulus development and blue thermals
@ -230,9 +235,9 @@ if (rn > 0.875)
}
# 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 + 2500.0);
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, 25000.0, 30000.0, 0.95, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.75)
else if (rn > 0.777)
{
# cloud scenario 2: some Cirrocumulus patches
@ -244,9 +249,9 @@ else if (rn > 0.75)
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 + 2500.0);
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.95, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.625)
else if (rn > 0.666)
{
# cloud scenario 3: Cirrostratus undulatus over weak cumulus
@ -256,10 +261,10 @@ else if (rn > 0.625)
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 + 2500.0);
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.95, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.5)
else if (rn > 0.555)
{
# cloud scenario 4: Cirrostratus undulatus streak
@ -271,7 +276,7 @@ else if (rn > 0.5)
# 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 + 2500.0);
}
else if (rn > 0.375)
else if (rn > 0.444)
{
# cloud scenario 5: Cirrus
@ -284,24 +289,37 @@ else if (rn > 0.375)
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 + 2500.0);
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.95, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.25)
else if (rn > 0.333)
{
# cloud scenario 6: strong Cirrus cover
create_4_8_cirrus(blat, blon, alt + alt_offset + 35000.0, alpha);
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 + 2500.0);
}
else if (rn > 0.125)
else if (rn > 0.222)
{
# cloud scenario 7: clear
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, 1.0, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.111)
{
# cloud scenario 8: Stratiform hazy clouds
local_weather.top_shade = 0.8;
create_2_8_alttstratus(blat, blon, alt+alt_offset, alpha);
local_weather.top_shade = 0.9;
create_4_8_tstratus_undulatus(blat, blon, alt+alt_offset + 4000, 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 +24000.0, alt+alt_offset + 26000.0, 0.9, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.0)
{
# cloud scenario 8: Cirrocumulus
# cloud scenario 9: Cirrocumulus
if (rand() > 0.7) # this is very expensive, so don't do it for every tile
{create_2_8_cirrocumulus_patches(blat, blon, alt + alt_offset + 26000.0, alpha);}
@ -401,7 +419,7 @@ if (rn > 0.875)
}
# 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 + 2500.0);
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.85, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.75)
@ -414,7 +432,7 @@ else if (rn > 0.75)
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 + 2500.0);
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.9, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.625)
@ -433,7 +451,7 @@ else if (rn > 0.625)
# 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 + 2500.0);
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.85, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.5)
@ -446,7 +464,7 @@ else if (rn > 0.5)
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 + 2500.0);
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.85, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.375)
{
@ -474,7 +492,7 @@ else if (rn > 0.25)
{create_2_8_cirrocumulus(blat, blon, alt + alt_offset + 26000.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 +24000.0, alt+alt_offset + 26000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.3, alt+alt_offset +24000.0, alt+alt_offset + 26000.0, 0.85, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.125)
{
@ -579,7 +597,7 @@ if (rn > 0.9)
# 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);
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.85, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.8)
@ -596,7 +614,7 @@ else if (rn > 0.8)
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);
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.85, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.7)
@ -609,7 +627,7 @@ else if (rn > 0.7)
create_2_8_cirrus(blat, blon, alt + 28000.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.0, alt+alt_offset +20000.0, alt+alt_offset + 22000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
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.85, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.6)
@ -685,7 +703,7 @@ else if (rn > 0.2)
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);
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.85, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.1)
@ -782,10 +800,9 @@ if (rand() < small_scale_persistence)
else
{rnd_store = rn;}
# rn = 0.05;
if (rn > 0.875)
if (rn > 0.888)
{
# cloud scenario 1: low Stratocumulus, thin streaks above
@ -800,7 +817,7 @@ if (rn > 0.875)
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.75)
else if (rn > 0.777)
{
# cloud scenario 2: weak Cumulus, Stratus undulatus above
@ -814,7 +831,7 @@ else if (rn > 0.75)
# 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)
else if (rn > 0.666)
{
# cloud scenario 3: Stratocumulus banks with patches above
@ -826,7 +843,7 @@ else if (rn > 0.625)
# 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.5)
else if (rn > 0.555)
{
# cloud scenario 4: structured Stratus
@ -837,7 +854,7 @@ else if (rn > 0.5)
# 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.375)
else if (rn > 0.444)
{
# cloud scenario 5: Stratus blending with Cumulus with Cirrocumulus above
@ -851,7 +868,7 @@ else if (rn > 0.375)
# 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.250)
else if (rn > 0.333)
{
# cloud scenario 6: small Stratocumulus banks
@ -865,7 +882,7 @@ else if (rn > 0.250)
# 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 if (rn > 0.125)
else if (rn > 0.222)
{
# cloud scenario 7: blended structured and unstructured Stratiform clouds
@ -877,7 +894,7 @@ else if (rn > 0.125)
# 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);
}
else if (rn > 0.0)
else if (rn > 0.111)
{
# cloud scenario 8: Cumulus alleys beneath a high dense stratus cover
@ -890,6 +907,25 @@ else if (rn > 0.0)
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.5, alt+alt_offset +5500.0, alt+alt_offset + 6500.0, 0.65, alt+alt_offset + 6000.0, alt+alt_offset + 7500.0);
}
else if (rn > 0.0)
{
# cloud scenario 9: weak Cumulus benath a high dense stratus cover
local_weather.top_shade = 0.6;
strength = 0.2 + rand() * 0.2;
#local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
var n = int(4000 * strength) * 0.2;
local_weather.cumulus_exclusion_layer(blat, blon, alt+alt_offset, n, 20000.0, 20000.0, alpha, 0.3,1.4 , size(elat), elat, elon, erad);
local_weather.top_shade = 1.0;
create_6_8_stratus(blat, blon, alt+alt_offset + 8000.0,alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset + 8000.0, vis + 15000.0, 0.7, alt+alt_offset +7500.0, alt+alt_offset + 8500.0, 0.65, alt+alt_offset + 8000.0, alt+alt_offset + 9500.0);
}
@ -3184,6 +3220,19 @@ local_weather.create_cumulus_alleys(lat+get_lat(x,y,phi), lon+get_lon(x,y,phi),
}
var create_4_8_small_cumulus_alleys = func (lat, lon, alt, alpha) {
var phi = alpha * math.pi/180.0;
var x = 2.0 * (rand()-0.5) * 5000;
var y = 2.0 * (rand()-0.5) * 5000;
var tri = 1.0 + 0.4 * rand();
local_weather.create_developing_cumulus_alleys(lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt, 0.0, 16, 2300.0,0.2, 400.0, 50 ,800.0, 0.2, 0.0, 500.0, alpha,tri);
}
var create_4_8_cirrus = func (lat, lon, alt, alpha) {