Re: Extracting central beam from ASCII XYZ bathymetry

Brent Wood <[email protected]>
Newsgroups gmane.comp.gis.gmt.user
Message-ID <[email protected]>
Hi Juan,


If you are running Linux (or Mac), using the text processing tools could probably do this on text files, depending on just what the structure of your XYZ files is.

On Windows, I figure there will be some version of awk you can install to make it useful :-)

For example, if you just want to print the middle field in a row of text, cat your file through this command:

awk '{print ( $((NF+1)/2) ) }'
note that in awk, NF is the number of fields (columns) in the line of text 
- add 1, divide by two will give you the number of the middle column 

prefix this with "$" to get the value of this column, & print it

eg: 

echo "1 2 3 4 5" | awk '{print ( $((NF+1)/2) ) }'
3
echo "1 2 3 4 5 6" | awk '{print ( $((NF+1)/2) ) }'
3
echo "1 2 3 4 5 6 7" | awk '{print ( $((NF+1)/2) ) }'
4


Something like this might work for you?

Cheers,

  Brent Wood



________________________________
 From: Juan Diaz-Naveas <[email protected]>
To: [email protected] 
Sent: Tuesday, March 11, 2014 9:40 AM
Subject: [GMT-HELP] Extracting central beam from ASCII XYZ bathymetry
 


Dear all,

I have a data set with several multibeam lines, but they are stored as XYZ ASCII data.

I need to find the approximate central beam for each stripe covered by each multibeam bathymetry line.

Does anyone have an idea on how to accomplish this?

I was thinking in using project and/or blockmean GMT commands, but actually I cannot figure out how or if there is any sense in trying this way.

Thank you for any help in advance

Juan DIaz-Naveas

To unsubscribe, send the message "signoff gmt-help" to [email protected]

To unsubscribe, send the message "signoff gmt-help" to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.