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
    • 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

Ferret Polytube demo

How to use the Ferret polytube script

Below is an annotated version of the script polytube_demo.jnl

Description: demonstrate "Lagrangian" plots along a path using color fill

See also Ferret's RIBBON plot style.

yes? ! Define a 3-leg plot track with discontinuities
yes? LET/QUIET X0 = 240
yes? LET/QUIET Y0 = 10
yes? LET/QUIET X1 = 180
yes? LET/QUIET Y1 = 60
yes? LET/QUIET X2 = 150
yes? LET/QUIET Y2 = 10
yes? LET/QUIET XLEG1 = X0 + (L-1)*(X1-X0)/50
yes? LET/QUIET YLEG1 = Y0 + (L-1)*(Y1-Y0)/50
yes? LET/QUIET XLEG2 = X1 + (L-51)*(X2-X1)/20
yes? LET/QUIET YLEG2 = Y1 + (L-51)*(Y2-Y1)/20
yes? LET/QUIET LCURVE = L-71
yes? LET/QUIET R0 = 35
yes? LET/QUIET RADIUS = R0 - LCURVE/3
yes? LET/QUIET XLEG3 = X2+R0 - RADIUS * COS(LCURVE/12)
yes? LET/QUIET YLEG3 = Y2 - RADIUS * SIN(LCURVE/12)
yes? LET/QUIET XSTRAIGHT = IF L LE 50 THEN XLEG1 ELSE XLEG2
yes? LET/QUIET YSTRAIGHT = IF L LE 50 THEN YLEG1 ELSE YLEG2
yes? LET/QUIET XTRACK = IF L LE 70 THEN XSTRAIGHT ELSE XLEG3
yes? LET/QUIET YTRACK = IF L LE 70 THEN YSTRAIGHT ELSE YLEG3
 
yes? LET/QUIET SST = 25 - YTRACK/3
yes? LET/QUIET wind = ytrack/20 * RANDN(ytrack)
yes? SET REGION/L=1:120
 
yes? ! Plot SST and indicate the ship track
yes? go basemap x=120:260 Y=25s:65n 20
yes? go polytube polygon/over/key/title="SST" xtrack ytrack SST
yes? plot/vs/line/sym/over/nolab xtrack, ytrack

A similar plot, but a thinner "tube" with a different palette, and another variable drawn with it

 

yes? go basemap x=120:260 Y=25s:65n 20
yes? go polytube polygon/over/key/pal=no_green xtrack ytrack SST 0.3
yes? label/nouser `1.05*($ppl$xlen)`,-.5,0,0,.15 SST
yes? go trackplot plot/vs/line/over/color=green/thickness=2/title="wind" xtrack ytrack wind

exercise: compare this similar plot, but a thinner "tube" drawn with the PLOT/VS/RIBBON command.

yes? go basemap x=120:260 Y=25s:65n 20
yes? ribbon/vs/over/line/thick=3/key/title="SST" xtrack, ytrack, SST