Skip to content

Nodata is not respected when using expression #487

Answered by vincentsarago
dvd3v asked this question in Q&A
Discussion options

You must be logged in to vote

The issue here is in rio-tiler. The expression applied after data reading and we have no way to know if the mask was created from nodata / mask / alpha band, which is why we can't update the Mask https://github.com/cogeotiff/rio-tiler/blob/master/rio_tiler/io/cogeo.py#L417-L432

One possible solution is to use the post_process option of rio-tiler Reader (https://cogeotiff.github.io/rio-tiler/readers/#read-options) and to pass it via the dataset_dependency which default to:

from dataclasses import dataclass
import numpy
from enum import Enum
from titiler.core import dependencies
from fastapi import Query

def b1mask(data: numpy.ndarray, mask: numpy.ndarray):
    b1_mask = numpy.where(data[0] >

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@dvd3v
Comment options

@vincentsarago
Comment options

@vincentsarago
Comment options

@dvd3v
Comment options

Answer selected by dvd3v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants