This method retrieves metadata from a raster series based on a metadata key.


This example opens a spatiotemporal series file from the ENVI installation path. The rasters comprising the series file are air temperature datasets. The example computes the rate of change in air temperature (K) at the 1000-isobar level, throughout the day of 30 December 2012, for the upper-left pixel (2.5 degree spatial resolution).

; Start the application
; Locate a raster series file
seriesFile = Filepath('AirTemp.series', Subdir=['data','time_series'], $
  Root_Dir = e.Root_Dir)
; Create a raster series object
series = ENVIRasterSeries(seriesFile)
; Print the series to see the index numbers
PRINT, series
; The earliest recorded time on 30 December 
; is 0000 hours (Zulu time), which is index #4. 
; The latest recorded time is 1800 hours, which is
; index #7. Get the data and times for each.
Data1 = series.GetData(INDEX=4, SUB_RECT=[0,0,0,0])
TimeStamp1 = series.GetKey(INDEX=4, KEY='TIME')
TimeStampToValues, TimeStamp1, YEAR=year1, MONTH=month1, $
   DAY=day1, HOUR=hour1, MINUTE=minute1, SECOND=second1
Time1 = JulDay(month1, day1, year1, hour1, minute1, second1)
Data2 = series.GetData(INDEX=7, SUB_RECT=[0,0,0,0])
TimeStamp2 = series.GetKey(INDEX=7, KEY='TIME')
TimeStampToValues, TimeStamp2, YEAR=year2, MONTH=month2, $
   DAY=day2, HOUR=hour2, MINUTE=minute2, SECOND=second2
Time2 = JulDay(month2, day2, year2, hour2, minute2, second2)
; Compute rate of change
RateOfChange = (Data2 - Data1) / (Time2 - Time1)
PRINT, RateOfChange

IDL prints:


The rate of change is 5.3 degrees K on 30 December 2012 for the upper-left pixel location.


Result = ENVIRasterSeries.GetKey([, Keywords=value]


Keywords are applied only during the initial creation of the object.


Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

INDEX (optional)

Specify an index number (or array of index numbers) of one or more rasters whose data you want to retrieve. If you do not specify this keyword, ENVI returns the data for the currently selected raster.

KEY (optional)

Specify a metadata field to search.

Version History

ENVI 5.2


API Version


See Also

ENVIRasterSeries, ENVIRaster