<div class="gmail_quote">On Thu, Jul 3, 2008 at 11:43 AM, Renu R. Joseph <<a href="mailto:rjoseph@atmos.umd.edu">rjoseph@atmos.umd.edu</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#ffffff" text="#000000">
<font face="Comic Sans MS">Hello All,<br>
<br>
I need suggestions/solutions on dealing with the problem of opening
files with julian day included in the names.<br>
<br>
I have files that named with the following name format:
m6s4_3hYYDDDHH.bin,<br>
where YY represents the last two digits of the years (01 is 2001); DDD
is julian day; HH is the hour of the start of the measurement<br>
<br>
If grads allowed a julian day formats it could have been opened with
"m6s4_3h%y2%jd%h200.bin" in the dset file location as follows.<br>
<br>
dset ^m6s4_3h%y2%jd3%h2.bin<br>
OPTIONS template<br>
OPTIONS big_endian<br>
OPTIONS yrev<br>
UNDEF -9999<br>
TITLE Precipitation estimates<br>
XDEF 1440 LINEAR 0.125 0.25<br>
YDEF 480 LINEAR -59.875 0.25<br>
ZDEF 01 LEVELS 1<br>
TDEF 1 LINEAR 00z01jan2001 3 hr<br>
VARS 1<br>
per 1 99 (mm/hr)<br>
ENDVARS<br>
<br>
Since I cannot do that, I know that one of the options is to use<br>
DSET ^m6s4_3h%ch.bin<br>
CHSUB 1 1 m6s4_3h0100100.bin<br>
CHSUB 2 2 m6s4_3h0100100.bin<br>
..................................................<br>
CHSUB 20448 20448 m6s4_3h0736521.bin<br>
OPTIONS template<br>
<br>
but that includes so many lines. Is there a way around this, unless I
physically rename files to be consistent with grads format names?<br></font></div></blockquote><div><br><br></div></div>You basically outlined your options. The best solution is to include julian day support in grads templating, something that is badly needed (I also ran into such files before). In my case I had a good reason not to rename the files (other applications required the julian day type of name conventions), and sometimes making a copy of the files isn't an option (disk space considerations). Here are a couple of options which leave the original files alone:<br>
<br>1) Symlink each file to a grads friendly name in a separate directory, e.g., grads/m6s4_2007-02-05_12z.bin. You should be able to do this with a relatively simple script.<br><br>2) If you know C, implement %j3 support in GrADS and contribute a patch. In GrADS both v1.9 and v2, look at this function in gautil.c: <br>
<br><div>/* Given a file name template and a dt structure, fill in to get the file name */</div><div>char *gafndt (char *fn, struct dt *dtim, struct dt *dtimi, float *vals, struct gachsub *pch1st, int t) {<br></div><div><br>
Good Luck,<br><br> Arlindo</div><br clear="all"><br>-- <br>Arlindo da Silva<br><a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a>