Re: Placeholders in NCL Script?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Oct 15 2010 - 10:03:30 MDT

Hi Cory,

For future reference: it's better to post NCL questions to ncl-talk rather than ncarg-talk.

http://mailman.ucar.edu/mailman/listinfo/ncl-talk

If I understand your question correctly, you should be able to do this using command line options.

For example, the beginning of your script might look something like this:

  needed_vars = (/"Y","M","D","H","m","s"/)

  if(.not.all(isvar(needed_vars))) then
    print("Error: one or more required variables have not been input.")
    exit
  end if

  MM = sprinti("%02d",M)
  DD = sprinti("%02d",D)
  HH = sprinti("%02d",H)
  mm = sprinti("%02d",m)
  ss = sprinti("%02d",s)
  filename = "wrfout_d01_" + Y + "-" + MM + "-" + DD + "_" + H + ":" + mm + ":" + ss

  print("filename = '" + filename + "'")

and then you can pass in the six needed variables on the UNIX command line with:

ncl Y=2010 M=2 D=5 H=20 m=3 s=20 test.ncl

On Oct 14, 2010, at 7:10 AM, Cory Van Pelt wrote:

> Hi all,
>
> I'm interested in using automatically executing NCL scripts after my WRF run. WRF dumps its files with dates and times of the run initialization, such as wrfout_d01_2010-09-27_12:00:00. Is there a way to use a placeholder for dates/times in the filename inside NCL so that cron will be able to run the NCL script without intervention? Something such as wrfout_d01_YYYY-MM-DD_HH:MM:SS ?
>
>
> Thanks,
>
> Cory
> cory.vanpelt@noaa.gov
>
>
>
> _______________________________________________
> ncarg-talk mailing list
> ncarg-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncarg-talk

_______________________________________________
ncarg-talk mailing list
ncarg-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncarg-talk
Received on Fri Oct 15 10:03:35 2010

This archive was generated by hypermail 2.1.8 : Fri Oct 15 2010 - 10:40:25 MDT