[GRASS-user] r.in.xyz

Michael Perdue michael_perdue at yahoo.ca
Fri Jan 18 18:19:05 EST 2008


You can use sed to find and replace patterns within a file. So;

~> cat temp.txt
1619923.0297213|4836235.79480289|0.01571819
1619927.57223432|4836235.09835698|nan
1619910.45256599|4836241.22590928|6.82026114

To make a substitution
~> sed 's/nan/-9999/g' ./temp.txt
1619923.0297213|4836235.79480289|0.01571819
1619927.57223432|4836235.09835698|-9999
1619910.45256599|4836241.22590928|6.82026114

To remove the offending line
->sed '/nan/d' ./temp.txt
1619923.0297213|4836235.79480289|0.01571819
1619910.45256599|4836241.22590928|6.82026114


Cheers,

Mike

On 18-Jan-08, at 3:51 PM, Jonathan Greenberg wrote:

> (sorry for the barrage of emails, i'm finagling with nnbathy today  
> and having some problems with import/exporting into grass).  Ok, so  
> the awk suggestions worked wonders to fix my xyz file.  Now when I  
> do an r.in.xyz, its failing because nnbathy outputted a NaN z-value  
> for a couple of locations.  Any tricks to getting r.in.xyz to just  
> ignore NaN or do I need to do some more awk magic?
>
> --j
>
> -- 
> Jonathan A. Greenberg, PhD
> Postdoctoral Scholar
> Center for Spatial Technologies and Remote Sensing (CSTARS)
> University of California, Davis
> One Shields Avenue
> The Barn, Room 250N
> Davis, CA 95616
> Cell: 415-794-5043
> AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user



More information about the grass-user mailing list