Jump to content
PDS Geosciences Node Community
Shyam Mohan

Missing tif files in some LROC CDRNAC products

Recommended Posts

Hello all,

Most of the LROC CDRNAC products has both '.img' and '.tif' files. I am assuming that both the files contain images of the same region but the '.img' files have meta data. I have observed that '.img'  are typically 300MB and '.tif' files are 30MB in size. I have the following two questions,

1. Why is the  '.img' file typically 10 times larger than the '.tif' files ? Is the meta data some huge in size?

2. Some products, for example  M1185002263RC does not have a 'tif' file. Is it not available for some products?

I am actually creating a mosaic area of 10x10 Km using LROC images of 1.5m/pixel resolution (approx) by stitching them together. I am using MATLAB for this purpose and it can only read '.tif' files.

Any help or suggestion would help me in moving forward.

Thank You,

Shyam.

Share this post


Link to post
Share on other sites

Dear Shyam,
To answer your questions:

1. The '.tif' files are reduced-resolution, compressed versions of the '.img' files. They are browse images; that is, they are intended to be used for a quick look at the data to help choose products of interest. They are not suitable for science analysis because the data have been compressed. The actual LROC image products are in the '.img' files, and yes, they can be very large. Each '.img' file has an embedded text header at the beginning of the file that has the metadata for the product, including the size, byte order, and bytes per pixel. You could use this information in Matlab to read in the image. 

2. I think there should be a .tif file for every .img file. The one for M1185002263RC is online here:
http://lroc.sese.asu.edu/data/LRO-L-LROC-3-CDR-V1.0/LROLRC_1023/EXTRAS/BROWSE/2015120/M1185002263RC_pyr.tif

For more information about the image products, look here:

- Lunar Orbital Data Explorer's User Manual page about LROC
http://ode.rsl.wustl.edu/mars/pagehelp/quickstartguide/index.html?lroc.htm

- LROC EDR/CDR Software Interface Specification
http://lroc.sese.asu.edu/data/LRO-L-LROC-3-CDR-V1.0/LROLRC_1035/DOCUMENT/LROCSIS.PDF

You might want to use the Lunaserv Global Explorer and the Quickmap 3D tools on the LROC web site, http://lroc.sese.asu.edu/archive

If you need more help, I will put you in contact with someone at the LROC Data Node.

Regards,
Susan
 
 

Share this post


Link to post
Share on other sites

Thank you Susie for the reply.  I am using the data for scientific purpose and hence I prefer to use 'img'   instead of 'tif' files which are compressed. Ironically, I read (https://en.wikipedia.org/wiki/TIFF) that 'tif' file format use lossless storage and thus there is no compression.

I could locate the 'tif' file corresponding to the product id M1185002263RC in the link that you shared. Initially, I was searching for it in the below link and I could not find it,http://ode.rsl.wustl.edu/moon/productPageAtlas.aspx?product_id=M1185002263RC&product_idGeo=20666502

I am not sure if the below question should be intended in this forum, however I am posting it,

How can I read a '.img' file in MATLAB? What is the toolbox or function to read and visualize an 'img' file ?

Thank You,

Shyam.

Share this post


Link to post
Share on other sites

I believe the Matlab function "fread" would be the correct way to read a binary file, although I have no experience with Matlab. You will need to know the size and data type of the .img file, which are given in the corresponding label file (.lbl). In the label, look for the keywords LINES, LINE_SAMPLES, SAMPLE_BITS, and SAMPLE_TYPE. 

For example, for the product at your link above, the label shows
 LINES = 52224
 LINE_SAMPLES = 5064
 SAMPLE_BITS = 16
 SAMPLE_TYPE = LSB_INTEGER (this means least significant byte first, or little-endian)
 
The label also tells you that the file has 104449 records, each one 5064 bytes long, and the image data start at the second record. So you'll have to skip the first record.
 RECORD_BYTES = 5064
 FILE_RECORDS = 104449
 LABEL_RECORDS = 1
 ^IMAGE = 2
 
I am guessing that the Matlab commands would be something like this:

fid = fopen('m1185002263rc.img', 'r');     % Open the file to read
status = fseek(fid, 5064, 'bof');          % Skip 5064 bytes from the beginning of the file
a = fread(fid, [5064,52224], 'int16' 'ieee-le');   % Read in a 5064x52224 array of little-endian signed 16-bit integers

Again, I am only guessing about the Matlab commands based on information I found online here.
http://matlab.izmiran.ru/help/techdoc/ref/fread.html

The image pixels are stored in the file in order from left to right, top to bottom. I understand the fread statement fills the array in column order. So you might have to transpose the array to get it to display correctly. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...