Jump to content
Linuxuser1234

Hoiw to visualize GRIB2 Files

Recommended Posts

The GRIB2 data is highly compressed data that effectively is a giant matrix.   GRIB2 is a compression format just like *.ZIP  or *.TAR files are compressed files.   GRIB2 files are massive files and are compressed to make transmission faster.   There are decompression programs that you can find free on the internet that will read them and create a gridded data file (matrix is a better description.)   And I'd suggest using those programs to extract the data rather than writing your own.  The next step is to select what data you wish to plot.  For example, the GFS model covers the entire world, and I believe the spacing is a value every one degree of lat and Long.  That is 129,699  values for every parameter, for every level -- surface to 10mb  --  for every time period for 16 days.   To plot a map, you have to go into this immense file and pick out those points that you want to display on the projected area of the map.   To complicate it, some values are actually pairs of data, one on one grid, and one on another.  Wind data is one such set.  To evaluate the wind at one point, you have to get the correct value from the correct point in two 129,699 point grids.  Finally, once you have your array of data that you want to plot, you have to plot it on to a map projection.  Unless you commit to using a simple Mercator projection, and your background bitmap is also a measurable  Mercator projection,  Overlaying the weather data onto an existing map on the screen will not be trivial either.  If you can find out exactly what projection your bitmap image was created with,  you job will be much easier.  Without that, I would recommend you create your own background map in a projection that you have the equations for and like.   Then comes the job of converting every data point (lat/long) into the X/Y coordinates of the screen.    This is all do-able--I've done it for creating trajectory forecasts for objects at about 100,000 ft ASL.   Just want to let you know that this is not a "beginner's" project and it will take a lot of time.    

 

In another post, you were asking about plotting fronts and pressure centers on a bitmap image.   I'd suggest knocking that project out first.  That has all the challenges of putting data out onto a map projection, but using simplified data values: lat/long  points for fronts, and a couple of numerical values for the Highs and Lows.   The advantage of doing that smaller project is I think those weather messages come out 4 times a day (or at least twice a day) and you can go on-line to check your plot against the "official" plot presumably where NWS took the data from.   Just be sure to check the product issue dates and times--that you don't have an outdated map to compare against.  It is essential that you always verify that you are plotting is what you think you are plotting.  That the data are in the right place and have the correct values.

 

Good luck on this project.  Creating the program to  plot fronts from the text message is a good one, and it will give you a working sub-routine that you can fold into later software you develop that also plots data onto maps.  Handy to keep in your bag of tricks.   Once you get the method of plotting data onto map projections down,  then you might try getting into working with the GRIB2 data.    Be sure you are solid on pointers and seek() commands, etc.   Have fun, and let me know when you get results.  Love to see them.

 

ptlycldy

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×