3 #include "grib1_routines.h"
17 float center_lat
, center_lon
;
18 float proj_central_lon
;
31 Grib1_Tables grib1_tables
;
42 proj_central_lon
= -100.0;
48 data
= (float *)calloc(xdim
*ydim
,sizeof(float));
55 read_gribmap_("gribmap.txt",&grib1_tables
,&ret
);
57 open_file_("test2.grb","w",&filefd
,&error
,9,1);
58 strcpy(datestr
,"2005-01-01_00:00:00");
59 for (i
=0; i
< 1; i
++) {
60 for (j
=0; j
<xdim
*ydim
; j
++) {
62 data[j] = rand()/RAND_MAX;
64 data
[j
] = j
/(float)ydim
;
66 fprintf(stderr
,"Writing grib record %d\n",i
);
67 status
= LOAD_GRID_INFO("TSK", datestr
, &leveltype
, &level
,
68 &level2
, &fcst_secs
, &accum_period
, &grid_id
, &projection
,
69 &xdim
, &ydim
, ¢er_lat
, ¢er_lon
, &dx
, &dy
,
70 &proj_central_lon
, &south
, &latin1
, &latin2
,
71 &grib1_tables
, &gridinfo
, strlen("TSK"), strlen(datestr
));
73 WRITE_GRIB(&gridinfo
, &filefd
, data
);
75 status = WRITE_GRIB("ABC",&level,&level2,&leveltype,
76 datestr,&fcst_secs,&accum_period,
77 &projection,&grid_id,&xdim,&ydim,¢er_lat,
78 ¢er_lon,&proj_central_lon,&dx,&dy,&south,&latin1,
79 &latin2,data,&grib_table_info,&filefd,8);
81 fprintf(stderr
,"status: %d\n",status
);
85 FREE_GRIBMAP(&grib1_tables
);