I am trying to plot a GeoTIFF that was initially created in QGIS. When saving the file, I export the GeoTIFF with the raw data to prevent errors while making the appropriate color map for matching the meta-data. For more context, I am saving a sub-set of the CS3 land use NetCDF. After I have saved the GeoTIFF to a specific extent, I open it with Georaster, get the image boundaries, and plot it with imshow. To make sure I have the correct color pallet for the color map, I read the GeoTIFF, save all pixel values in an array, and look for all possible values to account for in the color map list. The value array looks as follows:
Raster value list [10, 11, 12, 20, 30, 40, 50, 60, 61, 62, 70, 90, 100, 110, 120,
122, 130, 150, 153, 160, 170, 180, 190, 200, 210, 220]
And this is the array of the corresponding colors:
flag_colors = [ '#ffff64', '#ffff64', '#ffff00', '#aaf0f0','#dcf064', '#c8c864',
'#006400', '#00a000','#00a000', '#aac800', '#003c00', '#788200','#8ca000',
'#be9600','#966400','#966400','#ffb432', '#ffebaf','#ffebaf','#00785a', '#009678',
'#00dc82', '#c31400','#fff5d7','#0046c8', '#ffffff']
So when I plot the file with the following script:
my_image = georaster.SingleBandRaster(geotif_path, load_data=False)
minx, maxx, miny, maxy = my_image.extent
nc = georaster.SingleBandRaster(geotif_path, load_data=(minx, maxx, miny, maxy),
latlon=True)
cmap = ListedColormap(flag_colors)
ax.imshow(nc.r, cmap=cmap, vmin=10, vmax=220, extent=(minx, maxx, miny, maxy))
I get this image:
But what I was expecting something like this:

Even though I included all the colors in the array for the values in the GeoTIFF file, I not getting the correct colors on the plot.
Thank you in advance!
