LuciadLightspeed allows you to customize the visualization of NetCDF data, either by mapping data values to colored pixels, or by displaying a grid of icons. The latter method is suitable for NetCDF models containing multiple values. It combines the values of different parameters for the same position, and displays them as a single icon. A symbol for the wind combines both intensity and direction in a single icon, for example.

Setting up your own color model

The NetCDF painter provider for GXY views and NetCDF layer builder for Lightspeed views have a default color model for many types of weather data. You can use TLcdColorMap in combination with a TLcdIndexLookupOp image operator or TLspRasterStyle to set up your own color model.

First, create a TLcdColorMap that maps your colors to data values. You can add transparency to the colors as a fourth parameter. The data range can be retrieved from each ALcdImage's ALcdBandMeasurementSemantics.

To configure the color map in a Lightspeed view, use the colorMap method of the TLspRasterStyle builder.

To configure the color map in GXY view, build a TLcdLookupTable based on the color map and create an ALcdImageOperatorChain consisting of a single index lookup operator. You can configure the resulting chain on a TLcdGXYImagePainter. This is shown in Program: Setting up a color model. For more information on TLcdGXYImagePainter, refer to the LuciadLightspeed Developer’s Guide article on Image Processing.

Program: Setting up a color model (from samples/decoder/netcdf/gxy/custom/CustomNetCDFLayerFactory)
TLcdColorMap defaultColorMap = TLcdNetCDFGXYPainterProvider.createDefaultColorMap(netCDFObject);

// Create an image operator chain that contains a lookup table operation using a custom color map
TLcdColorMap colorMap = WeatherUtil.retrieveColorMap(netCDFObject, defaultColorMap);
TLcdLookupTable lookupTable = TLcdLookupTable.newBuilder().fromColorMap(colorMap).build();
ALcdImageOperatorChain colorMapLookupOperator = ALcdImageOperatorChain.newBuilder().indexLookup(lookupTable).build();

// Return an image painter that uses this lookup table
TLcdGXYImagePainter imagePainter = new TLcdGXYImagePainter();

Displaying a grid of icons

ILcdParameterizedIcon is an interface for drawing graphical icons. The method paintIcon paints the icon at the given position (x,y), expressed in view coordinates. The appearance of the icon can depend on the NetCDF values provided at that location. The class TLcdEarthWindIcon provides a common implementation. It displays standard wind barbs depicting direction and intensity, based on the U-component and V-component of the wind. The class TLcdEarthArrowIcon displays a colored arrow.

For NetCDF data with one component, such as temperature, TLcdNumericParameterizedIcon can be used to display a numeric text icon. A TLcdEarthSparseIcon displays another ILcdParameterizedIcon icon, with an icon density that is based on the strength of the parameter. It achieves this by not painting icons in regions where the strength of the parameter is low.