Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGB PNG output looks strange #168

Open
m-mohr opened this issue May 20, 2022 · 0 comments
Open

RGB PNG output looks strange #168

m-mohr opened this issue May 20, 2022 · 0 comments

Comments

@m-mohr
Copy link
Member

m-mohr commented May 20, 2022

I'm trying to create a RGB PNG, which looks good as GTiif:

datacube2 = connection.load_collection(collection_id = "SENTINEL2_L2A_MOSAIC_120", bands = ["B04", "B03", "B02"], spatial_extent = {"east": 9.722042179836016, "north": 43.14486158000392, "south": 41.34576268423038, "west": 8.44096604833396}, temporal_extent = ["2020-04-01T00:00:00Z", "2020-04-30T00:00:00Z"])

def reducer1(data, context = None):
    data1 = process("mean", data = data)
    return data1

datacube4 = datacube2.reduce_dimension(dimension = "t", reducer = reducer1)
datacube5 = datacube4.save_result(format = "PNG")

The resulting image looks weird:

MicrosoftTeams-image (2)

Some observations from this:

  1. I suspect I still need to do a linear scaling to 0 to 255, but the metadata doesn't show the min/max values for the bands. I'd propose to add statistics to raster:bands in the stac metadata, otherwise it's hard to know how to apply the scaling.
  2. If you try to write a PNG and the values do exceed the allowed values of a PNG (e.g. < 0 or > 255), I would hope to find a warning in the job logs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant