Re: wrapit / cd

From: Rick Grubin <grubin_at_nyahnyahspammersnyahnyah>
Date: Wed, 31 Oct 2007 16:24:50 -0600

Hi Mike

> Is there any way in NCL to change to directory A, use wrapit to run
> a fortran file there, change to directory B, use wrapit to run a
> fortran file there, and so on?
>
> I want to loop through a list of directory-name strings in NCL,
> change to those directories, and use wrapit to run fortran programs
> in those directories. But system("cd ...") apparently only
> temporarily changes directory if that makes sense, meaning once NCL
> gets to the next line, it no longer is in that directory.

The 'system()' function executes its command argument in a subshell,
meaning that whatever command you wish to run is a separate process
from your NCL session. Once it's done executing, you're "right back
where you started" so to speak. This is how the Unix 'system'
function operates.

If your list of directory name strings is representative of a flat
file structure -- all directories have the same root -- then you
should be able to loop without difficult using 'system(cd ...)' by
iterating over your list of strings.

If your list of directory name strings is a tree structure -- each
directory is a subdirectory of the previous -- then you'll need to
build a directory name string as you go, concatenating strings to be
able to change directory to successive levels down.

Example #2 at: http://www.ncl.ucar.edu/Document/Functions/Built-in/
system.shtml should give you an idea of how to do this, where
you'd build a new directory name each time instead of a new filename
as in the example.

If I didn't completely understand your question, could you please
explain a bit more?

-Rick.
----
Rick Grubin NCAR/TDD/CISL/VETS
Visualization + Enabling Technologies
grubin_at_ucar.edu 303.497.1832

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 31 2007 - 16:24:50 MDT

This archive was generated by hypermail 2.2.0 : Fri Nov 02 2007 - 10:04:07 MDT