Geographic Information Systems Asked on September 25, 2021
I am running a python script which calibrates a hydrologic model, this script uses gdal from Osgeo. Following is the command I am giving python:
from osgeo import gdal
infile="G:ARORAvic_inputsrouting_filesnew_basinsutlej_beas_new_fraction.tif"
ds = gdal.Open(infile,gdal.GA_ReadOnly)
b1 = ds.GetRasterBand(band)
b1 gives the following error:
AttributeError Traceback (most recent call last)
<ipython-input-33-ba605a73e25c> in <module>()
----> 1 b1 = ds.GetRasterBand(band)
AttributeError: 'NoneType' object has no attribute 'GetRasterBand'
The type(ds) returns NoneType.
What could be wrong here?
I had the same problem. I just capitalised tif in the path. It got solved that way.
So try replacing tif
as TIF
.
Also write the path in r""
so that you don't have to change the .
Answered by lianna on September 25, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP