Main goal: Create pandas DataFrame from raster image - one row per pixel
I have been using this resource
Main problem: Rasterio is improperly marking every pixel as NoData instead of pulling the proper values
I am working with .tif files from SoilGrids.org which give soil attributes such as sand, silt, clay, ph, etc.. Each .tif file has only one band. When I open the .tif files in ArcMap, I clearly see the values of the raster and everything displays properly.
When I display in rasterio using
img=rasterio.open("C:\\Users\\Research\\Documents\\Tara_Fall_2019\\Senegal_LCC\\SG_data\\Senegal_cec_0-5cm_mean_clipped.tif")
show(img,0)
I get the following image which shows the correct raster
but when I try to pull the actual data using
#read image
band=img.read(1)
band
I get an array full of nodata values
For reference, here are the properties of the raster pulled from arcmap
I have tried opening other .tif rasters from the same source with all the same properties and have the same problem. My guess is it is something wonky about the properties of the .tif files.