[Qgis-user] Can I open NetCDF files with QGIS?

Etienne Tourigny etourigny.dev at gmail.com
Wed Feb 8 11:02:53 PST 2012


Another solution is to have only one variable per file, you can do
that with cdo easily.

Etienne

On Wed, Feb 8, 2012 at 4:59 PM, Etienne Tourigny
<etourigny.dev at gmail.com> wrote:
> It seems that QGis does not support GDAL raster "subdatasets", I get
> this with netcdf and hdf4  files.
>
> Try this:
>
> gdal_translate -of vrt NETCDF:"Glb_20111001.nc":cf_DangerRisk danger_risk.vrt
> qgis danger_risk.vrt
>
> For more information on subdatasets see the GDAL netcdf driver page:
> http://www.gdal.org/frmt_netcdf.html
>
>
> It's a pity this doesn't work directly in QGis - anybody know if this
> could be fixed/implemented?
> It would be great to support subdatasets by adding a layer for each
> subdataset, and perhaps even better with a dialog for selecting a
> particular subdataset.
>
> Regards,
> Etienne
>
>
> On Wed, Feb 8, 2012 at 3:51 PM, Paolo Corti <pcorti at gmail.com> wrote:
>> Hi
>> sorry if this has been discussed before, but according to what I see
>> here [1] there was not an answer.
>>
>> I need to open a NetCDF file with QGIS.
>> I am using QGIS 1.7.2, and GDAL 1.9.0.
>> I can successfully manage NetCDF files with GDAL:
>>
>> $ gdalinfo --formats
>> Supported Formats:
>>  ...
>>  netCDF (rw+): Network Common Data Format
>>  ...
>>
>> $ gdalinfo Glb_20111001.nc
>> Driver: netCDF/Network Common Data Format
>> Files: Glb_20111001.nc
>> Size is 512, 512
>> Coordinate System is `'
>> Metadata:
>>  NC_GLOBAL#CDI=Climate Data Interface version 1.4.3
>>  NC_GLOBAL#CDO=Climate Data Operators version 1.4.3
>> (http://www.mpimet.mpg.de/cdo)
>>  NC_GLOBAL#Conventions=CF-1.0
>>  NC_GLOBAL#history=Wed Oct 12 23:30:47 2011: cdo -s -f nc merge
>> af01_20111001.nc af02_20111001.nc pf01_20111001.nc pf02_20111001.nc
>> pf03_20111001.nc pf04_20111001.nc pf05_20111001.nc pf06_20111001.nc
>> pf07_20111001.nc pf08_20111001.nc pf09_20111001.nc pf10_20111001.nc
>> pf11_20111001.nc pf12_20111001.nc pf13_20111001.nc pf14_20111001.nc
>> pf15_20111001.nc pf16_20111001.nc pf17_20111001.nc pf18_20111001.nc
>> pf19_20111001.nc pf20_20111001.nc pf21_20111001.nc pf22_20111001.nc
>> pf23_20111001.nc pf24_20111001.nc pf25_20111001.nc pf26_20111001.nc
>> pf27_20111001.nc pf28_20111001.nc pf29_20111001.nc pf30_20111001.nc
>> pf31_20111001.nc pf32_20111001.nc pf33_20111001.nc pf34_20111001.nc
>> pf35_20111001.nc pf36_20111001.nc pf37_20111001.nc pf38_20111001.nc
>> pf39_20111001.nc pf40_20111001.nc pf41_20111001.nc pf42_20111001.nc
>> pf43_20111001.nc pf44_20111001.nc pf45_20111001.nc pf46_20111001.nc
>> pf47_20111001.nc pf48_20111001.nc pf49_20111001.nc pf50_20111001.nc
>> Glb_20111001.nc
>> Wed Oct 12 23:30:39 2011: cdo -s -f nc merge
>> pf50_20111001_DangerRisk.nc pf50_20111001_FWI.nc pf50_20111001.nc
>> Wed Oct 12 23:30:37 2011: cdo -s -f nc mergetime
>> pf50_20111001_20111001_FWI.nc pf50_20111001_20111002_FWI.nc
>> pf50_20111001_20111003_FWI.nc pf50_20111001_20111004_FWI.nc
>> pf50_20111001_20111005_FWI.nc pf50_20111001_20111006_FWI.nc
>> pf50_20111001_20111007_FWI.nc pf50_20111001_20111008_FWI.nc
>> pf50_20111001_20111009_FWI.nc pf50_20111001_20111010_FWI.nc
>> pf50_20111001_FWI.nc
>> Wed Oct 12 23:30:36 2011: cdo -s -f nc -R chname,var228,pf50_FWI -copy
>> Work0/20111001_fwi/pf50/20111001_20111010_FWI.grib
>> pf50_20111001_20111010_FWI.nc
>>  NC_GLOBAL#institution=European Centre for Medium-Range Weather Forecasts
>> Subdatasets:
>>  SUBDATASET_1_NAME=NETCDF:"Glb_20111001.nc":cf_DangerRisk
>>  SUBDATASET_1_DESC=[10x640x1280] cf_DangerRisk (32-bit floating-point)
>>  SUBDATASET_2_NAME=NETCDF:"Glb_20111001.nc":cf_FWI
>>  SUBDATASET_2_DESC=[10x640x1280] cf_FWI (32-bit floating-point)
>>  ...
>> [cut]
>>
>> When I try to open this dataset with QGIS, this is what I get:
>> Cannot get GDAL raster band.
>>
>> In the console this is what has been logged:
>>
>> Warning: QgsRasterLayer::setDataProvider: Data provider is invalid.
>> ERROR 10: Pointer 'hObject' is NULL in 'GDALGetMetadata'.
>>
>> Any ideas? Should I open a ticket?
>> thanks
>> P
>>
>> [1] http://www.osgeo.org/pipermail/qgis-user/2011-July/012949.html
>>
>> --
>> Paolo Corti
>> Geospatial software developer
>> web: http://www.paolocorti.net
>> twitter: @capooti
>> skype: capooti
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user



More information about the Qgis-user mailing list