Hi,
The question is how to take an ID number and turn it into a sequence
number. See just below for an example of the ascii data.
We can use transformations to define a new ID, that is a variable
"new_id" with values of 1, 2, 3, ... representing the sequence
number of each profile in the dataset. For the short file
example below, it would look like this,
! initialize the dataset
define axis/x=1:15:1 xaxis
define grid/x=xaxis xgrid
file/skip=1/var="id_in, dep, temp, sal"/grid=xgrid
file.dat
! variable marking the first element of each profile with
1
let pstart = if i eq 1 or id_in[x=@ddf] GT 0 then 1
! Now usethe @EVNT transformation, increase the count
every time
! a value of 1 is encountered
let new_id = pstart[i=@evnt:1]
list id_in, pstart, new_id
DATA SET: ./id_z.dat
X: 0.5 to 15.5
Column 1: ID_IN
Column 2: PSTART is IF I EQ 1 OR ID_IN[X=@DDF] GT 0
THEN 1
Column 3: NEW_ID is PSTART[I=@EVNT:1]
ID_IN PSTART NEW_ID
1 / 1: 30.00 1.000 1.000
2 / 2: 30.00 .... 1.000
3 / 3: 30.00 .... 1.000
4 / 4: 30.00 1.000 2.000
5 / 5: 50.00 .... 2.000
6 / 6: 50.00 .... 2.000
7 / 7: 50.00 .... 2.000
8 / 8: 50.00 1.000 3.000
9 / 9: 60.00 .... 3.000
10 / 10: 60.00 .... 3.000
11 / 11: 60.00 .... 3.000
12 / 12: 60.00 .... 3.000
13 / 13: 60.00 .... 3.000
14 / 14: 60.00 .... 3.000
15 / 15: 60.00 .... 3.000
On 4/20/2013 3:05 AM, golla
nageswararao wrote:
Hi,
The profile id are not 1,2,3,4,...
Now the profile ids are random like
id dep temp sal
30, 0 temp1 sal1
30, 20 temp1 sal1
30, 50 temp1 sal1
30, 50 temp1 sal1
50, 0
50, 10
50, 40
50, 45
60, 0
60, 25
60, 30
60, 35
60, 40
60, 45
60, 90
.........
If this is the scenario how can the above command work? My
problem is to change the id no. like it should be
id dep temp sal
1, 0 temp1 sal1
1, 20 temp1 sal1
1, 50 temp1 sal1
1, 50 temp1 sal1
2, 0
2, 10
2, 40
2, 45
3, 0
3, 25
3, 30
3, 35
3, 40
3, 45
3, 90
.........
After that I will do the scat2gridgauss_xz command to make it
regular depths of choice. Before that I want to make the
profile id no. in sequence.
Thanks in advance
|