<aname="l00054"></a>00054 <spanclass="comment">/* create new handle from a message in a file*/</span>
<aname="l00055"></a>00055 h = <aname="a1"></a><aclass="code"href="group__grib__handle.html#g5e24f8499aa7e4178ccc25a5de3145c5"title="Create a handle from a file resource.">grib_handle_new_from_file</a>(0,in,&err);
<aname="l00057"></a>00057 printf(<spanclass="stringliteral">"Error: unable to create handle from file %s\n"</span>,filename);
<aname="l00058"></a>00058 }
<aname="l00059"></a>00059
<aname="l00060"></a>00060 <spanclass="comment">/* get as a long*/</span>
<aname="l00061"></a>00061 GRIB_CHECK(<aname="a2"></a><aclass="code"href="group__get__set.html#g03cfa6762312face1a3cc3ef23e16526"title="Get a long value from a key, if several keys of the same name are present, the last...">grib_get_long</a>(h,<spanclass="stringliteral">"numberOfPointsAlongAParallel"</span>,&numberOfPointsAlongAParallel),0);
<aname="l00064"></a>00064 <spanclass="comment">/* get as a long*/</span>
<aname="l00065"></a>00065 GRIB_CHECK(<aclass="code"href="group__get__set.html#g03cfa6762312face1a3cc3ef23e16526"title="Get a long value from a key, if several keys of the same name are present, the last...">grib_get_long</a>(h,<spanclass="stringliteral">"numberOfPointsAlongAMeridian"</span>,&numberOfPointsAlongAMeridian),0);
<aname="l00068"></a>00068 <spanclass="comment">/* get as a double*/</span>
<aname="l00069"></a>00069 GRIB_CHECK(<aname="a3"></a><aclass="code"href="group__get__set.html#g5d9eeda38bf59ee3fa9ce3f92e65009e"title="Get a double value from a key, if several keys of the same name are present, the...">grib_get_double</a>(h,<spanclass="stringliteral">"latitudeOfFirstGridPointInDegrees"</span>,&latitudeOfFirstGridPointInDegrees),0);
<aname="l00072"></a>00072 <spanclass="comment">/* get as a double*/</span>
<aname="l00073"></a>00073 GRIB_CHECK(<aclass="code"href="group__get__set.html#g5d9eeda38bf59ee3fa9ce3f92e65009e"title="Get a double value from a key, if several keys of the same name are present, the...">grib_get_double</a>(h,<spanclass="stringliteral">"longitudeOfFirstGridPointInDegrees"</span>,&longitudeOfFirstGridPointInDegrees),0);
<aname="l00076"></a>00076 <spanclass="comment">/* get as a double*/</span>
<aname="l00077"></a>00077 GRIB_CHECK(<aclass="code"href="group__get__set.html#g5d9eeda38bf59ee3fa9ce3f92e65009e"title="Get a double value from a key, if several keys of the same name are present, the...">grib_get_double</a>(h,<spanclass="stringliteral">"latitudeOfLastGridPointInDegrees"</span>,&latitudeOfLastGridPointInDegrees),0);
<aname="l00080"></a>00080 <spanclass="comment">/* get as a double*/</span>
<aname="l00081"></a>00081 GRIB_CHECK(<aclass="code"href="group__get__set.html#g5d9eeda38bf59ee3fa9ce3f92e65009e"title="Get a double value from a key, if several keys of the same name are present, the...">grib_get_double</a>(h,<spanclass="stringliteral">"longitudeOfLastGridPointInDegrees"</span>,&longitudeOfLastGridPointInDegrees),0);
<aname="l00084"></a>00084 <spanclass="comment">/* get as a double*/</span>
<aname="l00085"></a>00085 GRIB_CHECK(<aclass="code"href="group__get__set.html#g5d9eeda38bf59ee3fa9ce3f92e65009e"title="Get a double value from a key, if several keys of the same name are present, the...">grib_get_double</a>(h,<spanclass="stringliteral">"jDirectionIncrementInDegrees"</span>,&jDirectionIncrementInDegrees),0);
<aname="l00088"></a>00088 <spanclass="comment">/* get as a double*/</span>
<aname="l00089"></a>00089 GRIB_CHECK(<aclass="code"href="group__get__set.html#g5d9eeda38bf59ee3fa9ce3f92e65009e"title="Get a double value from a key, if several keys of the same name are present, the...">grib_get_double</a>(h,<spanclass="stringliteral">"iDirectionIncrementInDegrees"</span>,&iDirectionIncrementInDegrees),0);
<aname="l00092"></a>00092 <spanclass="comment">/* get the size of the values array*/</span>
<aname="l00093"></a>00093 GRIB_CHECK(<aname="a4"></a><aclass="code"href="group__get__set.html#g18b622ed86b24d5e5fcab70c309fc245"title="Get the number of coded value from a key, if several keys of the same name are present...">grib_get_size</a>(h,<spanclass="stringliteral">"values"</span>,&values_len),0);
<aname="l00097"></a>00097 <spanclass="comment">/* get data values*/</span>
<aname="l00098"></a>00098 GRIB_CHECK(<aname="a5"></a><aclass="code"href="group__get__set.html#g61f1029d7f37d51f33835e218d58378a"title="Get double array values from a key.">grib_get_double_array</a>(h,<spanclass="stringliteral">"values"</span>,values,&values_len),0);
<aname="l00099"></a>00099
<aname="l00100"></a>00100 average = 0;
<aname="l00101"></a>00101 <spanclass="keywordflow">for</span>(i = 0; i < values_len; i++)
<aname="l00102"></a>00102 average += values[i];
<aname="l00103"></a>00103
<aname="l00104"></a>00104 average /=(double)values_len;
<aname="l00105"></a>00105
<aname="l00106"></a>00106 free(values);
<aname="l00107"></a>00107
<aname="l00108"></a>00108 printf(<spanclass="stringliteral">"There are %d values, average is %g\n"</span>,(<spanclass="keywordtype">int</span>)values_len,average);
<aname="l00109"></a>00109
<aname="l00110"></a>00110 <aname="a6"></a><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);