I am 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 for the Coordinate reference system of this layer. I tried to specify 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?