<HTML>
<HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="OPENWEBMAIL" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>

<p><font size="2">Dear Jayakrishnan,</font></p>

<p><font size="2">In order to plot the station climatology <strong>contour</strong>, I used the C++ program, ctl file and gs file similar to yours. But it is still not working. The attachment is my TXT file (station ID, latitude, longitude, climatology), format is &quot;A7, F6.2 F8.2, F8.1&quot;. So could you please use my TXT data file and your C++ program, ctl file and gs file to test again?? Thanks a lot.</font></p>

<p><font size="2">Best,</font></p>

<p><font size="2">Qingfang</font></p>

<p></p>

<p><font size="2"><b>On Tue, 22 Jan 2008 12:21:51 +0530, Jayakrishnan PR wrote</b> 
<br />&gt; Dear Qingfang Dai, 
<br />&gt;     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. 
<br />&gt;   
<br />&gt; 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. 
<br />&gt; Hope this helps......best wishes.... 
<br />&gt;   
<br />&gt;   
<br />&gt; 
<br />&gt;   
<br />&gt; <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> </font></p>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<br />&gt; <font size="2">
<br />&gt; <font face="verdana,arial,helvetica,sans-serif" size="2">Dear GrADS Users,</font> 
<br />&gt; <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>
<br />&gt; <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> 
<br />&gt; #include &quot;stdafx.h&quot; 
<br />&gt; #include &lt;stdio.h&gt; 
<br />&gt; int main(int argc, char* argv[]) 
<br />&gt; { 
<br />&gt;   /* Structure that describes a report header in a stn file */ 
<br />&gt;   struct rpthdr 
<br />&gt;   { 
<br />&gt;     char  id[8];     /* Station ID */ 
<br />&gt;     float lat;       /* Latitude of Station */ 
<br />&gt;     float lon;      /* Longitude of Station */ 
<br />&gt;     float t;         /* Time in grid-relative units */ 
<br />&gt;     int   nlev;     /* Number of levels following */ 
<br />&gt;     int   flag;     /* Level independent var set flag */ 
<br />&gt;   } hdr; 
<br />&gt;   FILE  *ifile, *ofile; 
<br />&gt;   char  rec[80]; 
<br />&gt;   //int   flag,year,month,yrsav,mnsav; 
<br />&gt;   int   i; 
<br />&gt;   float val; 
<br />&gt; /* Open files */ 
<br />&gt;   ifile = fopen (&quot;clim.txt&quot;,&quot;r&quot;);  
<br />&gt;   ofile = fopen (&quot;clim.dat&quot;,&quot;wb&quot;);  
<br />&gt;    if (ifile==NULL || ofile==NULL) { 
<br />&gt;     printf(&quot;Error opening files\n&quot;); 
<br />&gt;     return 1; 
<br />&gt;   } 
<br />&gt; /* Read, write loop */ 
<br />&gt;   val = 0.0;  
<br />&gt;   while (fgets(rec,79,ifile)!=NULL) {    
<br />&gt;     /* Format conversion */  
<br />&gt;   sscanf (rec+8,&quot; %g %g %g&quot;,&amp;hdr.lat,&amp;hdr.lon,&amp;val);  
<br />&gt;     for (i=0; i&lt;8; i++) hdr.id[i] = rec[i]; 
<br />&gt;     /* Write this report */ 
<br />&gt;     hdr.nlev = 1; 
<br />&gt;     hdr.flag = 1; 
<br />&gt;     hdr.t = 0.0; 
<br />&gt;     fwrite (&amp;hdr,sizeof(struct rpthdr), 1, ofile); 
<br />&gt;     fwrite (&amp;val,sizeof(float), 1, ofile); 
<br />&gt;   } 
<br />&gt;   /* Time group terminator */ 
<br />&gt;   hdr.nlev = 0; 
<br />&gt;   fwrite (&amp;hdr,sizeof(struct rpthdr), 1, ofile); 
<br />&gt;   fclose(ifile); 
<br />&gt;   fclose(ofile); 
<br />&gt;   return 0; 
<br />&gt; } 
<br />&gt; 
<br />&gt; <strong>Second, I write the ctl file 'clim.ctl'  as</strong> 
<br />&gt; DSET ^clim.dat 
<br />&gt; DTYPE  station 
<br />&gt; STNMAP ^clim.map 
<br />&gt; UNDEF -999.9 
<br />&gt; TITLE 61-90 climatology 
<br />&gt; TDEF  1 LINEAR Jan1960 1mo 
<br />&gt; VARS  1 
<br />&gt; prep  1  99   precipitation climatology of station 
<br />&gt; ENDVARS 
<br />&gt; <strong>Finally, I write the gs file '<a href="http://clim.gs/" target="_blank" x_onclick="return 
top.js.OpenExtLink(window,event,this)">clim.gs</a>'  as</strong> 
<br />&gt; '!stnmap -i ../stnmap/AB_elev.ctl' 
<br />&gt; 'reinit' 
<br />&gt; 'open ../stnmap/AB_elev.ctl' 
<br />&gt; 'set gxout contour' 
<br />&gt; 'set grads off' 
<br />&gt; 'set mproj nps' 
<br />&gt; 'set grid off' 
<br />&gt; 'set frame off' 
<br />&gt; 'set cstyle 3' 
<br />&gt; 'set csmooth off' 
<br />&gt; 'set t 1 1' 
<br />&gt; 'd prep' 
<br />&gt; 'set font 1' 
<br />&gt; 'set string 1 tc 3' 
<br />&gt; 'set strsiz 0.15 0.15' 
<br />&gt; 'draw title 1961-1990 Climatology in January' 
<br />&gt; 'printim ../Clim.gif gif white' 
<br />&gt; Thanks. 
<br />&gt; Qingfang 
<br />&gt; </font></blockquote>
<br />&gt; 
<br clear="all" />Sincerely 
<br />&gt; -- 
<br />&gt; *********************************************** 
<br />&gt; Jayakrishnan.P.R 
<br />&gt; Junior Research Fellow 
<br />&gt; Department of Atmospheric Sciences 
<br />&gt; Cochin University of Science And Technology (CUSAT), Cochin-16 
<br />&gt; Kerala, India. 
<br />&gt; Mob: 09895417565 
<br />&gt; 
<br />&gt; *********************************************** 
<br />
<br />
<br />-- 
<br />Department of Math and Stat Sciences (<a href="http://www.math.ualberta.ca/" target="_blank">http://www.math.ualberta.ca</a>) 
<br />
<br />
</BODY>
</HTML>