[GRASS-user] OT: importing .grd files (GEBCO)

Hi,

I've recently faced this issue and with the help of some members of the list I got a solution to do this. My problem began when I tried to import some bathymetric data from the GEBCO initiative . This data is delivered in .grd format (GMT) Below I describe the methodology to accomplish the task (First in english, then in spanish)

Debian/Linux. GRASS 6.3. GMT package

1) In the console with the command grd2xyz we convert the .grd file to an .xyz one:

    grd2xyz file.grd > file.xyz

2) With the help of 'awk' we delete columns 1 & 2 (corresponding to lat/lon) and leave column '3' (bathimetry/altitude):

    cat file.xyz | awk '{print $3}' > baty.xyz

3) With the help of grdinfo we search for the dimensions and resolution of the .grd file

4) Knowing this we introduce a header in the baty.xyz file, i.e:
       north: 38
    south: 34
    east: -2
    west: -9
    rows: 241
    cols: 421

5) Now in GRASS, we create a new location with the above data. Datum and Projecion will depend on your area.

6) Then:

    r.in.ascii in=baty.xyz out=bathimetry

Hope this helps,

Antonio

------------------------------------------------------------------------------------------------------------------------------

1) Con la herramienta GMT grd2xyz convertimos el archivo .grd en .xyz

2) Mediante 'awk' eliminamos las columnas (1 y 2) correspondientes a los datos de lat y lon

    cat archivo.xyz | awk '{print $3}' > baty.xyz

3) Averiguamos las dimensiones (x e y) del área en cuestión (grdinfo archivo.grd)

4) Como sabemos los valores de lat y lon (grdinfo archivo.grd)los introducimos como cabecera en bati.xyz junto con las columnas (x) y las filas (y), tal que:
   north: 38
   south: 34
   east: -2
   west: -9
   rows: 241
   cols: 421

5) En GRASS nos creamos una nueva localidad (bat) con coordenadas lat(38n:34n)/lon(9w:2w), datum (eur50), proj = 5. Resolución (de grdinfo archivo.grd)

6) Con r.in.ascii importamos el archivo .xyz:

    r.in.ascii in=baty.xyz out=batimetria

Saludos,

Antonio