I manipulating netcdf raster data from the QGIS python console. The metadata of my netcdf file does not provide the Reference system. However I know it is 'EPSG:4326' I am writing a python script to perform tasks automatically, I don't want user interaction.
I am using the following commands :
fileName = "/path/to/raster/file.tif" fileInfo = QFileInfo(fileName) baseName = fileInfo.baseName() rlayer = QgsRasterLayer(fileName, baseName)`
But the QGIS windows asked me the Coordinate reference system of this layer. I tried to specified the crs while loading with something like
rlayer = QgsRasterLayer(filename=fileName, basename=baseName, crs='EPSG:4326')
But QGIS crashes.
Is it possible to specify a qml file where the crs is defined ?