Jump to content

Recommended Posts

Inspired by MKY's blizzard script, I created functions that provide you with climatological information. The functions contain a simple climatological model and statistical data, that I gathered from all kinds or sources on the web. The climatological data can be overriden by terrain makers, using config entires. I hope that this will contribute to the creation of weather addons, realism- and survival mods. 

 

Input is mostly limited to time, date and a position or object.  Besides climatological data, the functions determine Latitude, time, date, overcast, fog, cloud occlusion, terrain occlusion, and object occlusion to calculate output values.
 
The following variables are provided as output: 
 
 * Air temperature (°C) â€“ llw_fnc_getTemperature
 * Date and time (YYYY-MM-DD hh:mm:ss) â€“ llw_fnc_getDateTime
 * Shadow detection (true/false) â€“ llw_fnc_inShadow
 * Solar Azimuth angle (°) â€“ llw_fnc_getSunAngle
 * Solar Elevation angle (°) â€“ llw_fnc_getSunAngle
 * Solar Elevation angle at 12:00PM (°) â€“ llw_fnc_getSunElevationNoon
 * Solar Radiation energy (W/m²) â€“ llw_fnc_getSunRadiation
 * Sunrise time (hours) â€“ llw_fnc_getSunRise
 * Sunset time (hours) â€“ llw_fnc_getSunRise
 * Sea temperature (°C) â€“ llw_fnc_getTemperature

 

 

 
FUNCTIONS
 
llw_fnc_getDateTime - TEXT:
current date and time as "YYYY-MM-DD (hh:mm:ss)"
 
llw_fnc_getSunAngle - ARRAY:
(0) Solar Elevation angle and (1) Solar Azimuth angle. Current angles, or angles at a given time and date.
 
llw_fnc_getSunElevationNoon - NUMBER:
Solar Elevation Angle at 12:00AM
 
llw_fnc_getSunRadiation - NUMBER:
Solar radiation energy in W/m² at object or position. When a subclass of Man  is referenced, torso is used as reference position.
 
llw_fnc_getSunRise - ARRAY:
(0) Time at sunrise and (1) time at sunset. For current day or for date provided in parameters.
 
llw_fnc_getTemperature - ARRAY:
(0) Air temperature and (1) sea temperature in degrees celcius.
 
llw_fnc_inShadow - BOOLEAN:
returns wheteher an object or position is shielded from the sun. When a subclass of Man  is referenced, torso is used as reference position.
 
 
Please refer to the enclosed README.TXT for further details.
 
 
 

2016_02_14_00002.jpg

 

2016_02_14_00001.jpg

 

The scripts come with a demonstration script. (see screenshots)

 

 

 

Download link:

https://mega.nz/#!SwASwI7Y!WAQfpILWc-7HeTmBpdqPRoWWwfhajvsvCyjKI4aS7rU

 

Edited by Matthijs
12AM corrected to 12PM
  • Like 14
  • Thanks 2

Share this post


Link to post
Share on other sites

Doesn't look like it.  I think there's already a function for that in the BIS library somewhere.

Might be, made this back in the days:

 

GOM_fnc_getWeekday = {

params [["_date",date]];

_date params ["_year","_m","_q"];

_weekday = "";

_yeararray = _year call BIS_fnc_numberDigits;
_yeararray params ["_y0","_y1","_y2","_y3"];

_J = (_y0 * 10) + _y1;
_K = (_y2 * 10) + _y3;

if (_m < 3) then {_m = _m + 12};

_hgreg = (_q + floor ( ((_m + 1) * 26) / 10 ) + _K + floor (_K / 4) + floor (_J / 4) - (2 * _J)) mod 7;

_shortDayNames = ["Sat","Sun","Mon","Tue","Wed","Thu","Fri"];
_dayNames = ["Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"];

if ("SHORT" in _this) exitWith {_shortDayNames select _hgreg};
_dayNames select _hgreg

};

 

Been using the climatological functions to great success!

Very useful stuff!

 

Edit: Fixed params error, use select instead multiple if thens (made this in the very beginnings of my A3 career)

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

Very nice, but no license?

 

Also, noon is 12:00PM

Share this post


Link to post
Share on other sites

Very nice, but no license?

 

Also, noon is 12:00PM

 

maybe he means solar zenith or "solar noon"

 

 

but yea i am still trying to put together a function to convert date to day-of-week

Share this post


Link to post
Share on other sites

but yea i am still trying to put together a function to convert date to day-of-week

Did you miss my spoiler?

:yay:

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

Did you miss my spoiler?

:yay:

 

Cheers

 

wow cool :)

 

how did you arrive at this equation?

 

_hgreg = (_q + floor ( ((_m + 1) * 26) / 10 ) + _K + floor (_K / 4) + floor (_J / 4) - (2 * _J)) mod 7;

Share this post


Link to post
Share on other sites

* Sunrise time (hours) â€“ [/size]llw_fnc_getSunRise

 * Sunset time (hours) â€“ [/size]llw_fnc_getSunRise

BIS_fnc_sunriseSunsetTime
  • Like 1

Share this post


Link to post
Share on other sites

Ouch, seems I should visit the forums more often. :huh2:

 

On 4-9-2016 at 11:17 PM, Grumpy Old Man said:

Been using the climatological functions to great success!

Very useful stuff!

 

Thanks, it's great to hear that! :smile_o:

 

On 5-9-2016 at 0:27 PM, tortuosit said:

BIS_fnc_sunriseSunsetTime

 

Thanks, I could have saved myself a lot of time. On the other hand, it has been a nice learning experience.  :grinning:

  • Like 1

Share this post


Link to post
Share on other sites

@Matthijs, these are some great and useful functions, thanks a lot!

 

One question: The inShadow function does not work for moonlight, does it? I'm asking because I'm creating a mission where I want to change the camouflageCoef depending of the player being in the shadows (full moon) or running around in the plain fields. Any help would be much appreciated.

 

  • Haha 1

Share this post


Link to post
Share on other sites
1 hour ago, Undeceived said:

@Matthijs, these are some great and useful functions, thanks a lot!

 

One question: The inShadow function does not work for moonlight, does it? I'm asking because I'm creating a mission where I want to change the camouflageCoef depending of the player being in the shadows (full moon) or running around in the plain fields. Any help would be much appreciated.

 

That is correct.

 

The function was created to allow calculation of energy build-up in a body. It does this by calculating the position of the sun and checks for collissions between the body and the sun. (a rather CPU intensive thing I must admit)

 

I did not account for moon, stars nor artificial light, because their energy radiation is negligible. Sorry...

:huh2:

Share this post


Link to post
Share on other sites

I used your sunAngle calculator function on my Depth Gauge Watch addon I just released.  Thanks for making this.  It allowed me to know when it make my depth gauge glow in the dark.  :)  Thanks again @Matthijs!!

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

 

On 11-3-2018 at 7:48 AM, Feint said:

I used your sunAngle calculator function on my Depth Gauge Watch addon I just released.  Thanks for making this.  It allowed me to know when it make my depth gauge glow in the dark.  :)  Thanks again @Matthijs!!

 

Cool! :icon_biggrin:

 

Please be aware that there is a native ArmA3 function that I was not aware of. (I haven't tried it myself though)

Thanks to Tortuosit for pointing it out:

On 5-9-2016 at 12:27 PM, tortuosit said:

BIS_fnc_sunriseSunsetTime

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×