<div><br>Dear Qingfang Dai,</div>
<div> I have followed the same method as given by you in plotting station data and was successful in plotting the shaded plots of the required value. I herewith attaches the ctl file which I used and the c program. The program looks almost same with some modifications. May be you can compare it with your purposes because It is working well for me.
</div>
<div> </div>
<div>I have two suggestions....One is that it is better to create station map from out side the gs file and incorperate it in the ctl file. Next suggestion is that before running in the gs file kindly try the procedures in the command terminal. That will be better to know where the error has occured.
</div>
<div>Hope this helps......best wishes....</div>
<div> </div>
<div> </div>
<div><br> </div>
<div><span class="gmail_quote">On 1/22/08, <b class="gmail_sendername">Qingfang Dai</b> <<a href="mailto:qdai@math.ualberta.ca">qdai@math.ualberta.ca</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div bgcolor="#ffffff"><font size="2">
<p><font face="verdana,arial,helvetica,sans-serif" size="2">Dear GrADS Users,</font></p>
<p><font face="verdana,arial,helvetica,sans-serif" size="2">I want to plot the stations' climatology contour. My TXT data file is the format of (stnid, lat, lon, climatology value). So I did as followings but it doesn't work. I don't how I shuld do.
</font></p>
<p><font face="verdana,arial,helvetica,sans-serif" size="2"><strong>First, I used the following C++ program to write the TXT file into DAT file:</strong></font></p>
<p>#include "stdafx.h" <br>#include <stdio.h></p>
<p>int main(int argc, char* argv[]) <br>{ <br> /* Structure that describes a report header in a stn file */ <br> struct rpthdr <br> { <br> char id[8]; /* Station ID */ <br> float lat; /* Latitude of Station */
<br> float lon; /* Longitude of Station */ <br> float t; /* Time in grid-relative units */ <br> int nlev; /* Number of levels following */ <br> int flag; /* Level independent var set flag */
<br> } hdr;</p>
<p> FILE *ifile, *ofile; <br> char rec[80]; <br> //int flag,year,month,yrsav,mnsav; <br> int i; <br> float val;</p>
<p>/* Open files */ <br> ifile = fopen ("clim.txt","r"); <br> ofile = fopen ("clim.dat","wb"); </p>
<p> if (ifile==NULL || ofile==NULL) { <br> printf("Error opening files\n"); <br> return 1; <br> }</p>
<p>/* Read, write loop */ <br> val = 0.0; <br> while (fgets(rec,79,ifile)!=NULL) { <br> /* Format conversion */ <br> sscanf (rec+8," %g %g %g",&hdr.lat,&hdr.lon,&val); <br> for (i=0; i<8; i++)
hdr.id[i] = rec[i]; </p>
<p> /* Write this report */ <br> hdr.nlev = 1; <br> hdr.flag = 1; <br> hdr.t = 0.0; <br> fwrite (&hdr,sizeof(struct rpthdr), 1, ofile); <br> fwrite (&val,sizeof(float), 1, ofile); <br> } <br> /* Time group terminator */
<br> hdr.nlev = 0; <br> fwrite (&hdr,sizeof(struct rpthdr), 1, ofile); </p>
<p> fclose(ifile); <br> fclose(ofile); </p>
<p> return 0; <br>} <br></p>
<p><strong>Second, I write the ctl file 'clim.ctl' as</strong></p>
<p>DSET ^clim.dat <br>DTYPE station <br>STNMAP ^clim.map <br>UNDEF -999.9 <br>TITLE 61-90 climatology <br>TDEF 1 LINEAR Jan1960 1mo <br>VARS 1 <br>prep 1 99 precipitation climatology of station <br>ENDVARS</p>
<p><strong>Finally, I write the gs file '<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://clim.gs/" target="_blank">clim.gs</a>' as</strong></p>
<p>'!stnmap -i ../stnmap/AB_elev.ctl'</p>
<p>'reinit' <br>'open ../stnmap/AB_elev.ctl' <br>'set gxout contour' <br>'set grads off' <br>'set mproj nps' <br>'set grid off' <br>'set frame off' <br>'set cstyle 3'
<br>'set csmooth off' <br>'set t 1 1' <br>'d prep'</p>
<p>'set font 1' <br>'set string 1 tc 3' <br>'set strsiz 0.15 0.15' <br>'draw title 1961-1990 Climatology in January' <br>'printim ../Clim.gif gif white'</p>
<p>Thanks.</p>
<p>Qingfang <br></p></font></div></blockquote></div><br><br clear="all">Sincerely<br>-- <br>***********************************************<br>Jayakrishnan.P.R<br>Junior Research Fellow<br>Department of Atmospheric Sciences
<br>Cochin University of Science And Technology (CUSAT), Cochin-16<br>Kerala, India.<br>Mob: 09895417565<br><br>***********************************************