Dawn VIR .QUB Files: How to Open in ENVI Version 3.0 September 4, 2013 written by Ralph Milliken and Eldar Noe Dobrea, converted to text file by Carol Neese. Note: Images have been lost in the conversion to text. The instructions are still valid, but for the full document see the pdf version on this volume. The following document describes the procedure to manually open Dawn VIR .QUB files using ENVI. At the end of the document is an IDL script that generates ENVI label files automatically and precludes the need to perform this task manually for each file. 1) Start ENVI (tested with ENVI 4.8) and from the main menu choose: File > Open Image File Navigate to and select the appropriate .QUB file. (Data end in *_1.QUB, quality control files end in *_1_QQ.QUB) (see section 6.1.3 in the VIR Software Interface Specification document) 2) In the version of ENVI that was tested (and this likely applies to older versions of ENVI), the program was not able to automatically read in the .QUB file. The following error message may appear: "Problem: File does not appear to contain any image data." Click "OK" and a dialog window should appear. This window will be used to tell ENVI the dimensions of the data (lines, samples, bands, offset, data type, interleave, etc.). Once this information is entered correctly then ENVI should open the file in the correct manner. The data dimensions are listed in the associated PDS label file. 3)For copy-and-paste of the included IDL script, use the ASCII version of this document to avoid spurious characters 4) Open the associated .LBL file in a text editor (Microsoft Word should also work). Scroll down to the following section: Example for Level 1A EDR data (DN values): /* Standard cube Keywords */ AXES = 3 AXIS_NAME = ("BAND", "SAMPLE", "LINE") CORE_ITEMS = (432, 256, 64) CORE_ITEM_BYTES = 2 CORE_ITEM_TYPE = "MSB_INTEGER" Example for Level 1B RDR data (radiance values): /* Standard cube Keywords */ AXES = 3 AXIS_NAME = (BAND, SAMPLE, LINE) CORE_ITEMS = (432, 256, 64) CORE_ITEM_BYTES = 4 CORE_ITEM_TYPE = "IEEE_REAL" These keywords contain the information you will need to fill out the dialog window shown above. In this example, the .QUB file has 432 bands, 256 samples, and 64 lines. As of the writing of this document, the following values apply for the Dawn VIR data: EDR data (Level 1A) Interleave: BIP (band interleaved by pixel) Byte order: MSB (in ENVI this is equivalent to ‘Network IEEE’) Data type: 16-bit integer (i.e., Unsigned Int) RDR data (Level 1B) Interleave: BIP (band interleaved by pixel) Byte order: IEEE (MSB; in ENVI this is equivalent to ‘Network IEEE’) Data type: 32-bit real (i.e., Floating Point) Using the above information for the EDR (Level 1A) example, the completed ENVI dialog window for this cube should appear as: -------------------------------------------------------------- File Size: 14,155,776 bytes Input Header Info From > Edit Attributes > Samples: 256 Lines: 64 Bands: 432 Offset: 0 xstart: 1 ystart: 1 File Type: ENVI Standard Byte Order: Network (IEEE) Data Type: Unsigned Int Interleave: BIP File Imported into ENVI OK Cancel -------------------------------------------------------------- Click ‘OK’ and the .QUB file should open in ENVI and appear in the "Available Bands List" window. ENVI should now have created a new ENVI header file for this image (*.QUB.HDR). Note that the wavelengths for each band will still need to be entered for the image. This can be done by choosing File > Edit ENVI Header from the main menu, selecting the file you just opened, and then choosing Edit Attributes > Wavelengths. Alternatively, you can cut and paste the wavelength information from the .LBL file into the ENVI .QUB.HDR header file. An example ENVI header file for an EDR cube with VIR wavelength information is provided below. Now that the cube is opened in ENVI it can be loaded as grayscale or RGB and spectral information can be extracted (example provided in the pdf version of this document). Note that the EDR cubes are in DN and the RDR files are in radiance, NOT I/F. None of the .QUB files are map-projected. ---------------------------------------------------------------------- Example ENVI Header File (for EDR Level 1A .QUB file): ENVI description = {File Imported into ENVI.} samples = 256 lines = 64 bands = 432 header offset = 0 file type = ENVI Standard data type = 12 interleave = bip sensor type = Unknown byte order = 1 wavelength units = Micrometers wavelength= {0.255, 0.257, 0.259, 0.261, 0.263, 0.265, 0.266, 0.268, 0.270, 0.272, 0.274, 0.276, 0.278, 0.280, 0.282, 0.284, 0.285, 0.287, 0.289, 0.291, 0.293, 0.295, 0.297, 0.299, 0.301, 0.302, 0.304, 0.306, 0.308, 0.310, 0.312, 0.314, 0.316, 0.318, 0.319, 0.321, 0.323, 0.325, 0.327, 0.329, 0.331, 0.333, 0.335, 0.336, 0.338, 0.340, 0.342, 0.344, 0.346, 0.348, 0.350, 0.352, 0.354, 0.355, 0.357, 0.359, 0.361, 0.363, 0.365, 0.367, 0.369, 0.371, 0.372, 0.374, 0.376, 0.378, 0.380, 0.382, 0.384, 0.386, 0.388, 0.389, 0.391, 0.393, 0.395, 0.397, 0.399, 0.401, 0.403, 0.405, 0.407, 0.408, 0.410, 0.412, 0.414, 0.416, 0.418, 0.420, 0.422, 0.424, 0.425, 0.427, 0.429, 0.431, 0.433, 0.435, 0.437, 0.439, 0.441, 0.442, 0.444, 0.446, 0.448, 0.450, 0.452, 0.454, 0.456, 0.458, 0.459, 0.461, 0.463, 0.465, 0.467, 0.469, 0.471, 0.473, 0.475, 0.477, 0.478, 0.480, 0.482, 0.484, 0.486, 0.488, 0.490, 0.492, 0.494, 0.495, 0.497, 0.499, 0.501, 0.503, 0.505, 0.507, 0.509, 0.511, 0.512, 0.514, 0.516, 0.518, 0.520, 0.522, 0.524, 0.526, 0.528, 0.529, 0.531, 0.533, 0.535, 0.537, 0.539, 0.541, 0.543, 0.545, 0.547, 0.548, 0.550, 0.552, 0.554, 0.556, 0.558, 0.560, 0.562, 0.564, 0.565, 0.567, 0.569, 0.571, 0.573, 0.575, 0.577, 0.579, 0.581, 0.582, 0.584, 0.586, 0.588, 0.590, 0.592, 0.594, 0.596, 0.598, 0.600, 0.601, 0.603, 0.605, 0.607, 0.609, 0.611, 0.613, 0.615, 0.617, 0.618, 0.620, 0.622, 0.624, 0.626, 0.628, 0.630, 0.632, 0.634, 0.635, 0.637, 0.639, 0.641, 0.643, 0.645, 0.647, 0.649, 0.651, 0.652, 0.654, 0.656, 0.658, 0.660, 0.662, 0.664, 0.666, 0.668, 0.670, 0.671, 0.673, 0.675, 0.677, 0.679, 0.681, 0.683, 0.685, 0.687, 0.688, 0.690, 0.692, 0.694, 0.696, 0.698, 0.700, 0.702, 0.704, 0.705, 0.707, 0.709, 0.711, 0.713, 0.715, 0.717, 0.719, 0.721, 0.723, 0.724, 0.726, 0.728, 0.730, 0.732, 0.734, 0.736, 0.738, 0.740, 0.741, 0.743, 0.745, 0.747, 0.749, 0.751, 0.753, 0.755, 0.757, 0.758, 0.760, 0.762, 0.764, 0.766, 0.768, 0.770, 0.772, 0.774, 0.775, 0.777, 0.779, 0.781, 0.783, 0.785, 0.787, 0.789, 0.791, 0.793, 0.794, 0.796, 0.798, 0.800, 0.802, 0.804, 0.806, 0.808, 0.810, 0.811, 0.813, 0.815, 0.817, 0.819, 0.821, 0.823, 0.825, 0.827, 0.828, 0.830, 0.832, 0.834, 0.836, 0.838, 0.840, 0.842, 0.844, 0.846, 0.847, 0.849, 0.851, 0.853, 0.855, 0.857, 0.859, 0.861, 0.863, 0.864, 0.866, 0.868, 0.870, 0.872, 0.874, 0.876, 0.878, 0.880, 0.881, 0.883, 0.885, 0.887, 0.889, 0.891, 0.893, 0.895, 0.897, 0.898, 0.900, 0.902, 0.904, 0.906, 0.908, 0.910, 0.912, 0.914, 0.916, 0.917, 0.919, 0.921, 0.923, 0.925, 0.927, 0.929, 0.931, 0.933, 0.934, 0.936, 0.938, 0.940, 0.942, 0.944, 0.946, 0.948, 0.950, 0.951, 0.953, 0.955, 0.957, 0.959, 0.961, 0.963, 0.965, 0.967, 0.968, 0.970, 0.972, 0.974, 0.976, 0.978, 0.980, 0.982, 0.984, 0.986, 0.987, 0.989, 0.991, 0.993, 0.995, 0.997, 0.999, 1.001, 1.003, 1.004, 1.006, 1.008, 1.010, 1.012, 1.014, 1.016, 1.018, 1.020, 1.021, 1.023, 1.025, 1.027, 1.029, 1.031, 1.033, 1.035, 1.037, 1.039, 1.040, 1.042, 1.044, 1.046, 1.048, 1.050, 1.052, 1.054, 1.056, 1.057, 1.059, 1.061, 1.063, 1.065, 1.067, 1.069, 1.071} ---------------------------------------------------------------------- IDL script for the automatic generation of ENVI header files ;********************************************************************************** ;Procedure make_vir_envi_header ;DESCRIPTION: This procedure uses the PDS .LBL files to generate ENVI header files. ;Input: none. Upon executing program, file selection widget appears ;Output: ENVI header file with same name as selected .LBL file but .HDR extension instead ;USAGE: ; 1) issue command .r make_vir_envi_header.pro ; 2) use widget to select file or files with .LBL extension. You can select all files, including the _HK.LBL files, and the script will automatically filter out the _HK.LBL files. ; 3) ENVI header files will be automatically generated and writen to the working directory. ; 4) Now you can use the File-->Open Image File option in ENVI to open the files normally. ; Creation: Eldar Noe Dobrea 8-8-2013 ;********************************************************************************** fname=dialog_pickfile(/multiple_files,filter='*.LBL') for fnum=0,n_elements(fname)-1 do begin type='IMG' If strpos(fname(fnum),'QQ') NE -1 then type = 'GEO' ver='1A' If strpos(fname(fnum),'_1B_') NE -1 then ver = '1B' If strpos(fname(fnum),'HK') EQ -1 then begin openr,1,fname(fnum) readf,1,txt ;Import dimensions while strpos(txt, 'CORE_ITEMS') eq -1 do readf,1,txt print,txt core=strmid(txt,strpos(txt,'(')+1,strlen(txt)-1) core2=strmid(core,0,strpos(numbers,')')) axes=strsplit(numbers,',',/extract) band=axes(0) sample=axes(1) line_dim=axes(2) ;Import bands if not geometry file If type NE 'GEO' then begin ; If strpos(fnmane(fnum),'QQ') EQ -1 then begin while strpos(txt, 'BAND_BIN_CENTER') eq -1 do readf,1,txt line='' wvl=[0.] stop=0 while (stop eq 0) do begin readf,1,line if strpos(line,'(') ne -1 then line=strmid(line,strpos(line,'(')+1) if strpos(line,')') ne -1 then begin line=strmid(line,0,strpos(line,')')) stop=1 endif wvl=[wvl,strsplit(line,',',/extract)] Endwhile good=where(wvl ne 0) wvl=wvl(good) wvl2=strcompress(wvl,/remove_all) wvl2(0:n_elements(wvl2)-2)=wvl2(0:n_elements(wvl2)-2)+',' EndIf close,1 If type eq 'IMG' and ver eq '1A' then data_type = '12' ;set to unsigned integer If type eq 'IMG' and ver eq '1B' then data_type = '4' ;set to floating point If type eq 'GEO' and ver eq '1A' then data_type = '2' If type eq 'GEO' and ver eq '1B' then data_type = '4' ;set to floating point ;Prepare header fbase=strmid(fname(fnum),0,strlen(fname(fnum))-3) openw,1,fbase+'QUB.HDR' ;for i=0,n_elements(wvl)-1 do printf,1,wvl(i) printf,1,'ENVI' printf,1,'description = {' printf,1,' ENVI header generated by make_vir_envi_header.}' printf,1,'samples = ',sample printf,1,'lines = ',line_dim printf,1,'bands = ',band printf,1,'header offset = 0' printf,1,'file type = ENVI Standard' printf,1,'data type = '+data_type printf,1,'interleave = bip' printf,1,'sensor type = Unknown' printf,1,'byte order = 1' If type eq 'IMG' then printf,1,'wavelength units = Micrometers' If type eq 'GEO' then printf,1,'wavelength units = Unknown' If type eq 'IMG' then printf,1,'wavelength = {',wvl2,'}' close,1 EndIf EndFor End