Re: writing raster files produces black tifs


Julius Schmiedt
 

Thank you for the hint, I wasn´t aware of this ArcGIS behaviour concerning binary raster files. A first test was successful!

Am 12.07.2021 um 15:46 schrieb Hobart, Geordie (NRCan/RNCan):

Hi Julius.

 

If I understand you correctly, this is a Arc question.

IFF the values exist in your output file. You can test by loading your results file in a new process and rasterio.plot.show().

Arc tries to display a byte file for values between 0-255, hence no contrast between 0 and 1. In Arc,  open the layer properties of your  new GTiff and adjust the display values under the symbology tab.  

 

If not and the results file is all zeros then it is probably and error in your code. I had a similar issue where I incorrectly set the value NBITS =1 when calling rasterio.open() and on linux systems my output was empty.

 

Good luck.

Geordie

 

 

From: main@rasterio.groups.io <main@rasterio.groups.io> On Behalf Of Julius Schmiedt
Sent: July 12, 2021 02:18
To: main@rasterio.groups.io
Subject: [rasterio] writing raster files produces black tifs

 

Hello everybody,

I´m quite new to rasterio and Python, but my task is, to produce binary raster files based on the information of sentinel2 satellite images (GTiff). Therefore I use Spyder IDE and the numpy.where() method to calculate new arrays and save them as GTiffs.

Although the output arrays contain 0 and 1 values, the output tif only shows black (in the shape of the original gtiff), if opened with standard image viewer or ArcGIS Desktop. Only if opened via Python script in Spyder, I am able to display the output tifs as expected (using rasterio.plot.show() method).

If anybody has an idea, what the problem might be, I would appreciate any help.

Thanks!

--
Julius Schmiedt
Wissenschaftliche Hilfskraft

Department Landschaftsökologie
Helmholtz-Zentrum für Umweltforschung GmbH - UFZ
Permoserstraße 15 | 04318 Leipzig
Tel.: +49 341 235 - 1058
Email: julius.schmiedt@...
Web: https://www.ufz.de

--
Julius Schmiedt
Wissenschaftliche Hilfskraft

Department Landschaftsökologie
Helmholtz-Zentrum für Umweltforschung GmbH - UFZ
Permoserstraße 15 | 04318 Leipzig
Tel.: +49 341 235 - 1058
Email: julius.schmiedt@...
Web: https://www.ufz.de

Join main@rasterio.groups.io to automatically receive all group messages.