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

ELEMENT_INDEX_STR

ELEMENT_INDEX_STR(A, B) Returns index value in B for each string in A. The string comparisons are case-sensitive.

Arguments:

A

string data

 

B

list of strings to match

     

Result Axes:

X

Inherited from argument A

 

Y

Inherited from argument A

 

Z

Inherited from argument A

 

T

Inherited from argument A

Example

(See ELEMENT_INDEX) above for a simple example of the numeric case. )

Say we have a dataset that contains a string variable called institute for a collection of stations, and station locations xloc, yloc. Use ELEMENT_INDEX_STR to draw a polygon plot where the data stations belonging to each institute is shown by a dot with a unique color for each institution.

yes? USE obsdata.nc ! contains a variable called institute
 
yes? LET inst_names = {"NOAA", "WHOI", "FSU", "BOM"} 
yes? LET code = IS_ELEMENT_STR(institute, inst_names) 
 
yes? LIST institute, code
X: 0.5 to 53.5
Column 1: INSTITUTE
Column 2: CODE is ELEMENT_INDEX_STR(institute, {"NOAA", "FSU", "BOM", "WHOI"}) 
INSTITUTE CODE
1 / 1: "NOAA" 1.000 
2 / 2: "WHOI" 4.000 
3 / 3: "FSU" 2.000 
4 / 4: "BOM" 3.000 
5 / 5: "NOAA" 1.000 
6 / 6: "BOM" 3.000 
.. 
yes? GO basemap X=120:250 Y=25S:65N 20 
yes? GO polymark POLY/OVER/PALETTE=rainbow_by_levels/LEV=(1,5,1) \ xloc, yloc, code, square, 0.2