I am using Gtif files for raster calculations in python. I want to apply the formula:
Aridity index = precipitation/(Temperature + 10).
When I use this for Gtiff I get the following error: "TypeError: unsupported operand type(s) for /: 'DatasetReader' and 'DatasetReader".
I am new to python. Thank you
Here is my code:
tmp_tif= rasterio.open('temp.tif')
pcp_tif = rasterio.open('pcp.tif')
AI_DM = pcp_tif/tmp_tif + 10
As @alex points out (see comments), you should read the contents of the DatasetReaders first (see Documentation)
Therefore, what you want to do is this:
tmp_tif= rasterio.open('temp.tif').read()
pcp_tif = rasterio.open('pcp.tif').read()
AI_DM = pcp_tif/tmp_tif + 10