Ingesting simple gridded NetCDF data
Hi Pete,

In most of our readers we use a helper method (see format_colortable and load_colormap defined in syntool_converter/utils/ that supports matplotlib and a few other colormaps to build the object that we assign to the colortable field of the band.

Note that using the helper method is not mandatory:  as long as a gdal.Colortable instance (wherever it comes from) matching your colormap is assigned to the colortable field, the resulting GeoTIFF will use a palette based on your colormap to render unsigned byte values as RGB.

If your colormap is really not supported (i.e. not a matplotlib colormap nor one of the other colormaps supported by Syntool), I think you should make a copy of the format_colortable method in your reader and implement a custom load_colormap method which builds and returns a matplotlib.colors.LinearSegmentedColormap for your colormap.



Messages In This Thread
Ingesting simple gridded NetCDF data - by petwa - 2021-05-06T12:40 PM
RE: Ingesting simple gridded NetCDF data - by Sylvain Herlédan - 2021-05-11T09:33 PM

Forum Jump: