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

Home » Public Forums » archive » Re: Read data in more than one column
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Read data in more than one column [message #84602] Fri, 14 August 2015 15:39 Go to previous message
mick.mitanirc3 is currently offline  mick.mitanirc3
Messages: 16
Registered: August 2015
Junior Member
On Thursday, August 13, 2015 at 10:24:54 AM UTC-5, Joyrles Fernandes wrote:
> I have datas in a file with 26 columns. In first columns there are day of year, in second there are dates and in the remaining columns there are values of temperature. I don't get read these datas starting third columns. Can you help me, please?

Since you call READ_ASCII without a template file, the function will return a structure with a single tag named FIELD01 which will contain a two-dimensional array of type float. So even though your data is of mixed type, it will be converted to float - which doesn't really hurt the record number field but will mess up your date field which contains / characters as separators. Your date values will be converted only until the first non-numeric character is found, so 01/01/2010 becomes 1.0 which is not what you want. If you had stored the date as year first all of your records would end up with 2010 as the value.
Now while you are not using a template, you are specifying data_start=1 which means skip the first line in my file because it is a header line and not data. The example you give does not show a header line but perhaps it does exist but you didn't show it us.
You also mention 355 lines of data though I would have expected a count value of 365 or 366 to match a year.
Because you did not specify a template you end up with one record with one field which contains a float array in your structure. In your code you have the line dados=dados.(0) which says to take the first field in your structure (FIELD01 which contains a float array of 26x355) and then copy that over the structure variable, resulting in the loss of the structure leaving only the array.
Now the next line says date=dados[0,*] - which says go to the first column in the array and store the 355 elements there into a one dimensional array. This is going to be the 1-355 which looks like a record number not a date, unless you mean as a Julian Day of Year value.
Then you have day=[1,*] which I hope actually means day=dados[1,*] will put the days of the months into your array, because we lost the rest of the date information in the conversion to float.
Now you want to put the remaining part of the array into a new array containing only the temperature data. The command you want is temp=dados[2:25,*] which will copy the third through the 26th columns of dados to your array
[Message index]
 
Read Message
Read Message
Previous Topic: Read data in more than one column
Next Topic: Has anyone used stippling in contour plot ?

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

Current Time: Wed Oct 08 11:47:38 PDT 2025

Total time taken to generate the page: 0.06933 seconds