IDL array -> envi file.. distorted [message #61107] |
Wed, 02 July 2008 13:06 |
Jelle
Messages: 19 Registered: May 2008
|
Junior Member |
|
|
Hi All,
I am sure I am doing something silly here, and hope there is a quick
'n easy fix for what I have done..
I am processing a whole series of images. As the composite ENVI files
will contain 5000+ bands, I first process the images individually,
store them on disk, and when I am done I read each of them and stack
them. All in all the routine works. However, when I take an IDL array,
and write it to a sympli ENVI file, my images become warped (A
checkerboard appears on top of the actual patterns in the data). The
data is fine when I do a tv, image, right before saving. The saved
image is messed up. I tried swapping the NS / NL and that did not
improve things. Also changing the ENVI header between BIL / BSQ and
BIP does not help.
This is how I process, with irrelevant code in between removed:
; get the data:
envi_open_file, ALL_FILES[i], /no_interactive_query, /no_realize,
r_fid = this_fid
envi_file_query, this_fid, nb=nb, ns=ns, nl=nl, $
data_ignore_value=retrievedignorevalue, $
dims=dims, bnames=band_names
; Create a working data layer
ThisBand = fltarr(ns, nl, /nozero)
; subsequently for each band:
OneLayer = envi_get_data(dims=dims, fid=this_fid, pos=j)
; get the rain pixels
RainPixels = where(OneLayer GT RainTreshHold, raincount )
; Set the current rain bands to 0
if(raincount GT 0) then begin
ThisBand[RainPixels] = 0
print, 'rain'+string(j)+string(n_elements(RainPixels))
endif
; write to disk
;==> this is where the ThisBand array gets messed up.. What am I doing
wrong?
envi_write_envi_file, ThisBand, data_type=2, $
descrip = 'Time since last rain on a pixel to
pixel basis, 15 minute steps (1=15mins).', $
map_info = map_projection, $
nl=nl, ns=ns, nb=1, r_fid=r_fid, $
OUT_NAME = outtempname
|
|
|