[gradsusr] Automation my (ctl) descriptor file

Jennifer Adams jma at cola.iges.org
Tue Mar 8 11:18:34 EST 2011


Below is a C program (sdate.c) we use in our operations to print out  
the current date string in GrADS format -- e.g., 08mar2001. We have a  
descriptor file template with "XXX" in place of the date, then in a  
shell script, we invoke sdate, then use 'sed' to change the XXX to the  
current date. Like this:

#!/bin/sh
gdate=`/your_path_to/sdate`
...
sed s/XXX/$gdate/ /your_path_to/ctl.template > ./tmp
...

Hope that helps!
--Jennifer




#include <stdio.h>
#include <string.h>
#include <time.h>

char *cmons[12] =  
{"jan 
","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"};

main () {
time_t *tsec;
time_t tt;
struct tm *tm;
char sname[50];
int rc;

   tt = time((long *)0);
   tsec = &tt;
   tm = gmtime(tsec);
   if (tm->tm_year>99) tm->tm_year = tm->tm_year-100;
   sprintf (sname,"%02i%s%4i",tm->tm_mday,cmons[tm->tm_mon],tm->tm_year 
+2000);
   printf ("%s\n",sname);
}




On Mar 8, 2011, at 10:58 AM, Reynaldo Capia wrote:

> Hi everyone;
>
> I need to automate my tasks of GrADS;
>
> I have everything advanced, and I just want the following:
>
> => How can I do, to update the date every day of my descriptor  
> file(ctl)
>       in this line (31 linear 00z08MAR2011 TDEF 06hr)?.
>
> I accept suggestions.
> Thanks.
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer M. Adams
IGES/COLA
4041 Powder Mill Road, Suite 302
Calverton, MD 20705
jma at cola.iges.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110308/b9d2ecbb/attachment-0003.html 


More information about the gradsusr mailing list