Re: structure use [message #31333] |
Tue, 02 July 2002 21:46 |
Paul Sorenson
Messages: 48 Registered: May 2002
|
Member |
|
|
Patrick McEnaney wrote:
> the use of a structure doesn't allow changing a field size
You can get around this by using a pointer in your structure. For example:
*(*pState).pProfileData=fltarr(11,500,3)
...do some stuff...
*(*pState).pProfileData=fltarr(11,600,3)
-Paul Sorenson
-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----
|
|
|
Re: structure use [message #31340 is a reply to message #31333] |
Tue, 02 July 2002 11:49  |
btupper
Messages: 55 Registered: January 2002
|
Member |
|
|
On 1 Jul 2002 15:51:18 -0700, patrick@es.ucsc.edu (Patrick McEnaney)
wrote:
> Folks- This one should be easy I guess. I'm using a pointer to a 3d
> structure array to store ascii data so I can create simple plots. I've
> got the structure set as such:
>
> profiledata=fltarr(11,9999,3)
>
> Then when I access the data I just call (*pstate).profiledata(5,*,0)
> for a specific column of data, (*pstate) is the pointer. Here's my
> problem, and I'm challenged when it comes to fixing bugs so don't
> laugh if the fix is really obvious, my file sizes vary from just a few
> hundred samples to several thousand samples depending on the rate the
> instrumentation is set at. So if the file is 500 lines I'm reading in
> 500 valus in an array that 9999 samples long, the result is a decent
> profile of data but there are lots of unwanted data values plotting as
> well. So I want to plot just the good values and not the zeroes but
> the use of a structure doesn't allow changing a field size no matter
> if I use a named or anonymous type from what I've read. The question
> is, how do I just read the good values and ignore the zeroes.
>
Hi Patrick, Are you using a SeaBird CTD? If so, there is a line in
the ASCII header of a converted file that tells you how many records
(rows) are in the file... I think it is NQUAN.
If you are using this instrument, you could use the file readers we
have developed. I would have to hunt around a bit, but they aren't
too far away.
> What I'm essentially looking for is an IDL
> programming guide for non-programmer scientists and I'd like to get an
> opinion before buying.
In addition to David's book, you *really* should have Liam Gumley's
book, "Practical IDL Programming" (www.gumley.com) Each is
indispensible to me.
Ben
|
|
|
Re: structure use [message #31343 is a reply to message #31340] |
Tue, 02 July 2002 00:41  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Patrick McEnaney wrote:
>
> Folks- This one should be easy I guess. I'm using a pointer to a 3d
> structure array to store ascii data so I can create simple plots. I've
> got the structure set as such:
>
> profiledata=fltarr(11,9999,3)
>
> Then when I access the data I just call (*pstate).profiledata(5,*,0)
> for a specific column of data, (*pstate) is the pointer. Here's my
> problem, and I'm challenged when it comes to fixing bugs so don't
> laugh if the fix is really obvious, my file sizes vary from just a few
> hundred samples to several thousand samples depending on the rate the
> instrumentation is set at. So if the file is 500 lines I'm reading in
> 500 valus in an array that 9999 samples long, the result is a decent
> profile of data but there are lots of unwanted data values plotting as
> well. So I want to plot just the good values and not the zeroes but
> the use of a structure doesn't allow changing a field size no matter
> if I use a named or anonymous type from what I've read. The question
> is, how do I just read the good values and ignore the zeroes.
Dear Patrick,
lots of question lots of answers.
Your problem is that's you always read with a fix dimensioned
array.
If you use a small routine fileline you can dimension your reading
array to the number of availabel lines of the file.
If you like it more comfartable you can use e.g. read_data_file
to read in the whole file in a data-structure.
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/fileline.tar.gz
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/read_data_file.tar.gz
If you like to have fix sizes you can use the where function to
determine
the 0 values.
e.g. valid=where(values[0,*,0] ne 0 , count)
if count gt 0 then plot,values[0,valid,0]
>
> Another question, hopefully really easy this time...I've been
> attempting to use idl to visualize data or otherwise just program for
> the better part of two years. I get pulled away from the programming
> to perform other tasks very frequently so the results of my learning
> are, well....mixed. Before I started using idl I hadn't programmed at
> all in several years since taking fortran in college. I've taken two
> classes from RSI and have the books from the course and also Dr.
> Fanning's book. The problem I have with these books is that I haven't
> learned much from them because I don't perceive them as about idl as a
> programming language (no offense to any of the authors). For example
> if I went out and bought an O'Reilly or some other simple step by step
> discussing perl or C as a programming language. What I'm looking for
> is a good, simple to follow book with lots of examples (I hesitate to
> say a dummies guide because I can't stand the writing style). I
> noticed several additional books on Dr. Fanning's website, what is the
> opinion on these? What I'm essentially looking for is an IDL
> programming guide for non-programmer scientists and I'd like to get an
> opinion before buying.
If you like you can meet us in one of our lessons at FZ-J�lich.
Next one is end of October.
Reimar
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
============================================================ =======
|
|
|