[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 04:29:52 PDT 2012


On Mon, Jun 11, 2012 at 4:54 AM, Rutger <kassies at gmail.com> wrote:
> Hey Etienne,
>
> Thanks alot for the suggestions, here's are my results:
>
> I made a minimal install of osgeo4w and tried to run the earlier script, it
> results in the same error. I didnt notice anything different.
>
> I have tried it with the attached file, which also results in the same
> error.

Which version of gdal did you install?

See below, you are probably not using the correct syntax.

>
> Creating the 'tmp1.nc' with the command-line utilities works (as expected),
> but then opening it directly (or with the vrt) again results in the same
> error.
> The script for testing was as simple as this:
> /try:
>    from osgeo import gdal
> except ImportError:
>    import gdal
>
> dsin = gdal.Open('NETCDF:trmm.nc:soil_moisture_x')

This is not correct,  trmm.nc does not have soil_moisture_x variable

And you don't need to add NETCDF: to the file syntax, unless you are
using a subdataset - the full path will be given by `gdalinfo file.nc`

you should just open it like this

dsin = gdal.Open('trmm.nc')

> /
>
> I dont notice anything different when removing the VRT part, except that the
> VRT method only throws the error when i actually start reading from the
> dataset, whereas the direct .nc reading already fails at gdal.Open().
>
> I added the VRT part to be sure that the reference to the NetCDF file was
> correct. I wasnt 100% sure if my reference was correct, therefore i made
> gdal_translate build the VRT. But all of it doesnt seem to make a
> difference.
>
>
> Thanks for your help so far!
>
>
>
> --
> 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-tp4979943p4980313.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