[GRASS-user] problem in grd output file

Michael Perdue michael_perdue at yahoo.ca
Sat Sep 16 20:08:37 EDT 2006


I recently had a similar problem, so I thought I'd share what I just  
learned. In my case, the problem occurred when I tried to import a  
GMT grid using the command

r.in.bin -f -h input=../Documents/Mudflats_raw/Surface.grd  
output=Surface

r.in.bin complained that "east must be larger than west". It turns  
out that GMT is capable of reading and writing more than one Grdfile  
format. The default for GMT is to read and write grd files in the nf  
format (GMT netCDF format (float) (COARDS-compliant)). It looks like  
grass doesn't use this format, but instead reads and writes in the bf  
format (GMT native, C-binary format (float)). So, to use this format  
you have to explicitly tell GMT which format the file is (ie - 
GSurface.grd=bf) on the command line or set GRID_FORMAT in  
your .gmtdefaults4 file. It's all explained in section 4.17 of the  
"GMT Technical Reference and Cookbook".

Cheers,

Mike

On 8-Sep-06, at 11:11 AM, Dylan Beaudette wrote:

> On Friday 08 September 2006 12:29, temiz wrote:
>> Hello
>>
>> I  used this command to create GMT map.
>> r.out.bin -h input=elv1 output=el2.grd.
>>
>> But GMT's grdinfo command gives
>> $ grdinfo el2.grd
>> grdinfo: Not a netCDF file [el2.grd]
>>
>> How can I produce GMT compatible grid file?
>>
>> regards
>>
>> --
>> Ahmet Temiz
>
>
> Ahmet,
>
> There are two ways to do this, both of which I will be discussing  
> in a soon to
> be finished ;) article for the GRASS newsletter.
>
> in summary:
>
> #hackish way see this:
> http://169.237.35.250/~dylan/grass_user_group/map1.html
>
> #for a better approach, use r.out.bin | xyz2grd :
> MAP_TYPE=`r.info -t "$output_raster" | cut -f2 -d'='`
>
> case "$MAP_TYPE" in
> 	CELL)
> r.out.bin input=$output_raster output=- null=-9999 |
> xyz2grd -G$output_raster.grd -R$min_x/$max_x/$min_y/$max_y -I$ewres/ 
> $nsres -ZTLh -F -N-9999
> 	FCELL)
> 		r.out.bin input=$output_raster output=- null=-9999 |
> xyz2grd -G$output_raster.grd -R$min_x/$max_x/$min_y/$max_y -I$ewres/ 
> $nsres -ZTLf -F -N-9999 ;;
> 	DCELL)
> 		r.out.bin input=$output_raster output=- null=-9999 |
> xyz2grd -G$output_raster.grd -R$min_x/$max_x/$min_y/$max_y -I$ewres/ 
> $nsres -ZTLd -F -N-9999 ;;
> esac
>
>
> attached is a sample script, which will be presented in the  
> newsletter article
> soon.
>
>
>
>
> -- 
> Dylan Beaudette
> Soils and Biogeochemistry Graduate Group
> University of California at Davis
> 530.754.7341
> <template.sh>
> _______________________________________________
> grassuser mailing list
> grassuser at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grassuser

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the grass-user mailing list