-
Notifications
You must be signed in to change notification settings - Fork 321
Description
Problem description
The current method for converting data from a data array to an image is limited to a single Scene.save_datasets call. While this is useful for the user since they only have to run one function, it is limiting for anyone who wants to customize things (a major problem in satpy). This caused to_enhanced_image to be created which returns an XRImage that can be used for further customization. This made a lot more sense when we used the masked array based Image class, but now XRImage is just a wrapper around an xarray DataArray.
I propose we add an enhance method to the Scene that returns a new scene with enhanced image arrays. It could do this inplace too, but I'm not sure I like that as the default. The resulting call sequence might look like:
scn = Scene(...)
scn.load([...])
rs_scn = scn.resample(...)
enh_scn = rs_scn.enhance()
enh_scn.save_datasets()
This allows more freedom to customize the enhanced datasets or to not enhance them at all (don't call enhance). It also declutters the save_datasets available keyword arguments.
Admittedly I was the one who originally wanted enhancements to be something the writer had control over, but I'm starting to change my mind the more I use satpy. The original idea was that different writers might want different enhancements. I think for those cases it is up to the user to change what enhancements are used or for the writer to do the enhancements itself when it makes sense (ex. scale factor and offset for NetCDF writing).
Additionally this would make it easier to have different enhancements for the same datasets and save them to the same file format; something I believe @pnuu needed.