1
0
Fork 0

Thorsten Renk: local weather 1.18

fixes for a couple of issues, some improved textures/cloud model changes,
smooth instead of hard visibility transitions, updated documentation.
Also removed 'Test' entries from the menu.
(ThorstenB: Also cleaned-up Docs/ folder, moving local weather
documentation images to sub folder).
This commit is contained in:
ThorstenB 2011-07-03 23:39:01 +02:00
parent 169bc757b6
commit 0ece95127c
45 changed files with 345 additions and 230 deletions

View file

@ -1,20 +0,0 @@
This package contains the local weather AI scenarios 'local_weather_thunderstorm' and 'local_weather_cirrus'. Currently they populate the sky over San Francisco either with a thunderstorm or a Cirrus/Cirrocumulus sky. The thunderstorm comes with dynamical weather effects - rain, snow, turbulence and lightning inside the cloud tower. The packages contain more cloud models and textures than are actually needed in the scenarios, the scenarios are just to demonstrate what can be done using local weather AI models.
Known issues:
* AI model clouds seem to interfere with the standard layered clouds, thus for best effect any layered clouds need to be off - a low 3-d Cumulus layer on the other hand works well.
* Currently, the Cirrus and Cirrocumulus cloud models use the Aircraft AI system. Presumably, this (dependent on visibility) leads to their sudden (dis-)appearance, and a better solution should be found.
* The shading of the Cirrus clouds is imperfect - real Cirrus clouds appear to glow when the sund shines through them, caused by the dominance of forward scattering of light on the ice crystals of the cloud. This can be modelled setting emis 1 1 1 in the materials section of the 3-d model, however then the clouds also shine white at night. I have no good solution at present.
* The Nasal script of the thunderstorm sometimes crashes for no reason I could reproduce - pointers to fix that are welcome!
The package should be extracted in the Flightgear root directory.
The package is developed and tested using Flightgear 1.9.1, it may or may not work properly on other versions.
Thorsten Renk, Feb. 2010

View file

@ -1,13 +1,13 @@
<html>
<head>
<title>Local Weather </title>
</head>
<html>
<head>
<title>Local Weather </title>
</head>
<body>
<h1>Local Weather Package - v1.1</h1>
<h1>Local Weather Package - v1.18</h1>
<h2>1. Introduction</h2>
@ -15,20 +15,20 @@ The aim of a local weather system is to simulate weather phenomena tied to speci
This is in contrast to the current (v.2.0.0) global weather system of Flightgear where weather changes affect the weather everywhere in the simulated world and are (with few exceptions) not tied to specific locations. In such a system, it is impossible to observe e.g. the approach of a rainfront while flying in sunshine.<p>
The local weather package aims to provide the functionality to simulate such local phenomena. In version 1.1, the package supplies various cloud placement algorithms, as well as local control over most major weather parameters (wind, visibility, pressure, temperature, rain, snow, thermal lift, turbulence...) through interpolation routines and effect volumes. The dynamics of the different systems is tied together - for instance clouds and weather effects drift in the specified wind field. The package also contains a fairly detailed algorithm to generate convective clouds and thermals with a realistic distribution over the various terrain types. There is a simulation of the interaction of the convective cloud system with the terrain as a function of time. Clouds drifting in the wind flow over obstacles, i.e. they change their altitude dynamically. Convection is implemented with a life cycle model of Cumulus clouds - they are generated, evolve for a given lifetime dependent on the underlying terrain and decay at the end of their life cycle. Thermals associated with the clouds follow the same pattern. In particular, in the presence of wind favourable spots for convection generate 'alleys' of dense cloud cover downwind, or thermals and clouds generated over land decay rapidly once they reach open water.<p>
The local weather package aims to provide the functionality to simulate such local phenomena. In version 1.18, the package supplies various cloud placement algorithms, as well as local control over most major weather parameters (wind, visibility, pressure, temperature, rain, snow, thermal lift, turbulence...) through interpolation routines and effect volumes. The dynamics of the different systems is tied together - for instance clouds and weather effects drift in the specified wind field. The package also contains a fairly detailed algorithm to generate convective clouds and thermals with a realistic distribution over the various terrain types. There is a simulation of the interaction of the convective cloud system with the terrain as a function of time. Clouds drifting in the wind flow over obstacles, i.e. they change their altitude dynamically. Convection is implemented with a life cycle model of Cumulus clouds - they are generated, evolve for a given lifetime dependent on the underlying terrain and decay at the end of their life cycle. Thermals associated with the clouds follow the same pattern. In particular, in the presence of wind favourable spots for convection generate 'alleys' of dense cloud cover downwind, or thermals and clouds generated over land decay rapidly once they reach open water.<p>
For long-range flights, the system provides an offline weather system with plausible transitions between different large-scale weather patterns like fronts and low and high pressure areas, as well as the optional use of live METAR data. <p>
<h2>2. Installation</h2>
The package needs to be unpacked in the Flightgear root directory. It writes content into the <i>Nasal/, gui/, gui/dialogs/, Shaders, Effects/, Docs/</i>, <i>Environment/</i> and <i>Models/Weather/</i> subdirectories. The installation does not overwrite any of the default Flightgear files, but to be accessible from the menu for Flightgear 2.0.0, one must copy <i>gui/menubar.xml.alt</i> to the default <i>menubar.xml</i> or copy the three lines of the environemnt menu calling <i>local_weather</i>, <i>local_weather_tiles</i> and <i>local_weather_config</i> into the default file. More recent versions of Flightgear already provide the necessary menu items. In order to read in the default menu entries, the line <b>&#60;local-weather include="Environment/local-weather-defaults.xml"/&#62;</b> needs to be added to the file <i>preferences.xml</i>.<p>
The package needs to be unpacked in the Flightgear root directory. It writes content into the <i>Nasal/local_weather/, gui/, gui/dialogs/, Shaders, Effects/, Docs/</i>, <i>Environment/</i> and <i>Models/Weather/</i> subdirectories. The package requires run-time loadable Nasal submodule functionality and is not compatible with 2.0.0.<p>
This adds the items <i>Local Weather</i>, <i>Local Weather Tiles</i> and <i>Local Weather Config</i> to the <i>Environment</i> menu when Flightgear is up. Most of the basic functionality is contained in <i>local_weather.nas</i> which is loaded at startup and identifies itself with a message. A compatibility layer (<i>compat_layer.nas</i>) tests for hard-coded support and ensures that, dependent on the version, hard-coded or Nasal-coded fallback functions are used.<p>
This adds the items <i>Local Weather</i> and <i>Local Weather Settings</i> to the <i>Environment</i> and <i>Local Weather (test)</i> to the <i>Debug</i> menu when Flightgear is up. Most of the basic functionality is contained in <i>local_weather.nas</i> which is loaded at startup and identifies itself with a message. A compatibility layer (<i>compat_layer.nas</i>) tests for hard-coded support and ensures that, dependent on the version, hard-coded or Nasal-coded fallback functions are used.<p>
The Local Weather Nasal modules need to be loaded at runtime using the checkbox in <i>Environment/Local Weather Settings</i>, but once this is specified, the setting is remembered and the package will be automatically loaded upon startup. Unless asked to do so from the menu, Local Weather does <b>not</b> run any process in the background. Upon loading, the package does not set any properties already existing, but only generates properties necessary for the menu entries in its own subdirectory <i>/local-weather/</i> in the tree. The package also does a features check on startup if particular functions are available in hard-coded form. If the features are not present, the package will largely still function properly using slower Nasal fallback code.<p>
Unless asked to do so from the menu, local weather does <b>not</b> run any process in the background. Upon loading, the package does not set any properties already existing, but only generates properties necessary for the menu entries in its own subdirectory <i>/local-weather/</i> in the tree. The package also does a features check on startup if particular functions are available in hard-coded form. If the features are not present, the package will largely still function properly using slower Nasal fallback code.<p>
In order to use the hard-coded terrain presampling routines, it is currently necessary to add the line <b> --prop:/environment/terrain/area[0]/enabled=1</b> to the Flightgear commandline. If this is not done, the system will use the slower fallback routines.<p>
<h2>3. Functionality</h2>
@ -36,10 +36,10 @@ The general rule is that the gui is not hardened against problematic user input,
Cloud placement calls may sometimes take a significant time to execute especially for large numbers of clouds tied in a complicated way to the terrain. Placing 500 barrier clouds against a small barrier may take a minute to compute. During this time, a reduced framerate is to be expected<p>
The first menu <b>Local Weather</b> contains the low level cloud placement functions. Its purpose is mainly for developing cloud patterns without having to resort to re-type the underlying Nasal code every time. Currently five options are supported: <i>Place a single cloud</i>, <i>Place a cloud streak</i>, <i>Start the convective system</i>, <i>Create barrier clouds</i> , <i>Place a cloud layer</i> and <i>Make a cloudbox</i>.<p>
The menu item <i>Debug/Local Weather (Test) </i> contains the low level cloud placement functions. Its purpose is mainly for developing cloud patterns without having to resort to re-type the underlying Nasal code every time. Currently five options are supported: <i>Place a single cloud</i>, <i>Place a cloud streak</i>, <i>Start the convective system</i>, <i>Create barrier clouds</i> , <i>Place a cloud layer</i> and <i>Make a cloudbox</i>.<p>
<center>
<img src="menu1.jpg">
<img src="img/menu1.jpg">
</center><p>
<h3>Single cloud placement</h3>
@ -59,7 +59,7 @@ The pattern can then be randomized in x, y and altitude. Basically, specifying n
The convective system places Cumulus clouds centered on the current position based on the underlying terrain. Currently it models daily variation of convective strength and the latitude variation based on a simple sinusoidal model (i.e. it produces different results when called in the morning than at noon), but it does not take into account seasonal variation (i.e. it assumes the date to be the equinox). The actual placement is chosen based on the type of the underlying terrain, with Cumulus development more likely over city areas than on water. Details of the algorithm are described in the appendix. The parameters for this need some fine-tuning and are currently rather rough, but they lead for example to pronounced differences between land and sea in coastal regions. The following picture shows the result of a call of the system in the afternoon over TNCM.<p>
<center>
<img src="clouds-cumulus_afternoon.jpg">
<img src="img/clouds-cumulus_afternoon.jpg">
</center><p>
Unless 'Terrain presampling' is active, clouds are placed in a constant altitude <i>alt</i> in a tile with given <i>size</i> where the size measures the distance to the tile border, i.e. a size parameter of 15 km corresponds to a 30x30 km region. When 'Terrain presampling' is selected, the distribution of clouds in altitude is determined by a more complicated algorithm described in the appendix. Clouds are placed with constant density for given terrain type, so be careful with large area placements! <i>strength</i> is an overall multiplicative factor to fine-tune the amount of cloud generation.
@ -69,7 +69,7 @@ Unless 'Terrain presampling' is active, clouds are placed in a constant altitude
The barrier cloud system places a cloud at a random point within the region centered around the current position given by <i>size</i> with some probability if there is a terrain barrier downwind with the elevation <i>alt</i> within a distance <i>dist</i> or less. Cloud placement probability is larger for small distances to the barrier. The system tries to place <i>number</i> clouds and assumes that the wind comes from direction <i>wind</i>. If clouds cannot be placed (because there is no barrier within the specified altitude) the algorithm exits with a warning. The picture illustrates the result for the mountains above Las Vegas.<p>
<center>
<img src="barrier.jpg">
<img src="img/barrier.jpg">
</center><p>
Currently, the algorithm does not check for a barrier upstream - this may change in future versions. The ufo is a good way to explore the results of the algorithm by simply flying to a suitable location and calling it there for a relatively small region. Due to its large performance use, the barrier cloud system is currently not part of the large-scale weather generating system.
@ -83,7 +83,7 @@ If <i>rainflag</i> is set to 1, the system will also place external precipitatio
The picture illustrates the result of a layer generation call for Nimbostratus clouds with precipitation models. <p>
<center>
<img src="clouds-nimbostratus.jpg">
<img src="img/clouds-nimbostratus.jpg">
</center><p>
<h3>Cloudbox</h3>
@ -93,10 +93,10 @@ The cloudbox placement is an experimental routine allowing to define a cloud cor
<h3>Tile placement</h3>
The second menu is used to place complete weather patterns based on low-level calls. It is intended for the user to automatically create the various weather development during flight. Unless stated otherwise, all parameters in this menu are parsed at startup time of local weather only (i.e. when the user selects the <i>OK</i> button, but not while the system runs.<p>
The second menu <i>Environment/Local Weather</i> is used to place complete weather patterns based on low-level calls. It is intended for the user to automatically create the various weather development during flight. Unless stated otherwise, all parameters in this menu are parsed at startup time of Local Weather only (i.e. when the user selects the <i>OK</i> button, but not while the system runs.<p>
<center>
<img src="menu2.jpg">
<img src="img/menu2.jpg">
</center><p>
Weather is created in a series of 40x40 km squares, called tiles. Tiles are classified by airmass, such that the sequence of tiles can describe for example the transition from a high pressure area to a low pressure area. The dropdown menu is used to select the type of weather tile to build initially and to determine the rules according to which subsequent tiles are generated. <p>
@ -129,13 +129,13 @@ The slider <i>Thermal properties</i> is mainly relevant for soaring scenarios. I
The difference is apparent from the following pictures: Smooth and well-formed clouds characteristic of a calm day:<p>
<center>
<img src="detailed_clouds04.jpg">
<img src="img/detailed_clouds04.jpg">
</center><p>
Rough clouds characteristic of windshear and more turbulent conditions:<p>
<center>
<img src="detailed_clouds05.jpg">
<img src="img/detailed_clouds05.jpg">
</center><p>
As for the buttons, <i>OK</i> starts the local weather system with the selected options (note that almost all options in this menu are startup-time options, they are read once and changing them without restarting the system will not affect the behaviour of the system). <i>Clear/End</i> clears all clouds and ends all local weather functionality - the button brings the system back into the state before it was started. No loops or other subroutines are executed after the button is pressed. <i>Close</i> closes the dialog without starting the system.<p>
@ -143,7 +143,7 @@ As for the buttons, <i>OK</i> starts the local weather system with the selected
The button <i>Show winds</i> brings up the detailed wind menu which is needed for the wind models <i>aloft interpolated</i> and <i>aloft waypoints</i> when not in <i>METAR</i> mode:<p>
<center>
<img src="menu3.jpg">
<img src="img/menu3.jpg">
</center><p>
For <i>aloft interpolated</i>, the menu is used by inserting wind direction and speed for all given altitudes. After <i>OK</i>, the specified values are used. For <i>aloft waypoints</i>, the same info must be supplied for a series of waypoints. First, the latitude and longitude has to be inserted, afterwards the aloft winds for that point below. The button <i>Set waypoint</i> commits the windfield as specified in the menu for this position into memory. For orientation, the number of points inserted is counted on the lower right. <i>Clear Waypoints</i> removes all information entered so far. Note that <i>OK</i> does not commit the data for a waypoint. Entering a windfield in this way by hand is rather cumbersome, but may be useful occasionally - the main purpose of the wind model however is to work with live weather data.<p>
@ -154,11 +154,11 @@ For <i>aloft interpolated</i>, the menu is used by inserting wind direction and
The following pictures show possible results of tile setups 'High-pressure-border' and 'Low-pressure':<p>
<center>
<img src="high_pressure_border.jpg">
<img src="img/high_pressure_border.jpg">
</center><p>
<center>
<img src="low_pressure.jpg">
<img src="img/low_pressure.jpg">
</center><p>
<h3>Performance settings</h3>
@ -166,14 +166,16 @@ The following pictures show possible results of tile setups 'High-pressure-borde
The performance setting menu is available from the main menubar. It controls the allocation of system resources to the various tasks, as well as the behaviour of the offline weather system.<p>
The upper checkbox determines if the Nasal modules corresponding to Local Weather are loaded. Unless this box is checked, no Local Weather code is available and the corresponding other menu items are not functional.<p>
<center>
<img src="menu4.jpg">
<img src="img/menu4.jpg">
</center><p>
The first part controls the creation of new weather tiles, the second part controls the ranges up to which clouds inside a generated weather tile are shown as part of the scenery (clouds created but not shown are stored and processed in a buffer array). Clouds are visible if and only if they are 1) part of a created tile and 2) closer than the buffering range. This is illustrated in the following figure: Tiles are only created if their center is within range, clouds are only visible if the cloud model itself is within range, the resulting region dependent on the two ranges in which clouds are displayed is shown in red.<p>
<center>
<img src="tiles.gif">
<img src="img/tiles.gif">
</center><p>
From this, it is apparent that the two ranges should not be drastically different. Setting tile creation range to 55 km implies lots of work trying to asses the properties of faraway terrain to generate suitable cloud distributions, setting the buffering range to 15 km means that most of these clouds are never visible. Note that in low visibility, a large tile creation range can be problematic, as Flightgear may not have loaded the terrain. Note also that setting the tile creation range above 40 km means a slow startup of the system, as it needs to create 5 tiles on startup instead of just a single one.<p>
@ -192,19 +194,19 @@ Inside each tile, there are typically 4-8 different basic cloud patterns (distri
<h2>4. Cloud models</h2>
The package contains a number of different cloud models, both static ones for Cirrus and Cirrocumulus clouds as well as rotated ones for Altocumulus, Cirrostratus, Cumulus, Cumulonimbus, Stratus and Nimbostratus cloudlet models. Neither the cloud textures, nor the models nor the transformations are perfected, and any aspect can be improved, albeit at the cost of performance consumption.<p>
The package contains a number of different cloud models, both static ones for Cirrus and Cirrocumulus clouds as well as rotated ones for Altocumulus, Cirrostratus, Cumulus, Cumulonimbus, Stratus and Nimbostratus cloudlet models. Thin high-altitude haze such as characteristic for Cirrostratus or Altostratus clouds is approximated by colouring the skydome as a function of altitude. Neither the cloud textures, nor the models nor the transformations are perfected, and any aspect can be improved, albeit at the cost of performance consumption.<p>
Static clouds project textures onto curved sheets into the sky. The advantage of the technique is that cloud layers consisting of thousands of cloudlets with different sizes can be modelled. However, the sheets do not look equally well from all perspectives and somewhat unrealistic from close up.<p>
<center>
<img src="clouds-static.jpg">
<img src="img/clouds-static.jpg">
</center><p>
Rotated cloud models have the advantage that they look much better from close up and hardly unrealistic from any perspective, but the size distribution of cloudlets is somewhat restricted and they use a lot more performance than static clouds.<p>
<center>
<img src="clouds-detailed01.jpg">
<img src="img/clouds-detailed01.jpg">
</center><p>
These are rendered by different techniques. While the default Cumulus models consist of multiple layers rotated around the center of the model, the detailed Cumulus clouds consist of multiple (up to 24) individual cloudlets, rotating each around its own center, randomly distributed into a box with different texture types used for the cloud bottom. This not only improves the visual appearance, but also leads to a more realistic distribution of cloud sizes and shapes in the sky. In addition, when circling below the cloud (as done when soaring) the effect of the cloudlet rotation is less pronounced. The price to pay is that rendering detailed clouds costs more performance, so they may not be suitable for all systems.<p>
@ -212,7 +214,7 @@ These are rendered by different techniques. While the default Cumulus models co
More complex clouds are rendered in sandwitched layers of several different textures. An example are Cumulonimbus towers, which use diffuse textures on the bottom, changing to more structured textures in the upper part of the cloud. With up to 2000 cloudlets, skies with multiple thunderstorms may not render with sufficient framerates on every system.<p>
<center>
<img src="clouds-tropical02.jpg">
<img src="img/clouds-tropical02.jpg">
</center><p>
The general problem is finding a good balance between spending a lot of CPU time to make a single cloud model appear perfect, and the performance degradation that occurs if hundreds of clouds are placed in the sky. The basic aim is to provide realistic appearance for clouds from a standard view position (in cockpit looking forward), to retain acceptable appearance from other positions and to allow large cloud layers.<p>
@ -235,6 +237,14 @@ While the station concept is designed to support easy connection with weather up
Technically, the structure of the interpolation system means that while it is running, neither setting weather parameters in the GUI menu nor changing visibility using the <i>z</i>-key will have an effect - any setting made there will be overwritten by the interpolation loop periodically, and local weather needs to be stopped before such changes have an effect. <p>
In addition to true weather parameters, Local Weather 1.18 also has a model for the light propagation in the atmosphere which is handled by the same interpolation routines. This model determines the amount of light reaching the current altitude and the amount of thin haze above the current position. The first property affects to what color distant objects fade - when there is lots of light available, faraway objects appear white, however in the presence of cloud layers casting shadows, distant objects fade into dark shapes. The following screenshot illustrates the effect:
<center>
<img src="img/lightning-gloom.jpg">
</center><p>
The second property is used to simulate diffuse structureless Cirrostratus and Altostratus clouds. Details of the modelling are given in the appendix.
<h3>Weather parameters in effect volumes</h3>
Effect volumes are 3-dim regions in space in which the weather is not set by the interpolation system but by a specific prescription. This can be to either set a parameter to a constant value inside the volume, or to specify it as a function inside the volume. Effect volume settings always override information from the interpolation subsystem.<p>
@ -242,7 +252,7 @@ Effect volumes are 3-dim regions in space in which the weather is not set by the
Effect volumes may be nested, and they may overlap. The rules determining their behaviour can be summarized as follows: 1) there is no cross-talk between weather parameters, i.e. an effect volume specifying visibility is never influenced by one specifying pressure, regardless if they overlap or not. 2) when an effect volume is entered, its settings overwrite all previous settings 3) when an effect volume is left, the settings are restored to what the interpolation routine specifies if no other effect volumes influence the weather parameter, to the values as they were on entering the volume when the number of active volumes has not changed between entering and leaving the volume (i.e. when volumes are nested) or nothing happens if the number of active volumes has increased (i.e. when volumes form a chain). This is illustrated in the following figure:<p>
<center>
<img src="effect_nesting.gif">
<img src="img/effect_nesting.gif">
</center><p>
Volumes 2 and 3 are nested inside volume 1, therefore all settings of 2 overwrite those of 1 when 2 is entered and are restored to 1 when region 2 is left directly into 1. Region 4 is a chain, and as such ill defined: When one leaves 2 into 4, the settings of volume 3 are used (because later definitions overwrite earlier ones). When one now leaves 4 into 3 (and hence leaves 2), it would be wrong to restore to the values on entry of 2 (i.e. the properties of 1), as 3 is still active. But the active volume count has changed, so leaving 4 into 3 does not lead to any changes. The reason why 4 is still ill-defined is that what weather is encountered in 4 depends on the direction from which it is entered - when it is entered from 2, it has the properties of 3, whereas when it is entered from 3, it has the properties of 2. <p>
@ -253,7 +263,7 @@ Effect volumes are always specified between a minimum and a maximum altitude, an
where <i>geometry</i> is a flag (1: circular, 2: elliptical and 3: rectangular), <i>lat</i> and <i>lon</i> are the latitude and longitude, <i>r1</i> and <i>r2</i> are the two size parameters for the elliptic or rectangular shape (for the circular shape, only the first is used), <i>phi</i> is the rotation angle of the shape (not used for circular shape), <i>alt_low</i> and <i>alt_high</i> are the altitude boundaries, <i>vis, rain, snow, turb</i> and <i>lift</i> are weather parameters which are either set to the value they should assume, or to -1 if they are not to be used, or to -2 if a function instead of a parameter is to be used and -3 if a function for wave lift is used. Since thermal lift can be set to negative values in a sink, a separate flag is provided in this case. <i>sat</i> finally determines the light saturation, a parameter between 0 (dark) and 1 (normal light) - it can be used to dim the light beneath cloud layers (which is not done automatically as objects don't cast shades in Flightgear, and given that most cloud models are rotated, their shade would look rather odd on any case).<p>
In version 1.1, thermal lift and wave lift are implemented by function (wave lift is not yet automatically placed, but can be easily from Nasal). There is no easy way to implement any weather parameter by function in an effect volume, as this requires some amount of Nasal coding.<p>
In version 1.18, thermal lift and wave lift are implemented by function (wave lift is not yet automatically placed, but can be easily from Nasal). There is no easy way to implement any weather parameter by function in an effect volume, as this requires some amount of Nasal coding.<p>
Both thermal lift and saturation require a more recent version of Flightgear than 2.0.0 in order to take effect.<p>
@ -332,7 +342,13 @@ The first important call sets up the conditions to be interpolated:<p>
<i>set_weather_station(latitude, longitude, visibility-m, temperature-degc, dewpoint-degc, pressure-sea-level-inhg);</i><p>
The cloud placement calls should be reasonably familiar, as they closely resemble the structure by which they are accessible from the 'Local Weather' menu.<p>
The atmosphere light propagation needs to be prepared as well by a call<p>
<i>set_atmosphere_ipoint(latitude, longitude, vis_aloft, vis_alt_aloft, vis_overcast, overcast,overcast_alt_low, overcast_alt_high, scattering, scattering_alt_low, scattering_alt_high);</i><p>
The meaning of these parameters is as follows: Visibility is linearly interpolated in altitude between several altitudes: the ground value is given in the weather station call. <i>vis_aloft</i> determines the visibility after passing the lowest inversion layer (i.e. usually the lowest cloud layer altitude) where the visibility suddenly increases. The altitude of the transition is given by <i>vis_alt_aloft</i>. The visibility higher up is determined by high-altitude haze, i.e. it takes the value <i>vis_overcast</i> at the position <i>overcast_alt_high</i> (the upper edge of the haze layer) and increases with constant rate from there. The amount of high-altitude haze is given by <i>overcase</i>, a number between 0 and 1, and the position of the layer is determined by <i>overcast_alt_low</i> and <i>overcast_alt_high</i>. Above the second value, the skydome is no longer coloured. Finally, <i>scattering</i> determines the amount of light reaching the surface (between 0 and 1, reasonable values range from 0.5 to 1) and the following altitudes specify where the layers casting shadow are found - there is always the full amount of light available above <i>scattering_alt_high</i>. See the appendix for details of the model.<p>
The cloud placement calls should be reasonably familiar, as they closely resemble the structure by which they are accessible from the 'Local Weather (Test)' menu.<p>
If the cloud layer has an orientation, then all placement coordinates should be rotated accordingly. Similarly, each placement call should include the altitude offset. Take care to nest effect volumes properly where possible, otherwise undesired effects might occur...<p>
@ -367,9 +383,9 @@ With default settings, the local weather package generates a 40x40 km weather ti
<li> Some cloud textures have artefacts, rain textures have too sharp boundaries and in general some things could look better. Please don't complain, but rather get me good photographs of the sky, cloud texture files or create better AC3D cloud models. I will eventually improve texture quality, but it's not high up in the to-do list, and the cloud model files are openly accessible for anyone with an editor.<p>
<li> Rain and snow may not start properly. For me, rain is only generated when I switch 'Shader effects' on and off in the menu on startup, otherwise neither moving the menu slider nor entering an effect volume generate rain. This seems to be a bug of some Flightgear versions, not of the local weather system.<p>
<li> [2.0.0] Rain and snow may not start properly. For me, rain is only generated when I switch 'Shader effects' on and off in the menu on startup, otherwise neither moving the menu slider nor entering an effect volume generate rain. This seems to be a bug of some Flightgear versions, not of the local weather system.<p>
<li> Especially with multiple overcast layers and weather fronts, loading and unloading weather tiles may take a long time / cause severe drops in framerate. It seems that a dual core processor is very valuable with this particular issue - try switching multiprocessor support on if needed, otherwise please refer to performance tuning to solve such problems. In more recent versions of Flightgear, an activated texture cache improves performance dramatically. In general, overcast layers and tropical weather tiles do require a system on the high end of the performance scale to render properly.<p>
<li> [2.0.0] Especially with multiple overcast layers and weather fronts, loading and unloading weather tiles may take a long time / cause severe drops in framerate. It seems that a dual core processor is very valuable with this particular issue - try switching multiprocessor support on if needed, otherwise please refer to performance tuning to solve such problems. In more recent versions of Flightgear, an activated texture cache improves performance dramatically. In general, overcast layers and tropical weather tiles do require a system on the high end of the performance scale to render properly.<p>
<li> The local weather package is able to occasionally trigger errors like 'Warning:: Picked up error in TriangleIntersect'. These seem to be a problem in the core Flightgear code - the package does nothing but placing normal (rather simple) AC3D models into the scenery.<p>
@ -377,7 +393,7 @@ With default settings, the local weather package generates a 40x40 km weather ti
<li> [2.0.0] To smooth out changes in wind settings, rather than producing a sudden gust, the wind is changed over about 1 second. In sharp wind gradients, this produces a series of ripples like turbulence. This is actually a realistic behaviour in this situation and hence left as it is. Some systems seem to take an unreasonable effort to reinit the environment (as must be done to set wind) - here the function call <i>setWindSmoothly()</i> in <i>local_weather.nas</i> should perhaps be replace by <i>setWind</i> to ease the load.<p>
<li> Large tile creation distances can cause problems in low visibility weather, because Flightgear loads terrain only if it is within visual range. Thus, trying to sample the terrain for a tile 55 km away in 8 km visibility doesn't work because the terrain elevation and altitude is not known. This may cause improper placement of clouds - chiefly convective clouds, but also layered clouds may not appear on the proper altitude. Currently, there is a limit which restricts tile loading range to 3 times the visibility, but presumably a better solution can be found.<p>
<li> [2.0.0] Large tile creation distances can cause problems in low visibility weather, because Flightgear loads terrain only if it is within visual range. Thus, trying to sample the terrain for a tile 55 km away in 8 km visibility doesn't work because the terrain elevation and altitude is not known. This may cause improper placement of clouds - chiefly convective clouds, but also layered clouds may not appear on the proper altitude. Currently, there is a limit which restricts tile loading range to 3 times the visibility, but presumably a better solution can be found.<p>
<li> Using the 'aloft interpolated' wind option, it is possible to turn the wind direction sharply over a small distance (for example, one may turn the wind by 90 degrees from one tile to the next). Such sharp wind changes are (in most situations) unphysical, and they may cause problems for local weather because they rotate the coordinate system to a degree that the neighbouring tile may not be identified correctly. In essence, the system may not generate new tiles because the nearest tile is still the last generated one. The system largely tries to detect the problem and compensate, but occasionally this may be an issue.<p>
@ -386,6 +402,10 @@ With default settings, the local weather package generates a 40x40 km weather ti
<li> [2.0.0] No support for live weather data.<p>
<li> [2.0.0] No change of light saturation. <p>
<li> Currently, the light conditions need to be changed globally. This works fine for an 8/8 overcast layer, as there is little light on the ground, the light increases during the layer transition and is full above the layer. However, the effect is less than perfect for broken layers, as one can observe the ground during descent getting darker. A full solution to the problem would be (computationally rather demanding) individual cloud shadows rather than an average shading of the whole terrain, but as it stands, this is currently not feasible.
</ul>
<h2><a name="appendix_A">Appendix A: An introduction to the algorithms</a></h2>
@ -411,37 +431,37 @@ The following series of pictures, taken over KLSV (Nellis AFB, Las Vegas) illust
At 7:00 am, the thermal activity is weak, and there is no lift available in thermals yet.<p>
<center>
<img src="./KLSV-7_00.jpg">
<img src="img/./KLSV-7_00.jpg">
</center><p>
Some activity starts around 10:00 am the average available lift is 0.3 m/s, the more active clouds tend to be above city terrain.
<center>
<img src="KLSV-10_00.jpg">
<img src="img/KLSV-10_00.jpg">
</center><p>
At 12:00 noon, the maximal cloud number is reached. The average available lift is 1 m/s, in peaks up to 2 m/s.
<center>
<img src="KLSV-12_00.jpg">
<img src="img/KLSV-12_00.jpg">
</center><p>
The maximum of lift strength is reached close to 15:00 pm. The average lift is now 1.5 m/s, in peaks up to 3 m/s, and the strong convection leads to beginning overdevelopment, some clouds reach beyond the first inversion layer and tower higher up. At this point, the clouds may also overdevelop into a thunderstorm (which is not modelled explicitly by the convective algorithm as it requires somewhat different modelling, but is taken into account in the weather tiles).<p>
<center>
<img src="KLSV-15_00.jpg">
<img src="img/KLSV-15_00.jpg">
</center><p>
At 17:30 pm, the lift is still strong, 1.5 m/s on average and 2.5 m/s in peaks, but compared with the situation at noon, there are fewer clouds with stronger lift.<p>
<center>
<img src="KLSV-17_30.jpg">
<img src="img/KLSV-17_30.jpg">
</center><p>
At sunset around 19:00 pm, the number of clouds decreases quickly, but there is still a lot of residual thermal energy (the ground has not cooled down yet), therefore thermal lift of on average 1 m/s is still available even without solar energy input.
<center>
<img src="KLSV-19_00.jpg">
<img src="img/KLSV-19_00.jpg">
</center><p>
While not accurate in every respect, the model works fairly well to reproduce the actual time dependence of convective clouds and thermal lift during the day.<p>
@ -459,7 +479,7 @@ A cloud field is initialized with fractional lifetimes randomly distributed betw
The model of the distribution of lift inside a thermal is quite complex. <p>
<center>
<img src="thermal_lift.gif">
<img src="img/thermal_lift.gif">
</center><p>
Vertically, is is characterized in addition to height and radius by two parameters, 'coning' and 'shaping', which make it cone-shaped and wasp-waisted. From zero to 200 m above ground, the lift is smoothly fading in, above the cloudbase it is smoothly faded out to zero at 10% above the nominal altitude. Horizontally, there is an outer ring where the air becomes turbulent, followed by a region of sink which in turn is followed by the inner core of lift.<p>
@ -467,7 +487,7 @@ Vertically, is is characterized in addition to height and radius by two paramete
The distribution of lift and sink is time dependent.
<center>
<img src="thermal_lift_time.gif">
<img src="img/thermal_lift_time.gif">
</center><p>
In a young thermal, lift starts to develop from the ground, sink is initially absent. When the lift reaches the cloudbase, sink starts to develop from the ground and rises up as well. Only in a mature thermal are sink and lift in equilibrium. When the thermal starts to decay, lift initially decays from the ground upward, till it reaches the cloudbase. At this time the cap cloud dissolves. For a time there is a residual distribution of sink decaying from bottom to top till the thermal evolution is over and the thermal (and the associate turbulence field) is removed.<p>
@ -481,7 +501,7 @@ In nature, what determines the altitude of various clouds are the properties of
In the algorithm, various proxies for the structure of air layers and hence the condensation altitude are used. It is assumed that air layers must follow the general slope of the terrain (because there is nowhere else to go), but can (at least to some degree) flow around isolated obstacles. To get the general layout of the terrain, the algorithm first samples the altitude of an 80x80 km square around the 40x40 weather tile to be created. The choice of a larger sampling area reduces the sensitvity of the outcome to purely local terrain features and prevent pronounced transitions from one tile to the next. The result of this sampling is a distribution of probability to find the terrain at a given altitude:<p>
<center>
<img src="terrain1.jpg">
<img src="img/terrain1.jpg">
</center><p>
For instance, the terrain around Geneva is mostly flat around 1000 ft (where the peak of the distribution lies) with some mountains up to 4500 ft nearby. Based on such distributions, the algorithm next determines the minimum altitude <i>alt_min</i>, the maximum altitude <i>alt_max</i>, the altitude below which 20% of the terrain are found <i>alt_20</i> and the median altitude below which 50% of the terrain are found <i>alt_med</i>.<p>
@ -489,25 +509,25 @@ For instance, the terrain around Geneva is mostly flat around 1000 ft (where the
Cumulus clouds are always placed at a constant altitude above <i>alt_20</i>. This is done to ensure gorges and canyons do not provide a minimum in otherwise flat terrain so that clouds appear down in the gorge as opposed to on the rim where they would naturally occur. Basically, layers are assumed not to trace too fine structures in the terrain, so at least 20% of the terrain are required. In the test case of Grand Canyon, the algorithm correctly places the clouds at rim altitude rather than down in the canyon:
<center>
<img src="cloud_altitude_02.jpg">
<img src="img/cloud_altitude_02.jpg">
</center><p>
However, convective clouds are given some freedom to adjust to the terrain. The maximally possible upward shift is given by <i>alt_med - alt_20</i>. This is based on the notion that above <i>alt_med</i>, the terrain is not a significant factor any more because the air can simply flow around any obstacle. However, this maximal shift is not always used - if the cloud is placed far above the terrain in the first place, it would not follow the terrain much. Thus, a factor of <i>1000 ft / altitude above terrain</i>, required to be between 0 and 1, modifies the shift. As a result, a cloud layer placed high above the terrain has no sensitivity to terrain features. The result of this procedure is that clouds show some degree of following terrain elevation, as seen here in Grenoble<p>
<center>
<img src="cloud_altitude_03.jpg">
<img src="img/cloud_altitude_03.jpg">
</center><p>
but they do not follow all terrain features, especially not single isolated peaks as seen here at the example of Mt. Rainier:
<center>
<img src="cloud_altitude_01.jpg">
<img src="img/cloud_altitude_01.jpg">
</center><p>
Finally, layered clouds have essentially no capability to shift with terrain elevation. Moreover, they are caused by large-scale weather processes, hence they do not usually shift upward over even large mountain massives. Currently, the model places them at <i>0.5 * (alt_min + alt_20)</i> base altitude in order to retain, even in mountains, the sensitivity to the flat terrain surrounding the massiv. usually this works well, but may have a problem with gorges in flat terrain. The following picture shows a Nimbostratus layer close to Grenoble:<p>
<center>
<img src="cloud_altitude_04.jpg">
<img src="img/cloud_altitude_04.jpg">
</center><p>
<h3>The offline large scale weather pattern</h3>
@ -517,7 +537,7 @@ The local weather package generates semi-plausible weather changes even in the a
Weather tiles are classified chiefly by air pressure. What is currently in the models are three classes for a low pressure system, four different classes for the system of weather fronts and airmasses spiralling into the low pressure system and three classes for a hugh pressure system. The general rule is that low pressure tiles contain layered clouds, overcast skies and rain whereas the high pressure tiles contain clear skies and few convective clouds. The topology assumed for the weather system is apparent in the following diagram:
<center>
<img src="weather_patterns.jpg">
<img src="img/weather_patterns.jpg">
</center><p>
A transition between classes is possible whenever a class has a common border. However, if a transition actually takes place is probabilistic. Typically, the probability not to make a transition is about 80%. Since changes are only triggered for weather tiles one is actually in, the average distance over which weather patterns persist is 160 km. An exception to this are fronts - weather front tiles trigger changes based on direction rather than probability, so a warmfront will always be a sequence of 4 tiles, a coldfront will always be a small-scale phenomenon crossed within 30 km.
@ -536,21 +556,35 @@ Realistically, the boundary layer should also depend on terrain coverage. Due to
Gusty winds are assumed to be a bounday layer phenomenon and faded out to zero at a multiple of the boundary layer thickness which is given by <i>base wind speed [kt]/10</i>, i.e. for 25 kt winds the gusts are absent for 2.5 times the bounday layer thickness.<p>
<h3>The altitude model of visibility</h3>
<h3>Light propagation in the atmosphere</h3>
Relatively low visibility (as reported by METAR) is usually confined to low altitudes, due to the lower density of the upper atmosphere and the reduced level of dust and water the visibility at airliner cruise altitude is frequently in excess of 100 km. This means that an altitude model of the visibility is needed.<p>
Local weather assumes that haze and dust are confined to the lowest air layer. As a proxy for the transition to a higher layer, the altitude of the lowest cloud layer (or for 9000 ft for clear skies) is used. The visibility always increases with altitude, but below the first layer transition it increases slowly at a rate of 0.2 m / ft in altitude gain. During the layer transition where the transition occurs during 1500 ft, the visibility increases rather rapidly at a rate of 5 m / ft, which means that above the lowest air layer the visibility is almost 10 km more than on the ground. The visibility then continues to grow at a rate of 1 m / ft towards the Stratosphere. In all likelihood, this dramatically underestimates the true visibility at high altitudes, but has been chosen to limit the impact on performance.<p>
The following schematics illustrates the essential features of the light propagation model:<p>
<center>
<img src="img/light_model.gif">
</center><p>
The parameters to be set are <i>overcast</i> (the amount of colouring of the skydome, from 0 (no haze) to 1 (completely opaque)), <i>visibility</i> and <i>light</i> (the amount of light available, determining the shade of faraway objects). The assumptions underlying the model are:
<ul>
<li> The visibility increases above the lowest inversion layer quite rapidly. It can then be manually set up to a high-altitude haze layer (to account for phenomena such as weather fronts where a low-visibility airmass may be above), but increases with constant rate higher up.
<li> The high-altitude visibilities are not realistic, but kept artificially low to avoid framerate problems connected with excessive terrain loading.
<li> For the amount of light, a single transition region can be specified. This usually is the lowest inversion layer, but doesn't have to - for multiple layers, a more democratic choice can be made. Above the transition region, the full amount of light is always assumed.
<li>Currently, a single high-altitude haze layer is supported, and it's transition altitude can be given. No haze is simulated above it's highest altitude.
</ul>
<h2>Credits</h2>
The model of a thermal has been developed by Patrice Poly. The shader code used to transform clouds is heavily based on prior work by Stuart Buchanan. Hard-coding of some features by Torsten Dreyer is greatly appreciated.<p>
The model of a thermal has been developed by Patrice Poly. The shader code used to transform clouds is heavily based on prior work by Stuart Buchanan. Hard-coding of some features by Torsten Dreyer, Thorsten Brehm and Erik Hofman is greatly appreciated.<p>
Thorsten Renk, March 2011
Thorsten Renk, June 2011
</body>
</html>
</body>
</html>

View file

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View file

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

View file

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 111 KiB

View file

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View file

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View file

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View file

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View file

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View file

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View file

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

View file

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View file

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

View file

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View file

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View file

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 99 KiB

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View file

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View file

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View file

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View file

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View file

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

BIN
Docs/img/light_model.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View file

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View file

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View file

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View file

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

BIN
Docs/img/menu4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View file

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View file

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View file

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View file

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 5 KiB

View file

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View file

@ -180,6 +180,47 @@ else
}
}
var setVisibilitySmoothly = func (vis) {
if (features.can_disable_environment == 0)
{setVisibility(vis); return;}
visibility_target = vis;
visibility_current = getprop("/environment/visibility-m");
if (smooth_visibility_loop_flag == 0)
{
smooth_visibility_loop_flag = 1;
visibility_loop();
}
}
var visibility_loop = func {
if (local_weather.local_weather_running_flag == 0) {return;}
if (visibility_target == visibility_current)
{smooth_visibility_loop_flag = 0; return;}
if (visibility_target < visibility_current)
{
var vis_goal = visibility_target;
if (vis_goal < 0.97 * visibility_current) {vis_goal = 0.97 * visibility_current;}
}
else
{
var vis_goal = visibility_target;
if (vis_goal > 1.03 * visibility_current) {vis_goal = 1.03 * visibility_current;}
}
setprop("/environment/visibility-m",vis_goal);
visibility_current = vis_goal;
settimer( func {visibility_loop(); },0);
}
####################################
# set thermal lift to given value
####################################
@ -346,6 +387,45 @@ if (features.can_set_light == 1)
}
}
var setLightSmoothly = func (s) {
if (features.can_set_light == 0)
{return;}
light_target = s;
light_current = getprop("/rendering/scene/saturation");
if (smooth_light_loop_flag == 0)
{
smooth_light_loop_flag = 1;
light_loop();
}
}
var light_loop = func {
if (local_weather.local_weather_running_flag == 0) {return;}
if (light_target == light_current)
{smooth_light_loop_flag = 0; return;}
if (light_target < light_current)
{
var light_goal = light_target;
if (light_goal < 0.97 * light_current) {light_goal = 0.97 * light_current;}
}
else
{
var light_goal = light_target;
if (light_goal > 1.03 * light_current) {light_goal = 1.03 * light_current;}
}
setprop("/rendering/scene/saturation",light_goal);
light_current = light_goal;
settimer( func {light_loop(); },0);
}
####################################
# set horizon scattering
@ -610,14 +690,6 @@ if (local_weather.dynamics_flag == 1)
var blat = buffered_tile_latitude;
var blon = buffered_tile_longitude;
var alpha = buffered_tile_alpha;
#var blat1 = getprop(lw~"tiles/tmp/latitude-deg");
#var blon1 = getprop(lw~"tiles/tmp/longitude-deg");
#var alpha1 = getprop(lw~"tmp/tile-orientation-deg");
#print("Lat: ", blat1, " ", blat);
#print("Lon: ", blon1, " ", blon);
#print("Alp: ", alpha1, " ", alpha);
}
else
{
@ -742,6 +814,18 @@ var ec = "/environment/config/";
var mvec = [];
var msize = 0;
# loop flags and variables
var smooth_visibility_loop_flag = 0;
var visibility_target = 0.0;
var visibility_current = 0.0;
var smooth_light_loop_flag = 0;
var light_target = 0.0;
var light_current = 0.0;
# available hard-coded support
var features = {};

View file

@ -1,7 +1,7 @@
########################################################
# routines to set up, transform and manage local weather
# Thorsten Renk, March 2011
# Thorsten Renk, June 2011
# thermal model by Patrice Poly, April 2010
########################################################
@ -34,6 +34,7 @@
# clear_all to remove all clouds, effect volumes and weather stations and stop loops
# create_detailed_cumulus_cloud to place multiple cloudlets into a box based on a size parameter
# create_cumulonimbus_cloud to place multiple cloudlets into a box
# create_cumulonimbus_cloud_rain to place multiple cloudlets into a box and add a rain layer beneath
# create_cumosys wrapper to place a convective cloud system based on terrain coverage
# cumulus_loop to place 25 Cumulus clouds each frame
# create_cumulus to place a convective cloud system based on terrain coverage
@ -673,9 +674,8 @@ compat_layer.setOvercast(ovcst);
flag = getprop("local-weather/effect-volumes/number-active-vis");
if ((flag ==0) and (vis > 0.0) and (getprop(lw~"lift-loop-flag") == 0))
if ((flag ==0) and (vis > 0.0) and (getprop(lw~"lift-loop-flag") == 0) and (compat_layer.smooth_visibility_loop_flag == 0))
{
#cNode.getNode("visibility-m").setValue(vis);
setprop(lw~"current/visibility-m",vis);
compat_layer.setVisibility(vis);
}
@ -843,11 +843,6 @@ setprop(lwi~"wind-speed-kt",windspeed_current);
setprop(lw~"current/wind-from-heading-deg",winddir);
setprop(lw~"current/wind-speed-kt",windspeed_current);
#iNode.getNode("wind-from-heading-deg").setValue(winddir);
#iNode.getNode("wind-speed-kt").setValue(windspeed_current);
#cNode.getNode("wind-from-heading-deg").setValue(winddir);
#cNode.getNode("wind-speed-kt").setValue(windspeed_current);
if (getprop(lw~"interpolation-loop-flag") ==1) {settimer(interpolation_loop, interpolation_loop_time);}
@ -1090,7 +1085,8 @@ if (ev.vis_flag ==1)
# then set the new value in current and execute change
cNode.getNode("visibility-m").setValue(vis);
compat_layer.setVisibility(vis);
#compat_layer.setVisibility(vis);
compat_layer.setVisibilitySmoothly(vis);
# then count the number of active volumes on entry (we need that to determine
# what to do on exit)
@ -1100,7 +1096,6 @@ if (ev.vis_flag ==1)
setprop(lw~"effect-volumes/number-active-vis",getprop(lw~"effect-volumes/number-active-vis")+1);
}
#if (ev.getNode("effects/rain-flag", 1).getValue()==1)
if (ev.rain_flag == 1)
{
var rain = ev.rain;
@ -1132,7 +1127,7 @@ if (ev.sat_flag == 1)
{
var saturation = ev.sat;
ev.sat_r = getprop("/rendering/scene/saturation");
compat_layer.setLight(saturation);
compat_layer.setLightSmoothly(saturation);
ev.n_entry_sat = getprop(lw~"effect-volumes/number-active-sat");
setprop(lw~"effect-volumes/number-active-sat",getprop(lw~"effect-volumes/number-active-sat")+1);
}
@ -1189,7 +1184,8 @@ if (ev.vis_flag == 1)
{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.setVisibility(vis);
compat_layer.setVisibilitySmoothly(vis);
# and subtract from the counter
setprop(lw~"effect-volumes/number-active-vis",getprop(lw~"effect-volumes/number-active-vis")-1);
@ -1243,7 +1239,7 @@ if (ev.sat_flag == 1)
else if ((n_active -1) == n_entry)
{var saturation = ev.sat_r;}
else {var saturation = getprop("/rendering/scene/saturation");}
compat_layer.setLight(saturation);
compat_layer.setLightSmoothly(saturation);
setprop(lw~"effect-volumes/number-active-sat",getprop(lw~"effect-volumes/number-active-sat")-1);
}
@ -1614,12 +1610,15 @@ else if ((type == "Cumulonimbus") or (type == "Cumulonimbus (rain)")) {
}
else if (type == "Cirrus") {
if (subtype == "large") {
if (rn > 0.833) {path = "Models/Weather/cirrus1.xml";}
else if (rn > 0.666) {path = "Models/Weather/cirrus2.xml";}
else if (rn > 0.5) {path = "Models/Weather/cirrus3.xml";}
else if (rn > 0.333) {path = "Models/Weather/cirrus4.xml";}
else if (rn > 0.166) {path = "Models/Weather/cirrus5.xml";}
else {path = "Models/Weather/cirrus6.xml";}
if (rn > 0.888) {path = "Models/Weather/cirrus1.xml";}
else if (rn > 0.777) {path = "Models/Weather/cirrus2.xml";}
else if (rn > 0.666) {path = "Models/Weather/cirrus3.xml";}
else if (rn > 0.555) {path = "Models/Weather/cirrus4.xml";}
else if (rn > 0.444) {path = "Models/Weather/cirrus5.xml";}
else if (rn > 0.333) {path = "Models/Weather/cirrus6.xml";}
else if (rn > 0.222) {path = "Models/Weather/cirrus7.xml";}
else if (rn > 0.111) {path = "Models/Weather/cirrus8.xml";}
else {path = "Models/Weather/cirrus9.xml";}
}
else if (subtype == "small") {
if (rn > 0.75) {path = "Models/Weather/cirrus_amorphous1.xml";}
@ -1924,10 +1923,16 @@ var create_detailed_cumulus_cloud = func (lat, lon, alt, size) {
var edge_bias = convective_texture_mix;
var size_bias = 0.0;
size = size + convective_size_bias;
if (size > 2.0)
{create_cumulonimbus_cloud(lat, lon, alt, size); return;}
{
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;
}
else if (size>1.5)
{
@ -2006,10 +2011,47 @@ var create_cumulonimbus_cloud = func(lat, lon, alt, size) {
var height = 3000.0;
var alpha = rand() * 180.0;
create_streak("Cumulonimbus",lat,lon, alt+ 0.5* height, height,8,0.0,0.0,1600.0,1,0.0,0.0,800.0,alpha,1.0);
create_streak("Cumulonimbus",lat,lon, alt+ 700, 0,2,0.0,0.0,1600.0,1,0.0,0.0,800.0,alpha,1.0);
create_streak("Cumulonimbus",lat,lon, alt+ 0.5* height + 700, height,6,0.0,0.0,1600.0,1,0.0,0.0,800.0,alpha,1.0);
create_streak("Congestus bottom",lat,lon, alt, 100.0,6,0.0,1.0,0.7*1600,1,0.0,0.0,0.7*800,alpha,1.0);
create_streak("Congestus bottom",lat,lon, alt + 700, 100.0,6,0.0,1.0,0.7*1600,1,0.0,0.0,0.7*800,alpha,1.0);
}
###########################################################
# detailed small Cumulonimbus and rain created from multiple cloudlets
###########################################################
var create_cumulonimbus_cloud_rain = func(lat, lon, alt, size, rain) {
var height = 3000.0;
var alpha = rand() * 180.0;
create_streak("Cumulonimbus",lat,lon, alt+ 700, 0,2,0.0,0.0,1600.0,1,0.0,0.0,800.0,alpha,1.0);
create_streak("Cumulonimbus",lat,lon, alt+ 0.5* height + 700, height,6,0.0,0.0,1600.0,1,0.0,0.0,800.0,alpha,1.0);
create_streak("Congestus bottom",lat,lon, alt, 100.0,6,0.0,1.0,0.7*1600,1,0.0,0.0,0.7*800,alpha,1.0);
create_streak("Congestus bottom",lat,lon, alt + 700, 100.0,6,0.0,1.0,0.7*1600,1,0.0,0.0,0.7*800,alpha,1.0);
# place a rain texture
var path = "Models/Weather/rain2.xml";
if (thread_flag == 1)
{create_cloud_vec(path, lat, lon, alt, 0.0);}
else
{compat_layer.create_cloud(path, lat, lon, alt, 0.0);}
# and some rain underneath
create_effect_volume(1, lat, lon, 2000.0, 2000.0, 0.0, 0.0, alt+1000.0, 8000.0 + 8000.0 * rand(), rain, -1, -1, -1 ,1,-1 );
}
###########################################################
# wrappers for convective cloud system to distribute
# call across several frames if needed
@ -2048,6 +2090,7 @@ if (nc < 0)
{print("Convective system done!");}
setprop(lw~"tmp/convective-status", "idle");
assemble_effect_array();
convective_size_bias = 0.0;
return;
}
@ -4058,9 +4101,7 @@ setprop(lw~"METAR/layer[3]/cover-oct",0);
setprop(lw~"METAR/layer[3]/alt-agl-ft", 20000.0);
setprop(lw~"METAR/available-flag",1);
# set initial value for stored random number for small-scale cloud patterns
weather_tiles.rnd_store = rand();
# set listeners
@ -4429,6 +4470,7 @@ var wind_model_flag = 1;
# globals governing properties of the Cumulus system
var convective_texture_mix = 0.0;
var convective_size_bias = 0.0;
var cumulus_efficiency_factor = 1.0;
var cloud_mean_altitude = 0.0;
@ -4455,7 +4497,7 @@ var metar_flag = 0;
var local_weather_running_flag = 0;
var local_weather_startup_flag = 0;
var fps_control_flag = 0;
var detailed_terrain_interaction_flag = 1;
var detailed_terrain_interaction_flag = 0;
# globals for framerate controlled cloud management
@ -4466,65 +4508,11 @@ var target_framerate = 25.0;
# set all sorts of default properties for the menu
# setprop(lw~"tmp/cloud-type", "Altocumulus");
# setprop(lw~"tmp/alt", 12000.0);
# setprop(lw~"tmp/nx",5);
# setprop(lw~"tmp/xoffset",800.0);
# setprop(lw~"tmp/xedge", 0.2);
# setprop(lw~"tmp/ny",15);
# setprop(lw~"tmp/yoffset",800.0);
# setprop(lw~"tmp/yedge", 0.2);
# setprop(lw~"tmp/dir",0.0);
# setprop(lw~"tmp/tri", 1.0);
# setprop(lw~"tmp/rnd-pos-x",400.0);
# setprop(lw~"tmp/rnd-pos-y",400.0);
# setprop(lw~"tmp/rnd-alt", 300.0);
# setprop(lw~"tmp/conv-strength", 1);
# setprop(lw~"tmp/conv-size", 15.0);
# setprop(lw~"tmp/conv-alt", 2000.0);
# setprop(lw~"tmp/bar-alt", 3500.0);
# setprop(lw~"tmp/bar-n", 150.0);
# setprop(lw~"tmp/bar-dir", 0.0);
# setprop(lw~"tmp/bar-dist", 5.0);
# setprop(lw~"tmp/bar-size", 10.0);
# setprop(lw~"tmp/scloud-type", "Altocumulus");
# setprop(lw~"tmp/scloud-subtype", "small");
setprop(lw~"tmp/scloud-lat",getprop("position/latitude-deg"));
setprop(lw~"tmp/scloud-lon",getprop("position/longitude-deg"));
# setprop(lw~"tmp/scloud-alt", 5000.0);
# setprop(lw~"tmp/scloud-dir", 0.0);
# setprop(lw~"tmp/layer-type","Nimbus");
# setprop(lw~"tmp/layer-rx",10.0);
# setprop(lw~"tmp/layer-ry",10.0);
# setprop(lw~"tmp/layer-phi",0.0);
# setprop(lw~"tmp/layer-alt",3000.0);
# setprop(lw~"tmp/layer-thickness",500.0);
# setprop(lw~"tmp/layer-density",1.0);
# setprop(lw~"tmp/layer-edge",0.2);
# setprop(lw~"tmp/layer-rain-flag",1);
# setprop(lw~"tmp/layer-rain-density",1.0);
# setprop(lw~"tmp/box-x-m",600.0);
# setprop(lw~"tmp/box-y-m",600.0);
# setprop(lw~"tmp/box-alt-ft",300.0);
# setprop(lw~"tmp/box-n",10);
# setprop(lw~"tmp/box-core-fraction",0.4);
# setprop(lw~"tmp/box-core-offset",0.2);
# setprop(lw~"tmp/box-core-height",1.4);
# setprop(lw~"tmp/box-core-n",3);
# setprop(lw~"tmp/box-bottom-fraction",0.9);
# setprop(lw~"tmp/box-bottom-thickness",0.5);
# setprop(lw~"tmp/box-bottom-n",12);
# setprop(lw~"tmp/tile-type", "High-pressure");
# setprop(lw~"tmp/tile-orientation-deg", 260.0);
# setprop(lw~"tmp/windspeed-kt", 8.0);
# setprop(lw~"tmp/gust-frequency-hz", 0.0);
# setprop(lw~"tmp/gust-relative-strength",0.0);
# setprop(lw~"tmp/gust-angular-variation-deg",0.0);
# setprop(lw~"tmp/tile-alt-offset-ft", 0.0);
setprop(lw~"tmp/tile-alt-median-ft",0.0);
setprop(lw~"tmp/tile-alt-min-ft",0.0);
# setprop(lw~"tmp/tile-management", "realistic weather");
# setprop(lw~"tmp/asymmetric-tile-loading-flag", 0);
setprop(lw~"tmp/last-reading-pos-del",0);
setprop(lw~"tmp/last-reading-pos-mod",0);
setprop(lw~"tmp/thread-status", "idle");
@ -4532,24 +4520,6 @@ setprop(lw~"tmp/convective-status", "idle");
setprop(lw~"tmp/presampling-status", "idle");
setprop(lw~"tmp/buffer-status", "idle");
setprop(lw~"tmp/buffer-tile-index", 0);
#setprop(lw~"tmp/FL0-wind-from-heading-deg",260.0);
#setprop(lw~"tmp/FL0-windspeed-kt",8.0);
#setprop(lw~"tmp/FL50-wind-from-heading-deg",262.0);
#setprop(lw~"tmp/FL50-windspeed-kt",11.0);
#setprop(lw~"tmp/FL100-wind-from-heading-deg",264.0);
#setprop(lw~"tmp/FL100-windspeed-kt",16.0);
#setprop(lw~"tmp/FL180-wind-from-heading-deg",265.0);
#setprop(lw~"tmp/FL180-windspeed-kt",24.0);
#setprop(lw~"tmp/FL240-wind-from-heading-deg",269.0);
#setprop(lw~"tmp/FL240-windspeed-kt",35.0);
#setprop(lw~"tmp/FL300-wind-from-heading-deg",273.0);
#setprop(lw~"tmp/FL300-windspeed-kt",45.0);
#setprop(lw~"tmp/FL340-wind-from-heading-deg",274.0);
#setprop(lw~"tmp/FL340-windspeed-kt",50.0);
#setprop(lw~"tmp/FL390-wind-from-heading-deg",273.0);
#setprop(lw~"tmp/FL390-windspeed-kt",56.0);
#setprop(lw~"tmp/FL450-wind-from-heading-deg",272.0);
#setprop(lw~"tmp/FL450-windspeed-kt",65.0);
setprop(lw~"tmp/ipoint-latitude-deg",getprop("position/latitude-deg"));
setprop(lw~"tmp/ipoint-longitude-deg",getprop("position/longitude-deg"));

View file

@ -1,7 +1,7 @@
########################################################
# routines to set up weather tiles
# Thorsten Renk, March 2011
# Thorsten Renk, June 2011
########################################################
# function purpose
@ -179,6 +179,7 @@ if (rand() < small_scale_persistence)
else
{rnd_store = rn;}
#rn = 0.1;
if (rn > 0.8)
{
@ -198,7 +199,7 @@ if (rn > 0.8)
}
# 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);
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);
}
else if (rn > 0.6)
{
@ -212,7 +213,7 @@ else if (rn > 0.6)
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);
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);
}
else if (rn > 0.4)
{
@ -224,7 +225,7 @@ else if (rn > 0.4)
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);
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.2)
@ -237,7 +238,7 @@ else if (rn > 0.2)
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);
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.0)
{
@ -252,7 +253,7 @@ 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);
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);
}
@ -340,7 +341,7 @@ if (rn > 0.8)
}
# 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);
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);
}
else if (rn > 0.6)
@ -353,7 +354,7 @@ else if (rn > 0.6)
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);
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.4)
@ -372,7 +373,7 @@ else if (rn > 0.4)
# 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);
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);
}
else if (rn > 0.2)
@ -385,7 +386,7 @@ else if (rn > 0.2)
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);
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);
}
else if (rn > 0.0)
{
@ -399,7 +400,7 @@ else if (rn > 0.0)
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);
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);
}
# store convective altitude and strength
@ -462,7 +463,8 @@ if (rand() < small_scale_persistence)
else
{rnd_store = rn;}
if (rn > 0.875)
if (rn > 0.888)
{
# cloud scenario 1: Altocumulus patch over weak Cumulus
strength = 0.1 + rand() * 0.1;
@ -474,10 +476,10 @@ 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 +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.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.8, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.750)
else if (rn > 0.777)
{
# cloud scenario 2: Altocumulus streaks
strength = 0.15 + rand() * 0.2;
@ -494,22 +496,20 @@ else if (rn > 0.750)
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: Cirrus
strength = 0.1 + rand() * 0.1;
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
x = 2.0 * (rand()-0.5) * 3000;
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);
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);
}
else if (rn > 0.5)
else if (rn > 0.555)
{
# cloud scenario 4: Cumulonimbus banks
@ -525,10 +525,10 @@ 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.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, 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.8, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.375)
else if (rn > 0.444)
{
# cloud scenario 5: scattered Stratus
@ -543,7 +543,7 @@ else if (rn > 0.375)
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)
else if (rn > 0.333)
{
# cloud scenario 6: Cirrocumulus sheets
@ -564,9 +564,9 @@ 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.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.125)
else if (rn > 0.222)
{
# cloud scenario 7: Thin Cirrocumulus sheets over weak Cumulus
@ -579,7 +579,7 @@ else if (rn > 0.125)
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)
else if (rn > 0.111)
{
# cloud scenario 8: Altocumulus perlucidus
@ -591,6 +591,22 @@ else if (rn > 0.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.8, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.0)
{
# cloud scenario 9: Cumulus, Altocumulus and Cirrus
strength = 0.3 + rand() * 0.15;
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
create_1_8_altocumulus_scattered(blat, blon, alt + 12000.0 + alt_offset, alpha);
create_2_8_altocumulus_streaks(blat, blon, alt + 12000.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.0, alt+alt_offset +26000.0, alt+alt_offset + 30000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
}
# store convective altitude and strength
@ -646,6 +662,9 @@ local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_i
var alt = spread * 1000.0;
var strength = 0.0;
# bias Cumulus clouds towards larger sizes due to lots of water vapour
local_weather.convective_size_bias = 0.2 + rand() * 0.2;
# now a random selection of different possible cloud configuration scenarios
var rn = rand();
@ -655,7 +674,6 @@ if (rand() < small_scale_persistence)
else
{rnd_store = rn;}
# rn = 0.1;
if (rn > 0.857)
{
@ -676,7 +694,7 @@ else if (rn > 0.714)
{
# cloud scenario 2: weak Cumulus, Stratus undulatus above
strength = 0.15 + rand() * 0.15;
strength = 0.2 + rand() * 0.2;
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
create_6_8_tstratus_undulatus(blat, blon, alt+alt_offset+4000.0,alpha);
@ -793,9 +811,9 @@ calc_geo(blat);
# get probabilistic values for the weather parameters
var vis = 7000.0 + rand() * 7000.0;
var vis = 9000.0 + rand() * 10000.0;
var T = 5.0 + rand() * 10.0;
var spread = 1.5 + 2.5 * rand();
var spread = 2.0 + 2.5 * rand();
var D = T - spread;
var p = 1001.0 + rand() * 6.0; p = adjust_p(p);
@ -815,7 +833,8 @@ if (rand() < small_scale_persistence)
else
{rnd_store = rn;}
if (rn > 0.75)
if (rn > 0.8)
{
# cloud scenario 1: two patches of Nimbostratus with precipitation
@ -844,7 +863,7 @@ if (rn > 0.75)
# 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)
else if (rn >0.6)
{
# cloud scenario 2: 8/8 Stratus with light precipitation
# above broken cover
@ -860,7 +879,7 @@ else if (rn >0.5)
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)
else if (rn >0.4)
{
# cloud scenario 3: multiple broken layers
# cloud count 1350
@ -874,7 +893,7 @@ else if (rn >0.25)
# 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)
else if (rn >0.2)
{
# cloud scenario 4: a low 6/8 layer and some clouds above
# cloud count 650
@ -886,7 +905,21 @@ else if (rn >0.0)
# 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);
}
else if (rn >0.0)
{
# cloud scenario 5: a low 8/8 layer without rain
alt = alt + local_weather.cloud_vertical_size_map["Nimbus"] * 0.5 * m_to_ft;
create_8_8_nimbus_rain(blat, blon, alt+alt_offset, alpha,0.0);
if (rand() > 0.5)
{
create_2_8_cirrus(blat, blon, alt+alt_offset + 28000.0,alpha);
}
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 15000.0, alt+alt_offset, vis + 24000.0, 0.05, alt+alt_offset +5000.0, alt+alt_offset + 8000.0, 0.55, alt+alt_offset, alt+alt_offset + 2500.0);
}
# store convective altitude and strength
append(weather_dynamics.tile_convective_altitude,alt);
@ -946,11 +979,6 @@ var strength = 0.0;
create_8_8_nimbus_rain(blat, blon, alt+alt_offset, alpha,0.4 + rand()*0.2);
# and a precipitation layer below, more rain in the center of the tile
#local_weather.create_effect_volume(3, blat, blon, 20000.0, 20000.0, alpha, 0.0, alt + alt_offset, 3000.0, 0.3, -1, -1, -1,0 ,0.95);
#local_weather.create_effect_volume(3, blat , blon, 16000.0, 16000.0, alpha, 0.0, alt + alt_offset - 300.0, 1500.0, 0.5, -1, -1, -1,0 ,0.8);
# and some broken Stratus cover above
@ -1112,6 +1140,10 @@ local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_i
var alt = spread * 1000.0;
var strength = 0.0;
# bias Cumulus clouds towards larger sizes due to lots of water vapour
local_weather.convective_size_bias = 0.1 + rand() * 0.1;
var rn = rand();
if (rand() < small_scale_persistence)
@ -1245,6 +1277,9 @@ local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_i
var alt = spread * 1000.0;
var strength = 0.0;
# bias Cumulus clouds towards larger sizes due to lots of water vapour
local_weather.convective_size_bias = 0.3 + rand() * 0.3;
# tropical weather has a strong daily variation, call thunderstorm only in the correct afternoon time window
var t_factor = 0.5 * (1.0-math.cos((t * sec_to_rad)-0.9));
@ -3027,11 +3062,11 @@ var create_2_8_cirrus = func (lat, lon, alt, alpha) {
var phi = alpha * math.pi/180.0;
var x = 2.0 * (rand()-0.5) * 3000;
var y = 2.0 * (rand()-0.5) * 3000;
var x = 2.0 * (rand()-0.5) * 1000;
var y = 2.0 * (rand()-0.5) * 1000;
local_weather.create_streak("Cirrus",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt,1500.0,3,12000.0,0.0, 4000.0, 3,12000.0,0.0,4000.0,alpha,1.0);
local_weather.create_streak("Cirrus",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt,1500.0,2,20000.0,0.0, 3000.0, 2,20000.0,0.0,3000.0,alpha,1.0);
}
@ -3104,6 +3139,18 @@ for (var i = 0; i < 2; i = i + 1)
}
var create_1_8_cirrus = func (lat, lon, alt, alpha) {
var phi = alpha * math.pi/180.0;
var x = 2.0 * (rand()-0.5) * 2000;
var y = 2.0 * (rand()-0.5) * 2000;
local_weather.create_streak("Cirrus",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt,1500.0,1,24000.0,0.0, 9000.0, 2,24000.0,0.0,4000.0,alpha,1.0);
}
var create_1_8_cirrostratus_undulatus = func (lat, lon, alt, alpha) {
local_weather.create_undulatus("Cirrostratus",lat, lon, alt,300.0,1,8000.0,0.0,400.0,40,1000.0,0.1,100.0, 1500.0, alpha,1.0);
@ -3374,7 +3421,7 @@ var m_to_lon = 0.0; # we do this on startup
var lw = "/local-weather/";
var small_scale_persistence = getprop(lw~"config/small-scale-persistence");
var rnd_store = 0.0;
var rnd_store = rand();
var elat = [];
var elon = [];

View file

@ -1008,7 +1008,7 @@
</binding>
</button>
<button>
<!--<button>
<x>300</x>
<y>0</y>
<legend>Test</legend>
@ -1017,7 +1017,7 @@
<command>nasal</command>
<script>local_weather.test()</script>
</binding>
</button>
</button>-->
</group>

View file

@ -35,7 +35,7 @@
<value>Coldfront</value>
<value>Warmfront</value>
<value>Tropical</value>
<value>Test tile</value>
<!--<value>Test tile</value>-->
<binding>
<command>dialog-apply</command>
</binding>