dankelley / oce

R package for oceanographic processing
http://dankelley.github.io/oce/
GNU General Public License v3.0
141 stars 42 forks source link

Problem with reading Landsat 8 data / comment on surface temperatures #483

Closed jasonjb82 closed 10 years ago

jasonjb82 commented 10 years ago

Dan,

My second try with the oce package from github

library(oce)
l <- read.landsat("LC80080292014065LGN00", band="tirs1")
tirs1 <- l[["tirs1"]]

yields

Error in .local(x, i, j, ...) : 
  can only index for bands (e.g. x[["band", 8]]) or metadata (e.g. x[["time"]]

And after tweaking the code slightly, I managed to get it the error to go away and proceed to the next lines of code. Please see below

tirs1 <- l[["band",10]]

Now I am able to get the data plotted but I have come across some information that might be useful to look into as the values that are finally mapped are only brightness temperatures. It seems to me that you will need to take into consideration the emissivity values of the land cover to derive the actual surface temperatures.

You can refer to the links below from a couple of people who have looked into surface temperature mapping using the Landsat 8 TIRS bands and comments that have come from USGS as well. Hopefully this can be useful in further enhancing the code.

http://geohackers.in/2013/08/using-data-from-the-landsat-8-tirs-instrument-to-estimate-surface-temperature/

http://fromgistors.blogspot.com/2014/01/estimation-of-land-surface-temperature.html

Regards, Jason

dankelley commented 10 years ago

Thanks very much for these notes, which are ideal in the sense that they help other users, help me to address this issue, and provide hints for wider improvements to oce.

richardsc commented 10 years ago

I also get the same error from:

tirs1 <- l[["tirs1"]]
Error in .local(x, i, j, ...) : 
  can only index for bands (e.g. x[["band", 8]]) or metadata (e.g. x[["time"]]

It seems as though you've changed the accessor function for landsat objects since the blog posting?

dankelley commented 10 years ago

A useful citation that relates specifically to landsat 8:

Juan C. Jiménez-Muñoz, José A. Sobrino, Dražen Skokovic ́, Cristian Mattar, and Jordi Cristóbal, 2014. Land Surface Temperature Retrieval Methods From Landsat-8 Thermal Infrared Sensor Data. IEEE GEOSCIENCE AND REMOTE SENSING LETTERS, VOL. 11, NO. 10, OCTOBER 2014

This is available at academia.edu

dankelley commented 10 years ago

@richardsc can you retry with develop? I updated it a half hour ago so it should work properly in the blog posting. (I had coded it into the map-axes branch by mistake ... would be nice to merge that back into develop to avoid merge work.)

richardsc commented 10 years ago

@dankelley Yes develop works on that issue now. I get some other warnings (for my image), but I'll stick them in a different issue when I get a chance.

dankelley commented 10 years ago

Thanks. I think all images give those issues. The TIFF library is not understanding all the tags in geotiff files. I have half a mind to recode tiff reading if it's not too hard. I could also just hide the warnings because I don't think they matter -- I think it's just extra comments they put in about lat and lon etc but we get those from the header file anyhow so no need to try to get them from the actual tiff.

dankelley commented 10 years ago

I removed the warnings because they were annoying and had confused some users.

jasonjb82 commented 10 years ago

Dan,

I came across this posting with code on how to derive surface temperatures with the older Landsat data and just thought I would share it on here

http://www.hakimabdi.com/20111030/estimating-land-surface-temperature-from-landsat-thermal-imagery/

richardsc commented 10 years ago

That's a nice link -- also note that it references the landsat package, which is on CRAN:

http://cran.r-project.org/web/packages/landsat/index.html

richardsc commented 10 years ago

Another helpful link that came from the comments in the second link posted in the original comment is about correcting for total atmospheric water vapour:

http://atmcorr.gsfc.nasa.gov/

richardsc commented 10 years ago

Here's an interesting blog post summarizing various attempts to measure the emissivity of the ocean:

http://scienceofdoom.com/2010/12/27/emissivity-of-the-ocean/

dankelley commented 10 years ago

Thanks for these references, which I've started adding these links into the help("landsat-class") docs.

dankelley commented 10 years ago

486 is also related. I am refactoring the landsat code because its memory demands were too high for a 4GB computer. There are some changes in the user interface.

  1. The accessor operation, e.g. image[["tirs1"]] now returns a matrix of integers, not floating-point numbers. The values are "counts", in the range from 0 to 2^16-1. This is consistent with other Landsat software. It also makes the matrix be 2X smaller than before, which might help on smallish computers.
  2. A new function named landsatAdd() should be used to add new data "bands".
  3. The decimate() function now deals with landsat objects.

These changes are improvements, but they are not really why the work was done. The real reason was to reduce the memory size of landsat objects. Previously, each pixel was stored as a floating-point number (8 bytes) but now each is stored as a two-byte pair, for a 4X reduction in memory demands.

dankelley commented 10 years ago

I'm closing this since it seems to have been addressed, with no further comments in 5 days. Anyone can reopen it, if I understand the github interface correctly.