Mapper
get_hrap_mask.c
Go to the documentation of this file.
1 
2 #include "prototypes_new.h"
3 
4 int get_hrap_mask(char *fname)
5 
6 {
7 
8 extern struct tag tag[20];
9 FILE *fp;
10 extern struct hrap_grid *hrap_grid;
11 int i,j,h;
12 char kbuf[10000];
13 extern struct pcp *pcp;
14 int minhrapi,minhrapj,maxhrapi,maxhrapj;
15 int ghrapi,ghrapj;
16 int ii,jj;
17 int ier;
18 char *p;
19 int gmini,gminj,gmaxi,gmaxj;
20 int iflag;
21 
22 fp=fopen(fname,"r");
23 
24 if(fp==NULL) {
25 
26  printf("could not open %s\n",fname);
27 
28  return(-1);
29 
30  }
31 
32 for(i=0;i<hrap_grid->maxi;i++) {
33 
34 for(j=0;j<hrap_grid->maxj;j++) {
35 
36  hrap_grid->owner[i][j]=-1;
37 
38 
39  }
40 
41 }
42 
43 minhrapi=hrap_grid->hrap_minx;
44 minhrapj=hrap_grid->hrap_miny;
45 maxhrapi=hrap_grid->hrap_minx + hrap_grid->maxi;
46 maxhrapj=hrap_grid->hrap_miny + hrap_grid->maxj;
47 
48 p=fgets(kbuf,100,fp);
49 
50 for(i=0;i<20;i++)
51  tag[i].wfo[0]=0;
52 
53 ier=sscanf(kbuf,"%d %d %d %d %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n",
54  &gmini,&gminj,&gmaxi,&gmaxj,
55  tag[0].wfo,tag[1].wfo,tag[2].wfo,tag[3].wfo,
56  tag[4].wfo,tag[5].wfo,tag[6].wfo,tag[7].wfo,
57  tag[8].wfo,tag[9].wfo,tag[10].wfo,tag[11].wfo,
58  tag[12].wfo,tag[13].wfo,tag[14].wfo,tag[15].wfo,
59  tag[16].wfo,tag[17].wfo,tag[18].wfo,tag[19].wfo);
60 
61 for(i=0;i<gmaxi;i++) {
62 
63  fread(kbuf,sizeof(char),gmaxj*6,fp);
64 
65  kbuf[gmaxj*6]=0;
66  /* get hrap coord of gridded data */
67 
68  ghrapi=gmini+i;
69 
70  ii=ghrapi-minhrapi;
71 
72  if(ghrapi >= minhrapi && ghrapi < maxhrapi) {
73 
74  h=0;
75 
76  for(j=0;j<gmaxj;j++) {
77 
78  ghrapj=gminj+j;
79 
80  jj=ghrapj-minhrapj;
81 
82  if(ghrapj >= minhrapj && ghrapj < maxhrapj) {
83 
84  hrap_grid->owner[ii][jj]=atoi(&kbuf[h]);
85 
86 
87  }
88 
89  h=h+6;
90 
91  }
92 
93  }
94 
95  }
96 
97 fclose(fp);
98 
99 return(1);
100 
101 }
102 
static int i
int get_hrap_mask(char *fname)
Definition: get_hrap_mask.c:4
fclose(fp)
printf("fbuf is %s\n", fbuf)
fp
Definition: make_NEXRAD.c:339
int j
Definition: mapp2h.h:48
struct pcp * pcp
Definition: mapper.c:140
struct hrap_grid * hrap_grid
Definition: mapper.c:142
char fname[100]
Definition: send_afos.c:6
short int hrap_miny
Definition: misc.h:583
short int hrap_minx
Definition: misc.h:582
short int maxi
Definition: misc.h:580
short int maxj
Definition: misc.h:581
short int ** owner
Definition: misc_new.h:811
Definition: misc.h:596
Definition: misc_new.h:61