[GRASS-user] importing GMT grids

David Finlayson dfinlayson at usgs.gov
Thu Sep 20 18:00:07 EDT 2007


I convert the NC file to an ESRI ASCII grid and then use r.in.arc to
import the data (you can write a script to do this).

MB System has a perl script that does the netCDF -> ASCII grid
conversion (using GMT behind the scenes) called MBM_GRD2ARC. I have
attached the script here so that you do not need to install all of MB
System to get the code. (It's GPL like GMT and GRASS).

This process should give you exactly the same grid in both GMT and
GRASS. (By the way, MB System has the reverse tool called MBM_ARC2GRD
as well)

David

On 9/17/07, Carlos Guâno Grohmann <carlos.grohmann at gmail.com> wrote:
> any good advice on importing GMT grids? r.in.bin keeps complaining
> about the file size, no matter what byte size I choose, and setting it
> to get the header from the grid, makes it error on "east must be
> larger than west". Exporting the grid to xyz (grd2xyz) and then
> importing with r.in.xyz seems to work, but the resulting image is full
> of artifacts (see attach). I tried to change the grid registration in
> GMT (grdedit), and the boundaries too (in surface), giving it a
> half-pixel difference, but all came in the same way.
>
> If anyone wants to try, this is the xyz file:
> http://www.igc.usp.br/pessoais/guano/temp/3arcsec.csv
>
> and these are the commands I used:
>
> nearneighbor 3arcsec.csv -R337575/351435/3855915/3872175 -I30/30 -S200
> -V -Goutnear.grd
> grdedit outnear.grd -T
> grdinfo outnear.grd
> grd2xyz outnear.grd --D_FORMAT=%f >near.xyz
>
> and
>
> surface 3arcsec.csv -R337575/351435/3855915/3872175 -I30/30 -T0.35 -V -Gout.grd
>
> grdedit out.grd -T
> grdinfo out.grd
> grd2xyz out.grd --D_FORMAT=%f >spline.xyz
>
>
> the commands above have the "half pixel displacement" I mentioned, for
> this region:
>
> projection: 1 (UTM)
> zone:       11
> datum:      wgs84
> ellipsoid:  wgs84
> north:      3872190
> south:      3855900
> west:       337560
> east:       351450
> nsres:      30
> ewres:      30
> rows:       543
> cols:       463
> cells:      251409
>
>
> thanks
>
> Carlos
>
> --
> +-----------------------------------------------------------+
>               Carlos Henrique Grohmann - Guano
>   Visiting Researcher at Kingston University London - UK
>   Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
> Linux User #89721  - carlos dot grohmann at gmail dot com
> +-----------------------------------------------------------+
> _________________
> "Good morning, doctors. I have taken the liberty of removing Windows
> 95 from my hard drive."
> --The winning entry in a "What were HAL's first words" contest judged
> by 2001: A SPACE ODYSSEY creator Arthur C. Clarke
>
> Can't stop the signal.
>
> _______________________________________________
> grassuser mailing list
> grassuser at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grassuser
>
>
>


-- 
David Finlayson, Ph.D.
Operational Geologist

U.S. Geological Survey
Pacific Science Center
400 Natural Bridges Drive
Santa Cruz, CA  95060, USA

Tel: 831-427-4757, Fax: 831-427-4748, E-mail: dfinlayson at usgs.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mbm_grd2arc
Type: application/octet-stream
Size: 9303 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20070920/1aa98bb1/mbm_grd2arc.obj


More information about the grass-user mailing list