Hi Daran,
You should be able to set a string variable (within your NCL script) to
the name of the file you want to process. e.g.,
file1 = systemfunc("date +%Y%m%d%H")+"_surface.dat"
surface_dat = asciiread(file1,(/1000,5/),"float")
Or, if you need to do something more complicated, you can get the year, month,
day, and hour as separate (integer) variables, e.g.,
day1 = stringtoint(systemfunc("date +%d"))
hour1 = stringtoint(systemfunc("date +%H"))
and form the filename yourself.
--Larry
On Mon, 18 Sep 2000, Daran L. Rife wrote:
> Hi Group,
>
> I have a question regarding running NCL commands in batch mode. I'd like
> to create an NCL script that is called from the cron. The NCL script reads
> ASCII data. The ASCII data file name changes dynamically as wall clock
> time progresses -- in this case the file name contains a pseudo-Unix time
> stamp which indicates the valid time of the data.
>
> For example, at 1000 UTC a file named 2000091810_surface.dat exists on my
> system (it contains surface data from 1000 UTC). I'd like my NCL script
> (called from the cron) to plot this data. Then at 1100 UTC a file named
> 2000091811_surface.dat exits (containing surface data from 1100 UTC) --
> I'd like to automatically plot this data too, and so on.
>
> I've looked at the GSUN guide examples, and played around a bit with NCL
> itself. It seems as though the only way I can get my NCL script to
> recognize dynamically changing file names, is to generate a 'wrapper'
> script which dynamically creates appropriate file names/locations, then
> sets an environment variable indicating the location of the file. For
> example, here's some pseudo-code from a wrapper script:
>
>
> get system date
>
> create file name/location string from system date
>
> setenv $FILE_LOCATION
>
> ncl < my_ncl_script.ncl
>
> unsetenv $FILE_LOCATION
>
>
> Then in my NCL script I have an asciiread call that looks like:
>
> surface_dat = asciiread($FILE_LOCATION,(/1000,5/),"float")
>
>
>
> Is there a better option than what I've described above?
>
>
>
> Thanks for your time,
>
>
>
>
> Daran
>
> __________________________________________________________________
>
> Daran L. Rife
>
> Associate Scientist
>
> National Center for Atmospheric Research
> Research Applications Program
> P.O. Box 3000
> Boulder CO, 80307-3000
>
> 303.497.8398
>
> drife@ucar.edu
> __________________________________________________________________
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Larry W. Horowitz phone: (609) 452-6520
GFDL/NOAA fax: (609) 987-5063
P.O. Box 308, Princeton Univ. home page: http://www.asp.ucar.edu/~larryh/
Princeton, NJ 08542-0308 email: larryh@ucar.edu or lwh@gfdl.gov
This archive was generated by hypermail 2b29 : Mon Sep 18 2000 - 14:15:38 MDT