<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 "A7, F6.2 F8.2, F8.1". 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><font size="2"></font></p>
<p><font size="2"><b>On Tue, 22 Jan 2008 12:21:51 +0530, Jayakrishnan PR wrote</b>
<br />> Dear Qingfang Dai,
<br />> 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 />>
<br />> 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 />> Hope this helps......best wishes....
<br />>
<br />>
<br />>
<br />>
<br />> <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> </font></p>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<br />> <font size="2">
<br />> <font face="verdana,arial,helvetica,sans-serif" size="2">Dear GrADS Users,</font>
<br />> <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 />> <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 />> #include "stdafx.h"
<br />> #include <stdio.h>
<br />> 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;
<br />> FILE *ifile, *ofile;
<br />> char rec[80];
<br />> //int flag,year,month,yrsav,mnsav;
<br />> int i;
<br />> float val;
<br />> /* Open files */
<br />> ifile = fopen ("clim.txt","r");
<br />> ofile = fopen ("clim.dat","wb");
<br />> if (ifile==NULL || ofile==NULL) {
<br />> printf("Error opening files\n");
<br />> return 1;
<br />> }
<br />> /* 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];
<br />> /* 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);
<br />> fclose(ifile);
<br />> fclose(ofile);
<br />> return 0;
<br />> }
<br />>
<br />> <strong>Second, I write the ctl file 'clim.ctl' as</strong>
<br />> 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
<br />> <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 />> '!stnmap -i ../stnmap/AB_elev.ctl'
<br />> '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'
<br />> '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'
<br />> Thanks.
<br />> Qingfang
<br />> </font></blockquote>
<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 />> ***********************************************
<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>