<div><br>Dear Qingfang Dai,</div>
<div>&nbsp;&nbsp;&nbsp; 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>&nbsp;</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>&nbsp;</div>
<div>&nbsp;</div>
<div><br>&nbsp;</div>
<div><span class="gmail_quote">On 1/22/08, <b class="gmail_sendername">Qingfang Dai</b> &lt;<a href="mailto:qdai@math.ualberta.ca">qdai@math.ualberta.ca</a>&gt; 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&#39; climatology contour. My&nbsp;TXT data file is the format of (stnid, lat, lon, climatology value). So I did as followings but it doesn&#39;t work. I don&#39;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 &quot;stdafx.h&quot; <br>#include &lt;stdio.h&gt;</p>
<p>int main(int argc, char* argv[]) <br>{ <br>&nbsp; /* Structure that describes a report header in a stn file */ <br>&nbsp; struct rpthdr <br>&nbsp; { <br>&nbsp;&nbsp;&nbsp; char&nbsp; id[8];&nbsp;&nbsp;&nbsp; /* Station ID */ <br>&nbsp;&nbsp;&nbsp; float lat;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Latitude of Station */
<br>&nbsp;&nbsp;&nbsp; float lon;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Longitude of Station */ <br>&nbsp;&nbsp;&nbsp; float t;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Time in grid-relative units */ <br>&nbsp;&nbsp;&nbsp; int&nbsp;&nbsp; nlev;&nbsp;&nbsp;&nbsp;&nbsp; /* Number of levels following */ <br>&nbsp;&nbsp;&nbsp; int&nbsp;&nbsp; flag;&nbsp;&nbsp;&nbsp;&nbsp; /* Level independent var set flag */
<br>&nbsp; } hdr;</p>
<p>&nbsp; FILE&nbsp; *ifile, *ofile; <br>&nbsp; char&nbsp; rec[80]; <br>&nbsp; //int&nbsp;&nbsp; flag,year,month,yrsav,mnsav; <br>&nbsp; int&nbsp;&nbsp; i; <br>&nbsp; float val;</p>
<p>/* Open files */ <br>&nbsp; ifile = fopen (&quot;clim.txt&quot;,&quot;r&quot;);&nbsp; <br>&nbsp; ofile = fopen (&quot;clim.dat&quot;,&quot;wb&quot;);&nbsp;</p>
<p>&nbsp;&nbsp; if (ifile==NULL || ofile==NULL) { <br>&nbsp;&nbsp;&nbsp; printf(&quot;Error opening files\n&quot;); <br>&nbsp;&nbsp;&nbsp; return 1; <br>&nbsp; }</p>
<p>/* Read, write loop */ <br>&nbsp; val = 0.0;&nbsp; <br>&nbsp; while (fgets(rec,79,ifile)!=NULL) {&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; /* Format conversion */&nbsp; <br>&nbsp;&nbsp;sscanf (rec+8,&quot; %g %g %g&quot;,&amp;hdr.lat,&amp;hdr.lon,&amp;val);&nbsp; <br>&nbsp;&nbsp;&nbsp; for (i=0; i&lt;8; i++)
hdr.id[i] = rec[i]; </p>
<p>&nbsp;&nbsp;&nbsp; /* Write this report */ <br>&nbsp;&nbsp;&nbsp; hdr.nlev = 1; <br>&nbsp;&nbsp;&nbsp; hdr.flag = 1; <br>&nbsp;&nbsp;&nbsp; hdr.t = 0.0; <br>&nbsp;&nbsp;&nbsp; fwrite (&amp;hdr,sizeof(struct rpthdr), 1, ofile); <br>&nbsp;&nbsp;&nbsp; fwrite (&amp;val,sizeof(float), 1, ofile); <br>&nbsp; } <br>&nbsp; /* Time group terminator */
<br>&nbsp; hdr.nlev = 0; <br>&nbsp; fwrite (&amp;hdr,sizeof(struct rpthdr), 1, ofile); </p>
<p>&nbsp; fclose(ifile); <br>&nbsp; fclose(ofile); </p>
<p>&nbsp; return 0; <br>} <br></p>
<p><strong>Second, I write the ctl file&nbsp;&#39;clim.ctl&#39;&nbsp;as</strong></p>
<p>DSET ^clim.dat <br>DTYPE&nbsp; station <br>STNMAP ^clim.map <br>UNDEF -999.9 <br>TITLE 61-90 climatology <br>TDEF&nbsp; 1 LINEAR Jan1960 1mo <br>VARS&nbsp; 1 <br>prep&nbsp;&nbsp;1&nbsp; 99&nbsp;&nbsp;precipitation climatology&nbsp;of station <br>ENDVARS</p>
<p><strong>Finally, I write the&nbsp;gs file&nbsp;&#39;<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://clim.gs/" target="_blank">clim.gs</a>&#39;&nbsp;as</strong></p>
<p>&#39;!stnmap -i ../stnmap/AB_elev.ctl&#39;</p>
<p>&#39;reinit&#39; <br>&#39;open ../stnmap/AB_elev.ctl&#39; <br>&#39;set gxout contour&#39; <br>&#39;set grads off&#39; <br>&#39;set mproj nps&#39; <br>&#39;set grid off&#39; <br>&#39;set frame off&#39; <br>&#39;set cstyle 3&#39;
<br>&#39;set csmooth off&#39; <br>&#39;set t 1 1&#39; <br>&#39;d prep&#39;</p>
<p>&#39;set font 1&#39; <br>&#39;set string 1 tc 3&#39; <br>&#39;set strsiz 0.15 0.15&#39; <br>&#39;draw title 1961-1990 Climatology in January&#39; <br>&#39;printim ../Clim.gif gif white&#39;</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>***********************************************