Lab exercise 2, due right before the next class
GEO5083: Remote Sensing Image Processing and Analysis, UTSA

 

Student name: ______________

 

 

Use IDL to calculate temperature from ETM+ image

 

Purpose

 

            This lab is the first part of two labs about deriving temperature from  ETM+ image and comparing it with MODIS temperature. In the remote sensing class last semester, the instructor found all the images and did some preprocessing for your lab exercises. However, in the image processing class, you are required to find the image, download the image, preprocess and process the image, and analyze and report your findings. This is the only way to prepare you to do an independent study without too much help.  In this lab alone, you will use IDL code I prepared for you to derive the Temperature from ETM+ image.

 

(for the world wide landsat images you can download free from the USGS Global Visualization Viewer at http://glovis.usgs.gov. As seen from the image below, you will select any region of your interest through the landsat Path/Row (San Antonio is under Path/Row 27/40) or Lat/Long (San Antonio 28.9/-98.2). You can also set the Max Cloud (coverage) of 10%, which will help you eliminate images with cloud cover larger than 10%. for this lab, you can get data from USGS or from TexasView as instructed below.)

 

 

Step 1. Preparation

 

            You will need to download the thermal band of a ETM+ image from the TexasView website at http://www.crgsc.org/Data/Remote.aspx . Selecting any region of your interest (through the landsat Path/Row ID, San Antonio is under Path/Row 27/40). You will need to find images after February 2000 (which will be used to compare with the Terra MODIS temperature since Terra was launched in February 2000, in the lab 3). If there are several images available in your study area, you will need to find the best one with less Cloud Cover. You will download the real data under the nlaps directory. The figure below (Figure 1) is an example. You need to download the files of *.H2, *.I6, and *.I9 (remembering I9 is the high gain image, I6 is the low gain image). For land area, we use the high gain image. I hope you know what the rest of files are in the directory. If you do not know, please ask your classmates or me. We will use them for other labs. 

 

            You will need to create a directory Lab2 under c:/GEO5083. You will need to download the needed data to here. Once you download three documents to Lab2 (hint,  when you save data to Lab2, check the All Files under the Save as type. otherwise, you will save your data as .txt file. If this happens, you just need to remove the .txt, then you should be fine)

 

Figure 1

           

 Step 2. Open the *.H2 using ENVI

           

        Launching ENVI+IDL from the desktop, open the file *.H2, you will see they are ETM+_Band_6L (low gain) and ETM+_Band_6H (high gain), both at wavelength 11.45 micrometer.  You can check the difference of these two images by linking them or performing the statistics. The DN are actually different, but there is no much difference when compared the derived brightness temperatures (from results of last semester). But you are encouraged to do a comparison this time as well.  

       

 

Step 3. Calculate the temperature using IDL

 

        Now click IDL, and go to File -> New File (or directly click the button "New File"), and copy the following IDL code to the empty space, then click the "Save" botton to save the code as Lab2_temp.pro to your Lab2 directory.

 

 

;******************************************

PRO lab2_temp
; reading and displaying an ENVI image in IDL and export the result back to ENVI

envi_select, title='Choose multispectral image', fid=fid, dims=dims, pos=pos
if (fid EQ -1) THEN BEGIN
PRINT, 'cancelled'
RETURN
ENDIF
; fid is the image or file id, is greater than 0; an invalid fid has value of -1
; dims is five elements array of long integers defines the spatial subset
; pos is band(s) to be selected for processing (e.g. pos=[0,1,4], meaning bands 1, 2, 5 selected)



envi_file_query, fid, fname=fname

num_cols=dims[2]-dims[1]+1 ;dims[1] is the starting column number (starts o), dims[2] is ending column number
num_rows=dims[4]-dims[3]+1 ;dims[3] is the starting row number, dims[4] is the ending row number
num_bands=n_elements(pos) ;number of bands from the pos selected for processing
;or n_elements(image) meaning number of pixles in the image

; Define a empty BSQ array
image=fltarr(num_cols, num_rows, num_bands)

FOR i=0, num_bands-1 DO image[*,*,i]= envi_get_data(fid=fid, dims=dims, pos=pos[i])

image[*,*,0]=temporary(0.066823*image[*,*,0]) ;calculate radiance of low gain image
image[*,*,1]=temporary(0.0370588*image[*,*,1]+3.2) ;calculate radiance of high gain image

image[*,*,0]=temporary(1282.71/(alog((666.09/image[*,*,0])+1))) ;calculate brightness temperature
image[*,*,0]=temporary(image[*,*,0]/(1+(0.0007991666*image[*,*,0])*alog(0.988))) ;supposing the same emissivity of 0.988

image[*,*,1]=temporary(1282.71/(alog((666.09/image[*,*,1])+1))) ;calculate brightness temperature
image[*,*,1]=temporary(image[*,*,1]/(1+(0.0007991666*image[*,*,1])*alog(0.988))) ;supposing the same emissivity of 0.988

; get map info and export to ENVI for further processing or displaying
map_info=envi_get_map_info(fid=fid)
envi_enter_data, image(*,*,*), map_info=map_info

END

 

;*****************************************

 

 You can see this code is based on the code (example 5) I gave in the lecture, you should be able to change the code by adding your functions and other calculations to the code for many different applications. This class will gradually give you more codes similar like this for you to follow and modify and then meet your future needs of research and applications.

 

To compute the Land Surface Temperature (RT) from brightness temperature (BT), we use the equation 6 of P472 (Weng et al. 2004, this paper is one of our today's reading materials), though in this code, I only use a single emissivity of 0.988. If you want to do a completed project, you should use the method from the paper.

 

Click "Compile" to compile the code to see if there is any error. If there is error, the program will not be able to execute. you need to fix the error through debugging before you can execute the program. Once the program pass the debugging, you then click "Run" to execute the code. If you read details of the program, you will see the first line of the program is asking you to select an image and an window called "Choose multispectral image" will popup and you will select the *.H2 image you just loaded to ENVI.  You can select subset of the image or just use the full image. Here we use the full image and click "OK". Once it is finished, a new real temperature image will be appeared in the "Available Bands List". You can now analyze the images.

 

Step 4. Analyze the distribution and variability of the Temperature for the entire image area.

 

Use histogram, statistics, density slice, and others to analyze the distribution and variability of temperature for the entire area. You can use some GIS data as you want. You can even analyze the Temperature image in ArcGIS. Write a report about the study area, the data , the method used, and your analyzing results.