Saturday, August 5, 2017

How to Add a Draw Style to LuckGrib

LuckGrib is a Mac app for downloading and viewing grib files. It offers the most functionality of any similar product, as well as offering the largest selection of grib data for download.  All the files it can download can then be exported to use in navigation programs for optimum routing, provided they are compatible with latest grib formats. LuckGrib will download and display all of the various grib2 format options, but many nav programs do not yet display these formats or map projections. Grib1 data, on the other hand, are more or less universal amongst viewers and nav programs.

Among the many unique features of LuckGrib,  this note is about its ability to add custom instances of what it calls "draw styles" and "style sets," and why we might need this.  A draw style is the prescription of how you want the data to appear on the compute screen. Showing wind, for example, as barbs, feathers, contour lines, color or gradient background scaled to speed, or streamlines is one example of a set of draw style options for wind. Then each of these can in turn be set to specific colors, line widths, spacing, and even the gradients can be digitally defined over speed ranges.  (In another part of the program you can specify how dense you want interpolation between actual data points, or no interpolation at all.)

More specifically, a LuckGrib draw style applies to a specific parameter and level, or set of levels. In a display of surface wind and pressure for example, you can define a draw style for wind that includes, say, barbs (an arrows option) and background colors (an images option), and another draw style for pressure (say contours only).  This combination of two draw styles can then be named and saved as a draw style set, which you can recall or apply to other grib files.  When combining wind, current, and waves, for example, we can use this freedom in display to emphasize one parameter with one style set, and another using a different style set.

But that unmatched versatility is not the subject at hand.

LuckGrib not only can access almost any valid grib file, it will also import it and make the data available to the user.  In the GFS model, for example, we typically get wind and pressure, precip, and maybe gusts, and maybe winds and altitudes at the 500 mb level, but in fact there are some 300 GFS parameters available, and LuckGrib lets you ask for any of them. This makes the app a tremendous tool for inland weather analysis.

If we were to ask, for example, for the soil temperature 1 meter below the ground, we would indeed get that data for any location in the US, and if we loaded that grib file and put the cursor over a chosen location, we would read that temperature from the panel in the top right of the screen. But there would be no graphic display of this data because it was not anticipated in the marine oriented product. There is no predefined draw style for this. Without a draw style, say color vs temp with contours of equal temp, we cannot tell at a glance where the best place to plant our corn in Kansas might be... for example.

We come back to more realistic examples shortly, but here is the soil temp + wind + press selected over WA state. The cursor does not capture, but the top right shows read out at cursor location.


There is no draw style for this parameter, so we must add one.
(1) click the arrow on the (highlighted) active grib file, and we see which draw styles are missing


(2) We see TSOIL is the only missing one.  Note that the parameter name is TSOIL and the level of the data is @ 1-2DBLL (1 to 2m depth below land level). Click the arrow next to draw styles, then in the next popup, uncheck the box that says Show only draw files referenced by file.... which really means show only draw files referenced by file that have been so far activated. TSOIL will not show up at this point, we have to add it.

(3) For other parameters, you can scan the long list that then shows up to see if your parameter is there, but just not with the level you care about. But in this case there is no TSOIL, so we have to use + button and add it.

(4) When you press + you get the choices: Contour, Scalar image, Arrow,  or Streamline. For this parameter we would want to add contour and then scalar image, which is the one needed for a color gradient background.


Once you type in the official parameter abbreviation that we read from an earlier screen, it will know what this is and print the name as soon as you click the level field.  In this case, we can just use the default for all levels, since this is the typical draw style we would use for temperature.

You can sniff around the main grib file display with the cursor to see the range of temperatures you might like and enter them here, but this can always be changed easily once this style is saved.

Then do the same for an image style, and just drag one of the gradient patterns onto the template.  (I will need to add a video on this, which shows the process).

Then you are done and you can go back to the grib display and show these new styles for a clear picture of where to plant the corn.


We see several hot spots, the red peaks are 66ยบ F and higher. The yellow is about 48 and the turquoise is just under 40.  Not sure what this means.... it is a random exercise (this is not even Kansas), but ends up sort of interesting. Portland and Tacoma are the two red areas on the left, but not sure at all what the other hot areas mean.  This is left as an exercise.  There is nothing in those red areas with any similarity to Tacoma and Portland that I can think of—other than, (it appears) having high soil temperatures 1 to 2 meters below the ground. Also, why Tacoma and not Seattle? ... all beyond our present scope.

I will add a video to outline the process, and discuss the real example that forces mariners into this operation.  It has to do with pressure contours referenced to ground level (not what we want) rather than to mean sea level, which is the convention used in some Norwegian grib files.

On the other hand, LuckGrib is a fantastic tool for making your own inland weather station to predict thunderstorms, rain, cloud cover, and air temperature.  This use of the program on land will call for several of these custom draw styles.  Keep in mind, too, as you play with this exercise, you can't hurt anything. There are numerous buttons that take all draw styles, or selected ones, back to default.

Video on just adding a level to an existing parameter ... the motivating operation for this exercise.



Here is a video showing the steps of the above article, which is the full process of adding a parameter and draw styles.



No comments:

Post a Comment