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

Home » Public Forums » archive » How do I incorporate two or more subroutines from a main program
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
How do I incorporate two or more subroutines from a main program [message #89601] Thu, 30 October 2014 15:51 Go to next message
iansmith@bigpond.net. is currently offline  iansmith@bigpond.net.
Messages: 4
Registered: October 2014
Junior Member
At present I have inherited code which has a subroutine to read data from external file/s and a main program which prepares and plots selected variables from the data.

The structure is the read subroutine followed by the main program,

I now wish to execute a cubic spline fit to the plotted data and may wish to use a third party routine which I guess would be added as a separate subroutine called from my main program where, I assume I must define the called variables.

My question is does the additional subroutine also precede the main program ?

I would welcome advice

Ian
Re: How do I incorporate two or more subroutines from a main program [message #89604 is a reply to message #89601] Thu, 30 October 2014 16:13 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Thursday, October 30, 2014 6:51:43 PM UTC-4, ians...@bigpond.net.au wrote:
> My question is does the additional subroutine also precede the main program ?

You can do it that way.

IDL has a set way that it looks for subroutines. It looks in the current working directory first, and then it looks in the directories listed in your IDL path.

So the easiest way is to actually just copy or move your third party subroutines to the current working directory (the same directory where your main program is). IDL should compile it automatically when you put that subroutine name into your main program.

Craig
Re: How do I incorporate two or more subroutines from a main program [message #89605 is a reply to message #89601] Thu, 30 October 2014 16:26 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
iansmith@bigpond.net.au writes:

> At present I have inherited code which has a subroutine to read data from external file/s and a main program which prepares and plots selected variables from the data.
>
> The structure is the read subroutine followed by the main program,
>
> I now wish to execute a cubic spline fit to the plotted data and may wish to use a third party routine which I guess would be added as a separate subroutine called from my main program where, I assume I must define the called variables.
>
> My question is does the additional subroutine also precede the main program ?

Here is advice for how to install *any* third party library or set of
routines in IDL.

http://www.idlcoyote.com/code_tips/installcoyote.php

You might also be interested in the 10 most common errors IDL
programmers make:

http://www.idlcoyote.com/code_tips/mostcommon.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: How do I incorporate two or more subroutines from a main program [message #89606 is a reply to message #89601] Thu, 30 October 2014 17:53 Go to previous message
iansmith@bigpond.net. is currently offline  iansmith@bigpond.net.
Messages: 4
Registered: October 2014
Junior Member
On Friday, October 31, 2014 9:51:43 AM UTC+11, ians...@bigpond.net.au wrote:
> At present I have inherited code which has a subroutine to read data from external file/s and a main program which prepares and plots selected variables from the data.
>
> The structure is the read subroutine followed by the main program,
>
> I now wish to execute a cubic spline fit to the plotted data and may wish to use a third party routine which I guess would be added as a separate subroutine called from my main program where, I assume I must define the called variables.
>
> My question is does the additional subroutine also precede the main program ?
>
> I would welcome advice
>
> Ian

Thank you Craig and David you have been very helpful
Cheers
Ian
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Implicit print bug in IDL 8.4?
Next Topic: Best routines for mapping satellite images

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

Current Time: Wed Oct 08 13:40:30 PDT 2025

Total time taken to generate the page: 0.00383 seconds