Re: IDL code - problem to convert string to float [message #86775 is a reply to message #86703] |
Mon, 02 December 2013 10:17  |
capercas
Messages: 4 Registered: November 2013
|
Junior Member |
|
|
On Thursday, November 28, 2013 6:05:21 PM UTC+1, cape...@topo.upv.es wrote:
> Dear all,
>
>
>
> The problem comes from the strrs (SearchString value) when is converted to float. It could be because it is an string-ARRAY because I did not find this problem with uki1 and uki2 (using STRMATCH).
>
> For the last example I can not understand what is happening because there is not any conversion…but the warning say: Unable to convert given STRING to Long64
>
>
>
> If you could help me……
>
>
>
> PROBLEM 1
>
> *******************part of the code************************************
>
>
>
> if country eq 'UK' then begin
>
> uki1 = 'UKI1'
>
> uki2 = 'UKI2'
>
> ara90_uki1 = (float(dataclc90[WHERE(STRMATCH(dataclc90,uki1))+3]))/10000
>
> ara90_uki2 = (float(dataclc90[WHERE(STRMATCH(dataclc90,uki2))+3]))/10000
>
> pc90_uki1 = (float(dataclc90[WHERE(STRMATCH(dataclc90,uki1))+4]))/10000
>
> pc90_uki2 = (float(dataclc90[WHERE(STRMATCH(dataclc90,uki2))+4]))/10000
>
> past90_uki1 = (float(dataclc90[WHERE(STRMATCH(dataclc90,uki1))+5]))/10000
>
> past90_uki2 = (float(dataclc90[WHERE(STRMATCH(dataclc90,uki2))+5]) )/10000
>
> endif
>
>
>
> ara= float(dataclc90[WHERE(STRMATCH(dataclc90,strrs))+3])
>
> araclc90=float(ara)/10000
>
> pc= float(dataclc90[WHERE(STRMATCH(dataclc90,strrs))+4])
>
> pcclc90=float(pc)/10000
>
> past= float(dataclc90[WHERE(STRMATCH(dataclc90,strrs))+5])
>
> pastclc90=float(past)/10000
>
>
>
>
>
> ****************************console************************* ************
>
> IDL> help, uki1
>
> UKI1 STRING = 'UKI1'
>
> IDL> help, strrs
>
> STRRS STRING = Array[1]
>
>
>
>
>
>
>
> PROBLEM2
>
> ******************part of the code************************************
>
> Detected at: CAPRI_1990TO2050_PRIMESCOR_ALLMINMAX 965 E:\perpcar\Documents\LUMP\CAPRI_DATA\SCRIPTS\capri_1990to205 0_primescor_allminmax.pro
>
> % Type conversion error: Unable to convert given STRING to Long64.
>
>
>
> printf,1,uki2
>
> for y=0L, nyears+4 do begin
>
> printf, 1, ['dummies','noData',$ //This is the line 965
>
> 'noData','noData','noData', $
>
> 'noData','noData','noData'],$
>
> format='(i10,i15,i15,i15,i15,i15,i15,i15)'
>
>
>
> Thank you very much for your time.
>
> Regards,
>
> Carolina
Thank you very much David.
I will check in the IDL on-line help.
Best Regards,
Carolina
|
|
|