ANSI-C program: text2pt.c
NAME
text2pt - convert data in text format into a binary format IPTA
stack
SYNOPSIS
text2pt <data_tab> <type> <col>
<pdata>
<data_tab> | (input) data type 0: point list coordinates (pairs of integers x,y) 1: FLOAT 2: FCOMPLEX (pairs of float, re, im) 3: Positions (pairs of float, x, y) |
<col> | offset in columns to start reading data (0 --> number of columns) |
<pdata> | (output) point data stack (various types supported) |
EXAMPLE
text2pt data_tab 0 1 pt
Extracts the point coordinates of a set of points stored as text in the data_tab file and converts these position data to binary format. The binary format data is written to the point list file pt. The coordinate data are specified as starting at column offset 1.
DESCRIPTION
This program permits entering addition point data from a text
file. As an example consider a text format file that has the
following entries. There is one line for each point:
Here, column 0 is a point counter, columns 1 and 2 are the point x and y coordinates, and column 3 are height values. text2pt is quite general and you must specify the column and format of a particular data set. The starting column is given as an offset, so that an offset of 0 means that you are reading data starting at the first column.
Consider now that you want to save the point height data with column offset 3 into a FLOAT format stack Then you would use the command:
text2pt data_tab 1 3 phgt1To check if you have stored the data correctly, you can print out the values using the program prt_pt.:
prt_pt pt - phgt 0 - 2 -
To append the stacks derived from the text format data table to the end of existing stacks use the program cat_pt.
When reading point list coordinates (data type 0), the text
file contents are first interpreted as float numbers followed by
a nint()
operation before storing the result as integers in the point
list.