Trigonometry battles while doing radiometric correction

Today I’ve been calculating Top Of Atmosphere (TOA) reflectance for my Landsat 8 images that I will use in my Object Based classification of landcover.

I encountered some problems but also found solutions that I think might be helpful for people like me who don’t really remember the basic trig, and who also fights a constant battle against ArcGIS.

The first problem was that I got negative values when calculating TOA reflectance using the equations provided by USGS.  I figured out that the negative values came from dividing by the sine of the sun angle.

What I learned: ArcGIS and QGIS use radians when calculating trig functions, so since the sun angle, provided in the metadata file, is in degrees they need to be recalculated.

Next problem came when trying to calculate the following function in the raster calculator:

(2.0000E-05 * “LC81700342013157LGN00_B1.TIF” + -0.100000) / Sin(1.1794415)

An error message appeared when trying to execute that didn’t make sense to me.

“rcexec() <type ‘exceptions.RuntimeError’>: No CellSize and Extent set Failed to execute (RasterCalculator)”

The solution was found here and what I had to do was to go into Environments in the Raster Calculator and there set the Extent (in Processing Extent) and Cell Size (in Raster Analysis) to be “Same as layer X”. For some reason this needs to be done whenever using a trigonometric function, but it wasn’t necessary when I just calculated the TOA reflectance without correcting for the sun angle.

Notes to self (and others):

– There are also radians.

– Always google a problem, someone else is likely to have encountered something similar, if not exactly the same.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s