Thank you Devin! I am one step closer now!!! [message #55297] |
Thu, 16 August 2007 06:41  |
kim20026
Messages: 54 Registered: November 2006
|
Member |
|
|
However, I still faced next problem...
The first image was done successfully, but I got this error message
when the loop was going to next image...
"Openw: Error opening file. unit 100. file: D:\MODIS07\processed\D:
\MODIS07\processed\solza_swath_2D_1.img"
Actually, 'D:\MODIS07\processed' is the folder that output image files
will be stored. I don't know why this pathname was written twice.
When I process many *.hdf files at once, I make a batch file and write
the names of *.hdf files on it, and then process. Maybe there is some
kind of confliction between my way and MCTK way. I would like to try
MCTK way this time.
How do you usually do when you need to process may files at once? for
example,
MYD07_L2.A2006001.0355.005.2006126203815.hdf
MYD07_L2.A2006001.0530.005.2006126204759.hdf
MYD07_L2.A2006001.0535.005.2006126202918.hdf
MYD07_L2.A2006001.1735.005.2006126213235.hdf
MYD07_L2.A2006002.0435.005.2006126221739.hdf
if these are the files that you need to process, what will you do?
Thanks in advance !
Harry
|
|
|
Re: Thank you Devin! I am one step closer now!!! [message #55366 is a reply to message #55297] |
Fri, 17 August 2007 05:51  |
devin.white
Messages: 50 Registered: March 2007
|
Member |
|
|
The way you have your program set up (working off a text file
containing the data sets to process) works well with MCTK. The only
sticking point is how you're setting up the output rootname. That
value should be unique to every file you are processing. If you use
the same value every time, MCTK will attempt to write the data its
currently working with to the same output file repeatedly. I believe
that is why you're running into the OPENW error. The first file
writes correctly because it is the first one, but MCTK automatically
loads the result to the Available Bands List, which means that ENVI
now has a hold on it. When MCTK starts to process the second file, it
attempts to write into the first one but it doesn't have permission to
do so since ENVI's currently using it. I downloaded some MOD07_L2
data, created a text file like the one you used, modified your program
slightly, and the results appear to be good. You'll want to change
the directory and file specifications back to the ones you're using
for this work properly, though. You'll notice that I moved the output
rootname definition into the FOR loop so that a unique rootname can be
generated each time MCTK is called. In this example I based the
rootname off of the basename for the input file. I tend to do this so
I can keep track of the product type, collection date, collection
version, etc.
=====================================
PRO MCTK_MOD07_SOLZA
compile_opt idl2
WorkDir07 = 'C:\Harry_Test\'
batch_st07 = WorkDir07+'mod07_l2_file_list.txt'
WorkDirSat = 'C:\Harry_Test\'
numDates = file_lines(batch_st07)
Dates = StrArr(numDates)
; Read input dates from batch file
OpenR, lun, batch_st07, /Get_lun
ReadF, lun, Dates
Free_Lun, lun, /force
output_location = 'C:\Harry_Test\'
swath_name = 'mod07'
sd_names = ['Solar_Zenith']
out_method = 1
output_projection = envi_proj_create(/geographic)
interpolation_method = 6
for j = 0, 4 do begin ; numDates-1 do begin
current_file_basename = file_basename(dates[j], '.hdf')
output_rootname = current_file_basename+'_SOLZA'
s_time = systime(1)
modis_swath_file = WorkdirSat+Dates[j]
print, "Now processing MYD07 data using MCTK from date: ", $
Dates[j], ' File ', j+1, ' out of ', numDates
convert_modis_data, in_file=modis_swath_file, $
out_path = output_location, out_root= output_rootname, $
/higher_product, /swath, swt_name=swath_name, sd_names=sd_names,
$
out_method= out_method, out_proj=output_projection, $
num_x_pts=50, num_y_pts=50, interp_method=interpolation_method,$
/no_msg
endfor
e_time = systime(1)
print, 'Elapsed time for this procedure: ', e_time - s_time
print, "Look's OK!"
end
On Aug 16, 9:41 am, DirtyHarry <kim20...@gmail.com> wrote:
> However, I still faced next problem...
>
> The first image was done successfully, but I got this error message
> when the loop was going to next image...
>
> "Openw: Error opening file. unit 100. file: D:\MODIS07\processed\D:
> \MODIS07\processed\solza_swath_2D_1.img"
>
> Actually, 'D:\MODIS07\processed' is the folder that output image files
> will be stored. I don't know why this pathname was written twice.
>
> When I process many *.hdf files at once, I make a batch file and write
> the names of *.hdf files on it, and then process. Maybe there is some
> kind of confliction between my way and MCTK way. I would like to try
> MCTK way this time.
>
> How do you usually do when you need to process may files at once? for
> example,
>
> MYD07_L2.A2006001.0355.005.2006126203815.hdf
> MYD07_L2.A2006001.0530.005.2006126204759.hdf
> MYD07_L2.A2006001.0535.005.2006126202918.hdf
> MYD07_L2.A2006001.1735.005.2006126213235.hdf
> MYD07_L2.A2006002.0435.005.2006126221739.hdf
>
> if these are the files that you need to process, what will you do?
>
> Thanks in advance !
>
> Harry
|
|
|