Re: Changing Directories in the middle of an NCL script

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Fri, 24 Apr 2009 16:34:18 -0600

Never mind, I see it, another system command. Along the lines of
Mary's suggestion, how about this:

   cd = "cd " + DIR1 + " ; "
   system(cd + “do_what_im_doing_in_every_dir”)
   cd = "cd " + DIR2 + " ; "
   system(cd + “do_what_im_doing_in_every_dir”)

This would work well in a looping context. Also you could have
multiple system commands, if statements, and general complexity,
just by always using the prefix cd+ at the front of every system
command. There would be no noticeable penalty to efficiency by this
method.

--Dave

Dave Allured wrote:
> As I see it, the only directory-dependent thing that you can do with
> NCL is to read and write disk files. So instead of depending on the
> concept of a "current directory" to get things done, why not simply
> add the base directory name DIR1, DIR2 etc. onto each file name?
> What else could you possibly be doing that really needs a current
> directory?
>
> base="DIR1"
> do_things_with (base+filename1, base+filename2)
> base="DIR2"
> do_things_with (base+filename1, base+filename2)
>
> Dave Allured
> CU/CIRES Climate Diagnostics Center (CDC)
> http://cires.colorado.edu/science/centers/cdc/
> NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
> http://www.cdc.noaa.gov/psd1/
>
> wcapehar wrote:
>> We’re using NCL to do some processing that will require us to change
>> directory “amid-script.” In other words, we’ll be doing something in
>> dir1 and then needing to cd into dir2 and do something else.
>>
>> doing it this way...
>>
>> system(“cd DIR1”)
>> system(“do_what_im_doing_in_DIR1”)
>> system(“cd DIR2”)
>> system(“do_what_im_doing_in_DIR2”)
>>
>> ...doesn’t do it...
>>
>> There is a need to do this
>>
>> There is an equivalent command in IDL, but is there one NCL? Or do I
>> need to run a script in each directory, starting each with a shell command.
>>
>> ================================================================
>> Bill Capehart <William.Capehart_at_sdsmt.edu> Associate Professor
>> Institute of Atmospheric Sciences Land Surface Processes
>> 213 Mineral Industries Building Hydrometeorology
>> South Dakota School of Mines and Technology Ph: +1-605-394-1994
>> 501 East Saint Joseph Street Fax: +1-605-394-6061
>> Rapid City, SD 57701-3995 Mobile: +1-605-484-5692
>> =================== http://capehart.sdsmt.edu ==================
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 24 2009 - 16:34:18 MDT

This archive was generated by hypermail 2.2.0 : Mon Apr 27 2009 - 16:09:00 MDT