[GRASSLIST:6914] GRASS 6 gdal support for netcdf format

I need to import netcdf files into GRASS 6.0.0. I successfully built GRASS 6.0.0 with gdal support (and previously built gdal with netcdf support), but when I try to import the netcdf file, GRASS tells me it's an unsupported format. The r.in.gdal -f option confirms that netcdf is not supported as it is available in GRASS. I don't understand.

Regards,
Tom

--
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL: thomas.adams@noaa.gov

VOICE: 937-383-0528
FAX: 937-383-0033

I need to import netcdf files into GRASS 6.0.0. I successfully built
GRASS 6.0.0 with gdal support (and previously built gdal with netcdf
support), but when I try to import the netcdf file, GRASS tells me
it's an unsupported format. The r.in.gdal -f option confirms that
netcdf is not supported as it is available in GRASS. I don't
understand.

does this list it?

gdalinfo --formats

if so it should work with GRASS too, but make sure you don't have
multiple GDAL libraries installed, GRASS might be picking up the one
without netcdf support.

Quick solution:
convert to a GeoTIFF or something with 'gdal_translate' and load that.

Hamish

Hamish,

Thanks for your help! No, I do not see;

r.in.gdal -f in=foo out=bar | grep -i cdf
  GMT (rw): GMT NetCDF Grid Format
  netCDF (ro): network Common Data Format

when I run 'r.in.gdal -f in=foo out=bar | grep -i cdf

So, your best guess is that a gdal lib is being picked up without netcdf support. I'm not sure how this can be since I built all the libs. Due to local admin restrictions I had to put the gdal libs (and proj libs, etc.) in with the GRASS libs. How can I be sure that the gdal lib correctly built with netcdf support?

I do have one question, when building gdal, am I suppose to set the flag for GRASS support? I tried that once and got some error, so I *maybe* mistakenly thought that I should not do that.

Regards,
Tom

Hamish wrote:

I need to import netcdf files into GRASS 6.0.0. I successfully built GRASS 6.0.0 with gdal support (and previously built gdal with netcdf support), but when I try to import the netcdf file, GRASS tells me
it's an unsupported format. The r.in.gdal -f option confirms that
netcdf is not supported as it is available in GRASS. I don't
understand.
   
does this list it?

gdalinfo --formats

if so it should work with GRASS too, but make sure you don't have
multiple GDAL libraries installed, GRASS might be picking up the one
without netcdf support.

Quick solution:
convert to a GeoTIFF or something with 'gdal_translate' and load that.

Hamish

--
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL: thomas.adams@noaa.gov

VOICE: 937-383-0528
FAX: 937-383-0033

Thanks for your help! No, I do not see;

r.in.gdal -f in=foo out=bar | grep -i cdf
  GMT (rw): GMT NetCDF Grid Format
  netCDF (ro): network Common Data Format

when I run 'r.in.gdal -f in=foo out=bar | grep -i cdf

So, your best guess is that a gdal lib is being picked up without
netcdf support. I'm not sure how this can be since I built all the
libs. Due to local admin restrictions I had to put the gdal libs (and
proj libs, etc.) in with the GRASS libs.

I guess gdal didn't actually build with it then.

How can I be sure that the gdal lib correctly built with netcdf
support?

gdalinfo --formats

gdal-config --dep-libs
# and look for -lnetcdf

gdal-config --formats
# should be same as gdalinfo

ldd /usr/lib/libgdal.so.1 | grep cdf
        libnetcdf.so.3 => /usr/lib/libnetcdf.so.3 (0x40a3a000)

I do have one question, when building gdal, am I suppose to set the
flag for GRASS support? I tried that once and got some error, so I
*maybe* mistakenly thought that I should not do that.

That shouldn't have anything to do with it. GRASS support in GDAL is for
reading GRASS maps outside of GRASS. e.g. from QGIS, Mapserver, etc.
Note GRASS's r.out.gdal needs the GDAL-GRASS driver to work AFAIK.

In the past if you wanted to do this, you used to have to build GDAL
before GRASS without the GRASS driver, and then build GDAL again after
GRASS was made with the GRASS driver enabled.

The latest versions of GDAL builds the GRASS driver as a plugin, and you
can safely build the GRASS driver at any point.

Hamish