Use this procedure to compute the AVHRR geometry (latitude and longitude), solar zenith angles, and sensor zenith angles for each pixel. The input to this procedure must be an AVHRR Level 1B or KLM file. The information in the file header is used to compute the AVHRR geometry.

ENVI Classic uses the same solar geometry calculations as the NOAA Earth System Research Laboratory (see, except that it uses lookup tables to obtain equations for time, declination, and Julian day.


ENVI_DOIT, 'ENVI_AVHRR_GEOMETRY_DOIT', DIMS=array, FID=file ID [, /IN_MEMORY], METHOD=array [, OUT_BNAME=string array], OUT_DT={4 | 5}, OUT_NAME=string [, /RADIANS] [, R_FID=variable]



The “dimensions” keyword is a five-element array of long integers that defines the spatial subset (of a file or array) to use for processing. Nearly every time you specify the keyword FID, you must also specify the spatial subset of the corresponding file (even if the entire file, with no spatial subsetting, is to be processed).

  • DIMS[0]: A pointer to an open ROI; use only in cases where ROIs define the spatial subset. Otherwise, set to -1L.
  • DIMS[1]: The starting sample number. The first x pixel is 0.
  • DIMS[2]: The ending sample number
  • DIMS[3]: The starting line number. The first y pixel is 0.
  • DIMS[4]: The ending line number

To process an entire file (with no spatial subsetting), define DIMS as shown in the following code example. This example assumes you have already opened a file using ENVI_SELECT or ENVI_PICKFILE:

  envi_file_query, fid, dims=dims


The file ID (FID) is a long-integer scalar with a value greater than 0. An invalid FID has a value of -1. The FID is provided as a named variable by any routine used to open or select a file. Often, the FID is returned from the keyword R_FID in the ENVIRasterToFID routine. Files are processed by referring to their FIDs. If you work directly with the file in IDL, the FID is not equivalent to a logical unit number (LUN).

IN_MEMORY (optional)

Set this keyword to specify that output should be stored in memory. If you do not set IN_MEMORY, output will be stored on disk and you must specify OUT_NAME (see below).


Use this keyword to specify which of the output bands to calculate. METHOD is a four-element array of ones and zeros, where a 1 indicates that the corresponding output band should be calculated. METHOD has the following definitions:

  • METHOD[0]: Compute the latitude of each pixel
  • METHOD[1]: Compute the longitude of each pixel
  • METHOD[2]: Compute the solar zenith angle of each pixel
  • METHOD[3]: Compute the sensor zenith angle of each pixel

OUT_BNAME (optional)

Use this keyword to specify a string array of output band names.


Use this keyword to specify the output data type as either floating-point or double-precision. OUT_DT is a long integer that uses the IDL data type conventions:

  • 4: Floating-point (32 bits)
  • 5: Double-precision floating-point (64 bits)


Use this keyword to specify a string with the output filename for the resulting data. If you set the keyword IN_MEMORY, you do not need to specify OUT_NAME.

R_FID (optional)

ENVI Classic library routines that result in new images also have an R_FID, or “returned FID.” This is simply a named variable containing the file ID to access the processed data. Specifying this keyword saves you the step of opening the new file from disk.


Set this keyword to specify that output zenith angles are in radians. The default unit is degrees.

API Version