Skip to main content
  • Home
  • Documentation
  • FAQ
  • Downloads
  • Support
  • Current Release Notes
  • Ferret Users Guide
    • Users Guide Index
    • Commands Reference
    • 1. Introduction
    • 2. Data Set Basics
    • 3. Variables & Expressions
    • 4. Grids & Regions
    • 5. Animations & Gif Images
    • 6. Customizing Plots
    • 7. Handling String Data Symbols
    • 8. Working with Special Data Sets
    • 9. Computing Environment
    • 10. Converting to NetCDF
    • 11. Writing External Functions
    • Glossary
    • Appendix A: Functions
    • Appendix B: PPLUS Guide
    • Appendix C: Ferret-Specific PPLUS Enhancements
  • Previous Release Notes
  • Tutorials and Demos
    • Ferret Tour
    • DSG files: Discrete Sampling Geometries Demo
    • Ferret sorting demo
    • Fast Fourier Transforms demo
    • Empirical Orthogonal Functions demo
    • Ferret objective analysis demo
    • Ferret Palette Demo
    • Map projections
    • Ferret polygon vector demo
    • Ferret Graticules demo
    • Ferret Polytube Demo
    • Ferret Polymark Demo
    • Ferret Constant-Array demo
    • Ferret land_detail demo
    • COADS Tour
    • Levitus Tour
    • Use OPeNDAP
    • Ferret binary read demo
  • PyFerret
    • PyFerret Downloads and Install ../../faq/ferret-faqs.html
    • What is PyFerret?
    • Why use PyFerret?
    • PyFerret for the Ferret user
    • PyFerret command syntax: quick-start notes
    • PyFerret for the Python user
    • Graphics in PyFerret ?
    • New Ferret functionality
    • PyFerret Python functions and constants
    • PyFerret Python objects and methods
    • Ferret external functions in Python
    • Ferret Fortran external functions
    • PyFerret metadata-and-data dictionaries
  • OPeNDAP
    • OPeNDAP usage in Ferret
    • Use OPeNDAP Demo
    • Test OPeNDAP

EXPNDI_BY_Z

Expand a 1-D variable in X, to an X-Z variable, splitting Z profiles

EXPNDI_BY_Z(dat,mask,n_profiles,max_profile_len)

 

Use to split a variable into a set of depth profiles (see also the EXPNDI_BY_T function for T profiles)

 

Arguments:

DAT

Variable to expand along the X axis

 

MASK

Each valid point starts a new Z column

 

n_profiles

Number of profiles:
size in I of result

 

max_profile_len

Max length of each profile:
size in K of result

Result Axes:

X

Abstract: length is argument 3

 

Y

Inherited from DAT and MASK

 

Z

ABSTRACT: length is argument 4

 

T

Inherited from DAT and MASK

 

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 depth profiles, but of different lengths. See how DEPTH starts with 0 for each station, but there are a different number of measurements in each profile.

 

 

 DEPTH LON LAT TEMP SALINITY
0 12.45 45.5 24.25 36.421 
5 12.45 45.5 24.46 36.421 
10 12.45 45.5 24.23 36.433 
0 15.08 51.3 24.74 36.062 
5 15.08 51.3 24.65 36.052 
10 15.08 51.3 24.74 36.2 
20 15.08 51.3 24.75 35.982 
50 15.08 51.3 24.75 35.952 
75 15.08 51.3 24.75 35.952 
100 15.08 51.3 24.75 35.963 
0 17.11 41.3 24.79 36.343 
5 17.11 41.3 24.8 36.343 
10 17.11 41.3 24.79 36.353 
20 17.11 41.3 24.78 36.343 
50 17.11 41.3 24.78 36.313 
75 17.11 41.3 24.78 36.33 
100 17.11 41.3 24.77 36.313 
150 17.11 41.3 24.78 36.323 
200 17.11 41.3 25.1 36.273 
300 17.11 41.3 24.56 36.243 
400 17.11 41.3 24.81 36.33 
600 17.11 41.3 24.8 36.31

Open this dataset. Read the data as single 1-D lists, then define a XT variable.

yes? define axis/x=1:22:1 xinyes? define grid/x=xin input_grid
yes? file/skip=1/var="sta, depth, lat, lon, temp, salt"/grid=input_grid tprofiles.dat

yes? list depth, temp, salt
DATA SET: ./zprofiles.dat
X: 0.5 to 22.5
Column 1: DEPTH
Column 2: TEMP
Column 3: SALT
DEPTH TEMP SALT
1 / 1: 0.0 24.25 36.42
2 / 2: 5.0 24.46 36.42
3 / 3: 10.0 24.23 36.43
4 / 4: 0.0 24.74 36.06
5 / 5: 5.0 24.65 36.05
6 / 6: 10.0 24.74 36.00
7 / 7: 20.0 24.75 35.98
8 / 8: 50.0 24.75 35.95
9 / 9: 75.0 24.75 35.95
10 / 10: 100.0 24.75 35.96
11 / 11: 0.0 24.79 36.34
12 / 12: 5.0 24.80 36.34
13 / 13: 10.0 24.79 36.35
14 / 14: 20.0 24.78 36.34
15 / 15: 50.0 24.78 36.31
16 / 16: 75.0 24.78 36.30
17 / 17: 100.0 24.77 36.31
18 / 18: 150.0 24.78 36.32
19 / 19: 200.0 25.10 36.27
20 / 20: 300.0 24.56 36.24
21 / 21: 400.0 24.81 36.30
22 / 22: 600.0 24.80 36.31
..! Define the mask variable so that each new station is marked with a 1.! (We could also have said "let mask = if depth EQ 0 then 1")yes? let mask = if depth[i=@ddb] LT 0 then 1yes? list depth, mask
DATA SET: ./zprofiles.dat
X: 0.5 to 22.5
Column 1: DEPTH
Column 2: MASK is IF DEPTH[I=@DDB] LT 0 THEN 1
DEPTH MASK
1 / 1: 0.0 ...
2 / 2: 5.0 ...
3 / 3: 10.0 ...
4 / 4: 0.0 1.000
5 / 5: 5.0 ...
6 / 6: 10.0 ...
7 / 7: 20.0 ...
8 / 8: 50.0 ...
9 / 9: 75.0 ...
10 / 10: 100.0 ...
11 / 11: 0.0 1.000
12 / 12: 5.0 ...
13 / 13: 10.0 ...
14 / 14: 20.0 ...
15 / 15: 50.0 ...
16 / 16: 75.0 ...
17 / 17: 100.0 ...
18 / 18: 150.0 ...
19 / 19: 200.0 ...
20 / 20: 300.0 ...
21 / 21: 400.0 ...
22 / 22: 600.0 ...
! Note that the first is profile is not marked in the mask.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 to us. Or just give some upper bound.
 
yes? let max_profile_len = 15yes? let sal_xz = expndi_by_z(salt, mask, n_profiles, max_profile_len)yes? list sal_xz
VARIABLE : EXPNDI_BY_Z(SALT, MASK, N_PROFILES, MAX_PROFILE_LEN)
FILENAME : zprofiles.dat
SUBSET : 3 by 15 points (X-Z)
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.30
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
13 / 13: ... ... ...
14 / 14: ... ... ...
15 / 15: ... ... ...
 

Now we could define a Z axis in units of meters, using the data in variable DEPTH, and regrid variable sal_xz 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.