NetCDF output option for true-color

17 views
Skip to first unread message

Nigel Atkinson

unread,
Aug 20, 2021, 5:53:37 AM8/20/21
to pytroll
I'm looking into whether we can use satpy to assist our own imagery-generation system by generating true-color data which we can then ingest and plot in our usual way. I can generate a basic AHI image like this:

scn = Scene(filenames=glob("goes16/*"), reader='abi_l1b')
scn.load(['true_color'])
new_scn = scn.resample(scn.min_area(), resampler='native')
new_scn.save_datasets(writer='simple_image',filename='goes16_new.png')

The netCDF writer option looks like it could be useful as it generates data that could be interrogated by an external program:

new_scn.save_datasets(writer='cf',filename='goes16_new.nc')

It generates a dataset 'true_color' of dimension nx,ny,3. I would have expected this dataset to be the R, G, B components of the image - but it is not. You get something that is close to a black and white image, though there are some colour differences. Also, the range (in the central portion of my test image) is -7 to +435; not sure how to interpret that. Could you explain?

The other option I looked at was to save "scn" (before the resampler) rather than "new_scn". Here we get datasets called "C01", "C02", "C03". The attributes suggest that these are red, blue and 0.865um reflectances, i.e. before the creation of the pseudo-green channel. So that's probably not so useful.

Regards,

Nigel

Raspaud Martin

unread,
Aug 20, 2021, 6:48:31 AM8/20/21
to pyt...@googlegroups.com
Hi Nigel,

Regarding saving images to netcdf format: this is not something we
generally do. The way we designed it, the saving of data to netcdf is
to be able to have physical datasets available for other programs. As
such, the data is not "enhanced" (scaled, stretched) to the 0-255 space
that RGB images usually require, which means that you will get the
calibrated and corrected (sunz and rayleigh) data in the netcdf files.

So the values you get are probably (at least for the R and B channels)
corrected reflectances. The sunz normalization in particular can create
quite high (unrealistic) values, so that would explain the max of +435
you get.

The true color image in particular applies by default logarithmic
enhancements (or scaling if you prefer) to the data to produce
something visually pleasing, so that, along with the uncut extreme
values of the corrections, could explain the strange image you get.

As an aside, if you have a specification for having images in netcdf, I
am interested: A few years ago, when I looked for one, I couldn't find
anything.

Regarding saving the data before resampling, well the ABI data has
different resolutions for the different channels as you surely know,
meaning that the arrays of data are of different shapes. That's why
satpy delays the generation of the images till after the resampling, to
get all channels with the same shape, and what you get is indeed the
channels needed for red, blue and the fake green.

Finally, I'd like to mention that the go-to image format used by most
in the pytroll community for visualisation in meteorological
workstations is Geotiff. This format has the advantage of working well
with Web Map Services for example, a service quite popular nowadays for
serving imagery to customers. But of course, you may have a different
usage of data.

Best regards,
Martin

Nigel Atkinson

unread,
Aug 20, 2021, 8:38:46 AM8/20/21
to pytroll
Martin,

Thanks. After a little more investigation I confirmed that the 'true_color' dataset in the netCDF does indeed contain the corrected reflectances for red, green and blue. I applied the nonlinear scale that we usually use for MODIS and VIIRS, and got a nice colour image out.

Our system can easily ingest netCDF and hdf5, so that could be the way to go.

Regards,

Nigel
Reply all
Reply to author
Forward
0 new messages