[GRASSLIST:1665] Re: problem importing GMT grd files

Glynn Clements glynn.clements at virgin.net
Tue Nov 4 08:13:57 EST 2003


Zbigniew Perski wrote:

> I can not import grd files type 1 (converted with gmtreformat to format 
> 1 GMT) to Grass (5.0.2, running on i686 and i686 compiled from source on 
> those machines with Linux - kernel 2.4.22).
> I am trying the r.in.bin -fh command and 4-byte

> So, why min max are nan ???????????

GMT and GRASS use different bit patterns to represent null (no data)
values. GMT uses 0x7fffffff for float and 0x7fffffffffffffff for
double, whilst GRASS uses 0xffffffff for float and 0xffffffffffffffff
for double.

GMT writes out 0x7fffffff for null cells, which GRASS tries to treat
as a normal value; however, the processor treats it as the special
value NaN (not a number), which has some odd properties (e.g. it is
not equal to itself).

> What is wrong or how to make these data usable?

You may be able to fix it using e.g.

	r.mapcalc 'cohrenc.fixed = if(cohrenc==cohrenc,cohrenc,null())'

This should convert the NaN values to GRASS' NULL value, and leave the
other cells intact.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list