Re: read masked and overviews when no-data value is defined

Guy Doulberg

clicked send too soon:

2. when using masked overviews, it looked like it was using the overview

later today I will try to run tests again

Do you care on how we created the original raster?

On Wed, Aug 8, 2018 at 11:43 AM, Guy Doulberg <guyd@...> wrote:
He Sean,

We are creating  cog files using our code that takes as input any raster, tiles it add overviews and rearrange the tif to be a cog.

For doing so we are using rasetio shutils copy and rasterio build_overview.

The source rasters that we are working on have nodata

We did a variant of code in which we prior for creating the overviews we also created Band Mask

1. when we had no-data values, and read using the overviews it looked like it was constructing the overview from the original size

On Wed, Aug 8, 2018 at 12:14 AM, Sean Gillies <sean.gillies@...> wrote:
Hi Guy,

A month ago we resolved an issue in Rasterio that has some commonalities with yours. There was a report that overviews were being missed when reading masked arrays and it turned out that the overviews themselves were in error.

In Rasterio, we will skip reading a mask from the dataset if the dataset has no mask, but otherwise we don't call GDAL functions differently in the band mask vs nodata cases.

Can you tell us what nodata value is implicated in this problem and what software produced the data files?

On Mon, Aug 6, 2018 at 8:52 AM <guyd@...> wrote:
Hi all,

We are trying to read masked array using ``, reading the documentation it looks that if we pass masked=True we will get what we wanted. 

I was testing the read on raster with pre-built overviews and I used the overviews in read. From functionality point of view, I always got the right result, but I was tesing the data block that are being used, and I noticed this behaviors:

1. When using band-mask, there was a read only from the overview to construct the mask -- as excpected
2. When using no-data value there were reads the data of the original resolution and not from the nearest overview? when mask=False it reads data only from the overview,  why is that?

A workaround for that is to read with no mask and to construct the mask myself using the no-data value.


Sean Gillies

Join to automatically receive all group messages.