Creating
fishsim 2 weather files
J.C.Spooner
2002
Weather files aren't like most other files in FS2, they are "data files" as aposed to "text files", which means they are not editable with a text editor program such as notepad. This makes creating them difficult, and to do so would require a seperate program to be written. There is another way though, and although not ideal, and not very user friendly, it can be used if you want to. This page will explain how to create a weather file using this method, and also, it will explain the format of the data in the weather files, just in case there are any programmers out there who want to write a weather generator program. I'll leave this part to the end though as to anyone who doesn't understand programming, it may be a bit of a mind blower.
No excuses are made for the non user friendliness of creating weather files, as it is not intended for them to be created by third parties. A few people have asked how to do them, so here is the answer :)
Method one
Within FS2 ( any version ), there is a seperate bit of code that is there to generate weather files from a set of climate data provided. It is not apparent that it is there, as it requires a change to the app.ini file in the INF folder to activate it. In the [debug] section of the file, add the line GenClimate = 1. This will tell FS2, to generate a climate.dat file when it starts up, but in order for it to do that it will require some guidance as to what sort of climate to create.
In the INF folder again, create a text file called weather.ini, the format of which is :
; January
[Month(1)]
AvTemp = 30
Dev = 70
AvRain = 28
RDev = 560
WindN = 90
WindS = 30
WindE = 40
WindW = 50
WSpeed = 34
Lightup = 09:30
Lightdn = 15:15
; February
[Month(2)]
AvTemp = 39
Dev = 50
AvRain = 41
RDev = 570
WindN = 80
WindS = 34
WindE = 30
WindW = 60
Wspeed = 42
Lightup = 08:00
Lightdn = 16:00> .. and so on for each month ..
This values in this file ( weather.ini ) is what FS2 will use to create the climate data file. Each month has it's own section, eg [Month(1)] holds information on the climate in January, [Month(2)] is February and so on... Within each month section there are 11 variables, AvTemp, Dev, AvRain, RDev, WindN, WindS, WindE, WindW, WSpeed, Lightup, and lightdn. Each is described below :
Avtemp
The value of this variable represents the average temperature for the month, in degrees celcius, multiplied by 10. Eg, if the average temperature for a particular month in a climate is 12.5 degrees C, then you would enter it as 125. In the example above the average temperature for January is 3.0 degrees, and February 3.9 degrees.
Dev
This value represents how much the temperature deviates, again, it is represented as 10 times the temperature in degrees C. So, if the average temperature of a month is stated as being 30 ( 3.0 degrees celcius ) and the dev is stated as 70 ( 7.0 degrees celcius ), then this will tell FS2 to generate temperatures for the month of between -4.0 degrees and 10 degrees. Eg 3.0 - 7.0 = -4.0 degrees, and 3.0 + 7.0 = 10 degrees.
AvRain
This variable holds the average daily rainfall in mm for the month.
RDev
This is a hard one to explain and probably requires a lot of experimentation to perfect. It is similar to the temperature deviation above, however, the calculation for working this out is a lot more complex. There are different degrees of rain, light showers, heavy showers, light rain, drizzle, heavy rain etc.. So take a typical august in the UK for example, even though the average daily rainfall is probably low, it is still possible and quite likely that there will be the odd day of heavy showers, and even a day of heavy persistant rain. This means that to use just the average rainfall value, wouldn't result in a fluctuation of rainfall and cloud cover throughout the month, which is common. To help with this, the table below describes the values that FS2 will use to determine the amount of cloud cover and rain etc..
0 -> 100 Clear skies 101 -> 150 Overcast 151 -> 200 Light showers 201 -> 250 Light rain 251 -> 300 Heavy showers 301 -> 350 Rainy 351 + Heavy rain The value ranges in the table above are only meant as a guide, as there are a lot of other rain and cloud types and it's all complicated how it is worked out, there's drizzle, snow, sleet, fog, mist etc.. all sorts.
The idea of the RDev value is the higher it is, the higher chance of getting more fluctuation in a month and also getting a lot of rain. Experimentation is the key though, with this first method to get it right.
WindN, WindS, WindE, WindW
These variables are percentages ( 0 - 100 ), of wind direction. For example, in the UK, we get a lot of northerly winds in the winter, also easterley too. So you may set the WindN to something like 80, and the WindE to something like 50, with the WindS and WindW being set low, say, WindS = 10, WindW = 30.
WSpeed
This variable is used to set the maximum wind speed for the month in units ( not MPH, although close ). Note, though that FS2 may generate wind speeds higher than this value still. The table below can be used as a guide :
<= 4 Calm >4 <=8 Light >8 <=12 Moderate >12 <=16 Fresh >16 <=20 Windy >20 <=24 Gusty >24 <=28 Strong >28 <=32 Storm force >32 Gale force Lightup
This value represents the lighting up time ( at what time in the morning it begins to get light ). It has to be specified as a 24 hour clock value, with a leading zero for both the hours and minutes if needed. Eg, if it gets light at 6 minutes past 8 in the morning, this has to be specified as 08:06, not 8.6 or 08.6 or 8.06, it always contains two digits to specify the hour and two digits to specify the minute.
Lightdn
This is the same as the lighting up time above, apart from it indicates the time it starts to go dark, sunset. It is specified in exactly the same format as the lighting up time, using the 24 hour clock system and two digits to specify the hour and the minute. Eg if it goes dark at 8pm, this would be specified as 20:00
Okay, after setting the GenClimate = 1 line in the [debug] section of the app.ini file, and creating a weather.ini file in the INF folder as above, Fishsim 2 now has enough information to create a weather data file. All you do is run FS2, that's it's as soon as it starts, it will recognise the genclimate line and use the weather.ini file to generate a couple of files in the data folder of FS2. The first, climate.dat is the actual weather data file, this should be renamed to whatever climate you are generating. Eg, caribean.dat. The second file that is generated, is a text file called climate.txt. You don't have to distribute this file, it is only created so that you can check what the weather will be like every day for three years in FS2.
The format of the climate.txt file is :
Day 0 15 12 Overcast Clear skies N 8 MPH 8 : 30 17 : 0 0
Day 1 16 15 Clear skies Clear skies E 9 MPH 8 : 28 17 : 1 0
Day 2 18 16 Overcast Clear skies S 7 MPH 8 : 27 17 : 2 0
Day 3 19 16 Light showers Overcast SE 5 MPH 8 : 26 17 : 3 0
< etc.. and so on for every day for three years.. >Note, that it is a bit neater and more aligned than above, spaces and tab characters are not valid in HTML code, which is why it doesn't look neat here.
So, in the above example, the third day ( day 2 ) of the first year, it will be 18 degrees at midday, and 16 degrees at midnight. At midday, the sky will be overcast, and at midnight it will be clear. The wind, generally through the day, will be southerly, and around 7 mph. Sunrise, will be at 8:27 am, and sunset at 17:2 ( 2 minutes past 5 ). Ignore the last column, it is only meaningful for old debugging purposes.
So in short the climate.txt file will show you the weather and temperature at midday and midnight, the cloud/rain at midday and midnight, the wind speed and direction, and the lighting up and down times, for every day for three years ! ( it's a pretty big file that gets generated )
You can use the climate.txt file to see if the weather data file generated is about right for the climate you are creating, if it isn't change the weather.ini file, save it, and re-run FS2 again. After that, examine the climate.txt file and see if it's about right or not.
This method isn't ideal, but it can generate pretty good climate files. Fishsim isn't a program about predicting or generate weather though, and I do not proclaim to know a lot about it either, so it's not going to be ideal or as technical as other weather prediction programs, by a long way. But for the purposes of FS2, it's acceptable.
Method 2 ( file format )
First, if you don't know about programming and data types and structures, this part isn't necessary reading. It is only included for people who have a knowledge of programming and would like to create a weather file generation program for FS2.
As was mentioned above, FS2 weather files work on a three year cycle, in other words, the weather on the 1st July 2001, will be the same as the weather on the 1st July 2004, it repeats every three years. I doubt whether anyone using FS2 though will ever make the pattern connection, to do so would require an extremely good memory :)
To work out which of the three climate patterns to use is simple, for example, each file contains weather pattern 0, 1 and 2. PC's using windows operating systems store dates as offsets from 1900. So 101 is 2001 ( 1900+101 ), 102 = 2002 ( 1900+102 ) etc.. So for a program to retrieve the year, it will get back this value. With this value if the modulus of 3 is taken, this will give the weather pattern to use.
So, 101 % 3 = 2, 102 % 3 = 0 etc.. Using the modulus of 3 means that for any given value, a value of either 0, 1 or 2 will always be returned, which is handy as there are only 3 yearly weather patterns stored.
Anyway, put months and things out of the way, they aren't useful, as they change too much to be of any use. Eg, some months have 30 days, some 31, februrary is a real nightmare in itself. So instead FS2 uses days of the year and treats each year as having 366 days ! not 365. This is because some years are leap years etc, which means a day is gained :( so the most days any year can have is 366. For years that aren't leap years, the 366th day is ignored anyway and never used. For the sake of convenience, it is only wasting at most three days of data anyway, which is hardly worth bothering about, considering the extra effort that would be involved in storing each day accurately.
This means that 366 x 3 = 1098 days worth of weather are stored. A glance at any weather data file in the FS2 data folder will show that they are all 17,568 bytes long ( =~17.1 Kb ). This means therefore, that each day requires a total of 16 bytes of storage ( 17,568 / 1098 = 16 ). These 16 bytes are arranged as 8 signed 16 bit integers, or in 'c' speak ( the short data type ). The structure of the data is as follows :
short tempd; // Midday temperature
short tempn; // Midnight temperature
short raind; // Rain at midday
short rainn; // Rain at midnight
short windspeed; // Wind speed
short winddir; // Wind direction
short lightup; // Sunrise
short lightdown; // SunsetThere is no header information in the weather files, they go straight into the data from the start of the file. So day 1 of year pattern 0 is stored first, followed by day 2 of year pattern 0 etc.. to day 366 of year pattern 0. Then comes day 1 of year pattern 1, day 2 of year pattern 1 and so on.
Temperatures are stored as values that are multiplied by 10. So to retrieve the floating point value, divide the number in the file by 10. The rain values ( used in the table shown above ). Windspeed is as the table above. Wind direction is stored as 1 = North, 2 = North-east, 3 = East, 4 = South-east, 5 = South, 6 = South-west, 7 = West, 8 = North-west.
With the light times ( up and down ) these are stored in minutes. So to retrieve the hours / mins comination :
Divide the value by 60 and take the integer part ( ignore the fractional part ), this will give you the hour, as in the 24 hour clock ( 0 - 23 ). To get the minutes, apply the modulus of 60 to the value.
That's it :) phew, there are of coarse a lot more bits to it, for example, no mention is made of snow, sleet, fog, mist, and how it is all worked out, but if you do create an FS2 weather generation program and require the info on how to make it snow for example on a certain day, then please email me and i'll supply the info, it's too much to go into here.
(c) J.C.Spooner 2002