76-77 codeflag resolutionAndComponentFlags = 128 [10000000:(1=1) Direction increments given;(2=0) Earth assumed spherical with radius = 6367.47 km;(5=0) u and v components resolved relative to easterly and northerly directions:grib1/7.table]
77-77 bit ijDirectionIncrementGiven = 1 [iDirectionIncrementGiven, jDirectionIncrementGiven, DiGiven, DjGiven]
87-88 codeflag scanningMode = 0 [00000000:(1=0) Points scan in +i direction;(2=0) Points scan in -j direction;(3=0) Adjacent points in i direction are consecutive :grib1/8.table]
h = <aclass="code"href="group__grib__handle.html#g11d247e5afa10bd52fb895dc4296143f"title="Create a handle from a read_only template resource.">grib_handle_new_from_template</a>(NULL,<spanclass="stringliteral">"GRIB2"</span>);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"editionNumber"</span>,1),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"gribTablesVersionNo"</span>,128),0);
<spanclass="comment">/* 98 = European Center for Medium-Range Weather Forecasts (grib1/0.table) */</span>
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"identificationOfOriginatingGeneratingCentre"</span>,98),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"generatingProcessIdentifier"</span>,128),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"gridDefinition"</span>,255),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"section1Flags"</span>,128),0);
<spanclass="comment">/* 167 = 2T 2 metre temperature K (grib1/2.98.128.table) */</span>
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"indicatorOfParameter"</span>,167),0);
<spanclass="comment">/* 1 = Surface (of the Earth, which includes sea surface) (grib1/3.table) */</span>
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"indicatorOfTypeOfLevel"</span>,1),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"lev"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"yearOfCentury"</span>,7),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"month"</span>,3),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"day"</span>,18),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"hour"</span>,12),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"minute"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"indicatorOfUnitOfTimeRange"</span>,1),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"periodOfTime"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"periodOfTimeIntervals"</span>,0),0);
<spanclass="comment">/* 0 = Forecast product valid at reference time + P1 (P1>0) (grib1/5.table) */</span>
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"timeRangeIndicator"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"numberIncludedInAverage"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"numberMissingFromAveragesOrAccumulations"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"centuryOfReferenceTimeOfData"</span>,21),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"identificationOfOriginatingGeneratingSubCentre"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"decimalScaleFactor"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"localDefinitionNumber"</span>,1),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"marsClass"</span>,1),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"marsType"</span>,2),0);
<spanclass="comment">/* 1025 = Atmospheric model (mars/stream.table) */</span>
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"marsStream"</span>,1025),0);
p = <spanclass="stringliteral">"0001"</span>;
size = strlen(p)+1;
GRIB_CHECK(<aclass="code"href="group__get__set.html#g78143cc64571b454b0aba14246e9a53a"title="Set a string value from a key.">grib_set_string</a>(h,<spanclass="stringliteral">"experimentVersionNumber"</span>,p,&size),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"perturbationNumber"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"numberOfForecastsInEnsemble"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"numberOfVerticalCoordinateValues"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"pvlLocation"</span>,255),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"dataRepresentationType"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"numberOfPointsAlongAParallel"</span>,16),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"numberOfPointsAlongAMeridian"</span>,31),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"latitudeOfFirstGridPoint"</span>,60000),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"longitudeOfFirstGridPoint"</span>,0),0);
<spanclass="comment">/* 128 = 10000000</span>
<spanclass="comment"> (1=1) Direction increments given</span>
<spanclass="comment"> (2=0) Earth assumed spherical with radius = 6367.47 km</span>
<spanclass="comment"> (5=0) u and v components resolved relative to easterly and northerly directions</span>
<spanclass="comment"> See grib1/7.table */</span>
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"resolutionAndComponentFlags"</span>,128),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"latitudeOfLastGridPoint"</span>,0),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"longitudeOfLastGridPoint"</span>,30000),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"iDirectionIncrement"</span>,2000),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"jDirectionIncrement"</span>,2000),0);
<spanclass="comment">/* 0 = 00000000</span>
<spanclass="comment"> (1=0) Points scan in +i direction</span>
<spanclass="comment"> (2=0) Points scan in -j direction</span>
<spanclass="comment"> (3=0) Adjacent points in i direction are consecutive </span>
<spanclass="comment"> See grib1/8.table */</span>
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"scanningMode"</span>,0),0);
<spanclass="comment"> (3=0) Floating point values are represented</span>
<spanclass="comment"> (4=0) No additional flags at octet 14</span>
<spanclass="comment"> See grib1/11.table */</span>
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"dataFlag"</span>,8),0);
GRIB_CHECK(<aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"numberOfBitsContainingEachPackedValue"</span>,16),0);
size = 496;
v = (<spanclass="keywordtype">double</span>*)calloc(size,<spanclass="keyword">sizeof</span>(<spanclass="keywordtype">double</span>));
<spanclass="keywordflow">if</span>(!v) {
fprintf(stderr,<spanclass="stringliteral">"failed to allocate %d bytes\n"</span>,size*<spanclass="keyword">sizeof</span>(<spanclass="keywordtype">double</span>));
GRIB_CHECK(<aclass="code"href="group__get__set.html#ga24d87e236a2469309d1176ee5925d77"title="Set a double array from a key.">grib_set_double_array</a>(h,<spanclass="stringliteral">"values"</span>,v,size),0);
free(v);
<spanclass="comment">/* gribSection5 */</span>
<spanclass="comment">/* Save the message */</span>
f = fopen(argv[1],<spanclass="stringliteral">"w"</span>);
<spanclass="keywordflow">if</span>(!f) {
perror(argv[1]);
exit(1);
}
GRIB_CHECK(<aclass="code"href="group__handling__coded__messages.html#g9d654bd4fc5f422c161edd0a140ea185"title="getting the message attached to a handle">grib_get_message</a>(h,&buffer,&size),0);
<aclass="code"href="group__grib__handle.html#g0e4b2585f22247c49b930c1579257677"title="Frees a handle, also frees the message if it is not a user message.">grib_handle_delete</a>(h);
<spanclass="keywordflow">return</span> 0;
}
</pre></div><br>
<hrsize="1"><addressstyle="text-align: right;"><small>Generated on Tue Sep 22 15:18:22 2009 for grib_api by