Previous Getting Started with IDL: Surfaces and Contours Next

Surface Data and the Command Line

Surface data can be visualized and manipulated at the IDL Command Line. First, we need to create a two-dimensional dataset which we will then visualize. See Accessing Binary Surface Data for instructions to open this data set.

First, view the array MARBELLS_BINARY.MARBELLS as a three-dimensional, "wire-mesh" surface. Use the CONGRID procedure initially to resample the data set so that the "mesh" can be displayed at a size visible to the human eye.

  1. Here resample the array size to 35 by 45, or one tenth its original size. To do this enter:
  2. MARBELLS=CONGRID(MARBELLS_BINARY.MARBELLS,35,45)  
    

     

  3. Now we are ready to visualize the mesh using the SURFACE command:
  4. SURFACE, MARBELLS  
    

     

    Figure 7-3: Surface Plot with Default Angles

    Figure 7-3: Surface Plot with Default Angles

     


    Note
    You can also enter ISURFACE, MARBELLS and interactively manipulate the display.

The SURFACE command can be used to view your data from different angles. AX and AZ are plotting keywords that are used to control the SURFACE command. The keyword AX specifies the angle of rotation of the surface (in degrees towards the viewer) about the X axis. The AZ keyword specifies the rotation of the surface in degrees counterclockwise around the Z axis.

  1. View the array from a different angle by entering the following command:
  2. SURFACE, MARBELLS, AX = 70, AZ = 25  
    

     

    Figure 7-4: Surface Plot Showing Different Angles

    Figure 7-4: Surface Plot Showing Different Angles

Displaying a Shaded Surface

You can also view a two-dimensional array as a light-source shaded surface.

  1. First, load one of the pre-defined IDL color tables by entering:
  2. LOADCT, 3  
    

     

  3. To view the light-source shaded surface, shown in the following, simply enter the command:
  4. SHADE_SURF, MARBELLS  
    

     

    Figure 7-5: Surface Plot with Light-source Shaded

    Figure 7-5: Surface Plot with Light-source Shaded

     

  5. To look at the array from another angle, enlarge the label text, and add a title. Again, keywords are used to control certain features of the shaded surface plot. The AX and AZ keywords control the viewing angle, just as they did with the SURFACE command.
  6.  

    The CHARSIZE keyword controls the size of plotted text. The TITLE keyword was used to add the title "Shaded Surface Representation".

    SHADE_SURF,MARBELLS,AX=45,AZ=20,CHARSIZE=1.5, $
       TITLE='Shaded Surface Representation'  
    

     

    Figure 7-6: Surface Plot with Annotated Surface Plot

    Figure 7-6: Surface Plot with Annotated Surface Plot

     

  7. You can create a different kind of shaded surface, where the shading information is provided by the elevation of each point. Now different shading colors on the plot correspond to different elevations (the BYTSCL function scales the data values into the range of bytes).
  8.  

    You could also specify a different array for the shading colors.

    SHADE_SURF,MARBELLS,SHADE=BYTSCL(MARBELLS)  
    

     

    Figure 7-7: Byte-scaled Surface Plot

    Figure 7-7: Byte-scaled Surface Plot

     

  9. You can plot a wire-frame surface of the Maroon Bells Mountains right over the existing plot. The XSTYLE, YSTYLE, and ZSTYLE keywords are used to select different styles of axis. Here, SURFACE is set to not draw the X, Y, and Z axes because they were already drawn by the SHADE_SURF command.
  10.  

    The /NOERASE keyword allows the SURFACE plot to be drawn over the existing SHADE_SURF plot. Enter the following:

    SURFACE,MARBELLS,XSTYLE=4,YSTYLE=4,ZSTYLE=4,/NOERASE  
    

     

    Figure 7-8: Byte-scaled Surface Plot with an Overlaid Wire-frame

    Figure 7-8: Byte-scaled Surface Plot with an Overlaid Wire-frame

  IDL Online Help (March 06, 2007)