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

Home » Public Forums » archive » IDL code - problem to convert string to float
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
IDL code - problem to convert string to float [message #86703] Thu, 28 November 2013 09:05 Go to previous message
capercas is currently offline  capercas
Messages: 4
Registered: November 2013
Junior Member
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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: VERT_COLORS Problem
Next Topic: IDL environment "idlde" doesn't work

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

Current Time: Wed Oct 08 15:06:47 PDT 2025

Total time taken to generate the page: 0.00408 seconds