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

Home » Public Forums » archive » Re: Name of arrays
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: Name of arrays [message #79260 is a reply to message #79259] Mon, 20 February 2012 01:46 Go to previous messageGo to previous message
Israel Rodriguez Herm is currently offline  Israel Rodriguez Herm
Messages: 13
Registered: February 2012
Junior Member
On Feb 19, 5:00 pm, David Fanning <n...@idlcoyote.com> wrote:
> Israel Rodriguez Hermelo writes:
>> Why did you say that's a slippery slope? Is there a better solution?
>> I'm already using it with no problems.
>
> I see a lot of people who are just getting started with
> programming wanting to name their variables like this.
> It seems cool, but in the end it just leads to unmaintainable
> programs. A variable is a variable. The variable named "a" is
> just as good as the variable named "b". Yes, variables should
> have good names in programs. But just give them a name
> (e.g., "theseMonths") in the program module where you need them.
> Don't go looking for them all over God's creation!
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Thank you for your advice David. I'll try to avoid using
scope_varfecht then.
My problem however is not simply that I want to have pretty names for
my variables. The problem is that I don't know a priori the number of
arrays that I will need nor their size.
For example, in some cases the input data might correspond to the
months of February and July, but in other cases might correspond to
January, March and April.

MONTH = [ 'FEBRUARY' , 'JULY' , 'SEPTEMBER' ]

To deal with this, I was trying:

Nmonths=N_ELEMENTS(MONTH)

for i=0, Nmonths-1 do begin

readcol, MONTH(i)+'_data.txt', TEMPERATURE

Ndays=N_ELEMENTS(TEMPERATURE)

(scope_varfetch(MONTH(r)+'TEMPERATURE', /enter))=fltarr(Ndays)

endfor

I see why you wrote that scope_varfecht makes the leads to
unmaintainable
programs and I would prefer any other solution but I've been looking
for it in the forum and I haven't found any. Do you have any
suggestion?
Thanks in advance!

Regards,

Israel
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: tracking clusters through multiple timesteps
Next Topic: Issue with console of workbench 8.0

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

Current Time: Wed Oct 08 16:04:44 PDT 2025

Total time taken to generate the page: 0.00293 seconds