nasa / harmony-browse-image-generator

Other
2 stars 4 forks source link

Mhs/das 2108/handle no data #6

Closed flamingbear closed 5 months ago

flamingbear commented 5 months ago

Description

This PR updates HyBIG to appropriately handle masked data. Rioxarray's mask_and_scale masks bad data some details here This PR ensures that data that comes in as "bad" according to rioxarray is transparent, i.e. not shown, in the final output image.

This corrects a bug where data with nans was normalized incorrectly leading to all black output images.

Code and tests were updated to ensure any image, 1 band raster without associated colortable, 1band with colortable, a 3band raster and 4band raster are all tested with missing/bad data.

Jira Issue ID

DAS-2108

Local Test Steps

build and run the image and tests.

❯ ./bin/build-image && ./bin/build-test && ./bin/run-test

Deploy the new image to your local Harmony-In-A-Box.

This has been associated with HGA again and can't be tested in harmony at the moment. Ensure you're on the VPN, associate HyBIG with C1260737748-ASDC_DEV2 and Test PREFIRE data with this command: http://localhost:3000/C1260737748-ASDC_DEV2/ogc-api-coverages/1.0.0/collections/all/coverage/rangeset?forceAsync=true&granuleId=G1262401617-ASDC_DEV2&format=image%2Fpng&outputCrs=EPSG%3A4326&skipPreview=true

Alternatively download a test file here: https://data.asdc.sit.earthdata.nasa.gov/asdc2-sit-protected/browse/PREFIRE/PREFIRE_SAT2_2B-FLX_R00/2021.07.21/PREFIRE_SAT2_2B-FLX_S07_R00_20210721044449_03042.nc.G00.tif

And run it through this gist. https://gist.github.com/flamingbear/ce1a41962a65766c5230bab736cc1002

visualize the output in qgis.

PR Acceptance Checklist

flamingbear commented 5 months ago

@owenlittlejohns You want to re-review the latest changes?

lyonthefrog commented 5 months ago

I ran the test using the test-prefire.py script, and it looks like I got the expected output. The left image shows the original problem, and the right image is the corrected output using this branch.

das-2108-results

I added a few questions, but they're mainly just for my own understanding. Cool stuff!