Expand a 1-D variable in X, to an X-T variable
EXPNDI_BY_T(dat,mask,n_profiles,max_profile_len)
Use to split a variable into a set of time series (see also the EXPNDI_BY_Z function for Z profiles)
|
Arguments: |
DAT |
Variable to expand, a 1D variable on X axis |
|
MASK |
Each valid point starts a new T column |
|
|
n_profiles |
Number of time-series profiles: |
|
|
max_profile_len |
Max length of each profile: |
|
|
Result Axes: |
X |
Abstract: length is argument 3 |
|
Y |
Inherited from DAT and MASK |
|
|
Z |
Inherited from DAT and MASK |
|
|
T |
ABSTRACT: length is argument 4 |
|
|
E |
Inherited from DAT and MASK |
|
|
F |
Inherited from DAT and MASK |
Example:
Data read from ascii files or data organized as simple 1-D lists may represent sets of time series, but of different lengths. See how DAY starts with 5 for each station, but there are a different number of measurements for each time series.
STATION DAY LON LAT TEMP SALINITY 1 5 12.45 45.5 24.25 36.42 1 6 12.45 45.5 24.46 36.42 1 7 12.45 45.5 24.23 36.43 2 5 15.08 51.3 24.74 36.06 2 6 15.08 51.3 24.65 36.05 2 7 15.08 51.3 24.74 36 2 8 15.08 51.3 24.75 35.98 2 9 15.08 51.3 24.75 35.95 2 10 15.08 51.3 24.75 35.95 2 11 15.08 51.3 24.75 35.96 3 5 17.11 41.3 24.79 36.34 3 6 17.11 41.3 24.8 36.34 3 7 17.11 41.3 24.79 36.35 3 8 17.11 41.3 24.78 36.34 3 9 17.11 41.3 24.78 36.31 3 10 17.11 41.3 24.78 36.34 3 11 17.11 41.3 24.77 36.31 3 12 17.11 41.3 24.78 36.32 3 13 17.11 41.3 25.1 36.27 3 14 17.11 41.3 24.56 36.24 3 15 17.11 41.3 24.81 36.3 3 16 17.11 41.3 24.8 36.31
Open this dataset. Read the data as single 1-D lists, then define a XT variable.
Open this dataset. Read the data as single 1-D lists, then define a XT variable.
yes? define axis/x=1:22:1 xin
yes? define grid/x=xin input_grid
yes? file/skip=1/var="sta, day, lat, lon, temp, salt"/grid=input_grid tprofiles.dat
yes? list day, temp, salt
DATA SET: ./tprofiles.dat
X: 0.5 to 22.5
Column 1: DAY is day
Column 2: TEMP is temp
Column 3: SALT is salt
DAY TEMP SALT
1 / 1: 5.00 24.25 36.42
2 / 2: 6.00 24.46 36.42
3 / 3: 7.00 24.23 36.43
4 / 4: 5.00 24.74 36.06
5 / 5: 6.00 24.65 36.05
6 / 6: 7.00 24.74 36.00
7 / 7: 8.00 24.75 35.98
8 / 8: 9.00 24.75 35.95
9 / 9: 10.00 24.75 35.95
10 / 10: 11.00 24.75 35.96
11 / 11: 5.00 24.79 36.34
12 / 12: 6.00 24.80 36.34
13 / 13: 7.00 24.79 36.35
14 / 14: 8.00 24.78 36.34
15 / 15: 9.00 24.78 36.31
16 / 16: 10.00 24.78 36.34
17 / 17: 11.00 24.77 36.31
18 / 18: 12.00 24.78 36.32
19 / 19: 13.00 25.10 36.27
20 / 20: 14.00 24.56 36.24
21 / 21: 15.00 24.81 36.30
22 / 22: 16.00 24.80 36.31
yes? let mask = if day[i=@ddb] LT 0 then 1
yes? list day, mask
DATA SET: ./tprofiles.dat
X: 0.5 to 22.5
Column 1: DAY is day
Column 2: MASK is IF DAY[I=@DDB] LT 0 THEN 1
DAY MASK
1 / 1: 5.00 ...
2 / 2: 6.00 ...
3 / 3: 7.00 ...
4 / 4: 5.00 1.000
5 / 5: 6.00 ...
6 / 6: 7.00 ...
7 / 7: 8.00 ...
8 / 8: 9.00 ...
9 / 9: 10.00 ...
10 / 10: 11.00 ...
11 / 11: 5.00 1.000
12 / 12: 6.00 ...
13 / 13: 7.00 ...
14 / 14: 8.00 ...
15 / 15: 9.00 ...
16 / 16: 10.00 ...
17 / 17: 11.00 ...
18 / 18: 12.00 ...
19 / 19: 13.00 ...
20 / 20: 14.00 ...
21 / 21: 15.00 ...
22 / 22: 16.00 ...
yes? let n_profiles = `1 + mask[i=@ngd]`
! We may be able to define the size of the profile using the data,
! Depending on the information available we might just give some upper bound.
yes? let max_profile_len = day[i=@max] - day[i=@min] + 1
yes? let sal_xt = expndi_by_t(salt, mask, n_profiles, max_profile_len)
yes? list sal_xt
VARIABLE : EXPNDI_BY_T(SALT, MASK, N_PROFILES, MAX_PROFILE_LEN)
FILENAME : tprofiles.dat
SUBSET : 3 by 12 points (X-T)
1 2 3
1 2 3
1 / 1: 36.42 36.06 36.34
2 / 2: 36.42 36.05 36.34
3 / 3: 36.43 36.00 36.35
4 / 4: ... 35.98 36.34
5 / 5: ... 35.95 36.31
6 / 6: ... 35.95 36.34
7 / 7: ... 35.96 36.31
8 / 8: ... ... 36.32
9 / 9: ... ... 36.27
10 / 10: ... ... 36.24
11 / 11: ... ... 36.30
12 / 12: ... ... 36.31
Now we could define a time axis in units of days, from the data in variable DEPTH, and regrid variable sal_xt to that axis using the @ASN transformation. We could also go on to use the information in the file to locate the profiles in X and Y.
