mapbox / mapbox/rio-rgbify

Fix nodata values at source edges

Open
#38 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
125
Forks
46
PR merge metrics
No merged PRs in 30d

Description

This is in case anyone else runs into the same issue, really.

I was having issues with artefacts at the edges of source images, caused by nodata values. Adding a call to numpy's `nan_to_num` in data_to_rgb (encoders.py) fixes it:

data /= interval
data = np.nan_to_num(data, True, 100000.0)
data = np.around(data / 2**round_digits) * 2**round_digits

(100000.0 is from the -b and -i values of my invocation and shouldn't be hardcoded, obviously.)

Contributor guide

Open the contributing guide

Research direction

Start by reading data_to_rgb in encoders.py and trace how the -b and -i values determine the interval and nodata handling. Verify the edge case with source images containing nodata values, and ensure the resulting encoded output has no edge artefacts without hardcoding invocation-specific values.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.