[gradsusr] Automation my (ctl) descriptor file
Becker, Bernd
bernd.becker at metoffice.gov.uk
Tue Mar 8 11:39:46 EST 2011
on a unix box the following should pick the current time:
date +%m'z'%d%b%Y
--
Bernd Becker Climate Impacts Product Development
Met Office Hadley Centre FitzRoy Road Exeter Devon EX1 3PB United
Kingdom
Tel.: +44 (0) 1392 884511 Fax: +44 (0)870 900 5050
E-mail:bernd.becker at metoffice.gov.uk -
http://www.metoffice.gov.uk/research/our-scientists/seasonal-to-decadal/
bernd-becker
________________________________
From: gradsusr-bounces at gradsusr.org
[mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Jennifer Adams
Sent: 08 March 2011 16:19
To: GrADS Users Forum
Subject: Re: [gradsusr] Automation my (ctl) descriptor file
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/12abb3a5/attachment-0003.html
More information about the gradsusr
mailing list