SUBSET_by_EVF [message #75916] |
Sun, 08 May 2011 02:48  |
gaurijyoti29
Messages: 10 Registered: April 2009
|
Junior Member |
|
|
I am using the idl code kept on idl pvwave group website by Pete
yazdi:for extracting subset from an image. I am trying to extract data
for india (using india.evf) from mosaic of eight tiles of modis ndvi
data. However, i am getting the following error as follows;
ENVI Retrieve Data: An error has occured during processing.
Error: POINT_LUN: Negative position argument not allowed.
Position: -10318977704060
Unit: 102
File: D/MOD13A3/Modis13a3_200032.img.
The results may be invalid.
Any help would be very much appreciated.
pro SUBSET_by_EVF
envi, /restore_base_save_files
envi_batch_init,log_file='batch.txt'
; define the image to be opened
img_file='C:\RSI\IDL61\products\ENVI41\data\bhtmref.img'
envi_open_file,img_file,r_fid=fid
print, 'fid=',fid
; query the file and define the output file variables
envi_file_query,fid,dims=dims,ns=ns,nl=nl,nb=nb
t_fid=lonarr(nb)+fid
pos=lindgen(nb)
out_name='subset.img'
;open the EVF file
evf_fname='C:\RSI\IDL61\subset_via_roi\bhtmref.evf'
evf_id=envi_evf_open(evf_fname)
;get the vector information
envi_evf_info,evf_id,num_recs=num_recs,data_type=data_type,p rojection=proje
ction,$
layer_name=layer_name
; print information about each record
print, 'Number of records:',num_recs
for i=0,num_recs-1 do begin
record=envi_evf_read_record(evf_id,i)
print, 'Number of nodes in Record '+strtrim(i+1,2)+':
',n_elements(record[0,*])
print, 'Record Info:'
print, record
endfor
; Get record info (assuming one record in EVF)
record=envi_evf_read_record(evf_id,0)
xMap=record[0,*]
yMap=record[1,*]
;Convert record to xy pixel coordinates of the image to be subsetted
envi_convert_file_coordinates,fid,xf,yf,xMap,yMap
;Prepare the subset dimensions
dims[0]=-1L
dims[1]=min(xf)-1
dims[2]=max(xf)-1
dims[3]=min(yf)-1
dims[4]=max(yf)-1
;Use copyfile_doit to copy input file with new dimensions
envi_doit,'cf_doit',fid=t_fid,pos=pos,dims=dims,remove=0,out _name=out_name,
r_fid=r_fid
; Exit Envi
envi_batch_exit
end
|
|
|
Re: SUBSET_by_EVF [message #76004 is a reply to message #75916] |
Mon, 09 May 2011 08:58  |
Brian Wolven
Messages: 94 Registered: May 2011
|
Member |
|
|
Don't know if this is the problem without running the code myself, but you might want to make sure this loop is indexed with a long (i=0L) instead of an integer (i=0):
for i=0L,num_recs-1 do begin
record=envi_evf_read_record(evf_id,i)
print, 'Number of nodes in Record '+strtrim(i+1,2)+':
',n_elements(record[0,*])
print, 'Record Info:'
print, record
endfor
|
|
|