==================================================================================================== Try and error with seviri composites "night_ir_with_background" and "night_ir_with_background_hires" ==================================================================================================== Below I list some important entries concerning my investigation. 2022/06/08 Ernst Lobsiger satpy 0.36 etc/composites/visir.yaml ************************* _night_background: compositor: !!python/name:satpy.composites.StaticImageCompositor standard_name: night_background # url: "https://neo.sci.gsfc.nasa.gov/archive/blackmarble/2016/global/BlackMarble_2016_01deg_geo.tif" url: "https://neo.gsfc.nasa.gov/archive/blackmarble/2016/global/BlackMarble_2016_01deg_geo.tif" known_hash: "sha256:146c116962677ae113d9233374715686737ff97141a77cc5da69a9451315a685" # optional _night_background_hires: compositor: !!python/name:satpy.composites.StaticImageCompositor # standard_name: night_background_hires // ** see below standard_name: night_background # url: "https://neo.sci.gsfc.nasa.gov/archive/blackmarble/2016/global/BlackMarble_2016_3km_geo.tif" url: "https://neo.gsfc.nasa.gov/archive/blackmarble/2016/global/BlackMarble_2016_3km_geo.tif" known_hash: "sha256:e915ef2a20d84e2a59e1547d3ad564463ad4bcf22bfa02e0e0b8ed1cd722e9c0" # optional # There is no (generic.yaml) enhancement with name/standard name 'night_background_hires': # Change standard_name to 'night_background' or add enhancement 'night_background_hires'?! etc/composites/seviri.yaml ************************** night_ir_alpha: compositor: !!python/name:satpy.composites.GenericCompositor standard_name: night_ir_alpha prerequisites: - name: IR_039 - name: IR_108 - name: IR_120 - name: IR_108 night_ir_with_background: compositor: !!python/name:satpy.composites.BackgroundCompositor standard_name: night_ir_with_background prerequisites: - night_ir_alpha - _night_background night_ir_with_background_hires: compositor: !!python/name:satpy.composites.BackgroundCompositor # standard_name: night_ir_with_background_hires // *** see below standard_name: night_ir_with_background prerequisites: - night_ir_alpha - _night_background_hires etc/composites/abi.yaml *********************** night_ir_alpha: compositor: !!python/name:satpy.composites.GenericCompositor standard_name: night_ir_alpha prerequisites: - 3.90 - 10.3 - 12.3 - 10.3 night_ir_with_background: compositor: !!python/name:satpy.composites.BackgroundCompositor standard_name: night_ir_with_background prerequisites: - night_ir_alpha - _night_background night_ir_with_background_hires: compositor: !!python/name:satpy.composites.BackgroundCompositor # standard_name: night_ir_with_background_hires // *** see below standard_name: night_ir_with_background prerequisites: - night_ir_alpha - _night_background_hires etc/composites/ahi.yaml *********************** night_ir_alpha: compositor: !!python/name:satpy.composites.GenericCompositor standard_name: night_ir_alpha prerequisites: - name: B07 - name: B13 - name: B15 - name: B13 night_ir_with_background: compositor: !!python/name:satpy.composites.BackgroundCompositor standard_name: night_ir_with_background prerequisites: - night_ir_alpha - _night_background night_ir_with_background_hires: compositor: !!python/name:satpy.composites.BackgroundCompositor # standard_name: night_ir_with_background_hires // *** see below standard_name: night_ir_with_background prerequisites: - night_ir_alpha - _night_background_hires etc/enhancements/generic.yaml ***************************** night_background: standard_name: night_background operations: - name: stretch method: !!python/name:satpy.enhancements.stretch kwargs: stretch: crude min_stretch: [0, 0, 0] max_stretch: [255, 255, 255] # ** There is no enhancement for 'night_background_hires'! # This caused hires city illumination looking plain white # while with the lowres background it looks yellow/golden. night_ir_alpha: standard_name: night_ir_alpha operations: - name: stretch method: !!python/name:satpy.enhancements.stretch kwargs: {stretch: linear, cutoffs: [0.02, 0.02]} - name: inverse method: !!python/name:satpy.enhancements.invert args: - [true, true, true, true] night_ir_with_background: standard_name: night_ir_with_background operations: - name: stretch method: !!python/name:satpy.enhancements.stretch kwargs: stretch: crude min_stretch: [0, 0, 0] max_stretch: [1, 1, 1] # *** There is no enhancement for 'night_ir_with_background_hires'!? # Not sure the above is very different from the enhancement default? Conclusions: ************ I started with MSG4 seviri data to plot composite 'night_ir_with_background'. It turns out that there are a couple of bugs with this composite. These bugs spread to different composites as 'night_ir_with_background' is also used in day/night composites and for other GEO satellites (instruments abi and ahi). When resampling to 'seviri_0deg' it turns out that resampler 'nearest' does cause a white free space around the disc. fill_value=0/255 in the save_dataset line has NO effect. resampler='gradient_search', method='bilinear' or plain and slow resampler='bilinear' work as expected with fill_value=0/255 in the save_dataset line. Experiments with fill_value in the resampler line show: ******** !! NEVER EVER USE fill_value=xxx IN THE RESAMPLE LINE !! ******** You will have all sorts of weird effects whith whatever resampler you use. 'nearest' does upset composites while 'bilinear' makes a lot of wrong pixels. You can make resampler 'nearest' to produce a black free space around the disk if you hard code/set the fill_value in pyresample/kd_tree.py to zero: ... if fill_value is not None and np.isnan(fill_value) and \ np.issubdtype(data.dtype, np.integer): fill_value = 0 # _get_fill_mask_value(data.dtype) logger.warning("Fill value incompatible with integer data " "using {:d} instead.".format(fill_value)) ... Of course this is a plain "botch". fill_value=0 should be given back _get_fill_mask_value(data.dtype) and no idea what the side effects are. But maybe this is a hint at last to make 'nearest' behave as expected.