Problem with stn header in using stnmap
Smita B
smitabodepudi at YAHOO.COM
Sat Feb 11 14:10:02 EST 2006
im using Grads vers v1.8SL11 32-bit little-endianion on windows xp
Im trying to use stnmap utility to generate a map file.
what shuld be the nlev and flag data types (shuld they be defined as int
or float)
Issue 1:
--------
When i define nlev and flag as integers i get the following error
Starting scan of station data binary file.
Binary data file open: c:\programs\output.txt
Processing time = 1
Invalid station hdr found in station binary file
Possible causes: Invalid level count in hdr
Descriptor file mismatch
File not station data
Invalid relative time
levs = 0 flag = 1633771873 time = 0
but when i define them as float stnmap doesn't complain and creates a a
map file.
here is the c program for reference.
struct stnhdr
{
char id[8];
float lat;
float lon;
float t;
int nlev; /* if defined as float then no error in stnmap */
int flag; /* same
}stn;
FILE *f2;
int main ()
{
int i,j,k;
float value;
f2 = fopen("OUTPUT.TXT","wb");
for(i =0;i<8;i++)
stn.id[i]='a';
for(j=0;j<10;j++)
{
for(i = 0; i< 10; i++)
{
stn.lat = j;
stn.lon = i;
value = i*j;
if (i == 0)
{
stn.nlev = 0;
stn.flag = 0;
stn.t = 0.0;
fwrite(&stn,sizeof(struct stnhdr),1,f2);
}
stn.nlev=1;
stn.flag =1;
fwrite(&stn,sizeof(struct stnhdr),1,f2);
fwrite(&value, sizeof(float),1,f2);
}
}
stn.nlev = 0;
fwrite(&stn,sizeof(struct stnhdr),1,f2);
}
Issue 2:
--------
I try to plot using map file with the following script : but i don't get
any data plotted.
clear
set gxout value
set display color
open stat.ctl
set lat 60 78'
'set lon -190 -155'
*
*
'set stid off'
'set ccolor rainbow'
'display data'
More information about the gradsusr
mailing list