comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » MOD43B3 Col.4 Processing. unexpected error message. why?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
MOD43B3 Col.4 Processing. unexpected error message. why? [message #54721] Mon, 09 July 2007 10:46 Go to previous message
kim20026 is currently offline  kim20026
Messages: 54
Registered: November 2006
Member
Good day, everyone. Even though I am still in the swamp and my
previous question on MOD04 is left unsolved, I have to process MOD43B3
albedo product. I am trying to make image files from MOD43B3 hdf files
now.

I did this way so far.

0. Variable (initialization/declaration)
1. Get hdf file info.
2. Input map info (sin projection)
3. Convert SIN to TM Korea

There was no problem in making images with one variable (black sky
albedo), and then I added another similar variable, white sky albedo,
in my new simulation. (This part is commented out and labed as part1
and part2)

However, I got unexpected error messages shown below.

--------------
Envi retrieve data: An error has occurred during processing.
Error: "Array dimensions must be greater than 0". The result may be
invalid.
--------------

These messages are too broad for me and I don't know how to handle
this. In addition, the ' Envi_retrieve_data' must be an internal
function... something like that. I cannot find this function in ENVI
help.

Any suggestions?

Harry


------------------------------
PRO MOD43B3_MakeImage_1km_03

; 0. Variable (initialization/declaration)
WorkDir = 'd:\MODIS_TSrad\MODIS_ALL\'
WorkDirOut = 'd:\MODIS_TSrad\MODIS43\Processed\'
batch_st = strcompress(WorkDir + 'batch_MOD43_TSrad.txt', /remove_all)
WorkDirSat = 'D:\MODIS_TSrad\MODIS43\MOD43\'
StrMOD = 'MOD43'

OpenR, lun, batch_st, /Get_Lun
numdates =file_lines(batch_st)
Dates = StrArr(numdates)

; Read input dates from batch file

OpenR, lun, batch_st, /Get_lun
ReadF, lun, Dates

Free_Lun, lun, /force

close, /all

FOR j = 0L, numDates-1 DO BEGIN

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -

print, "Now processing MOD43 data from date: ", Dates[j], '
File ', j+1, ' out of ', numDates, $
' overpassing time. '

; 0. Get hdf file info.

Filename = WorkdirSat+Dates[j]
FileID = HDF_OPEN(filename, /Read)
sdFileID = HDF_SD_Start(filename, /Read) ;The returned
value of this function is the SD ID of the HDF file
sdsID_albedo = HDF_SD_Select(sdFileID, 0) ; Albedo
sdsID_qc = HDF_SD_Select(sdFileID, 1) ; QC

hdf_sd_getdata, sdsID_albedo, albedo
hdf_sd_getdata, sdsID_qc, qc

;print, 'j = ', j
;help, albedo, qc

albedo_black = fltarr(1200, 1200)
albedo_white = fltarr(1200, 1200)
qc1 = ulonarr(1200, 1200)
qc2 = ulonarr(1200, 1200)

albedo_black[*, *]=albedo[0, 9, *, *]
albedo_white[*, *]=albedo[1, 9, *, *]

qc1[*,*] = qc[0,*,*]
qc2[*,*] = qc[1,*,*]

;help, albedo_black, albedo_white, qc1, qc2


;VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV VVVVV
;V V V V V V
;V V V 1. Input map Information(SIN projection) V V V
;V V V 2. Convert SIN to TM Korea V V V
;V V V V V V
;VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV VVVVV

; 1. Input map information (SIN)

mc=[0.5, 0.5, 11119968.509D, 4447338.766D]
ps=[926.6254331D, 926.6254331D]
units =envi_translate_projection_units('Meters')
params1=[6371007.181D, 0, 0, 0]
Projection_Name1 = 'SIN_MODIS'
map_info = ENVI_MAP_INFO_CREATE(type=16, name=Projection_Name1,
params=params1, $
UNITS = units, MC = mc, PS = ps)

ENVI_WRITE_ENVI_FILE, albedo_black,
out_name='albedo_black_map_4.img', map_info=map_info, out_dt=4,$
r_fid=albedo_black_map, sensor_type=32

envi_file_query, albedo_black_map, ns=ns, nl=nl, nb=nb
dims = [-1, 0, ns-1, 0, nl-1]
pos_albedo_black = lindgen(nb)

;
============================================================ ==============
; Part 1
; ENVI_WRITE_ENVI_FILE, albedo_white,
out_name='albedo_white_map_4.img', map_info=map_info, out_dt=4,$
; r_fid=albedo_white_map, sensor_type=32
;
; envi_file_query, albedo_white_map, ns=ns, nl=nl, nb=nb
; dims = [-1, 0, ns-1, 0, nl-1]
; pos_albedo_white = lindgen(nb)
;
============================================================ ==============
; 2. Convert SIN to TM Korea
; Names of MODIS products
; MOD43B3.A2002177.h28v05.004.2003246195929.hdf

StrDate = STRMID(Dates[j], 9, 7)
StrSat = STRMID(Dates[j], 0, 7)

out_name_albedo_black = WorkDirOut+StrSat+'\'+StrDate+'\'+StrDate
+'_albedo_black_1km_4'+'.img'
out_name_albedo_white = WorkDirOut+StrSat+'\'+StrDate+'\'+StrDate
+'_albedo_white_1km_4'+'.img'

DATUM = 'Tokyo mean'
Projection_Name2= 'Korea - TM (Middle)'
Params2 = [6377397.2, 6356079.0, 38.000000D, 127.002890D,
200000.0, 500000.0, 1.000000]

OUT_Proj = ENVI_PROJ_CREATE(type=3, name=Projection_Name2,
datum=Datum, params=Params2)

envi_convert_file_map_projection, fid=albedo_black_map,
pos=pos_albedo_black, dims=dims, o_proj=OUT_Proj, $
o_pixel_size=[1000, 1000],out_name=out_name_albedo_black,
warp_method=2, r_fid=albedo_black_TM, $
resampling=0, background=0

envi_file_query, albedo_black_TM, ns=ns, nl=nl, nb=nb
dims = [-1, 0, ns-1, 0, nl-1]
pos_albedo_black_TM = lindgen(nb)

;
============================================================ ==============
; part 2
; envi_convert_file_map_projection, fid=albedo_white_map,
pos=pos_albedo_white, dims=dims, o_proj=OUT_Proj, $
; o_pixel_size=[1000, 1000],out_name=out_name_albedo_white,
warp_method=2, r_fid=albedo_white_TM, $
; resampling=0, background=0

; envi_file_query, albedo_white_TM, ns=ns, nl=nl, nb=nb
; dims = [-1, 0, ns-1, 0, nl-1]
; pos_albedo_white_TM = lindgen(nb)
;
============================================================ ==============

;------------------------------------------------------
; Cleaning memory
;envi_file_mng, id= albedo_black_map, /remove
;envi_file_mng, id= albedo_white_map, /remove
;------------------------------------------------------
; Done with SDS, close the interface
HDF_SD_ENDACCESS, SDSID_albedo

HDF_SD_END, sdFileID
HDF_Close, FileID

Close, /all, /force

ENDFOR
print, "C'est si bon! C'est fini!!!"
Free_Lun, lun, /force
close, /all

END
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Reading FITS File Question
Next Topic: IDLWAVE Screen Split

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 18:33:31 PDT 2025

Total time taken to generate the page: 0.47997 seconds