RESIZE_DOIT [message #93264] |
Tue, 24 May 2016 10:30  |
sawahrman
Messages: 2 Registered: December 2015
|
Junior Member |
|
|
Hi all,
I've written some code to batch resize some image data, and I'm getting the following error message:
Type conversion error: Unable to convert given STRING to Integer.
The loop I've written to resize the data is:
while (i lt total_frames) do begin
Swath_size = [-1L,0,480,Start_Line, End_Line]
ENVI_DOIT, 'RESIZE_DOIT', FID=in_file, DIMS=Swath_size,$
OUT_NAME=input_file_name + Swath_num, R_FID=in_file, RFACT=Swath_size
Swath_num = Swath_num + 1
Start_Line = Start_Line + Num_Scene_Frames + Num_Invalid_Frames
End_Line = Start_Line + Num_Scene_Frames
end
I'd appreciate some more sets of eyes to help me see what I'm missing.
Thanks
|
|
|
Re: RESIZE_DOIT [message #93265 is a reply to message #93264] |
Tue, 24 May 2016 12:58  |
Jim Pendleton
Messages: 165 Registered: November 2011
|
Senior Member |
|
|
On Tuesday, May 24, 2016 at 11:30:47 AM UTC-6, Spencer Wahrman wrote:
> Hi all,
>
> I've written some code to batch resize some image data, and I'm getting the following error message:
> Type conversion error: Unable to convert given STRING to Integer.
>
> The loop I've written to resize the data is:
> while (i lt total_frames) do begin
> Swath_size = [-1L,0,480,Start_Line, End_Line]
> ENVI_DOIT, 'RESIZE_DOIT', FID=in_file, DIMS=Swath_size,$
> OUT_NAME=input_file_name + Swath_num, R_FID=in_file, RFACT=Swath_size
> Swath_num = Swath_num + 1
> Start_Line = Start_Line + Num_Scene_Frames + Num_Invalid_Frames
> End_Line = Start_Line + Num_Scene_Frames
> end
>
> I'd appreciate some more sets of eyes to help me see what I'm missing.
>
> Thanks
In this expression
OUT_NAME=input_file_name + Swath_num
the variable "input_file_name" is a string, I presume, while "Swath_num" is an integer. In the IDL language, the "+" operator applied to a number and a string will attempt to cast the string to a number, and not the other way around.
You probably want something like the following instead
OUT_NAME=input_file_name + Swath_num.tostring()
or
OUT_NAME=input_file_name + strtrim(Swath_num, 2)
Jim P
|
|
|