[Release] Grb2fmap - GRIB to BMS Converter
Current version: v0.5d – Improved interpolation of weathertype especially on the first 3 hours
A couple of days back, I wanted to set realistic weather for my campaign. As there was no program capable of converting GRIB files to BMS .fmap files (yet) and my artistic talent for hand-crafting them sucks, I decided to code my own tool. As some squad mates from the 87th manifested their interest in the tool, I added a simple dialog based UI and decided that I could release it as well.
It converts GRIB edition 1 files to BMS .fmap files
Generated weather at 1hr intervals - next 10 days
Example of generated wind:
Unzip into your directory of choice
grib2Bfmap program supports GRIB edition 1 files only. These files need to have the following records: PRATE (or APCP), TCDC, PRMSL, TMP, UGRD, VGRD. It will project the whole GRIB grid into your theater, so it is imperative that the GRIB grid latitudes/longitudes adjust as close as you can to the theater area or the projected weather wont be accurate! (you can also select weather from a different area of the world if so you desire, and it will get projected into the theater area)
The easiest way to obtain a valid GRIB file is to get them using the freely available zygrib tool. My recommended options for downloading the file into KTO are as in the following picture:
Please note the recommended Latitude and Longitude values, and the compulsory NOAA-GFS tables. Without selecting those tables no files will be generated! Interval and number of days can be changed at your discretion, depending on the number of files you want to generate.
Recommended coordinates for KTO
LAT: Min 34N, Max 43N
LON: Min: 123E, Max 132E
Recommended coordinates for ITO (by uri_ba)
LAT: Min 25N, Max 35N
LON: Min: 30E, Max 40E
Unzip the downloaded file and select the unzipped .grb file via the grib2fmap Convert! option. If the file is valid, the .fmap file(s) will be generated on the same folder where the input file was located. If the GRIB file contained records for several dates/times, multiple .fmap files will be generated. These are named according to the BMS auto-update map naming convention, so that they only need to be dropped into the campaign’s WeatherMapsUpdates directory. Of course individual files may be loaded into BMS as well the usual way.
So, in recap, the shortened instructions are:
- Download a GRIB file with zyGrib, with the options as in the picture above (KTO)
- Unzip the downloaded file
- Launch grib2fmap
- Click on Convert! and select the .grb file you extracted in step 2
- Apply the weather into your BMS TE/Campaign in any of the two available ways (BMS Manual)
Grb2fmap useds cloud cover and precipitation criteria to select the BMS weather type (sunny, inclement…) for each cell. The Minimum Cloud Cover and Minimum Precipitation edit boxes allow to fine-tune how the program applies these criteria. In order for a weather type to be selected, both cloud cover and precipitation criteria must be met (i.e. in order to get inclement weather BOTH the cloud cover need to be 5/8 or more, and the precipitation rate 2mm/hr or more in that cell, with the default parameters). Playing with these values may allow you to weaken or strengthen the generated weather. In most cases, the included default values seem like a sensible compromise, requiring at least 1/8 cloud cover for fair weather, 5/8 for poor, and considerable rainfall for inclement.
The bottom left values correspond to the grid sizes of the generated map file. They can no longer be changed in the UI, but may be changed in the INI file, should this be required.
The bottom right is the current time in your campaign. The generated .fmap file(s) will be named starting from this time, in order to be used with the BMS auto-update feature (BMS 4.33 Manual Page 5-63).
The interval at what the BMS maps are generated (in minutes) can be specified in the last edit control. GRIB weather samples will be interpolated to generate this weather. Times as low as one minute can be specified, though something in the region of 60-180 minutes makes more sense. Bear also in mind that updating the weather map often in a multiplayer session will use considerable bandwidth!
The defualt value for these options may be changed editing the INI file.
The GRIB parser code is derived from wgrib v188.8.131.52b by Wesley Ebisuzaki which uses tables by by Helmut P. Frank and Luis Kornblueh itself.
Icon by Custom Icon Designs
BMS 4.33 of course (otherwise there would be no sense for this tool) by the BMS Team
Falcas for all his tools. Weather commander definitely helped to fix-up some glitches!
Please send me a PM and attach the .grb file, screenshot of your settings and any relevant .fmap files if you encounter any crash or oddly generated weather
- Microsoft Visual C++ 2013 Redistributable Package (x86): download if you get an error about missing MSVCP120.DLL
We are in November, so expect quite a lot of poor weather unless you play with the default parameters…
i may update the weather engine, to include cumulus coverage and visibility within the cells
Looks really interesting !
Thank you, I will play with weather today!:-)
Thank you so much, Ahmed!
Is that correct? I have prepared 80 fmaps for next days and their names go like this:
10500.fmap - 5 AM
10800.fmap - 8 AM
11100.fmap - 11 AM
11400.fmap - 14 PM
11700.fmap - 17 PM
12000.fmap - 20 PM
12300.fmap - 23 PM
12600.fmap - “26” PM (?) = 2 AM - shouldn’t it be named 20200.fmap?
EDIT: v0.3 fixing this available on the first post
As compensation , the weekend is looking better to get the viper downtown into Pyongyang
Thank you for this little, but very nice tool!!
Thank you very much, just did a quick test, looks quite good and very simple!
Well its November so the Weather isnt that good
Great stuff! Let me ask you one thing: Did you hack the fmap format or how are you writing it? Can you please share it?
Ironically I’m just finishing up the same utility…
Had to take some time to reverse the fmap file due to the lack of info.
One question if anyone would be so kind to answer, can BMS 4.33 use the full precision of the floating point numbers or should they be rounded to be optimized with the code? (see cursor values below)
Was going to use linear interpolation for the points but seems bilinear would be the best way to appropriate the data as the GRIB sample sets don’t match 59x59 by default, unless I’m missing something (which is probably the case lol). This also brings up the question of why 59x59 is used in the first place.
Question to the OP… Did you have to interpolate your GRIB data or was the selection size sufficient? My current method was to plot existing lat/long in the sample set and then extrapolate to a large grid using %. In my example below it only shows the sample set (GRIB) not yet interpolated.
This post is deleted!
This post is deleted!
Khronik, no there is no interpolation used at the moment (that is what I referred to as “smoothing” in the OP) but it would be a very easy thing to add. I may add it on a future version.
I didn’t worry about it as the effects are surely quite unnoticeable in-sim. I would go for simple, though, and not worry about projections, for the same previous reason.
I can’t get the file to run. I tried it many times. it shows the process running 3x but no action. I also can’t end the process through task manager. I have to restart my machine to get them to end. I also tried running in Adminitrator. Still no go. I’m using Windows 7 Pro.
Edit: it works fine on my windows 10 laptop
Jambo, glad you got it working! I really can’t assist you on the other PC without any more information. I use Windows 7 Pro myself without any problem.
As for the discussion above about interpolation I have implemented bilinear interpolation and the results where so surprising that I have released a new version (v0.4). Available on the first post.
This one is most likely the final, unless somebody finds any significant bugs (please dont!)
Thanks so much Ahmed,
Please can you also save ‘starting time’ into ini file? Only this last setting is not saved;-)
Awesome tool, thank you so much!
I’d love if it could bypass ZyGRIB altogether and download and convert GRIB data on its own, but this would be asked a bit too much, I think.
(Is an automated download for a selected area possible with any GRIB tool at all? Google does not provide a definite answer.)