Conversion of GTOPO30

Michel Wurtz - LTE mw at engees.u-strasbg.fr
Mon Jun 15 03:20:36 EDT 1998


Luis Franco wrote:
> 
> Hi, grass comunity.
> 
> I've manage to get a program to convert the GTOPO30 maps to grass raster
> ascii format and import them in grass (for version 4.0- I don't know if
> it works with any other...) but it's kind of slow (only one of the many
> files that comprises it took 3 hours on a Pentium II - 233 MHz...). I
> need to know something that any low-level programmer knows (not me...).
> What's the faster algorithm to exchange from Most Significant Byte first
> (MBR) of Motorola's processors to the PC format of saving binary
> numbers. We're talking of 57 Mb of 16-bit integer...

If the contents is *only* 16-bits integer (not mixed with
strings, 32-bits ints, etc...) use dd with option conv=swab :

    "dd if=<MBR_file> of=<Intel_bin_file> conv=swab"

You may also use dd as a filter.

BTW, I doubt that the binary conversion is slow, but I know that
binary/ascii conversion is slow :  why don't you write directly
a grass binary raster file ? you have just to swap bytes in the
original raster (result in cell directory) and create an ascii
header (in cellhd directory). r.support let you create other
files automaticaly and choosing a color rendition...

Direct binary conversion took me only a few minuts on a 486DX33
(file was not GTOPO30, but a 22 Mb 16-bits compressed raster ...)
-- 
Michel Wurtz    ENGEES - Laboratoire Territoires & Environnement
                1, quai Koch - BP 1039, F-67070 STRASBOURG cedex
                Tel: +33 03.88.25.34.62  Fax: +33 03.88.37.04.97



More information about the grass-user mailing list