National Oceanic and
Atmospheric Administration
United States Department of Commerce

Values associated with pixels

Values associated with pixels


Is there any way to plot the value of each pixel on the plot?




Actually, there are two different ways to get values associated with pixels.

  • The method displayed above uses brute force to display the value of every grid cell in a particular region. An example script for this plot is given below.
  • The second method is to use the digitize.jnl script which allows you to mouse click on a pixel and obtain that pixels value and, optionally, surrounding values.


! etopo5 is a 5 minute bathymetry
use etopo5

A region of the Indonesian through flow
! using a nice palette and levels for bathymetries

/lev=(-5500,-5500,5000)(-5500,0,500)(0,2000,250)(2000,6000,1000) rose

! I could use the repeat command with /x= and /y= but then
! Ferret would be interpolating so I'd like to find out what
! indices are associated with the region of interest. Then
! the plotted values will lie on top of the grid cells. 
! Lets notate just some of the values, a 1x1 degree box.

let i1 = i[gx=rose,x=118.5]
let i2 = i[gx=rose,x=119.5]
let j1 = j[gy=rose,y=-5.5]
let j2 = j[gy=rose,y=-4.5]

! Now use a nested repeat with the indices we just obtained.
! By default, the Label command places labels at world coordinate
! positions. The back tics force x[g=rose] and y[g=rose] be
! evaluated before they are passed to the label command. In
! the context of the REPEAT loop, `rose` will be evaluated at
! each I and J position and this number will be passed to the
! label command as a string.

repeat/i=`i1`:`i2`:1 (repeat/j=`j1`:`j2`:1 label `x[g=rose]` `y[g=rose]` 0 0 .08 "`rose`")


Last modified: Thu Apr 27 2000