[gdal-dev] Reading a NetCDF file with python (not recognised as a supported dataset name

Etienne Tourigny etourigny.dev at gmail.com
Mon Jun 11 08:26:29 PDT 2012


On Mon, Jun 11, 2012 at 11:27 AM, Rutger <kassies at gmail.com> wrote:
> Hey,
>
> I installed the latest OSGeo4W version (as mentioned in the quickstart at
> the website: http://download.osgeo.org/osgeo4w/osgeo4w-setup.exe).
> During installation i unchecked every package except GDAL. The OSGeo4W shell
> mentions "GDAL 1.9.1, released 2012/05/16" as the version.
>
> I should have off course removed the subdataset when opening, my bad. The
> error message changes from:
> /ERROR 4: `NETCDF:trmm.nc:soil_moisture_x' does not exist in the file
> system,
> and is not recognised as a supported dataset name./
>
> to:
> /ERROR 4: `trmm.nc' not recognised as a supported file format./
>
> It maybe rules out that the subdataset reference is the issue, but opening
> the actual file is.
>
> I also tried loading the netCDF-driver in Python, this returns a 'None'. In
> the OSGeo4W shell i started python and did:
> /D:\>python
> Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import gdal
>>>> driver = gdal.GetDriverByName('netCDF')
>>>> print driver
> None
>>>> driver = gdal.GetDriverByName('Gtiff')
>>>> print driver
> <osgeo.gdal.Driver; proxy of <Swig Object of type 'GDALDriverShadow *' at
> 0x00D680F8> >
>>>>/
>

did you install the gdal-python package? Your gdal python is probably
referencing an older gdal build which does not include netcdf support.

There most probably is something wrong with your installation, because
I can read both files fine in osgeo4w with gdal-1.9.1 - 32 bits

By any chance, are you running a 64-bit windows?

> I dont know if reading and writing is done by the same driver. Is there a
> way to test which GDAL version/installation my Python 2.7.2 imports. I only
> have the Python bindings for 1.9.1 installed. But i probably have other GDAL
> installations which ship with other programs (like QGIS).

here is how you can get the gdal version in python
print('gdal version:'+gdal.VersionInfo())
my install returns :
gdal version:1910

>
> Thanks again!
>
>
> Regards,
>
>
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/Reading-a-NetCDF-file-with-python-not-recognised-as-a-supported-dataset-name-tp4979943p4980406.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list