Re: Converting ASCII Grids to NetCdf

Andrew,

Another approach would be to use the fabulous GDAL package

  http://www.remotesensing.org/gdal/

which makes converting the Arc/Info ASCII grid to netcdf (GMT conventions) as easy as:

  gdal_translate arc_ascii.grd -of GMT gmt_grid.nc

GDAL can convert between these formats:

  http://gdal.maptools.org/formats_list.html

GDAL can read CF NetCDF grids as well, but it looks like it doesn't (yet?) support writing CF-compliant NetCDF. Perhaps someone from the Galeon project knows more about the plans for GDAL & CF.

The easiest way (and what I do) to get GDAL built with all the goodies is download "FWTOOLS" from

  http://fwtools.maptools.org/

which is a complete binary distribution for both Linux and PC containing GDAL as well as Python, OpenEv, Mapserver.

-Rich
--
Richard P. Signell
U.S. Geological Survey       Phone: (508) 457-2229
384 Woods Hole Road          Fax:   (508) 457-2310
Woods Hole, MA  02543-1598


Don Murray wrote:
Hi Andrew-

Chase, Andrew wrote:

Hi Folks,

I'm trying to do something relatively simple, but I haven't been able to
find any examples of others doing it before me. Just thought I'd ask
here before going off and writing the code myself.
What I want to do is take a DEM stored in the  ESRI ASCII Raster format
and convert it to a netcdf file. My ascii raster has the standard header
format like so:
ncols         5001
nrows         4001
xllcorner     -125
yllcorner     34
cellsize      0.001
NODATA_value  -9999

Anybody got some code to do this? :-)

If not, no biggee, just thought I'd ask.


The best way to do this would be to write an IO Service Provider
(IOSP) layer that would read in the file and create the netCDF
object.  I'm not sure if there is any documentation on this,
but there are some other examples that you could probably follow.

There is code in VisAD to read in the ASCII Arc Grid format
into VisAD Data objects and it could be adapted to use for this
task.  The source code is available at:

ftp://ftp.ssec.wisc.edu/pub/visad/visad_src-2.0.jar

in the visad.data.gis.AsciiArcGrid reader.  It does not
handle any associated .prj files.

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************


==============================================================================
To unsubscribe netcdf-java, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================


  • 2006 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: