I have been looking all over the internet for a possible cause of this, but without luck, and was hoping it's some standard Rasterio quirk that I just can't track down. I am trying to load the Tanzania poverty map from World Pop, which is a 1km resolution raster grid of population rates (available here). Values for each grid square can be between 0 and 1, and the raster looks like this:
Using the following Python code I've been loading the raster with Rasterio:
import os
import rasterio
file_path = os.path.abspath('path/to/tza10povcons125.tif')
raster = rasterio.open(file_path)
band = raster.read(1)
Based on my understanding of Rasterio, I would expect the band
variable to contain a 2 dimensional array of values between 0
and 1
(or, rather, 0.664994
and 0.950991
, which are the min and max values according to QGIS). However, when I print out the band
variable I see:
array([[ -3.39999995e+38, -3.39999995e+38, -3.39999995e+38, ...,
-3.39999995e+38, -3.39999995e+38, -3.39999995e+38],
[ -3.39999995e+38, -3.39999995e+38, -3.39999995e+38, ...,
-3.39999995e+38, -3.39999995e+38, -3.39999995e+38],
[ -3.39999995e+38, -3.39999995e+38, -3.39999995e+38, ...,
-3.39999995e+38, -3.39999995e+38, -3.39999995e+38],
...,
[ -3.39999995e+38, -3.39999995e+38, -3.39999995e+38, ...,
-3.39999995e+38, -3.39999995e+38, -3.39999995e+38],
[ -3.39999995e+38, -3.39999995e+38, -3.39999995e+38, ...,
-3.39999995e+38, -3.39999995e+38, -3.39999995e+38],
[ -3.39999995e+38, -3.39999995e+38, -3.39999995e+38, ...,
-3.39999995e+38, -3.39999995e+38, -3.39999995e+38]], dtype=float32)
The recurring value, -3.39999995e+38
, is also suspiciously close to the minimum value for numpy's float32
datatype:
>>> import numpy as np
>>> np.finfo('float32').min
-3.4028235e+38
I am just wondering if anyone has seen this kind of behaviour for Rasterio before, or if there is something obvious that I am missing?