Home »
Public Forums »
archive »
Retrieving variables from a subroutine
Retrieving variables from a subroutine [message #52634] |
Mon, 19 February 2007 06:21 |
Andy Heaps
Messages: 22 Registered: March 2006
|
Junior Member |
|
|
I've written some IDL code to retrieve all the variables from a NetCDF
file. This takes the form of:
ncopen, 'file.nc'
@ncread
where the ncopen routine opens up the NetCDF file and writes all the
variable information into a set of system strings in a !variable. The
batch file statement @ncread then accesses these strings to read the
data so all the variables are available from within the calling routine.
This process is the only way I could think of to get the variables to
appear in the calling procedure without having the NetCDF code
directly in the user's program. Although this works, I cannot help
thinking this is not the most elegant way of doing the job. I'd
certainly like to just have one command to do the job, rather than
two, if at all possible.
As this program is for the use of undergrad students I don't want to
use structures as they'll think IDL is very complicated and we all
know that that isn't the case ;-) One of the ideas I had was to
somehow get the returning ncopen procedure to call @ncread but I
cannot think of a way to do that.
Does anyone know of any IDL magic that could be used to have a single
procedural (or other) call, and then somehow end up with the NetCDF
variables extracted back in the the calling procedure?
Cheers
Andy
|
|
|
Current Time: Thu Oct 09 09:20:42 PDT 2025
Total time taken to generate the page: 0.24345 seconds