diff --git a/html/clone_8f90-example.html b/html/clone_8f90-example.html deleted file mode 100644 index 9f2c5d352..000000000 --- a/html/clone_8f90-example.html +++ /dev/null @@ -1,101 +0,0 @@ - - -grib_api: clone.f90 - - - - -
- -
-

clone.f90

How to clone a message.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: how to create a new GRIB message by cloning 
-00010 !               an existing message.
-00011 !
-00012 !
-00013 !  Author: Anne Fouilloux
-00014 !
-00015 !
-00016 program clone
-00017   use grib_api
-00018   implicit none
-00019   integer                                       :: err,i,iret
-00020   integer                                       :: nx, ny
-00021   integer                                       :: infile,outfile
-00022   integer                                       :: igrib_in
-00023   integer                                       :: igrib_out
-00024   character(len=2)                              :: step
-00025   double precision, dimension(:,:), allocatable :: field2D
-00026 
-00027   
-00028   call grib_open_file(infile,'../../data/constant_field.grib1','r')
-00029   call grib_open_file(outfile,'out.grib1','w')
-00030 
-00031   !     a new grib message is loaded from file
-00032   !     igrib is the grib id to be used in subsequent calls
-00033   call grib_new_from_file(infile,igrib_in)
-00034 
-00035   call grib_get(igrib_in,"numberOfPointsAlongAParallel", nx)
-00036   
-00037   call grib_get(igrib_in,"numberOfPointsAlongAMeridian",ny)
-00038 
-00039   allocate(field2D(nx,ny),stat=err)
-00040 
-00041   if (err .ne. 0) then
-00042      print*, 'Failed to allocate ', nx*ny, ' values'
-00043      STOP
-00044   end if
-00045   ! clone the constant field to create 4 new GRIB messages
-00046   do i=0,18,6
-00047     call grib_clone(igrib_in, igrib_out)
-00048     write(step,'(i2)') i
-00049 ! Careful: stepRange is a string (could be 0-6, 12-24, etc.)
-00050 ! use adjustl to remove blank from the left.
-00051     call grib_set(igrib_out,'stepRange',adjustl(step))
-00052 
-00053     call generate_field(field2D)
-00054 
-00055 ! use pack to create 1D values
-00056     call grib_set(igrib_out,'values',pack(field2D, mask=.true.))
-00057  
-00058   !     write cloned messages to a file
-00059     call grib_write(igrib_out,outfile)
-00060     call grib_release(igrib_out)
-00061   end do
-00062 
-00063   call grib_release(igrib_in)
-00064 
-00065   call grib_close_file(infile)
-00066 
-00067   call grib_close_file(outfile)
-00068   deallocate(field2D)
-00069 
-00070 contains
-00071 !======================================
-00072 subroutine generate_field(gfield2D)
-00073  double precision, dimension(:,:) :: gfield2D
-00074 
-00075  call random_number(gfield2D)
-00076 end subroutine generate_field
-00077 !======================================
-00078 
-00079 end program clone
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/copy__message_8f90-example.html b/html/copy__message_8f90-example.html deleted file mode 100644 index 1353a30b6..000000000 --- a/html/copy__message_8f90-example.html +++ /dev/null @@ -1,76 +0,0 @@ - - -grib_api: copy_message.f90 - - - - -
- -
-

copy_message.f90

How to copy a message in memory and create a new message.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: how to copy a message in memory
-00010 !
-00011 !
-00012 !  Author: Anne Fouilloux
-00013 !
-00014 !
-00015 program copy
-00016   use grib_api
-00017   implicit none
-00018   integer                            :: err, centre
-00019   integer(kind=kindOfSize)           :: byte_size
-00020   integer                            :: infile,outfile
-00021   integer                            :: igrib_in,iret
-00022   integer                            :: igrib_out
-00023   character(len=1), dimension(:), allocatable :: message
-00024 
-00025   
-00026   call grib_open_file(infile,'../../data/constant_field.grib1','r')
-00027   call grib_open_file(outfile,'out.grib1','w')
-00028 
-00029   !     a new grib message is loaded from file
-00030   !     igrib is the grib id to be used in subsequent calls
-00031   call grib_new_from_file(infile,igrib_in)
-00032 
-00033   call grib_get_message_size(igrib_in, byte_size)
-00034   allocate(message(byte_size), stat=err)
-00035 
-00036   call grib_copy_message(igrib_in,message)
-00037 
-00038   call grib_new_from_message(igrib_out, message)
-00039 
-00040   centre=80
-00041   call grib_set(igrib_out,"centre",centre)
-00042 
-00043 !  write messages to a file
-00044   call grib_write(igrib_out,outfile)
-00045 
-00046   call grib_release(igrib_out)
-00047 
-00048   call grib_release(igrib_in)
-00049 
-00050   call grib_close_file(infile)
-00051   call grib_close_file(outfile)
-00052   deallocate(message)
-00053 
-00054 end program copy
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/examples.html b/html/examples.html deleted file mode 100644 index 9452426a1..000000000 --- a/html/examples.html +++ /dev/null @@ -1,58 +0,0 @@ - - -grib_api: Examples - - - - -
- -
-

grib_api Examples

Here is a list of all examples: -
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/get_8c-example.html b/html/get_8c-example.html deleted file mode 100644 index 481aaf59f..000000000 --- a/html/get_8c-example.html +++ /dev/null @@ -1,128 +0,0 @@ - - -grib_api: get.c - - - - -
- -
-

get.c

get.c How to get values through the key names.

-

00001 
-00010 /*
-00011  * C Implementation: get
-00012  *
-00013  * Description: how to get values using keys.
-00014  *
-00015  * Author: Enrico Fucile
-00016  *
-00017  *
-00018  */
-00019 #include <stdio.h>
-00020 #include <stdlib.h>
-00021 
-00022 #include "grib_api.h"
-00023 
-00024 int main(int argc, char** argv) {
-00025   int err = 0;
-00026   double *values = NULL;
-00027   size_t values_len= 0;
-00028 
-00029   size_t i = 0;
-00030 
-00031   double latitudeOfFirstGridPointInDegrees;
-00032   double longitudeOfFirstGridPointInDegrees;
-00033   double latitudeOfLastGridPointInDegrees;
-00034   double longitudeOfLastGridPointInDegrees;
-00035 
-00036   double jDirectionIncrementInDegrees;
-00037   double iDirectionIncrementInDegrees;
-00038 
-00039   long numberOfPointsAlongAParallel;
-00040   long numberOfPointsAlongAMeridian;
-00041 
-00042   double average = 0;
-00043 
-00044   FILE* in = NULL;
-00045   char* filename = "../../data/regular_latlon_surface.grib1";
-00046   grib_handle *h = NULL;
-00047 
-00048   in = fopen(filename,"r");
-00049   if(!in) {
-00050     printf("ERROR: unable to open file %s\n",filename);
-00051     return 1;
-00052   }
-00053 
-00054   /* create new handle from a message in a file*/
-00055   h = grib_handle_new_from_file(0,in,&err);
-00056   if (h == NULL) {
-00057     printf("Error: unable to create handle from file %s\n",filename);
-00058   }
-00059 
-00060   /* get as a long*/
-00061   GRIB_CHECK(grib_get_long(h,"numberOfPointsAlongAParallel",&numberOfPointsAlongAParallel),0);
-00062   printf("numberOfPointsAlongAParallel=%ld\n",numberOfPointsAlongAParallel);
-00063 
-00064   /* get as a long*/
-00065   GRIB_CHECK(grib_get_long(h,"numberOfPointsAlongAMeridian",&numberOfPointsAlongAMeridian),0);
-00066   printf("numberOfPointsAlongAMeridian=%ld\n",numberOfPointsAlongAMeridian);
-00067 
-00068   /* get as a double*/
-00069   GRIB_CHECK(grib_get_double(h,"latitudeOfFirstGridPointInDegrees",&latitudeOfFirstGridPointInDegrees),0);
-00070   printf("latitudeOfFirstGridPointInDegrees=%g\n",latitudeOfFirstGridPointInDegrees);
-00071 
-00072   /* get as a double*/
-00073   GRIB_CHECK(grib_get_double(h,"longitudeOfFirstGridPointInDegrees",&longitudeOfFirstGridPointInDegrees),0);
-00074   printf("longitudeOfFirstGridPointInDegrees=%g\n",longitudeOfFirstGridPointInDegrees);
-00075 
-00076   /* get as a double*/
-00077   GRIB_CHECK(grib_get_double(h,"latitudeOfLastGridPointInDegrees",&latitudeOfLastGridPointInDegrees),0);
-00078   printf("latitudeOfLastGridPointInDegrees=%g\n",latitudeOfLastGridPointInDegrees);
-00079 
-00080   /* get as a double*/
-00081   GRIB_CHECK(grib_get_double(h,"longitudeOfLastGridPointInDegrees",&longitudeOfLastGridPointInDegrees),0);
-00082   printf("longitudeOfLastGridPointInDegrees=%g\n",longitudeOfLastGridPointInDegrees);
-00083 
-00084   /* get as a double*/
-00085   GRIB_CHECK(grib_get_double(h,"jDirectionIncrementInDegrees",&jDirectionIncrementInDegrees),0);
-00086   printf("jDirectionIncrementInDegrees=%g\n",jDirectionIncrementInDegrees);
-00087 
-00088   /* get as a double*/
-00089   GRIB_CHECK(grib_get_double(h,"iDirectionIncrementInDegrees",&iDirectionIncrementInDegrees),0);
-00090   printf("iDirectionIncrementInDegrees=%g\n",iDirectionIncrementInDegrees);
-00091 
-00092   /* get the size of the values array*/
-00093   GRIB_CHECK(grib_get_size(h,"values",&values_len),0);
-00094 
-00095   values = malloc(values_len*sizeof(double));
-00096 
-00097   /* get data values*/
-00098   GRIB_CHECK(grib_get_double_array(h,"values",values,&values_len),0);
-00099 
-00100   average = 0;
-00101   for(i = 0; i < values_len; i++)
-00102     average += values[i];
-00103 
-00104   average /=(double)values_len;
-00105 
-00106   free(values);
-00107 
-00108   printf("There are %d values, average is %g\n",(int)values_len,average);
-00109 
-00110   grib_handle_delete(h);
-00111 
-00112   fclose(in);
-00113   return 0;
-00114 }
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/get_8f90-example.html b/html/get_8f90-example.html deleted file mode 100644 index 658312cdf..000000000 --- a/html/get_8f90-example.html +++ /dev/null @@ -1,134 +0,0 @@ - - -grib_api: get.f90 - - - - -
- -
-

get.f90

How to get values through the key names.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: how to get values using keys.
-00010 !
-00011 !  Author: Enrico Fucile 
-00012 !
-00013 !
-00014 program get
-00015   use grib_api
-00016   implicit none
-00017   
-00018   integer                            ::  ifile
-00019   integer                            ::  iret
-00020   integer                            ::  igrib
-00021   real                               ::  latitudeOfFirstPointInDegrees
-00022   real                               ::  longitudeOfFirstPointInDegrees
-00023   real                               ::  latitudeOfLastPointInDegrees
-00024   real                               ::  longitudeOfLastPointInDegrees
-00025   integer                            ::  numberOfPointsAlongAParallel
-00026   integer                            ::  numberOfPointsAlongAMeridian
-00027   real, dimension(:), allocatable    ::  values
-00028   integer                            ::  numberOfValues
-00029   real                               ::  average,min_val, max_val
-00030   integer                            ::  is_missing
-00031   
-00032   call grib_open_file(ifile, &
-00033        '../../data/reduced_latlon_surface.grib1','r')
-00034   
-00035   ! Loop on all the messages in a file.
-00036   
-00037   !     a new grib message is loaded from file
-00038   !     igrib is the grib id to be used in subsequent calls
-00039   call  grib_new_from_file(ifile,igrib, iret) 
-00040   
-00041   LOOP: DO WHILE (iret /= GRIB_END_OF_FILE)
-00042 
-00043      !check if the value of the key is MISSING
-00044      is_missing=0;
-00045      call grib_is_missing(igrib,'numberOfPointsAlongAParallel', &
-00046           is_missing);
-00047      if ( is_missing /= 1 ) then
-00048         !     get as a integer
-00049         call grib_get(igrib,'numberOfPointsAlongAParallel', &
-00050              numberOfPointsAlongAParallel) 
-00051         write(*,*) 'numberOfPointsAlongAParallel=', &
-00052              numberOfPointsAlongAParallel
-00053      else
-00054         write(*,*) 'numberOfPointsAlongAParallel is missing'
-00055      endif     
-00056      !     get as a integer
-00057      call grib_get(igrib,'numberOfPointsAlongAMeridian', &
-00058           numberOfPointsAlongAMeridian) 
-00059      write(*,*) 'numberOfPointsAlongAMeridian=', &
-00060           numberOfPointsAlongAMeridian
-00061      
-00062      !     get as a real
-00063      call grib_get(igrib, 'latitudeOfFirstGridPointInDegrees', &
-00064           latitudeOfFirstPointInDegrees) 
-00065      write(*,*) 'latitudeOfFirstGridPointInDegrees=', &
-00066           latitudeOfFirstPointInDegrees
-00067      
-00068      !     get as a real
-00069      call grib_get(igrib, 'longitudeOfFirstGridPointInDegrees', &
-00070           longitudeOfFirstPointInDegrees) 
-00071      write(*,*) 'longitudeOfFirstGridPointInDegrees=', &
-00072           longitudeOfFirstPointInDegrees
-00073      
-00074      !     get as a real
-00075      call grib_get(igrib, 'latitudeOfLastGridPointInDegrees', &
-00076           latitudeOfLastPointInDegrees) 
-00077      write(*,*) 'latitudeOfLastGridPointInDegrees=', &
-00078           latitudeOfLastPointInDegrees
-00079      
-00080      !     get as a real
-00081      call grib_get(igrib, 'longitudeOfLastGridPointInDegrees', &
-00082           longitudeOfLastPointInDegrees) 
-00083      write(*,*) 'longitudeOfLastGridPointInDegrees=', &
-00084           longitudeOfLastPointInDegrees
-00085      
-00086      
-00087      !     get the size of the values array
-00088      call grib_get_size(igrib,'values',numberOfValues)
-00089      write(*,*) 'numberOfValues=',numberOfValues
-00090      
-00091      allocate(values(numberOfValues), stat=iret)
-00092      !     get data values
-00093      call grib_get(igrib,'values',values)
-00094      call grib_get(igrib,'min',min_val) ! can also be obtained through minval(values)
-00095      call grib_get(igrib,'max',max_val) ! can also be obtained through maxval(values)
-00096      call grib_get(igrib,'average',average) ! can also be obtained through maxval(values)
-00097           
-00098      write(*,*)'There are ',numberOfValues, &
-00099           ' average is ',average, &
-00100           ' min is ',  min_val, &
-00101           ' max is ',  max_val
-00102      
-00103      call grib_release(igrib)
-00104      
-00105      call grib_new_from_file(ifile,igrib, iret)
-00106      
-00107   end do LOOP
-00108   
-00109   call grib_close_file(ifile)
-00110   
-00111   deallocate(values)
-00112 end program get
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/get__data_8f90-example.html b/html/get__data_8f90-example.html deleted file mode 100644 index 3d9b4cd3d..000000000 --- a/html/get__data_8f90-example.html +++ /dev/null @@ -1,90 +0,0 @@ - - -grib_api: get_data.f90 - - - - -
- -
-

get_data.f90

How to get latitude/longitude/values.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: how to get lat/lon/values.
-00010 !
-00011 !
-00012 !  Author: Enrico Fucile
-00013 !
-00014 !
-00015 program get_data
-00016 use grib_api
-00017 implicit none
-00018   integer            :: ifile
-00019   integer            :: iret,i
-00020   real(kind=8),dimension(:),allocatable     :: lats,lons,values
-00021   integer(4)        :: numberOfPoints
-00022   real(8)  :: missingValue=9999
-00023   integer           :: count=0
-00024   character(len=256) :: filename
-00025 
-00026 !     Message identifier.
-00027   integer            :: igrib
-00028 
-00029   ifile=5
-00030 
-00031   call grib_open_file(ifile, &
-00032        '../../data/reduced_latlon_surface.grib1','R')
-00033 
-00034 ! Loop on all the messages in a file.
-00035 
-00036   call grib_new_from_file(ifile,igrib,iret)
-00037 
-00038   do while (iret/=GRIB_END_OF_FILE)
-00039     count=count+1
-00040     print *, "===== Message #",count
-00041     call grib_get(igrib,'numberOfPoints',numberOfPoints)
-00042     call grib_set(igrib,'missingValue',missingValue)
-00043 
-00044     allocate(lats(numberOfPoints))
-00045     allocate(lons(numberOfPoints))
-00046     allocate(values(numberOfPoints))
-00047 
-00048     call grib_get_data(igrib,lats,lons,values)
-00049 
-00050     do i=1,numberOfPoints
-00051       if (values(i) /= missingValue) then
-00052         print *, lats(i),lons(i),values(i)
-00053       end if
-00054     enddo
-00055 
-00056     deallocate(lats)
-00057     deallocate(lons)
-00058     deallocate(values)
-00059 
-00060     call grib_release(igrib)
-00061     call grib_new_from_file(ifile,igrib, iret)
-00062 
-00063   end do 
-00064 
-00065 
-00066   call grib_close_file(ifile)
-00067 
-00068 end program 
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/get__fortran_8_f-example.html b/html/get__fortran_8_f-example.html deleted file mode 100644 index ca9296622..000000000 --- a/html/get__fortran_8_f-example.html +++ /dev/null @@ -1,151 +0,0 @@ - - -grib_api: get_fortran.F - - - - -
- -
-

get_fortran.F

get_fortran.F How to get values through the key names.

-

00001 C Copyright 2005-2016 ECMWF
-00002 C This software is licensed under the terms of the Apache Licence Version 2.0
-00003 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 C 
-00005 C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 C
-00008 C  Fortran 77  Implementation: get_fortran
-00009 C
-00010 C  Description: how to get values using keys.
-00011 C
-00012 C  Author: Enrico Fucile
-00013 C
-00014 C
-00015 C
-00016       program get
-00017       implicit none
-00018       integer maxNumberOfValues
-00019       parameter( maxNumberOfValues = 10000 )
-00020       include 'grib_api_f77.h'
-00021       integer ifile
-00022       integer iret
-00023       integer igrib
-00024       integer i
-00025       real*8 latitudeOfFirstPointInDegrees
-00026       real*8 longitudeOfFirstPointInDegrees
-00027       real*8 latitudeOfLastPointInDegrees
-00028       real*8 longitudeOfLastPointInDegrees
-00029       real*8 jDirectionIncrementInDegrees
-00030       real*8 iDirectionIncrementInDegrees
-00031       integer*4 numberOfPointsAlongAParallel
-00032       integer*4 numberOfPointsAlongAMeridian
-00033       real*8 values(maxNumberOfValues)
-00034       integer*4 numberOfValues
-00035       real*8 average
-00036       character*256 error
-00037       integer*4 size
-00038 
-00039       size=maxNumberOfValues
-00040       ifile=5
-00041 
-00042       iret=grib_open_file(ifile
-00043      X,'../../data/regular_latlon_surface.grib1','r')
-00044       call grib_check(iret)
-00045 
-00046 C     a new grib message is loaded from file
-00047 C     igrib is the grib id to be used in subsequent calls
-00048       call grib_check( grib_new_from_file(ifile,igrib) )
-00049 
-00050 C     get as a integer
-00051       call grib_check(grib_get_int(igrib,'numberOfPointsAlongAParallel'
-00052      X,numberOfPointsAlongAParallel) )
-00053       write(*,*) 'numberOfPointsAlongAParallel='
-00054      X,numberOfPointsAlongAParallel
-00055 
-00056 C     get as a integer
-00057       call grib_check( grib_get_int(igrib,'numberOfPointsAlongAMeridian'
-00058      X,numberOfPointsAlongAMeridian) )
-00059       write(*,*) 'numberOfPointsAlongAMeridian='
-00060      X,numberOfPointsAlongAMeridian
-00061 
-00062 C     get as a real8
-00063       call grib_check( grib_get_real8(igrib
-00064      X,'latitudeOfFirstGridPointInDegrees'
-00065      X,latitudeOfFirstPointInDegrees) )
-00066        write(*,*) 'latitudeOfFirstGridPointInDegrees='
-00067      X,latitudeOfFirstPointInDegrees
-00068 
-00069 C     get as a real8
-00070       call grib_check( grib_get_real8(igrib
-00071      X,'longitudeOfFirstGridPointInDegrees'
-00072      X,longitudeOfFirstPointInDegrees) )
-00073        write(*,*) 'longitudeOfFirstGridPointInDegrees='
-00074      X,longitudeOfFirstPointInDegrees
-00075 
-00076 C     get as a real8
-00077       call grib_check( grib_get_real8(igrib
-00078      X,'latitudeOfLastGridPointInDegrees'
-00079      X,latitudeOfLastPointInDegrees) )
-00080        write(*,*) 'latitudeOfLastGridPointInDegrees='
-00081      X,latitudeOfLastPointInDegrees
-00082 
-00083 C     get as a real8
-00084       call grib_check( grib_get_real8(igrib
-00085      X,'longitudeOfLastGridPointInDegrees'
-00086      X,longitudeOfLastPointInDegrees) )
-00087       write(*,*) 'longitudeOfLastGridPointInDegrees='
-00088      X,longitudeOfLastPointInDegrees
-00089 
-00090 C     get as a real8
-00091       call grib_check( grib_get_real8(igrib
-00092      X,'jDirectionIncrementInDegrees'
-00093      X,jDirectionIncrementInDegrees) )
-00094       write(*,*) 'jDirectionIncrementInDegrees='
-00095      X,jDirectionIncrementInDegrees
-00096 
-00097 C     get as a real8
-00098       call grib_check( grib_get_real8(igrib
-00099      X,'iDirectionIncrementInDegrees'
-00100      X,iDirectionIncrementInDegrees) )
-00101       write(*,*) 'iDirectionIncrementInDegrees='
-00102      X,iDirectionIncrementInDegrees
-00103 
-00104 C     get the size of the values array
-00105       call grib_check(grib_get_size(igrib,'values',numberOfValues))
-00106       write(*,*) 'numberOfValues=',numberOfValues
-00107 
-00108 C     get data values
-00109       call grib_check(grib_get_real8_array(igrib,'values',values,size))
-00110       if ( size .ne. numberOfValues ) then
-00111         write(*,*) 'ERROR: wrong numberOfValues'
-00112         stop
-00113       endif
-00114 
-00115       average = 0
-00116       do i=1,numberOfValues
-00117         average = average + values(i);
-00118       enddo
-00119 
-00120       average =average / numberOfValues
-00121 
-00122       write(*,*)'There are ',numberOfValues
-00123      X,' average is ',average
-00124 
-00125       call grib_check(grib_release(igrib))
-00126 
-00127       call grib_check(grib_close_file(ifile))
-00128 
-00129       end
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/get__pl_8f90-example.html b/html/get__pl_8f90-example.html deleted file mode 100644 index 4895a2a66..000000000 --- a/html/get__pl_8f90-example.html +++ /dev/null @@ -1,70 +0,0 @@ - - -grib_api: get_pl.f90 - - - - -
- -
-

get_pl.f90

How to get the list of number of points for each parallel in reduced grids.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: how to get PL values.
-00010 !
-00011 !
-00012 !  Author: Anne Fouilloux
-00013 !
-00014 !
-00015 program get_pl
-00016   use grib_api
-00017   implicit none
-00018   integer                         :: infile
-00019   integer                         :: igrib
-00020   integer                         :: PLPresent, nb_pl
-00021   real, dimension(:), allocatable :: pl
-00022 
-00023 
-00024   call grib_open_file(infile, &
-00025        '../../data/reduced_gaussian_surface.grib1','r')
-00026   
-00027   !     a new grib message is loaded from file
-00028   !     igrib is the grib id to be used in subsequent calls
-00029   call grib_new_from_file(infile,igrib)
-00030   
-00031   !     set PVPresent as an integer 
-00032   call grib_get(igrib,'PLPresent',PLPresent)
-00033   print*, "PLPresent= ", PLPresent
-00034   if (PLPresent == 1) then
-00035      call grib_get_size(igrib,'pl',nb_pl)
-00036      print*, "there are ", nb_pl, " PL values"
-00037      allocate(pl(nb_pl))
-00038      call grib_get(igrib,'pl',pl)
-00039      print*, "pl = ", pl
-00040      deallocate(pl)
-00041   else
-00042      print*, "There is no PL values in your GRIB message!"
-00043   end if
-00044   call grib_release(igrib)
-00045      
-00046   call grib_close_file(infile)
-00047 
-00048 end program get_pl
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/get__pv_8f90-example.html b/html/get__pv_8f90-example.html deleted file mode 100644 index 752c8e74f..000000000 --- a/html/get__pv_8f90-example.html +++ /dev/null @@ -1,70 +0,0 @@ - - -grib_api: get_pv.f90 - - - - -
- -
-

get_pv.f90

How to get the list of levels.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: how to get PV values.
-00010 !
-00011 !
-00012 !  Author: Anne Fouilloux
-00013 !
-00014 !
-00015 program get_pv
-00016   use grib_api
-00017   implicit none
-00018   integer                         :: infile
-00019   integer                         :: igrib
-00020   integer                         :: PVPresent, nb_pv
-00021   real, dimension(:), allocatable :: pv
-00022   
-00023 
-00024   call grib_open_file(infile, &
-00025        '../../data/reduced_gaussian_model_level.grib1','r')
-00026   
-00027   !     a new grib message is loaded from file
-00028   !     igrib is the grib id to be used in subsequent calls
-00029   call grib_new_from_file(infile,igrib)
-00030   
-00031   !     set PVPresent as an integer 
-00032   call grib_get(igrib,'PVPresent',PVPresent)
-00033   print*, "PVPresent = ", PVPresent
-00034   if (PVPresent == 1) then
-00035      call grib_get_size(igrib,'pv',nb_pv)
-00036      print*, "There are ", nb_pv, " PV values"
-00037      allocate(pv(nb_pv))
-00038      call grib_get(igrib,'pv',pv)
-00039      print*, "pv = ", pv
-00040      deallocate(pv)
-00041   else
-00042      print*, "There is no PV values in your GRIB message!"
-00043   end if
-00044   call grib_release(igrib)
-00045   
-00046   call grib_close_file(infile)
-00047   
-00048 end program get_pv
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/globals_type.html b/html/globals_type.html deleted file mode 100644 index 5bc06efe5..000000000 --- a/html/globals_type.html +++ /dev/null @@ -1,73 +0,0 @@ - - -grib_api: Data Fields - - - - -
- -
-
- -
-
- -
-  -

-

-
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib__api_8h.html b/html/grib__api_8h.html deleted file mode 100644 index 387efb62b..000000000 --- a/html/grib__api_8h.html +++ /dev/null @@ -1,1602 +0,0 @@ - - -grib_api: grib_api.h File Reference - - - - -
- -
-

grib_api.h File Reference

Copyright 2005-2016 ECMWF. More... -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Defines

#define GRIB_KEYS_ITERATOR_ALL_KEYS   0
#define GRIB_KEYS_ITERATOR_SKIP_READ_ONLY   (1<<0)
#define GRIB_KEYS_ITERATOR_SKIP_OPTIONAL   (1<<1)
#define GRIB_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC   (1<<2)
#define GRIB_KEYS_ITERATOR_SKIP_CODED   (1<<3)
#define GRIB_KEYS_ITERATOR_SKIP_COMPUTED   (1<<4)
#define GRIB_KEYS_ITERATOR_SKIP_DUPLICATES   (1<<5)
#define GRIB_KEYS_ITERATOR_SKIP_FUNCTION   (1<<6)
#define GRIB_SUCCESS   0
 No error.
#define GRIB_END_OF_FILE   -1
 End of ressource reached.
#define GRIB_INTERNAL_ERROR   -2
 Internal error.
#define GRIB_BUFFER_TOO_SMALL   -3
 Passed buffer is too small.
#define GRIB_NOT_IMPLEMENTED   -4
 Function not yet implemented.
#define GRIB_7777_NOT_FOUND   -5
 Missing 7777 at end of message.
#define GRIB_ARRAY_TOO_SMALL   -6
 Passed array is too small.
#define GRIB_FILE_NOT_FOUND   -7
 File not found.
#define GRIB_CODE_NOT_FOUND_IN_TABLE   -8
 Code not found in code table.
#define GRIB_STRING_TOO_SMALL_FOR_CODE_NAME   -9
 Code cannot unpack because of string too small.
#define GRIB_WRONG_ARRAY_SIZE   -10
 Array size mismatch.
#define GRIB_NOT_FOUND   -11
 Key/value not found.
#define GRIB_IO_PROBLEM   -12
 Input output problem.
#define GRIB_INVALID_MESSAGE   -13
 Message invalid.
#define GRIB_DECODING_ERROR   -14
 Decoding invalid.
#define GRIB_ENCODING_ERROR   -15
 Encoding invalid.
#define GRIB_NO_MORE_IN_SET   -16
 Code cannot unpack because of string too small.
#define GRIB_GEOCALCULUS_PROBLEM   -17
 Problem with calculation of geographic attributes.
#define GRIB_OUT_OF_MEMORY   -18
 Out of memory.
#define GRIB_READ_ONLY   -19
 Value is read only.
#define GRIB_INVALID_ARGUMENT   -20
 Invalid argument.
#define GRIB_NULL_HANDLE   -21
 Null handle.
#define GRIB_INVALID_SECTION_NUMBER   -22
 Invalid section number.
#define GRIB_VALUE_CANNOT_BE_MISSING   -23
 Value cannot be missing.
#define GRIB_WRONG_LENGTH   -24
 Wrong message length.
#define GRIB_INVALID_TYPE   -25
 Invalid key type.
#define GRIB_WRONG_STEP   -26
 Unable to set step.
#define GRIB_WRONG_STEP_UNIT   -27
 Wrong units for step (step must be integer).
#define GRIB_INVALID_FILE   -28
 Invalid file id.
#define GRIB_INVALID_GRIB   -29
 Invalid grib id.
#define GRIB_INVALID_INDEX   -30
 Invalid index id.
#define GRIB_INVALID_ITERATOR   -31
 Invalid iterator id.
#define GRIB_INVALID_KEYS_ITERATOR   -32
 Invalid keys iterator id.
#define GRIB_INVALID_NEAREST   -33
 Invalid nearest id.
#define GRIB_INVALID_ORDERBY   -34
 Invalid order by.
#define GRIB_MISSING_KEY   -35
 Missing a key from the fieldset.
#define GRIB_OUT_OF_AREA   -36
 The point is out of the grid area.
#define GRIB_CONCEPT_NO_MATCH   -37
 Concept no match.
#define GRIB_NO_DEFINITIONS   -38
 Definitions files not found.
#define GRIB_WRONG_TYPE   -39
 Wrong type while packing.
#define GRIB_END   -40
 End of resource.
#define GRIB_NO_VALUES   -41
 Unable to code a field without values.
#define GRIB_WRONG_GRID   -42
 Grid description is wrong or inconsistent.
#define GRIB_END_OF_INDEX   -43
 End of index reached.
#define GRIB_NULL_INDEX   -44
 Null index.
#define GRIB_PREMATURE_END_OF_FILE   -45
 End of ressource reached when reading message.
#define GRIB_INTERNAL_ARRAY_TOO_SMALL   -46
 An internal array is too small.
#define GRIB_MESSAGE_TOO_LARGE   -47
 Message is too large for the current architecture.
#define GRIB_CONSTANT_FIELD   -48
 Constant field.
#define GRIB_SWITCH_NO_MATCH   -49
 Switch unable to find a matching case.

Typedefs

typedef struct
-grib_handle 
grib_handle
typedef struct
-grib_multi_handle 
grib_multi_handle
typedef struct
-grib_context 
grib_context
typedef struct
-grib_iterator 
grib_iterator
typedef struct
-grib_nearest 
grib_nearest
typedef struct
-grib_keys_iterator 
grib_keys_iterator
typedef struct grib_index grib_index
typedef void(* grib_free_proc )(const grib_context *c, void *data)
 Grib free procedure, format of a procedure referenced in the context that is used to free memory.
typedef void *(* grib_malloc_proc )(const grib_context *c, size_t length)
 Grib malloc procedure, format of a procedure referenced in the context that is used to allocate memory.
typedef void *(* grib_realloc_proc )(const grib_context *c, void *data, size_t length)
 Grib realloc procedure, format of a procedure referenced in the context that is used to reallocate memory.
typedef void(* grib_log_proc )(const grib_context *c, int level, const char *mesg)
 Grib loc proc, format of a procedure referenced in the context that is used to log internal messages.
typedef void(* grib_print_proc )(const grib_context *c, void *descriptor, const char *mesg)
 Grib print proc, format of a procedure referenced in the context that is used to print external messages.
typedef size_t(* grib_data_read_proc )(const grib_context *c, void *ptr, size_t size, void *stream)
 Grib data read proc, format of a procedure referenced in the context that is used to read from a stream in a resource.
typedef size_t(* grib_data_write_proc )(const grib_context *c, const void *ptr, size_t size, void *stream)
 Grib data read write, format of a procedure referenced in the context that is used to write to a stream from a resource.
typedef off_t(* grib_data_tell_proc )(const grib_context *c, void *stream)
 Grib data tell, format of a procedure referenced in the context that is used to tell the current position in a stream.
typedef off_t(* grib_data_seek_proc )(const grib_context *c, off_t offset, int whence, void *stream)
 Grib data seek, format of a procedure referenced in the context that is used to seek the current position in a stream.
typedef int(* grib_data_eof_proc )(const grib_context *c, void *stream)
 Grib data eof, format of a procedure referenced in the context that is used to test end of file.

Functions

grib_indexgrib_index_new_from_file (grib_context *c, char *filename, const char *keys, int *err)
 Create a new index form a file.
int grib_index_get_size (grib_index *index, const char *key, size_t *size)
 Get the number of distinct values of the key in argument contained in the index.
int grib_index_get_long (grib_index *index, const char *key, long *values, size_t *size)
 Get the distinct values of the key in argument contained in the index.
int grib_index_get_double (grib_index *index, const char *key, double *values, size_t *size)
 Get the distinct values of the key in argument contained in the index.
int grib_index_get_string (grib_index *index, const char *key, char **values, size_t *size)
 Get the distinct values of the key in argument contained in the index.
int grib_index_select_long (grib_index *index, const char *key, long value)
 Select the message subset with key==value.
int grib_index_select_double (grib_index *index, const char *key, double value)
 Select the message subset with key==value.
int grib_index_select_string (grib_index *index, const char *key, char *value)
 Select the message subset with key==value.
grib_handlegrib_handle_new_from_index (grib_index *index, int *err)
 Create a new handle from an index after having selected the key values.
void grib_index_delete (grib_index *index)
 Delete the index.
int grib_count_in_file (grib_context *c, FILE *f, int *n)
 Counts the messages contained in a file resource.
grib_handlegrib_handle_new_from_file (grib_context *c, FILE *f, int *error)
 Create a handle from a file resource.
grib_handlegrib_handle_new_from_message (grib_context *c, void *data, size_t data_len)
 Create a handle from a user message in memory.
grib_handlegrib_handle_new_from_multi_message (grib_context *c, void **data, size_t *data_len, int *error)
 Create a handle from a user message in memory.
grib_handlegrib_handle_new_from_message_copy (grib_context *c, const void *data, size_t data_len)
 Create a handle from a user message.
grib_handlegrib_handle_new_from_template (grib_context *c, const char *res_name)
 Create a handle from a read_only template resource.
grib_handlegrib_handle_new_from_samples (grib_context *c, const char *res_name)
 Create a handle from a message contained in a samples directory.
grib_handlegrib_handle_clone (grib_handle *h)
 Clone an existing handle using the context of the original handle, The message is copied and reparsed.
int grib_handle_delete (grib_handle *h)
 Frees a handle, also frees the message if it is not a user message.
grib_multi_handlegrib_multi_handle_new (grib_context *c)
 Create an empty multi field handle.
int grib_multi_handle_append (grib_handle *h, int start_section, grib_multi_handle *mh)
 Append the sections starting with start_section of the message pointed by h at the end of the multi field handle mh.
int grib_multi_handle_delete (grib_multi_handle *mh)
 Delete multi field handle.
int grib_multi_handle_write (grib_multi_handle *mh, FILE *f)
 Write a multi field handle in a file.
int grib_get_message (grib_handle *h, const void **message, size_t *message_length)
 getting the message attached to a handle
int grib_get_message_copy (grib_handle *h, void *message, size_t *message_length)
 getting a copy of the message attached to a handle
grib_iteratorgrib_iterator_new (grib_handle *h, unsigned long flags, int *error)
 Create a new iterator from a handle, using current geometry and values.
int grib_iterator_next (grib_iterator *i, double *lat, double *lon, double *value)
 Get the next value from an iterator.
int grib_iterator_previous (grib_iterator *i, double *lat, double *lon, double *value)
 Get the previous value from an iterator.
int grib_iterator_has_next (grib_iterator *i)
 Test procedure for values in an iterator.
int grib_iterator_reset (grib_iterator *i)
 Test procedure for values in an iterator.
int grib_iterator_delete (grib_iterator *i)
 Frees an iterator from memory.
grib_nearestgrib_nearest_new (grib_handle *h, int *error)
 Create a new nearest from a handle, using current geometry .
int grib_nearest_find (grib_nearest *nearest, grib_handle *h, double inlat, double inlon, unsigned long flags, double *outlats, double *outlons, double *values, double *distances, int *indexes, size_t *len)
 Find the 4 nearest points of a latitude longitude point.
int grib_nearest_delete (grib_nearest *nearest)
 Frees an nearest from memory.
int grib_nearest_find_multiple (grib_handle *h, int is_lsm, double *inlats, double *inlons, long npoints, double *outlats, double *outlons, double *values, double *distances, int *indexes)
 Find the nearest point of a set of points whose latitudes and longitudes are given in the inlats, inlons arrays respectively.
int grib_get_offset (grib_handle *h, const char *key, size_t *offset)
 Get the number offset of a key, in a message if several keys of the same name are present, the offset of the last one is returned.
int grib_get_size (grib_handle *h, const char *key, size_t *size)
 Get the number of coded value from a key, if several keys of the same name are present, the total sum is returned.
int grib_get_long (grib_handle *h, const char *key, long *value)
 Get a long value from a key, if several keys of the same name are present, the last one is returned.
int grib_get_double (grib_handle *h, const char *key, double *value)
 Get a double value from a key, if several keys of the same name are present, the last one is returned.
int grib_get_double_element (grib_handle *h, const char *key, int i, double *value)
 Get as double the i-th element of the "key" array.
int grib_get_double_elements (grib_handle *h, const char *key, int *i, long size, double *value)
 Get as double array the elements of the "key" array whose indexes are listed in the input array i.
int grib_get_string (grib_handle *h, const char *key, char *mesg, size_t *length)
 Get a string value from a key, if several keys of the same name are present, the last one is returned.
int grib_get_bytes (grib_handle *h, const char *key, unsigned char *bytes, size_t *length)
 Get raw bytes values from a key.
int grib_get_double_array (grib_handle *h, const char *key, double *vals, size_t *length)
 Get double array values from a key.
int grib_get_long_array (grib_handle *h, const char *key, long *vals, size_t *length)
 Get long array values from a key.
int grib_copy_namespace (grib_handle *dest, const char *name, grib_handle *src)
 Copy the keys belonging to a given namespace from a source handle to a destination handle.
int grib_set_long (grib_handle *h, const char *key, long val)
 Set a long value from a key.
int grib_set_double (grib_handle *h, const char *key, double val)
 Set a double value from a key.
int grib_set_string (grib_handle *h, const char *key, const char *mesg, size_t *length)
 Set a string value from a key.
int grib_set_bytes (grib_handle *h, const char *key, const unsigned char *bytes, size_t *length)
 Set a bytes array from a key.
int grib_set_double_array (grib_handle *h, const char *key, const double *vals, size_t length)
 Set a double array from a key.
int grib_set_long_array (grib_handle *h, const char *key, const long *vals, size_t length)
 Set a long array from a key.
void grib_dump_content (grib_handle *h, FILE *out, const char *mode, unsigned long option_flags, void *arg)
 Print all keys, with the context print procedure and dump mode to a resource.
void grib_get_all_names (grib_handle *h, char *names)
 Gather all names available in a handle to a string, using a space as separator.
void grib_dump_action_tree (grib_context *c, FILE *f)
 Print all keys from the parsed definition files available in a context.
grib_contextgrib_get_context (grib_handle *h)
 Retreive the context from a handle.
grib_contextgrib_context_get_default (void)
 Get the static default context.
grib_contextgrib_context_new (grib_context *c)
 Create and allocate a new context from a parent context.
void grib_context_delete (grib_context *c)
 Frees the cached definition files of the context.
void grib_gts_header_on (grib_context *c)
 Set the gts header mode on.
void grib_gts_header_off (grib_context *c)
 Set the gts header mode off.
void grib_gribex_mode_on (grib_context *c)
 Set the gribex mode on.
void grib_gribex_mode_off (grib_context *c)
 Set the gribex mode off.
void grib_context_set_user_data (grib_context *c, void *udata)
 Sets user data in a context.
void * grib_context_get_user_data (grib_context *c)
 get userData from a context
void grib_context_set_memory_proc (grib_context *c, grib_malloc_proc griballoc, grib_free_proc gribfree, grib_realloc_proc gribrealloc)
 Sets memory procedures of the context.
void grib_context_set_persistent_memory_proc (grib_context *c, grib_malloc_proc griballoc, grib_free_proc gribfree)
 Sets memory procedures of the context for persistent data.
void grib_context_set_buffer_memory_proc (grib_context *c, grib_malloc_proc griballoc, grib_free_proc gribfree, grib_realloc_proc gribrealloc)
 Sets memory procedures of the context for large buffers.
void grib_context_set_path (grib_context *c, const char *path)
 Sets the context search path for definition files.
void grib_context_set_dump_mode (grib_context *c, int mode)
 Sets context dump mode.
void grib_context_set_print_proc (grib_context *c, grib_print_proc printp)
 Sets the context printing procedure used for user interaction.
void grib_context_set_logging_proc (grib_context *c, grib_log_proc logp)
 Sets the context logging procedure used for system (warning, errors, infos .
void grib_multi_support_on (grib_context *c)
 Turn on support for multiple fields in single grib messages.
void grib_multi_support_off (grib_context *c)
 Turn off support for multiple fields in single grib messages.
long grib_get_api_version (void)
 Get the api version.
void grib_print_api_version (FILE *out)
 Prints the api version.
grib_keys_iteratorgrib_keys_iterator_new (grib_handle *h, unsigned long filter_flags, char *name_space)
int grib_keys_iterator_next (grib_keys_iterator *kiter)
const char * grib_keys_iterator_get_name (grib_keys_iterator *kiter)
int grib_keys_iterator_delete (grib_keys_iterator *kiter)
int grib_keys_iterator_rewind (grib_keys_iterator *kiter)
const char * grib_get_error_message (int code)
 Convert an error code into a string.
-


Detailed Description

-Copyright 2005-2016 ECMWF. -

-This software is licensed under the terms of the Apache Licence Version 2.0 -which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-In applying this licence, ECMWF does not waive the privileges and immunities granted to it by -virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.

-grib_api C header file

-This is the only file that must be included to use the grib_api library from C.


Define Documentation

- -
-
- - - - -
#define GRIB_7777_NOT_FOUND   -5
-
-
- -

-Missing 7777 at end of message. -

- -

-

- -

-
- - - - -
#define GRIB_ARRAY_TOO_SMALL   -6
-
-
- -

-Passed array is too small. -

- -

-

- -

-
- - - - -
#define GRIB_BUFFER_TOO_SMALL   -3
-
-
- -

-Passed buffer is too small. -

- -

-

- -

-
- - - - -
#define GRIB_CODE_NOT_FOUND_IN_TABLE   -8
-
-
- -

-Code not found in code table. -

- -

-

- -

-
- - - - -
#define GRIB_CONCEPT_NO_MATCH   -37
-
-
- -

-Concept no match. -

- -

-

- -

-
- - - - -
#define GRIB_CONSTANT_FIELD   -48
-
-
- -

-Constant field. -

- -

-

- -

-
- - - - -
#define GRIB_DECODING_ERROR   -14
-
-
- -

-Decoding invalid. -

- -

-

- -

-
- - - - -
#define GRIB_ENCODING_ERROR   -15
-
-
- -

-Encoding invalid. -

- -

-

- -

-
- - - - -
#define GRIB_END   -40
-
-
- -

-End of resource. -

- -

-

- -

-
- - - - -
#define GRIB_END_OF_FILE   -1
-
-
- -

-End of ressource reached. -

-

Examples:
-get.f90, get_data.f90, keys_iterator.f90, multi.f90, and samples.f90.
-
-

- -

-
- - - - -
#define GRIB_END_OF_INDEX   -43
-
-
- -

-End of index reached. -

-

Examples:
-index.f90.
-
-

- -

-
- - - - -
#define GRIB_FILE_NOT_FOUND   -7
-
-
- -

-File not found. -

- -

-

- -

-
- - - - -
#define GRIB_GEOCALCULUS_PROBLEM   -17
-
-
- -

-Problem with calculation of geographic attributes. -

- -

-

- -

-
- - - - -
#define GRIB_INTERNAL_ARRAY_TOO_SMALL   -46
-
-
- -

-An internal array is too small. -

- -

-

- -

-
- - - - -
#define GRIB_INTERNAL_ERROR   -2
-
-
- -

-Internal error. -

- -

-

- -

-
- - - - -
#define GRIB_INVALID_ARGUMENT   -20
-
-
- -

-Invalid argument. -

- -

-

- -

-
- - - - -
#define GRIB_INVALID_FILE   -28
-
-
- -

-Invalid file id. -

- -

-

- -

-
- - - - -
#define GRIB_INVALID_GRIB   -29
-
-
- -

-Invalid grib id. -

- -

-

- -

-
- - - - -
#define GRIB_INVALID_INDEX   -30
-
-
- -

-Invalid index id. -

- -

-

- -

-
- - - - -
#define GRIB_INVALID_ITERATOR   -31
-
-
- -

-Invalid iterator id. -

- -

-

- -

-
- - - - -
#define GRIB_INVALID_KEYS_ITERATOR   -32
-
-
- -

-Invalid keys iterator id. -

- -

-

- -

-
- - - - -
#define GRIB_INVALID_MESSAGE   -13
-
-
- -

-Message invalid. -

- -

-

- -

-
- - - - -
#define GRIB_INVALID_NEAREST   -33
-
-
- -

-Invalid nearest id. -

- -

-

- -

-
- - - - -
#define GRIB_INVALID_ORDERBY   -34
-
-
- -

-Invalid order by. -

- -

-

- -

-
- - - - -
#define GRIB_INVALID_SECTION_NUMBER   -22
-
-
- -

-Invalid section number. -

- -

-

- -

-
- - - - -
#define GRIB_INVALID_TYPE   -25
-
-
- -

-Invalid key type. -

- -

-

- -

-
- - - - -
#define GRIB_IO_PROBLEM   -12
-
-
- -

-Input output problem. -

- -

-

- -

-
- - - - -
#define GRIB_MESSAGE_TOO_LARGE   -47
-
-
- -

-Message is too large for the current architecture. -

- -

-

- -

-
- - - - -
#define GRIB_MISSING_KEY   -35
-
-
- -

-Missing a key from the fieldset. -

- -

-

- -

-
- - - - -
#define GRIB_NO_DEFINITIONS   -38
-
-
- -

-Definitions files not found. -

- -

-

- -

-
- - - - -
#define GRIB_NO_MORE_IN_SET   -16
-
-
- -

-Code cannot unpack because of string too small. -

- -

-

- -

-
- - - - -
#define GRIB_NO_VALUES   -41
-
-
- -

-Unable to code a field without values. -

- -

-

- -

-
- - - - -
#define GRIB_NOT_FOUND   -11
-
-
- -

-Key/value not found. -

- -

-

- -

-
- - - - -
#define GRIB_NOT_IMPLEMENTED   -4
-
-
- -

-Function not yet implemented. -

- -

-

- -

-
- - - - -
#define GRIB_NULL_HANDLE   -21
-
-
- -

-Null handle. -

- -

-

- -

-
- - - - -
#define GRIB_NULL_INDEX   -44
-
-
- -

-Null index. -

- -

-

- -

-
- - - - -
#define GRIB_OUT_OF_AREA   -36
-
-
- -

-The point is out of the grid area. -

- -

-

- -

-
- - - - -
#define GRIB_OUT_OF_MEMORY   -18
-
-
- -

-Out of memory. -

- -

-

- -

-
- - - - -
#define GRIB_PREMATURE_END_OF_FILE   -45
-
-
- -

-End of ressource reached when reading message. -

- -

-

- -

-
- - - - -
#define GRIB_READ_ONLY   -19
-
-
- -

-Value is read only. -

- -

-

- -

-
- - - - -
#define GRIB_STRING_TOO_SMALL_FOR_CODE_NAME   -9
-
-
- -

-Code cannot unpack because of string too small. -

- -

-

- -

-
- - - - -
#define GRIB_SUCCESS   0
-
-
- -

-No error. -

-

Examples:
-iterator.c.
-
-

- -

-
- - - - -
#define GRIB_SWITCH_NO_MATCH   -49
-
-
- -

-Switch unable to find a matching case. -

- -

-

- -

-
- - - - -
#define GRIB_VALUE_CANNOT_BE_MISSING   -23
-
-
- -

-Value cannot be missing. -

- -

-

- -

-
- - - - -
#define GRIB_WRONG_ARRAY_SIZE   -10
-
-
- -

-Array size mismatch. -

- -

-

- -

-
- - - - -
#define GRIB_WRONG_GRID   -42
-
-
- -

-Grid description is wrong or inconsistent. -

- -

-

- -

-
- - - - -
#define GRIB_WRONG_LENGTH   -24
-
-
- -

-Wrong message length. -

- -

-

- -

-
- - - - -
#define GRIB_WRONG_STEP   -26
-
-
- -

-Unable to set step. -

- -

-

- -

-
- - - - -
#define GRIB_WRONG_STEP_UNIT   -27
-
-
- -

-Wrong units for step (step must be integer). -

- -

-

- -

-
- - - - -
#define GRIB_WRONG_TYPE   -39
-
-
- -

-Wrong type while packing. -

- -

-

-


Typedef Documentation

- -
-
- - - - -
typedef struct grib_context grib_context
-
-
- -

-Grib context, structure containing the memory methods, the parsers and the formats. -

-

- -

-
- - - - -
typedef struct grib_iterator grib_iterator
-
-
- -

-Grib iterator, structure supporting a geographic iteration of values on a grib message.

Examples:
-iterator.c.
-
-

- -

-
- - - - -
typedef struct grib_nearest grib_nearest
-
-
- -

-Grib nearest, structure used to find the nearest points of a latitude longitude point.

Examples:
-nearest.c.
-
-

-


Function Documentation

- -
-
- - - - - - - - - - - - - - - - - - -
void grib_dump_action_tree (grib_context c,
FILE *  f 
)
-
-
- -

-Print all keys from the parsed definition files available in a context. -

-

Parameters:
- - - -
f : the File used to print the keys on
c : the context that containd the cached definition files to be printed
-
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void grib_dump_content (grib_handle h,
FILE *  out,
const char *  mode,
unsigned long  option_flags,
void *  arg 
)
-
-
- -

-Print all keys, with the context print procedure and dump mode to a resource. -

-

Parameters:
- - - - - - -
h : the handle to be printed
out : output file handle
mode : available dump modes are: debug wmo c_code
option_flags : all the GRIB_DUMP_FLAG_x flags can be used
arg : used to provide a format to output data (experimental)
-
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
void grib_get_all_names (grib_handle h,
char *  names 
)
-
-
- -

-Gather all names available in a handle to a string, using a space as separator. -

-

Parameters:
- - - -
h : the handle used to gather the keys
names : the sting to be filled with the names
-
- -
-

- -

-
- - - - - - - - - -
long grib_get_api_version (void   ) 
-
-
- -

-Get the api version. -

-

Returns:
api version
- -
-

- -

-
- - - - - - - - - -
const char* grib_get_error_message (int  code  ) 
-
-
- -

-Convert an error code into a string. -

-

Parameters:
- - -
code : the error code
-
-
Returns:
the error message
- -
-

- -

-
- - - - - - - - - -
void grib_print_api_version (FILE *  out  ) 
-
-
- -

-Prints the api version. -

- -

-

-


Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_compare.html b/html/grib_compare.html deleted file mode 100644 index 59f34c162..000000000 --- a/html/grib_compare.html +++ /dev/null @@ -1,281 +0,0 @@ - - -grib_api: grib_compare - - - - -
- -
-

grib_compare

-DESCRIPTION

-Compare grib messages contained in two files. If some differences are found it fails returning an error code. Floating point values are compared exactly by default, different tolerance can be defined see -P -A -R. Default behaviour: absolute error=0, bit-by-bit compare, same order in files.

-USAGE

-grib_compare [options] grib_file grib_file

-OPTIONS

--r
- Compare files in which the messages are not in the same order. This option is time expensive.
-
- -b key,key,...
- All the keys in this list are skipped in the comparison. Bit-by-bit compare on.
-
- -e
- edition independent compare. It is used to compare grib edition 1 and 2.
-
- -c key[:l/d/s/n],key[:l/d/s/n],...
- Only the listed keys or namespaces (:n) are compared. The optional letter after the colon is used to force the type in the comparison: l->integer, d->float, s->string, n->namespace. See -a option. Incompatible with -H option.
-
- -a
- -c option modifier. The keys listed with the option -c will be added to the list of keys compared without -c.
-
- -H
- Compare only message headers. Bit-by-bit compare on. Incompatible with -c option.
-
- -R key1=relative_error1,key2=relative_error2,...
- Compare floating point values using the relative error as tolerance. key1=relative_error will compare key1 using relative_error1. all=relative_error will compare all the floating point keys using relative_error. Default all=0.
-
- -A absolute error
- Compare floating point values using the absolute error as tolerance. Default is absolute error=0
-
- -P
- Compare data values using the packing error as tolerance.
-
- -T factor
- Compare data values using factor multipied by the tolerance specified in options -P -R -A.
-
- -w key[:{s/d/l}]{=/!=}value,key[:{s/d/l}]{=/!=}value,...
- Where clause. Grib messages are processed only if they match all the key/value constraints. A valid constraint is of type key=value or key!=value. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be specified. Default type is string.
-
- -f
- Force. Force the execution not to fail on error.
-
- -V
- Version.
-
- -7
- Does not fail when the message has wrong length
-
- -v
- Verbose.
-
-

-grib_compare examples

-
    -
  1. The default behaviour for grib_compare without any option is to perform a bit by bit comparison of the two messages. If the messages are found to be bitwise different then grib_compare switches to a "key based" mode to find out which coded keys are different. To see how grib_compare works we first set the shortName=2d (2 metre dew point temperature) in the file regular_latlon_surface.grib1
    -
    ->grib_set -s shortName=2d regular_latlon_surface.grib1 2d.grib1
    -
    Then we can compare the two fields with grib_compare.
    -
    ->grib_compare regular_latlon_surface.grib1 2d.grib1
    -
    --- GRIB #1 -- shortName=2t paramId=167 stepRange=0 levelType=sfc level=0 packingType=grid_simple gridType=regular_ll --
    -long [indicatorOfParameter]: [167] != [168]
    -
    In the output we see that the only "coded" key with different values in the two messages is indicatorOfParameter which is the relevant key for the parameter information. The comparison can be forced to be successful listing the keys with different values in the -b option.
    ->grib_compare -b indicatorOfParameter regular_latlon_surface.grib1 2d.grib1
    -

    -
    -
  2. Two grib messages can be very different because they have different edition, but they can contain the same identical information in the header and the same data. To see how grib_compare can help in comparing messages with different edition we do
    ->grib_set edition=2 reduced_gaussian_model_level.grib1 reduced_gaussian_model_level.grib2
    -
    Then we compare the two fields with grib_compare.
    -
    ->grib_compare reduced_gaussian_model_level.grib1 reduced_gaussian_model_level.grib2
    -
    --- GRIB #1 -- shortName=t paramId=130 stepRange=0 levelType=ml level=1 packingType=grid_simple gridType=reduced_gg --
    -long [totalLength]: [10908] != [10996]
    -long [editionNumber]: [1] != [2]
    -long [section1Length]: [52] != [21]
    -[table2Version] not found in 2nd field
    -[gridDefinition] not found in 2nd field
    -[indicatorOfParameter] not found in 2nd field
    -[indicatorOfTypeOfLevel] not found in 2nd field
    -[yearOfCentury] not found in 2nd field
    -[unitOfTimeRange] not found in 2nd field
    -[P1] not found in 2nd field
    -[P2] not found in 2nd field
    -[numberIncludedInAverage] not found in 2nd field
    -[numberMissingFromAveragesOrAccumulations] not found in 2nd field
    -[centuryOfReferenceTimeOfData] not found in 2nd field
    -[reservedNeedNotBePresent] not found in 2nd field
    -[localDefinitionNumber] not found in 2nd field
    -[perturbationNumber] not found in 2nd field
    -[numberOfForecastsInEnsemble] not found in 2nd field
    -[padding_local1_1] not found in 2nd field
    -long [section2Length]: [896] != [17]
    -[pvlLocation] not found in 2nd field
    -[dataRepresentationType] not found in 2nd field
    -long [latitudeOfFirstGridPoint]: [87864] != [87864000]
    -long [latitudeOfLastGridPoint]: [-87864] != [-87864000]
    -long [longitudeOfLastGridPoint]: [357188] != [357188000]
    -[padding_grid4_1] not found in 2nd field
    -long [section4Length]: [9948] != [770]
    -[dataFlag] not found in 2nd field
    -
    It is clear that the two messages are coded in a very different way. If we now add the -e option, the tool will compare only the higher level information common between the two messages.
    ->grib_compare -e reduced_gaussian_model_level.grib1 reduced_gaussian_model_level.grib2
    -
    The comparison is successful because the two messages contain the same information coded in two different ways. We can display the list of keys used by grib_compare adding the option -v (verbose).
    ->grib_compare -ve reduced_gaussian_model_level.grib1 reduced_gaussian_model_level.grib2
    -reduced_gaussian_model_level.grib2
    -  comparing centre as string
    -  comparing paramId as string
    -  comparing shortName as string
    -  comparing typeOfLevel as string
    -  comparing level as long
    -  comparing pv as double  (184 values) tolerance=0
    -  comparing latitudeOfFirstGridPointInDegrees as double  (1 values) tolerance=0.0005
    -  comparing longitudeOfFirstGridPointInDegrees as double  (1 values) tolerance=0.0005
    -  comparing latitudeOfLastGridPointInDegrees as double  (1 values) tolerance=0.0005
    -  comparing longitudeOfLastGridPointInDegrees as double  (1 values) tolerance=0.0005
    -  comparing iDirectionIncrementInDegrees is set to missing in both fields
    -  comparing N as long
    -  comparing iScansNegatively as long
    -  comparing jScansPositively as long
    -  comparing jPointsAreConsecutive as long
    -  comparing pl as long
    -  comparing gridType as string
    -  comparing packedValues as double  (6114 values) tolerance=0
    -  comparing param as string
    -  comparing levtype as string
    -  comparing levelist as long
    -  comparing date as long
    -  comparing time as long
    -  comparing step as long
    -  comparing class as long
    -  comparing type as long
    -  comparing stream as long
    -  comparing expver as string
    -  comparing domain as string
    -
    -1 of 1 grib messages in reduced_gaussian_model_level.grib2
    -
    -1 of 1 total grib messages in 1 files
    -
    For each key the type used in the comparison is reported and for the floating point keys also the tolerance used is printed.
    -
    -
  3. Some options are provided to compare only a set of keys in the messages. The option -H is used to compare only the headers coded in the message, it doesn't compare the data values. The option "-c key1:[l/d/s/n],key2:[l/d/s/n],... " can be used to compare a set of keys or namespaces. The letter after the colon is optional and it is used to force the type used in the comparison which is otherwise assumed to be the native type of the key. The possible types are: -When the type "n" is used all the set of keys belonging to the specified namespace are compared assuming their own native type. To illustrate how these options work we change the values coded in a message using grib_filter with the following rules file (see grib_filter).
    -set bitsPerValue=10;
    -set values={1,2.5,3,4,5,6,70};
    -write "first.grib1";
    -set values={1,2.5,5,4,5,6,70};
    -write "second.grib1";
    -
    We first compare the two files using the -H option (only headers are compared).
    ->grib_compare -H first.grib1 second.grib1
    -
    The comparison is successful because the data are not compared. To compare only the data we have to compare the "data namespace".
    ->grib_compare -c data:n first.grib1 second.grib1
    -
    --- GRIB #1 -- shortName=t paramId=130 stepRange=0 levelType=ml level=1 packingType=grid_simple gridType=reduced_gg --
    -double [packedValues]: 1 out of 7 different,  max absolute diff. = 2, relative diff. = 0.4
    -	max diff. element 2: 3.00000000000000000000e+00 5.00000000000000000000e+00
    -	tolerance=0 packingError: [0.04] [0.04]
    -	values max= [70.04]  [70.04]         min= [1] [1]
    -
    The comparison is showing that one of seven values is different in a comparison with the (default) absolute tolerance=0. We can change the tolerance with the -A option:
    ->grib_compare -A 2 -c data:n first.grib1 second.grib1
    -
    and we see that the comparison is successful if the absolute tolerance is set to 2. We can also set the relative tolerance for each key with the option -R:
    ->grib_compare -R packedValues=0.4 -c data:n first.grib1 second.grib1
    -
    and we get again a successful comparison because the relative tolerance is bigger than the relative absolute difference of two corresponding values. Another possible choice for the tolerance is to be equal to the packingError, which is the error due to the packing algorithm. If we change the decimalPrecision of a packed field we introduce a packing error sometimes bigger than the original packing error.
    ->grib_set -s changeDecimalPrecision=0 first.grib1 third.grib1
    -
    and we compare the two fields using the -P option (tolerance=packingError).
    ->grib_compare -P -c data:n first.grib1 third.grib1
    -
    the comparison is successful because their difference is within the biggest of the two packing error. With the option -P the comparison is failing only if the original data coded are different, not if the packing precision is changed. If we try again to compare the fields without the -P option:
    ->grib_compare -c data:n first.grib1 third.grib1
    -
    --- GRIB #1 -- shortName=t paramId=130 stepRange=0 levelType=ml level=1 packingType=grid_simple gridType=reduced_gg --
    -double [packedValues]: 4 out of 7 different,  max absolute diff. = 0.48, relative diff. = 0.16
    -	max diff. element 1: 2.52000000000000001776e+00 3.00000000000000000000e+00
    -	tolerance=0 packingError: [0.04] [0.5]
    -	values max= [70.04]  [70]         min= [1] [1]
    -
    we see that some values are different and that the maximum absolute differenc is close to the biggest packing error (max diff=0.48 packingError=0.5). The packing error was chosen to be 0.5 by setting decimalPrecision to 0 which means that we don't need to preserve any decimal figure.
    -
    -
  4. When we already know that the fields are not numerically identical, but have similar statistical characteristics we can compare their statistics namespaces:
    ->grib_compare -c statistics:n first.grib1 third.grib1
    -
    --- GRIB #1 -- shortName=t paramId=130 stepRange=0 levelType=ml level=1 packingType=grid_simple gridType=reduced_gg --
    -double [max]: [7.00400000000000062528e+01] != [7.00000000000000000000e+01]
    -	absolute diff. = 0.04, relative diff. = 0.000571102
    -	tolerance=0
    -double [avg]: [1.30914285714285707485e+01] != [1.31428571428571423496e+01]
    -	absolute diff. = 0.0514286, relative diff. = 0.00391304
    -	tolerance=0
    -double [sd]: [2.32994686809877009637e+01] != [2.32589679873534969090e+01]
    -	absolute diff. = 0.0405007, relative diff. = 0.00173827
    -	tolerance=0
    -double [skew]: [-1.41592875700515623549e+01] != [-1.41669971380493855406e+01]
    -	absolute diff. = 0.00770957, relative diff. = 0.000544192
    -	tolerance=0
    -double [kurt]: [7.32364710785659567271e-01] != [7.32723797489455375143e-01]
    -	absolute diff. = 0.000359087, relative diff. = 0.000490071
    -	tolerance=0
    -
    and we see that maximum, minimum, average, standard deviation, skewness and kurtosis are compared. While the values are different by 0.48 the statistics comparison shows that the difference in the statistical values is never bigger than 0.052
    ->grib_compare -A 0.052 -c statistics:n first.grib1 third.grib1
    -
    The statistics namespace is available also for spherical harmonics data and provides information about the field in the geographic space computing them in the spectral space for performance reasons.
    -
    -
  5. When a file contains several fields and some keys are different, it is useful to have a summary report of the keys found different in the messages. This can be obtained with the option -f. We change few keys in a file:
    ->grib_set -w typeOfLevel=surface -s step=48 tigge_pf_ecmwf.grib2 out.grib2
    -
    and comparing with the -f option:
    ->grib_compare -f tigge_pf_ecmwf.grib2 out.grib2
    -
    --- GRIB #9 -- shortName=skt paramId=235 stepRange=96 levelType=sfc level=0 packingType=grid_simple gridType=regular_ll --
    -long [forecastTime]: [96] != [48]
    -
    --- GRIB #10 -- shortName=sd paramId=228141 stepRange=96 levelType=sfc level=0 packingType=grid_simple gridType=regular_ll --
    -long [forecastTime]: [96] != [48]
    -
    --- GRIB #11 -- shortName=sf paramId=228144 stepRange=0-96 levelType=sfc level=0 packingType=grid_simple gridType=regular_ll --
    -long [dayOfEndOfOverallTimeInterval]: [26] != [24]
    -long [lengthOfTimeRange]: [96] != [48]
    -
    -...  output deleted 
    -
    -## ERRORS SUMMARY #######
    -##
    -## Summary of different key values 
    -## forecastTime ( 3 different )
    -## dayOfEndOfOverallTimeInterval ( 11 different )
    -## lengthOfTimeRange ( 11 different )
    -##
    -## 14 different messages out of 38
    -
    -
    we get a list of all the different messages in the files and a summary report of the different keys.
    -
    -
  6. We can change the order of the messages in a file using grib_copy with the -B option:
    ->grib_copy -B typeOfLevel tigge_pf_ecmwf.grib2 out.grib2
    -
    If we now compare the two files:
    ->grib_compare -f tigge_pf_ecmwf.grib2 out.grib2
    -
    --- GRIB #1 -- shortName=10u paramId=165 stepRange=96 levelType=sfc level=10 packingType=grid_simple gridType=regular_ll --
    -long [discipline]: [0] != [2]
    -long [totalLength]: [1555] != [990]
    -long [parameterCategory]: [2] != [0]
    -long [parameterNumber]: [2] != [22]
    -long [scaledValueOfFirstFixedSurface]: [10] != [0]
    -long [typeOfSecondFixedSurface]: [255] != [106]
    -scaleFactorOfSecondFixedSurface is set to missing in 1st field is not missing in 2nd field
    -scaledValueOfSecondFixedSurface is set to missing in 1st field is not missing in 2nd field
    -long [numberOfValues]: [684] != [239]
    -double [referenceValue]: [-1.57229328155517578125e+01] != [4.15843811035156250000e+01]
    -	absolute diff. = 57.3073, relative diff. = 1.3781
    -	tolerance=3.8147e-06
    -long [binaryScaleFactor]: [-10] != [-15]
    -long [bitsPerValue]: [16] != [24]
    -long [section6Length]: [6] != [92]
    -long [bitMapIndicator]: [255] != [0]
    -long [section7Length]: [1373] != [722]
    -[codedValues] has different size: 1st field: 684, 2nd field: 239
    -...    very long output 
    -
    the comparison is failing because of the different order of the messages. We can use the -r option to compare the files assuming that the messages are not in the same order:
    ->grib_compare -r tigge_pf_ecmwf.grib2 out.grib2
    -
    and we have a successful comparison because for each message in the first file an identical message is found in the second file. This option should be used carefully as it is very time expensive.
-

-
-
-


Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_convert.html b/html/grib_convert.html deleted file mode 100644 index 8847a8f2d..000000000 --- a/html/grib_convert.html +++ /dev/null @@ -1,59 +0,0 @@ - - -grib_api: grib_convert - - - - -
- -
-

grib_convert

-DESCRIPTION

-It converts grib messages applying the rules from a conversion_rules file. The rules are of the type "keyname = value;" and if blocks are allowed as if ( keyname1 == value1 || keyname2 != value2 && keyname3 == value3 ) { keyname4 = value4; }

-USAGE

-grib_convert [options] conversion_rules grib_file grib_file ... output_grib_file

-OPTIONS

--f
- Force. Force the execution not to fail on error.
-
- -M
- Multi-grib support off. Turn off support for multiple fields in single grib message
-
- -g
- Copy GTS header.
-
- -G
- GRIBEX compatibility mode.
-
- -V
- Version.
-
- -7
- Does not fail when the message has wrong length
-
- -v
- Verbose.
-
-

-grib_convert examples

-The following grib_convert rules convert all the grib messages contained in the input files in grib edition 2 and if a 2 metre temperature is found also the keys contained in the culy bracket are changed.
-
editionNumber = 2;
-if( indicatorOfParameter == 11 && indicatorOfTypeOfLevel == 105)
-{
-    productDefinitionTemplateNumber = 1;
-    typeOfFirstFixedSurface         = 103;
-    scaleFactorOfFirstFixedSurface  = 0;
-    scaledValueOfFirstFixedSurface  = 2;
-}
-

Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_copy.html b/html/grib_copy.html deleted file mode 100644 index 587f91816..000000000 --- a/html/grib_copy.html +++ /dev/null @@ -1,82 +0,0 @@ - - -grib_api: grib_copy - - - - -
- -
-

grib_copy

-DESCRIPTION

-Copies the content of grib files printing values of some keys.

-USAGE

-grib_copy [options] grib_file grib_file ... output_grib_file

-OPTIONS

--f
- Force. Force the execution not to fail on error.
-
- -r
- Repack data. Sometimes after setting some keys involving properties of the packing algorithm a repacking of data is needed. This repacking is performed setting this -r option.
-
- -p key[:{s/d/l}],key[:{s/d/l}],...
- Declaration of keys to print. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be requested. Default type is string.
-
- -P key[:{s/d/l}],key[:{s/d/l}],...
- As -p adding the declared keys to the default list.
-
- -w key[:{s/d/l}]=value,key[:{s/d/l}]=value,...
- Where clause. Only grib messages matching the key/value constraints are copied to the output_grib_file. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be defined. Default type is string.
-
- -B order by directive
- Order by. The output will be ordered according the order by directive. Order by example: "step asc, centre desc" (step ascending and centre discending)
-
- -V
- Version.
-
- -W width
- Minimum width of each column in output. Default is 10.
-
- -M
- Multi-grib support off. Turn off support for multiple fields in single grib message
-
- -g
- Copy GTS header.
-
- -G
- GRIBEX compatibility mode.
-
- -7
- Does not fail when the message has wrong length
-
- -v
- Verbose.
-
-

-grib_copy examples

-
    -
  1. To copy only the pressure levels from a file
    -
    -> grib_copy -w levtype=pl ../data/tigge_pf_ecmwf.grib2 out.grib
    -

    -
  2. To copy only the fields that are not on pressure levels from a file
    -
    -> grib_copy -w levtype!=pl ../data/tigge_pf_ecmwf.grib2 out.grib
    -

    -
  3. A grib_file with multi field messages can be converted in single field messages with a simple grib_copy.
    -
    -> grib_copy multi.grib simple.grib
    -

    -
-
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_debug.html b/html/grib_debug.html deleted file mode 100644 index 5132e3ecc..000000000 --- a/html/grib_debug.html +++ /dev/null @@ -1,649 +0,0 @@ - - -grib_api: grib_debug - - - - -
- -
-

grib_debug

-DESCRIPTION

-Dump the content of a grib file in debug mode.

-USAGE

-grib_debug [options] grib_file grib_file ...

-OPTIONS

--V
- Version.
-
-

-grib_debug examples

-Dumping in a WMO documentation style with hexadecimal octet values (-H)
- and with the aliases of each key listed in square brackets (-a).
-
- grib_dump -Ha ../data/reduced_gaussian_model_level.grib1
-
-***** FILE: ../data/reduced_gaussian_model_level.grib1 
-======================   MESSAGE 1 ( length=10142 )            ======================
-======================   SECTION_0 ( length=0, padding=0 )     ======================
-1-4       identifier = GRIB
-5-7       totalLength = 10142 ( 0x00 0x27 0x9E )
-8         editionNumber = 1 ( 0x01 ) [ls.edition]
-======================   SECTION_1 ( length=52, padding=0 )    ======================
-1-3       section1Length = 52 ( 0x00 0x00 0x34 )
-4         gribTablesVersionNo = 128 ( 0x80 ) [table2Version]
-5         identificationOfOriginatingGeneratingCentre = 98 ( 0x62 ) [European Center for Medium-Range Weather Forecasts (grib1/0.table) ] [ls.centre, identificationOfCentre, originatingCentre]
-6         generatingProcessIdentifier = 128 ( 0x80 ) [generatingProcessIdentificationNumber, process]
-7         gridDefinition = 255 ( 0xFF )
-8         section1Flags = 128 [10000000]
-9         indicatorOfParameter = 130 ( 0x82 ) [T Temperature K (grib1/2.98.128.table) ]
-10        indicatorOfTypeOfLevel = 109 ( 0x6D ) [Hybrid level level number (2 octets) (grib1/3.table) ] [ls.levelType, typeOfLevel, typeOfFirstFixedSurface, mars.levtype]
-11-12     lev = 1 ( 0x00 0x01 ) [topLevel, bottomLevel, ls.level, mars.levelist]
-13        yearOfCentury = 7 ( 0x07 )
-14        month = 3 ( 0x03 )
-15        day = 18 ( 0x12 )
-16        hour = 12 ( 0x0C )
-17        minute = 0 ( 0x00 )
-18        indicatorOfUnitOfTimeRange = 1 ( 0x01 ) [Hour (grib1/4.table) ]
-19        periodOfTime = 0 ( 0x00 ) [P1]
-20        periodOfTimeIntervals = 0 ( 0x00 ) [P2]
-21        timeRangeIndicator = 0 ( 0x00 ) [Forecast product valid at reference time + P1 (P1>0) (grib1/5.table) ]
-22-23     numberIncludedInAverage = 0 ( 0x00 0x00 )
-24        numberMissingFromAveragesOrAccumulations = 0 ( 0x00 )
-25        centuryOfReferenceTimeOfData = 21 ( 0x15 )
-26        identificationOfOriginatingGeneratingSubCentre = 0 ( 0x00 ) [Absent (grib1/0.table) ] [subCentre]
-27-28     decimalScaleFactor = 2 ( 0x00 0x02 )
-29-40     reservedNeedNotBePresent = 12 {
-               00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
-            } # pad reservedNeedNotBePresent 
-41        localDefinitionNumber = 1 ( 0x01 )
-42        marsClass = 1 ( 0x01 ) [Operational archive (mars/class.table) ] [mars.class]
-43        marsType = 2 ( 0x02 ) [Analysis (mars/type.table) ] [ls.dataType, mars.type]
-44-45     marsStream = 1025 ( 0x04 0x01 ) [Atmospheric model (mars/stream.table) ] [mars.stream]
-46-49     experimentVersionNumber = 0001 [mars.expver]
-50        perturbationNumber = 0 ( 0x00 )
-51        numberOfForecastsInEnsemble = 0 ( 0x00 )
-52        padding_local1_1 = 1 {
-                     00
-                  } # pad padding_local1_1 
-======================   SECTION_2 ( length=896, padding=0 )   ======================
-1-3       section2Length = 896 ( 0x00 0x03 0x80 )
-4         numberOfVerticalCoordinateValues = 184 ( 0xB8 ) [NV, numberOfCoordinatesValues]
-5         pvlLocation = 33 ( 0x21 )
-6         dataRepresentationType = 4 ( 0x04 ) [Gaussian Latitude/Longitude Grid (grib1/6.table) ]
-7-8       numberOfPointsAlongAParallel = MISSING ( 0xFF 0xFF ) [geography.Ni]
-9-10      numberOfPointsAlongAMeridian = 64 ( 0x00 0x40 ) [geography.Nj]
-11-13     latitudeOfFirstGridPoint = 87864 ( 0x01 0x57 0x38 ) [La1]
-14-16     longitudeOfFirstGridPoint = 0 ( 0x00 0x00 0x00 ) [Lo1]
-17        resolutionAndComponentFlags = 0 [00000000]
-18-20     latitudeOfLastGridPoint = -87864 ( 0x81 0x57 0x38 ) [La2]
-21-23     longitudeOfLastGridPoint = 357188 ( 0x05 0x73 0x44 ) [Lo2]
-24-25     iDirectionIncrement = MISSING ( 0xFF 0xFF ) [Di]
-26-27     numberOfParallelsBetweenAPoleAndTheEquator = 32 ( 0x00 0x20 )
-28        scanningMode = 0 [00000000]
-29-32     padding_grid4_1 = 4 {
-                  00, 00, 00, 00
-               } # pad padding_grid4_1 
-33-768    pv = (184,736) {
-         0,    2.00004,    3.98083,    7.38719,    12.9083,    21.4136,    33.9529,    51.7466, 
-   76.1677,    108.716,    150.986,    204.637,    271.356,    352.824,    450.686,    566.519, 
-   701.813,    857.946,    1036.17,    1237.59,    1463.16,    1713.71,    1989.87,    2292.16, 
-    2620.9,     2976.3,    3358.43,     3767.2,    4202.42,    4663.78,    5150.86,    5663.16, 
-   6199.84,    6759.73,    7341.47,    7942.93,    8564.62,     9208.3,    9873.56,    10558.9, 
-   11262.5,    11982.7,    12713.9,    13453.2,      14192,    14922.7,    15638.1,    16329.6, 
-   16990.6,    17613.3,      18191,      18717,    19184.5,    19587.5,    19919.8,    20175.4, 
-   20348.9,    20434.2,    20426.2,      20319,      20107,    19785.4,    19348.8,    18798.8, 
-   18141.3,    17385.6,    16544.6,    15633.6,    14665.6,    13653.2,    12608.4,    11543.2, 
-   10471.3,    9405.22,    8356.25,    7335.16,    6353.92,     5422.8,    4550.21,    3743.46, 
-   3010.15,     2356.2,    1784.85,    1297.66,    895.194,    576.314,    336.772,    162.043, 
-   54.2083,    6.57563,    0.00316,          0,          0,          0,          0,          0, 
-         0,          0,          0,          0
-... 84 more values
-} # ibmfloat pv 
-769-896   pl = (64,128) {
-        20,         27,         36,         40,         45,         50,         60,         64, 
-        72,         75,         80,         90,         90,         96,        100,        108, 
-       108,        120,        120,        120,        128,        128,        128,        128, 
-       128,        128,        128,        128,        128,        128,        128,        128, 
-       128,        128,        128,        128,        128,        128,        128,        128, 
-       128,        128,        128,        128,        120,        120,        120,        108, 
-       108,        100,         96,         90,         90,         80,         75,         72, 
-        64,         60,         50,         45,         40,         36,         27,         20
-} # unsigned pl 
-======================   SECTION_4 ( length=9182, padding=0 )   ======================
-1-3       section4Length = 9182 ( 0x00 0x23 0xDE )
-4         dataFlag = 0 [00000000]
-5-6       binaryScaleFactor = 0 ( 0x00 0x00 )
-7-10      referenceValue = 17402.8
-11        numberOfBitsContainingEachPackedValue = 12 ( 0x0C ) [nbp, numberOfBits, bitsPerValue]
-12-9182   values = (6114,9171) {
-   203.778,    203.468,    202.958,    202.348,    201.758,    201.278,    200.888,    200.558, 
-   200.268,    200.078,    200.068,    200.318,    200.808,    201.458,    202.138,    202.758, 
-   203.248,    203.588,    203.798,    203.878,    205.968,    205.418,    204.438,    203.218, 
-   202.008,    201.128,    200.708,    200.598,    200.478,    200.228,    199.908,    199.528, 
-   199.108,    198.708,    198.528,    198.748,    199.458,    200.488,    201.548,    202.478, 
-   203.358,    204.178,    204.808,    205.198,    205.508,    205.838,    206.068,    207.338, 
-   206.488,    205.198,    203.798,    202.548,    201.528,    200.848,    200.638,    200.818, 
-   201.028,    200.888,    200.308,    199.638,    199.228,    199.018,    198.738,    198.328, 
-   197.868,    197.358,    196.928,    196.858,    197.348,    198.368,    199.638,    200.758, 
-   201.538,    202.288,    203.338,    204.438,    205.158,    205.558,    205.938,    206.438, 
-   207.008,    207.468,    207.638,    207.178,    206.658,    205.398,    203.788,    202.468, 
-   201.338,    200.298,    199.938,    200.318,    200.608,    200.478,    200.008,    199.208, 
-   198.278,    197.708,    197.558,    197.318
-... 6014 more values
-} # data_g1simple_packing values 
-======================   SECTION_5 ( length=4, padding=0 )     ======================
-1-4       7777 = 7777
-

-
-
- How to obtain all the key names available in a grib file.
-
- grib_dump -D ../data/regular_latlon_surface.grib1
-***** FILE: ../data/regular_latlon_surface.grib1 
-======================   MESSAGE 1 ( length=1100 )             ======================
-0-0 constant oneConstant = 1
-0-0 constant oneMillionConstant = 1000000
-0-0 offset_file offset = 0
-0-0 count_file count = 1
-0-0 count_total countTotal = 1
-0-0 lookup kindOfProduct = 1196575042 [GRIB 1196575042 0-4]
-0-0 lookup GRIBEditionNumber = 1 [? 1 7-1]
-======> section GRIB (1100,1100,0)
-   0-0 constant grib1divider = 1000
-   0-0 constant ieeeFloats = 0
-   0-0 transient dummy = 1
-   ======> section section_0 (0,0,0)
-      ----> label empty 
-   <===== section section_0
-   0-4 ascii identifier = GRIB
-   4-7 g1_message_length totalLength = 1100
-   7-8 unsigned editionNumber = 1 [ls.edition]
-   ======> section section_1 (52,52,0)
-      8-8 constant ECMWF = 98
-      8-8 position offsetSection1 = 8
-      8-11 section_length section1Length = 52
-      11-12 unsigned gribTablesVersionNo = 128 [table2Version]
-      12-13 codetable identificationOfOriginatingGeneratingCentre = 98 [European Center for Medium-Range Weather Forecasts (grib1/0.table) ] [ls.centre, identificationOfCentre, originatingCentre]
-      13-14 unsigned generatingProcessIdentifier = 128 [generatingProcessIdentificationNumber, process]
-      14-15 unsigned gridDefinition = 255
-      15-16 codeflag section1Flags = 128 [10000000:(1=1)  Section 2 included;(2=0)  Section 3 omited:grib1/1.table]
-      16-17 codetable indicatorOfParameter = 167 [2T 2 metre temperature K (grib1/2.98.128.table) ]
-      17-17 sprintf marsParam = 167.128 [mars.param, ls.param]
-      17-18 codetable indicatorOfTypeOfLevel = 1 [Surface (of the Earth, which includes sea surface) (grib1/3.table) ] [ls.levelType, typeOfLevel, typeOfFirstFixedSurface, mars.levtype]
-      18-20 unsigned lev = 0 [topLevel, bottomLevel, ls.level, mars.levelist]
-      20-21 unsigned yearOfCentury = 7
-      21-22 unsigned month = 3
-      22-23 unsigned day = 18
-      23-24 unsigned hour = 12
-      24-25 unsigned minute = 0
-      25-25 constant second = 0
-      25-26 codetable indicatorOfUnitOfTimeRange = 1 [Hour (grib1/4.table) ]
-      26-27 unsigned periodOfTime = 0 [P1]
-      27-28 unsigned periodOfTimeIntervals = 0 [P2]
-      28-29 codetable timeRangeIndicator = 0 [Forecast product valid at reference time + P1 (P1>0) (grib1/5.table) ]
-      29-31 unsigned numberIncludedInAverage = 0
-      31-32 unsigned numberMissingFromAveragesOrAccumulations = 0
-      32-33 unsigned centuryOfReferenceTimeOfData = 21
-      33-34 codetable identificationOfOriginatingGeneratingSubCentre = 0 [Absent (grib1/0.table) ] [subCentre]
-      34-36 signed decimalScaleFactor = 0
-      36-36 transient setLocalDefinition = 0
-      36-48 pad reservedNeedNotBePresent = 12 {
-         00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
-      } # pad reservedNeedNotBePresent 
-      48-48 g1date dataDate = 20070318 [mars.date, ls.date]
-      48-48 evaluate year = 2007
-      48-48 g1monthlydate monthlyDate = 20070301
-      48-48 time dataTime = 1200 [mars.time]
-      48-48 g1startstep marsStartStep = 0 [mars.startStep]
-      48-48 g1endstep marsEndStep = 0 [mars.endStep]
-      48-48 g1step marsStep = 0 [mars.step, ls.step, forecastTime]
-      48-48 g1verificationdate verificationDate = 20070318
-      48-48 g1monthlydate monthlyVerificationDate = 20070301
-      48-48 g1day_of_the_year_date dayOfTheYearDate = 2007-078
-      48-48 constant wrongPadding = 0
-      48-48 constant localUsePresent = 1
-      48-48 g1param parameter = 167
-      48-49 unsigned localDefinitionNumber = 1
-      ======> section localDefinition (11,11,0)
-         ======> section mars_labeling (8,8,0)
-            49-50 codetable marsClass = 1 [Operational archive (mars/class.table) ] [mars.class]
-            50-51 codetable marsType = 2 [Analysis (mars/type.table) ] [ls.dataType, mars.type]
-            51-53 codetable marsStream = 1025 [Atmospheric model (mars/stream.table) ] [mars.stream]
-            53-57 ksec1expver experimentVersionNumber = 0001 [mars.expver]
-            57-57 constant SimulationsOf30Days = s3
-            57-57 constant TYPE_S3 = 22
-         <===== section mars_labeling
-         57-58 unsigned perturbationNumber = 0
-         58-59 unsigned numberOfForecastsInEnsemble = 0
-         59-60 pad padding_local1_1 = 1 {
-            00
-         } # pad padding_local1_1 
-      <===== section localDefinition
-      60-60 transient centreForTableNumber = 98
-      60-60 section_padding localExtensionPadding = 0 {}
-      60-60 section_padding section1Padding = 0 {}
-      60-60 padtoeven evenpadding_sec1 = 0 {}
-      60-60 concept grib1_short_name = 2T [ls.short_name]
-      60-60 concept grib1_name = 2_metre_temperature [name]
-      60-60 concept grib1_units = K [units]
-   <===== section section_1
-   60-60 bit gridDescriptionSectionPresent = 1 [GDSPresent]
-   60-60 bit bitmapPresent = 0 [bitmapSectionPresent]
-   ======> section section_2 (32,32,0)
-      60-60 position offsetSection2 = 60
-      60-63 section_length section2Length = 32
-      63-64 unsigned numberOfVerticalCoordinateValues = 0 [NV, numberOfCoordinatesValues]
-      64-64 constant neitherPresent = 255
-      64-65 unsigned pvlLocation = 255
-      65-66 codetable dataRepresentationType = 0 [Latitude/Longitude Grid (grib1/6.table) ]
-      ======> section dataRepresentation (22,22,0)
-         66-66 constant gridDefinitionTemplateNumber = 0
-         66-68 unsigned numberOfPointsAlongAParallel = 16 [Ni]
-         68-70 unsigned numberOfPointsAlongAMeridian = 31 [Nj]
-         70-73 signed latitudeOfFirstGridPoint = 60000 [La1]
-         73-73 scale latitudeOfFirstGridPointInDegrees = 60 [geography.laFirst]
-         73-76 signed longitudeOfFirstGridPoint = 0 [Lo1]
-         76-76 scale longitudeOfFirstGridPointInDegrees = 0 [geography.loFirst]
-         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]
-         77-77 bit earthIsOblate = 0
-         77-77 bit resolutionAndComponentFlags3 = 0
-         77-77 bit resolutionAndComponentFlags4 = 0
-         77-77 bit uvRelativeToGrid = 0
-         77-77 bit resolutionAndComponentFlags6 = 0
-         77-77 bit resolutionAndComponentFlags7 = 0
-         77-77 bit resolutionAndComponentFlags8 = 0
-         77-80 signed latitudeOfLastGridPoint = 0 [La2]
-         80-80 scale latitudeOfLastGridPointInDegrees = 0 [geography.laLast]
-         80-83 signed longitudeOfLastGridPoint = 30000 [Lo2]
-         83-83 transient longitudeOfLastGridPointG1to2 = 30000
-         83-83 scale longitudeOfLastGridPointInDegrees = 30 [geography.loLast]
-         83-85 unsigned iDirectionIncrement = 2000 [Di]
-         85-87 unsigned jDirectionIncrement = 2000 [Dj]
-         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]
-         88-88 bit iScansNegatively = 0
-         88-88 bit jScansPositively = 0
-         88-88 bit jPointsAreConsecutive = 0
-         88-88 constant iScansPositively = 1
-         88-88 bit scanningMode4 = 0
-         88-88 bit scanningMode5 = 0
-         88-88 bit scanningMode6 = 0
-         88-88 bit scanningMode7 = 0
-         88-88 bit scanningMode8 = 0
-         88-88 latlon_increment jDirectionIncrementInDegrees = 2 [geography.jInc, geography.gridNorthSouth]
-         88-88 latlon_increment iDirectionIncrementInDegrees = 2 [geography.iInc, geography.gridWestEast]
-         ----> iterator ITERATOR 
-      <===== section dataRepresentation
-      88-88 position endGridDefinition = 88
-      88-88 transient PVPresent = 0
-      88-88 position offsetBeforePV = 88
-      88-88 position offsetBeforePL = 88
-      88-88 transient PLPresent = 0 [reducedGrid]
-      88-92 padto padding_sec2_1 = 4 {
-         00, 00, 00, 00
-      } # padto padding_sec2_1 
-      92-92 padtoeven padding_sec2_3 = 0 {}
-   <===== section section_2
-   92-92 position endOfHeadersMaker = 92
-   92-92 transient missingValue = 9999
-   92-92 constant tableReference = 0
-   ======> section section_4 (1004,1004,0)
-      92-92 position offsetSection4 = 92
-      92-95 g1_section4_length section4Length = 1004
-      95-95 g1_half_byte_codeflag halfByte = 8
-      95-96 codeflag dataFlag = 8 [00001000:(1=0)  Grid-point data;(2=0)  Simple packing;(3=0)  Floating point values are represented;(4=0)  No additional flags at octet 14:grib1/11.table]
-      96-98 signed binaryScaleFactor = -10
-      98-102 ibmfloat referenceValue = 269.587
-      102-103 unsigned numberOfBitsContainingEachPackedValue = 16 [nbp, numberOfBits, bitsPerValue]
-      103-103 bit sphericalHarmonics = 0
-      103-103 bit complexPacking = 0
-      103-103 bit integerPointValues = 0
-      103-103 bit additionalFlagPresent = 0
-      ======> section dataValues (993,993,0)
-         103-103 constant dataRepresentationTemplateNumber = 0
-         103-103 position offsetBeforeData = 103
-         103-103 constant bitMapIndicator = 255
-         103-1096 data_g1simple_packing values = (496,993) {
-               277.704,    277.797,    278.103,    274.598,    269.587,    278.345,    277.213,     278.19, 
-               277.853,    276.747,    274.361,    273.636,    274.593,    273.782,    273.016,    274.316, 
-               278.492,    278.792,    278.836,    278.333,    277.389,    278.525,    278.175,    277.255, 
-               277.383,    278.047,    277.877,    276.213,     273.99,    278.333,     278.58,    277.642, 
-               278.865,    278.997,    278.509,    278.983,    279.527,    279.414,      278.8,    278.749, 
-               278.895,    279.056,    278.699,    278.426,    276.601,    277.491,    279.646,    279.198, 
-               279.108,    279.156,    279.406,    279.527,    280.344,    280.869,    279.951,    281.621, 
-               281.221,    280.676,    281.049,    280.354,    279.025,    278.192,     280.05,    280.375, 
-                280.68,    281.269,    281.406,    281.483,    279.454,    280.641,    282.984,    282.578, 
-               281.797,    281.542,    281.854,      281.5,    279.917,    280.529,    282.008,    281.102, 
-               282.223,    282.727,    280.315,    278.539,    280.066,    280.789,    280.517,    282.883, 
-               283.897,    285.161,    285.779,    285.847,    281.973,    282.869,    281.926,    280.816, 
-                282.48,    281.894,    281.035,    281.722
-            ... 396 more values
-         } # data_g1simple_packing values 
-      <===== section dataValues
-      1096-1096 size valuesCount = 496
-      1096-1096 concept typeOfGrid = regular_ll [ls.gridType]
-      1096-1096 concept typeOfPacking = grid_simple [ls.packingType, dataRepresentation]
-      1096-1096 padtoeven padding_sec4_1 = 0 {}
-   <===== section section_4
-   ======> section section_5 (4,4,0)
-      ----> label gribSection5 
-      1096-1096 position offsetSection5 = 1096
-      1096-1100 ascii 7777 = 7777
-   <===== section section_5
-<===== section GRIB
-

-
-
- How to obtain a C code example from a grib file.
-
- grib_dump -C ../data/regular_latlon_surface.grib1
-
#include <grib_api.h>
-
-/* This code was generated automatically */
-
-
-int main(int argc,const char** argv)
-{
-    grib_handle *h     = NULL;
-    size_t size        = 0;
-    double* v          = NULL;
-    FILE* f            = NULL;
-    const char* p      = NULL;
-    const void* buffer = NULL;
-
-    if(argc != 2) {
-       fprintf(stderr,"usage: %s out\n",argv[0]);
-        exit(1);
-    }
-
-    h = grib_handle_new_from_template(NULL,"GRIB2");
-    if(!h) {
-        fprintf(stderr,"Cannot create grib handle\n");
-        exit(1);
-    }
-
-
-    /* empty */
-
-    GRIB_CHECK(grib_set_long(h,"editionNumber",1),0);
-    GRIB_CHECK(grib_set_long(h,"gribTablesVersionNo",128),0);
-
-    /* 98 = European Center for Medium-Range Weather Forecasts (grib1/0.table)  */
-    GRIB_CHECK(grib_set_long(h,"identificationOfOriginatingGeneratingCentre",98),0);
-
-    GRIB_CHECK(grib_set_long(h,"generatingProcessIdentifier",128),0);
-    GRIB_CHECK(grib_set_long(h,"gridDefinition",255),0);
-
-    /* 128 = 10000000
-    (1=1)  Section 2 included
-    (2=0)  Section 3 omited
-    See grib1/1.table */
-    GRIB_CHECK(grib_set_long(h,"section1Flags",128),0);
-
-
-    /* 167 = 2T 2 metre temperature K (grib1/2.98.128.table)  */
-    GRIB_CHECK(grib_set_long(h,"indicatorOfParameter",167),0);
-
-
-    /* 1 = Surface (of the Earth, which includes sea surface) (grib1/3.table)  */
-    GRIB_CHECK(grib_set_long(h,"indicatorOfTypeOfLevel",1),0);
-
-    GRIB_CHECK(grib_set_long(h,"lev",0),0);
-    GRIB_CHECK(grib_set_long(h,"yearOfCentury",7),0);
-    GRIB_CHECK(grib_set_long(h,"month",3),0);
-    GRIB_CHECK(grib_set_long(h,"day",18),0);
-    GRIB_CHECK(grib_set_long(h,"hour",12),0);
-    GRIB_CHECK(grib_set_long(h,"minute",0),0);
-
-    /* 1 = Hour (grib1/4.table)  */
-    GRIB_CHECK(grib_set_long(h,"indicatorOfUnitOfTimeRange",1),0);
-
-    GRIB_CHECK(grib_set_long(h,"periodOfTime",0),0);
-    GRIB_CHECK(grib_set_long(h,"periodOfTimeIntervals",0),0);
-
-    /* 0 = Forecast product valid at reference time + P1 (P1>0) (grib1/5.table)  */
-    GRIB_CHECK(grib_set_long(h,"timeRangeIndicator",0),0);
-
-    GRIB_CHECK(grib_set_long(h,"numberIncludedInAverage",0),0);
-    GRIB_CHECK(grib_set_long(h,"numberMissingFromAveragesOrAccumulations",0),0);
-    GRIB_CHECK(grib_set_long(h,"centuryOfReferenceTimeOfData",21),0);
-
-    /* 0 = Absent (grib1/0.table)  */
-    GRIB_CHECK(grib_set_long(h,"identificationOfOriginatingGeneratingSubCentre",0),0);
-
-    GRIB_CHECK(grib_set_long(h,"decimalScaleFactor",0),0);
-    GRIB_CHECK(grib_set_long(h,"localDefinitionNumber",1),0);
-
-    /* 1 = Operational archive (mars/class.table)  */
-    GRIB_CHECK(grib_set_long(h,"marsClass",1),0);
-
-
-    /* 2 = Analysis (mars/type.table)  */
-    GRIB_CHECK(grib_set_long(h,"marsType",2),0);
-
-
-    /* 1025 = Atmospheric model (mars/stream.table)  */
-    GRIB_CHECK(grib_set_long(h,"marsStream",1025),0);
-
-    p    = "0001";
-    size = strlen(p)+1;
-    GRIB_CHECK(grib_set_string(h,"experimentVersionNumber",p,&size),0);
-    GRIB_CHECK(grib_set_long(h,"perturbationNumber",0),0);
-    GRIB_CHECK(grib_set_long(h,"numberOfForecastsInEnsemble",0),0);
-    GRIB_CHECK(grib_set_long(h,"numberOfVerticalCoordinateValues",0),0);
-    GRIB_CHECK(grib_set_long(h,"pvlLocation",255),0);
-
-    /* 0 = Latitude/Longitude Grid (grib1/6.table)  */
-    GRIB_CHECK(grib_set_long(h,"dataRepresentationType",0),0);
-
-    GRIB_CHECK(grib_set_long(h,"numberOfPointsAlongAParallel",16),0);
-    GRIB_CHECK(grib_set_long(h,"numberOfPointsAlongAMeridian",31),0);
-    GRIB_CHECK(grib_set_long(h,"latitudeOfFirstGridPoint",60000),0);
-    GRIB_CHECK(grib_set_long(h,"longitudeOfFirstGridPoint",0),0);
-
-    /* 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
-    See grib1/7.table */
-    GRIB_CHECK(grib_set_long(h,"resolutionAndComponentFlags",128),0);
-
-    GRIB_CHECK(grib_set_long(h,"latitudeOfLastGridPoint",0),0);
-    GRIB_CHECK(grib_set_long(h,"longitudeOfLastGridPoint",30000),0);
-    GRIB_CHECK(grib_set_long(h,"iDirectionIncrement",2000),0);
-    GRIB_CHECK(grib_set_long(h,"jDirectionIncrement",2000),0);
-
-    /* 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 
-    See grib1/8.table */
-    GRIB_CHECK(grib_set_long(h,"scanningMode",0),0);
-
-
-    /* ITERATOR */
-
-
-    /* 8 = 00001000
-    (1=0)  Grid-point data
-    (2=0)  Simple packing
-    (3=0)  Floating point values are represented
-    (4=0)  No additional flags at octet 14
-    See grib1/11.table */
-    GRIB_CHECK(grib_set_long(h,"dataFlag",8),0);
-
-    GRIB_CHECK(grib_set_long(h,"numberOfBitsContainingEachPackedValue",16),0);
-    size = 496;
-    v    = (double*)calloc(size,sizeof(double));
-    if(!v) {
-        fprintf(stderr,"failed to allocate %d bytes\n",size*sizeof(double));
-        exit(1);
-    }
-
-    v[   0] = 277.704; v[   1] = 277.797; v[   2] = 278.103; v[   3] = 274.598;
-    v[   4] = 269.587; v[   5] = 278.345; v[   6] = 277.213; v[   7] =  278.19;
-    v[   8] = 277.853; v[   9] = 276.747; v[  10] = 274.361; v[  11] = 273.636;
-    v[  12] = 274.593; v[  13] = 273.782; v[  14] = 273.016; v[  15] = 274.316;
-    v[  16] = 278.492; v[  17] = 278.792; v[  18] = 278.836; v[  19] = 278.333;
-    v[  20] = 277.389; v[  21] = 278.525; v[  22] = 278.175; v[  23] = 277.255;
-    v[  24] = 277.383; v[  25] = 278.047; v[  26] = 277.877; v[  27] = 276.213;
-    v[  28] =  273.99; v[  29] = 278.333; v[  30] =  278.58; v[  31] = 277.642;
-    v[  32] = 278.865; v[  33] = 278.997; v[  34] = 278.509; v[  35] = 278.983;
-    v[  36] = 279.527; v[  37] = 279.414; v[  38] =   278.8; v[  39] = 278.749;
-    v[  40] = 278.895; v[  41] = 279.056; v[  42] = 278.699; v[  43] = 278.426;
-    v[  44] = 276.601; v[  45] = 277.491; v[  46] = 279.646; v[  47] = 279.198;
-    v[  48] = 279.108; v[  49] = 279.156; v[  50] = 279.406; v[  51] = 279.527;
-    v[  52] = 280.344; v[  53] = 280.869; v[  54] = 279.951; v[  55] = 281.621;
-    v[  56] = 281.221; v[  57] = 280.676; v[  58] = 281.049; v[  59] = 280.354;
-    v[  60] = 279.025; v[  61] = 278.192; v[  62] =  280.05; v[  63] = 280.375;
-    v[  64] =  280.68; v[  65] = 281.269; v[  66] = 281.406; v[  67] = 281.483;
-    v[  68] = 279.454; v[  69] = 280.641; v[  70] = 282.984; v[  71] = 282.578;
-    v[  72] = 281.797; v[  73] = 281.542; v[  74] = 281.854; v[  75] =   281.5;
-    v[  76] = 279.917; v[  77] = 280.529; v[  78] = 282.008; v[  79] = 281.102;
-    v[  80] = 282.223; v[  81] = 282.727; v[  82] = 280.315; v[  83] = 278.539;
-    v[  84] = 280.066; v[  85] = 280.789; v[  86] = 280.517; v[  87] = 282.883;
-    v[  88] = 283.897; v[  89] = 285.161; v[  90] = 285.779; v[  91] = 285.847;
-    v[  92] = 281.973; v[  93] = 282.869; v[  94] = 281.926; v[  95] = 280.816;
-    v[  96] =  282.48; v[  97] = 281.894; v[  98] = 281.035; v[  99] = 281.722;
-    v[ 100] = 279.978; v[ 101] = 284.138; v[ 102] = 287.234; v[ 103] = 287.831;
-    v[ 104] = 288.452; v[ 105] = 289.882; v[ 106] = 287.776; v[ 107] = 287.946;
-    v[ 108] = 281.466; v[ 109] = 284.771; v[ 110] = 283.343; v[ 111] = 282.477;
-    v[ 112] = 284.723; v[ 113] = 280.869; v[ 114] = 285.693; v[ 115] = 284.132;
-    v[ 116] = 276.881; v[ 117] = 283.388; v[ 118] = 287.295; v[ 119] = 286.764;
-    v[ 120] = 291.798; v[ 121] = 291.607; v[ 122] = 290.086; v[ 123] = 286.769;
-    v[ 124] =  284.24; v[ 125] = 280.884; v[ 126] = 286.866; v[ 127] = 284.694;
-    v[ 128] = 285.417; v[ 129] = 283.823; v[ 130] = 289.898; v[ 131] = 290.317;
-    v[ 132] = 287.031; v[ 133] = 287.949; v[ 134] = 289.263; v[ 135] = 289.869;
-    v[ 136] = 289.926; v[ 137] = 289.535; v[ 138] = 289.817; v[ 139] = 287.768;
-    v[ 140] = 290.394; v[ 141] = 290.294; v[ 142] = 287.069; v[ 143] = 281.759;
-    v[ 144] = 289.132; v[ 145] = 287.316; v[ 146] = 287.548; v[ 147] = 287.181;
-    v[ 148] = 287.645; v[ 149] = 289.492; v[ 150] = 288.956; v[ 151] = 286.634;
-    v[ 152] =   289.7; v[ 153] = 289.189; v[ 154] = 287.704; v[ 155] = 291.151;
-    v[ 156] = 286.208; v[ 157] = 291.093; v[ 158] = 284.818; v[ 159] = 282.097;
-    v[ 160] = 289.244; v[ 161] = 288.263; v[ 162] = 289.545; v[ 163] = 290.018;
-    v[ 164] = 289.881; v[ 165] = 290.215; v[ 166] = 289.999; v[ 167] = 289.447;
-    v[ 168] = 284.105; v[ 169] = 290.686; v[ 170] = 288.128; v[ 171] = 290.241;
-    v[ 172] = 289.116; v[ 173] = 289.576; v[ 174] =   291.8; v[ 175] =  286.35;
-    v[ 176] = 289.239; v[ 177] = 289.525; v[ 178] =  289.45; v[ 179] = 290.114;
-    v[ 180] = 290.301; v[ 181] = 289.429; v[ 182] = 290.005; v[ 183] = 287.195;
-    v[ 184] = 289.823; v[ 185] = 290.313; v[ 186] = 290.792; v[ 187] = 286.693;
-    v[ 188] = 291.941; v[ 189] = 290.783; v[ 190] = 290.818; v[ 191] = 287.234;
-    v[ 192] = 287.001; v[ 193] =  287.49; v[ 194] = 286.791; v[ 195] =  286.71;
-    v[ 196] = 287.182; v[ 197] =  290.49; v[ 198] = 290.322; v[ 199] = 289.957;
-    v[ 200] = 290.056; v[ 201] = 289.915; v[ 202] = 289.917; v[ 203] = 290.251;
-    v[ 204] = 290.502; v[ 205] = 290.782; v[ 206] = 291.367; v[ 207] = 291.025;
-    v[ 208] = 290.326; v[ 209] = 285.912; v[ 210] = 290.003; v[ 211] = 294.341;
-    v[ 212] = 294.048; v[ 213] = 291.771; v[ 214] = 290.675; v[ 215] = 291.203;
-    v[ 216] = 291.478; v[ 217] = 290.939; v[ 218] = 290.555; v[ 219] = 289.821;
-    v[ 220] = 290.126; v[ 221] = 291.021; v[ 222] = 291.243; v[ 223] = 290.761;
-    v[ 224] =  291.05; v[ 225] = 291.556; v[ 226] = 292.386; v[ 227] = 293.149;
-    v[ 228] = 293.301; v[ 229] = 291.821; v[ 230] = 290.157; v[ 231] = 293.427;
-    v[ 232] = 292.629; v[ 233] =  292.25; v[ 234] =  294.59; v[ 235] = 296.421;
-    v[ 236] =  296.16; v[ 237] = 290.221; v[ 238] = 290.882; v[ 239] = 290.864;
-    v[ 240] =  294.69; v[ 241] = 294.224; v[ 242] = 294.332; v[ 243] = 293.917;
-    v[ 244] = 292.863; v[ 245] = 293.005; v[ 246] = 292.814; v[ 247] = 295.443;
-    v[ 248] = 296.665; v[ 249] = 298.566; v[ 250] = 298.846; v[ 251] = 298.165;
-    v[ 252] = 297.105; v[ 253] = 294.729; v[ 254] = 294.968; v[ 255] = 293.305;
-    v[ 256] = 298.003; v[ 257] = 296.402; v[ 258] =  295.03; v[ 259] = 295.649;
-    v[ 260] = 295.811; v[ 261] = 297.203; v[ 262] = 298.222; v[ 263] =  297.12;
-    v[ 264] = 299.167; v[ 265] = 298.919; v[ 266] = 298.372; v[ 267] = 297.932;
-    v[ 268] =  296.47; v[ 269] = 295.208; v[ 270] = 294.647; v[ 271] = 294.034;
-    v[ 272] = 300.407; v[ 273] = 301.659; v[ 274] = 300.621; v[ 275] = 297.093;
-    v[ 276] = 295.676; v[ 277] = 298.434; v[ 278] = 298.906; v[ 279] = 302.369;
-    v[ 280] = 300.815; v[ 281] = 299.277; v[ 282] = 298.643; v[ 283] = 298.381;
-    v[ 284] = 296.632; v[ 285] = 294.887; v[ 286] = 295.411; v[ 287] = 293.665;
-    v[ 288] = 303.051; v[ 289] = 304.741; v[ 290] = 304.555; v[ 291] = 301.901;
-    v[ 292] = 301.846; v[ 293] = 300.793; v[ 294] = 302.141; v[ 295] = 300.521;
-    v[ 296] =  300.74; v[ 297] = 301.164; v[ 298] = 299.811; v[ 299] = 298.146;
-    v[ 300] = 298.443; v[ 301] = 293.905; v[ 302] = 295.545; v[ 303] = 296.185;
-    v[ 304] = 306.254; v[ 305] = 307.698; v[ 306] = 307.503; v[ 307] =  304.62;
-    v[ 308] = 304.458; v[ 309] = 303.097; v[ 310] =  303.69; v[ 311] = 303.482;
-    v[ 312] = 303.514; v[ 313] = 304.001; v[ 314] = 299.346; v[ 315] = 298.529;
-    v[ 316] = 297.935; v[ 317] = 295.495; v[ 318] = 295.846; v[ 319] = 296.122;
-    v[ 320] = 309.596; v[ 321] = 308.059; v[ 322] = 305.473; v[ 323] = 305.581;
-    v[ 324] =  306.11; v[ 325] = 303.994; v[ 326] = 304.602; v[ 327] = 304.286;
-    v[ 328] =  304.18; v[ 329] = 305.511; v[ 330] = 300.083; v[ 331] =  299.69;
-    v[ 332] = 297.061; v[ 333] = 296.252; v[ 334] = 296.508; v[ 335] = 298.427;
-    v[ 336] = 309.837; v[ 337] = 309.568; v[ 338] = 308.175; v[ 339] = 306.983;
-    v[ 340] = 307.399; v[ 341] = 303.002; v[ 342] = 303.582; v[ 343] = 303.765;
-    v[ 344] = 304.829; v[ 345] = 303.815; v[ 346] = 302.952; v[ 347] = 301.263;
-    v[ 348] = 296.397; v[ 349] = 298.184; v[ 350] = 297.765; v[ 351] = 299.807;
-    v[ 352] = 311.829; v[ 353] =  309.43; v[ 354] = 307.672; v[ 355] = 307.068;
-    v[ 356] = 306.384; v[ 357] = 304.862; v[ 358] = 304.397; v[ 359] = 303.944;
-    v[ 360] = 304.673; v[ 361] = 304.326; v[ 362] = 303.948; v[ 363] = 302.827;
-    v[ 364] = 297.377; v[ 365] = 296.722; v[ 366] = 298.711; v[ 367] = 300.744;
-    v[ 368] = 310.353; v[ 369] = 309.716; v[ 370] =  309.28; v[ 371] = 308.163;
-    v[ 372] = 306.711; v[ 373] =  305.75; v[ 374] =  304.74; v[ 375] = 305.384;
-    v[ 376] = 304.885; v[ 377] = 305.735; v[ 378] =  307.71; v[ 379] = 303.764;
-    v[ 380] = 303.073; v[ 381] =  300.87; v[ 382] = 300.858; v[ 383] = 302.205;
-    v[ 384] = 311.264; v[ 385] = 311.085; v[ 386] = 310.432; v[ 387] =  308.94;
-    v[ 388] = 305.619; v[ 389] =     307; v[ 390] = 306.413; v[ 391] = 307.649;
-    v[ 392] = 308.429; v[ 393] = 309.358; v[ 394] = 309.365; v[ 395] = 307.933;
-    v[ 396] =  306.15; v[ 397] = 305.126; v[ 398] = 305.611; v[ 399] = 303.336;
-    v[ 400] = 309.947; v[ 401] = 309.562; v[ 402] = 309.339; v[ 403] = 310.316;
-    v[ 404] = 308.055; v[ 405] = 307.565; v[ 406] = 310.605; v[ 407] =   308.4;
-    v[ 408] = 309.219; v[ 409] = 310.801; v[ 410] = 310.525; v[ 411] =  309.65;
-    v[ 412] = 306.611; v[ 413] = 306.033; v[ 414] = 307.988; v[ 415] = 308.941;
-    v[ 416] =   308.4; v[ 417] = 307.615; v[ 418] = 307.404; v[ 419] = 308.381;
-    v[ 420] = 309.778; v[ 421] = 311.715; v[ 422] = 308.409; v[ 423] = 307.156;
-    v[ 424] = 308.715; v[ 425] = 307.201; v[ 426] = 310.448; v[ 427] =  309.24;
-    v[ 428] = 306.716; v[ 429] = 307.307; v[ 430] = 309.062; v[ 431] = 309.776;
-    v[ 432] = 303.033; v[ 433] =  302.76; v[ 434] = 303.071; v[ 435] = 306.578;
-    v[ 436] = 309.819; v[ 437] = 305.046; v[ 438] = 309.764; v[ 439] = 307.857;
-    v[ 440] = 301.171; v[ 441] = 302.783; v[ 442] = 301.107; v[ 443] = 300.429;
-    v[ 444] = 303.189; v[ 445] = 304.585; v[ 446] = 303.709; v[ 447] = 307.132;
-    v[ 448] = 302.315; v[ 449] = 302.922; v[ 450] = 302.593; v[ 451] = 302.476;
-    v[ 452] = 302.132; v[ 453] = 305.953; v[ 454] = 300.132; v[ 455] = 301.361;
-    v[ 456] = 302.355; v[ 457] = 304.042; v[ 458] = 302.175; v[ 459] = 297.057;
-    v[ 460] = 296.072; v[ 461] = 296.644; v[ 462] = 296.895; v[ 463] =  296.22;
-    v[ 464] = 300.897; v[ 465] = 300.839; v[ 466] = 300.899; v[ 467] = 301.941;
-    v[ 468] = 302.709; v[ 469] = 301.495; v[ 470] = 302.248; v[ 471] = 301.468;
-    v[ 472] = 303.598; v[ 473] = 304.599; v[ 474] = 299.779; v[ 475] =   297.9;
-    v[ 476] = 295.564; v[ 477] = 296.015; v[ 478] = 293.688; v[ 479] = 294.294;
-    v[ 480] = 300.801; v[ 481] = 300.724; v[ 482] = 301.204; v[ 483] = 302.463;
-    v[ 484] = 302.885; v[ 485] = 305.413; v[ 486] = 305.523; v[ 487] = 303.672;
-    v[ 488] = 304.547; v[ 489] = 303.334; v[ 490] = 301.616; v[ 491] = 298.654;
-    v[ 492] = 297.975; v[ 493] = 295.379; v[ 494] =  293.83; v[ 495] = 300.082;
-   
-    GRIB_CHECK(grib_set_double_array(h,"values",v,size),0);
-    free(v);
-
-    /* gribSection5 */
-
-/* Save the message */
-
-    f = fopen(argv[1],"w");
-    if(!f) {
-        perror(argv[1]);
-        exit(1);
-    }
-
-    GRIB_CHECK(grib_get_message(h,&buffer,&size),0);
-
-    if(fwrite(buffer,1,size,f) != size) {
-        perror(argv[1]);
-        exit(1);
-    }
-
-    if(fclose(f)) {
-        perror(argv[1]);
-        exit(1);
-    }
-
-    grib_handle_delete(h);
-    return 0;
-}
-

-
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_dump.html b/html/grib_dump.html deleted file mode 100644 index f30b6a441..000000000 --- a/html/grib_dump.html +++ /dev/null @@ -1,242 +0,0 @@ - - -grib_api: grib_dump - - - - -
- -
-

grib_dump

-DESCRIPTION

-Dump the content of a grib file in different formats.

-USAGE

-grib_dump [options] grib_file grib_file ...

-OPTIONS

--O
- Octet mode. WMO documentation style dump.
-
- -D
- Debug mode.
-
- -P key[:{s/d/l}],key[:{s/d/l}],...
- As -p adding the declared keys to the default list.
-
- -d
- Print all data values. Available only in C mode
-
- -C
- C code mode. A C code program generating the grib message is dumped.
-
- -t
- Print type information.
-
- -H
- Print octet content in hexadecimal format.
-
- -a
- Dump aliases.
-
- -w key[:{s/d/l}]{=/!=}value,key[:{s/d/l}]{=/!=}value,...
- Where clause. Grib messages are processed only if they match all the key/value constraints. A valid constraint is of type key=value or key!=value. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be specified. Default type is string.
-
- -M
- Multi-grib support off. Turn off support for multiple fields in single grib message
-
- -7
- Does not fail when the message has wrong length
-
- -V
- Version.
-
- -G
- GRIBEX compatibility mode.
-
-

-grib_dump examples

-
    -
  1. To dump in a WMO documentation style with hexadecimal octet values (-H)
    -
    ->grib_dump -H ../data/reduced_gaussian_model_level.grib1
    -

    -
  2. To obtain all the key names available in a grib file.
    -
    -> grib_dump -D ../data/regular_latlon_surface.grib1
    -

    -
  3. To obtain a C code example from a grib file.
    -
    >grib_dump -C ../data/regular_latlon_surface.grib1
    -#include <grib_api.h>
    -
    -/* This code was generated automatically */
    -
    -
    -int main(int argc,const char** argv)
    -{
    -    grib_handle *h     = NULL;
    -    size_t size        = 0;
    -    double* vdouble    = NULL;
    -    long* vlong        = NULL;
    -    FILE* f            = NULL;
    -    const char* p      = NULL;
    -    const void* buffer = NULL;
    -
    -    if(argc != 2) {
    -       fprintf(stderr,"usage: %s out\n",argv[0]);
    -        exit(1);
    -    }
    -
    -    h = grib_handle_new_from_samples(NULL,"GRIB1");
    -    if(!h) {
    -        fprintf(stderr,"Cannot create grib handle\n");
    -        exit(1);
    -    }
    -
    -    GRIB_CHECK(grib_set_long(h,"editionNumber",1),0);
    -    GRIB_CHECK(grib_set_long(h,"table2Version",128),0);
    -
    -    /* 98 = European Center for Medium-Range Weather Forecasts (grib1/0.table)  */
    -    GRIB_CHECK(grib_set_long(h,"centre",98),0);
    -
    -    GRIB_CHECK(grib_set_long(h,"generatingProcessIdentifier",130),0);
    -    GRIB_CHECK(grib_set_long(h,"gridDefinition",255),0);
    -
    -    /* 128 = 10000000
    -    (1=1)  Section 2 included
    -    (2=0)  Section 3 omited
    -    See grib1/1.table */
    -    GRIB_CHECK(grib_set_long(h,"section1Flags",128),0);
    -
    -
    -    /* 167 = 2 metre temperature  (K)  (grib1/2.98.128.table)  */
    -    GRIB_CHECK(grib_set_long(h,"indicatorOfParameter",167),0);
    -
    -
    -    /* 1 = Surface  (of the Earth, which includes sea surface)  (grib1/3.table)  */
    -    GRIB_CHECK(grib_set_long(h,"indicatorOfTypeOfLevel",1),0);
    -
    -    GRIB_CHECK(grib_set_long(h,"level",0),0);
    -    GRIB_CHECK(grib_set_long(h,"yearOfCentury",8),0);
    -    GRIB_CHECK(grib_set_long(h,"month",2),0);
    -    GRIB_CHECK(grib_set_long(h,"day",6),0);
    -    GRIB_CHECK(grib_set_long(h,"hour",12),0);
    -    GRIB_CHECK(grib_set_long(h,"minute",0),0);
    -
    -    /* 1 = Hour (grib1/4.table)  */
    -    GRIB_CHECK(grib_set_long(h,"unitOfTimeRange",1),0);
    -
    -    GRIB_CHECK(grib_set_long(h,"P1",0),0);
    -    GRIB_CHECK(grib_set_long(h,"P2",0),0);
    -
    -    /* 0 = Forecast product valid at reference time + P1  (P1>0)  (grib1/5.table)  */
    -    GRIB_CHECK(grib_set_long(h,"timeRangeIndicator",0),0);
    -
    -    GRIB_CHECK(grib_set_long(h,"numberIncludedInAverage",0),0);
    -    GRIB_CHECK(grib_set_long(h,"numberMissingFromAveragesOrAccumulations",0),0);
    -    GRIB_CHECK(grib_set_long(h,"centuryOfReferenceTimeOfData",21),0);
    -
    -    /* 0 = Unknown code table entry (grib1/0.ecmf.table)  */
    -    GRIB_CHECK(grib_set_long(h,"subCentre",0),0);
    -
    -    GRIB_CHECK(grib_set_long(h,"decimalScaleFactor",0),0);
    -
    -    /* 1 = MARS labelling or ensemble forecast data (grib1/localDefinitionNumber.98.table)  */
    -    GRIB_CHECK(grib_set_long(h,"localDefinitionNumber",1),0);
    -
    -
    -    /* 1 = Operational archive (mars/class.table)  */
    -    GRIB_CHECK(grib_set_long(h,"marsClass",1),0);
    -
    -
    -    /* 2 = Analysis (mars/type.table)  */
    -    GRIB_CHECK(grib_set_long(h,"marsType",2),0);
    -
    -
    -    /* 1025 = Atmospheric model (mars/stream.table)  */
    -    GRIB_CHECK(grib_set_long(h,"marsStream",1025),0);
    -
    -    p    = "0001";
    -    size = strlen(p)+1;
    -    GRIB_CHECK(grib_set_string(h,"experimentVersionNumber",p,&size),0);
    -    GRIB_CHECK(grib_set_long(h,"perturbationNumber",0),0);
    -    GRIB_CHECK(grib_set_long(h,"numberOfForecastsInEnsemble",0),0);
    -    GRIB_CHECK(grib_set_long(h,"numberOfVerticalCoordinateValues",0),0);
    -    GRIB_CHECK(grib_set_long(h,"pvlLocation",255),0);
    -
    -    /* 0 = Latitude/Longitude Grid (grib1/6.table)  */
    -    GRIB_CHECK(grib_set_long(h,"dataRepresentationType",0),0);
    -
    -    GRIB_CHECK(grib_set_long(h,"Ni",16),0);
    -    GRIB_CHECK(grib_set_long(h,"Nj",31),0);
    -    GRIB_CHECK(grib_set_long(h,"latitudeOfFirstGridPoint",60000),0);
    -    GRIB_CHECK(grib_set_long(h,"longitudeOfFirstGridPoint",0),0);
    -
    -    /* 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
    -    See grib1/7.table */
    -    GRIB_CHECK(grib_set_long(h,"resolutionAndComponentFlags",128),0);
    -
    -    GRIB_CHECK(grib_set_long(h,"latitudeOfLastGridPoint",0),0);
    -    GRIB_CHECK(grib_set_long(h,"longitudeOfLastGridPoint",30000),0);
    -    GRIB_CHECK(grib_set_long(h,"iDirectionIncrement",2000),0);
    -    GRIB_CHECK(grib_set_long(h,"jDirectionIncrement",2000),0);
    -
    -    /* 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 
    -    See grib1/8.table */
    -    GRIB_CHECK(grib_set_long(h,"scanningMode",0),0);
    -
    -
    -    /* ITERATOR */
    -
    -
    -    /* NEAREST */
    -
    -    GRIB_CHECK(grib_set_long(h,"bitsPerValue",16),0);
    -    GRIB_CHECK(grib_set_long(h,"sphericalHarmonics",0),0);
    -    GRIB_CHECK(grib_set_long(h,"complexPacking",0),0);
    -    GRIB_CHECK(grib_set_long(h,"integerPointValues",0),0);
    -    GRIB_CHECK(grib_set_long(h,"additionalFlagPresent",0),0);
    -
    -    /* gribSection5 */
    -
    -/* Save the message */
    -
    -    f = fopen(argv[1],"w");
    -    if(!f) {
    -        perror(argv[1]);
    -        exit(1);
    -    }
    -
    -    GRIB_CHECK(grib_get_message(h,&buffer,&size),0);
    -
    -    if(fwrite(buffer,1,size,f) != size) {
    -        perror(argv[1]);
    -        exit(1);
    -    }
    -
    -    if(fclose(f)) {
    -        perror(argv[1]);
    -        exit(1);
    -    }
    -
    -    grib_handle_delete(h);
    -    return 0;
    -}
    -

    -
-
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_dump_examples.html b/html/grib_dump_examples.html deleted file mode 100644 index e44ec3c88..000000000 --- a/html/grib_dump_examples.html +++ /dev/null @@ -1,21 +0,0 @@ - - -grib_api: grib_dump examples - - - - -
- -
-

grib_dump examples

With the -O option you can get only the keys actually coded into the message, with the -a option the aliases of each key are printed. grib_dump -Oa "grib_file"
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_examples.html b/html/grib_examples.html deleted file mode 100644 index fe57c0be9..000000000 --- a/html/grib_examples.html +++ /dev/null @@ -1,34 +0,0 @@ - - -grib_api: Grib API examples - - - - -
- -
-

Grib API examples

The main features of the grib_api are explained here through some simple examples that can be taken as a starting point to write more complex programs.
-

-Fortran 90

- -

-C

- -

-Fortran 77

- -
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_filter.html b/html/grib_filter.html deleted file mode 100644 index d054d9845..000000000 --- a/html/grib_filter.html +++ /dev/null @@ -1,124 +0,0 @@ - - -grib_api: grib_filter - - - - -
- -
-

grib_filter

-DESCRIPTION

-Apply the rules defined in rules_file to each grib message in the grib files provided as arguments.

-USAGE

-grib_filter [options] rules_file grib_file grib_file ...

-OPTIONS

--f
- Force. Force the execution not to fail on error.
-
- -o output_grib_file
- Output grib is written to ouput_grib_file. If an ouput grib file is required and -o is not used, theouput grib is written to filtered.out
-
- -M
- Multi-grib support off. Turn off support for multiple fields in single grib message
-
- -V
- Version.
-
- -g
- Copy GTS header.
-
- -G
- GRIBEX compatibility mode.
-
- -7
- Does not fail when the message has wrong length
-
- -v
- Verbose.
-
-

-grib_filter examples

-
    -
  1. The rules accepted by grib_filter are different from the grib_convert rules due to the kind of work grib_filter it is supposed to do.
    - The main difference between grib_filter and grib_convert is that the convert is a 1 field in input 1 field in output tool, while the filter is a 1 field in input as many field you need in output. At this aim the filter syntax allows a write in the form: write "filename". So that it is possible repeating as many write you need or using a parametrised write to send the output to many files.
    - The grib_filter processes sequentially all the grib messages contained in the input file and it applies the rules to each one.
    - Since the filename used in the write statement can contain some key values, taken from the grib processed when applying the "write rule", several files are produced in output containing fields with the same value of the keys used in the file name.
    - Indeed if we write a rules_file containing the only statement:
    -
    -
    -write "../data/split/[centre]_[date]_[dataType]_[levelType].grib[editionNumber]";
    -

    - Applying this rules_file to the ../data/tigge_pf_ecmwf.grib2 grib file we obtain several files in the ../data/split directory containting fields splitted according their keys values
    -
    ->grib_filter rules_file ../data/tigge_pf_ecmwf.grib2
    ->ls ../data/split
    -ecmf_20060619_pf_sfc.grib2
    -ecmf_20060630_pf_sfc.grib2
    -ecmf_20070122_pf_pl.grib2
    -ecmf_20070122_pf_pt.grib2
    -ecmf_20070122_pf_pv.grib2
    -ecmf_20070122_pf_sfc.grib2
    -

    -
  2. The key values in the file name can also be obtained in a different format by indicating explicitly the type required after a colon. -The following statement works in a slightly different way from the previous example, including in the output file name the long values for centre and dataType.
    -
    -write "../data/split/[centre:l]_[date]_[dataType:l]_[levelType].grib[editionNumber]";
    -

    - Running the same command again we obtain a different list of files.
    -
    ->grib_filter rules_file ../data/tigge_pf_ecmwf.grib2
    ->ls ../data/split
    -98_20060619_4_sfc.grib2
    -98_20060630_4_sfc.grib2
    -98_20070122_4_pl.grib2
    -98_20070122_4_pt.grib2
    -98_20070122_4_pv.grib2
    -98_20070122_4_sfc.grib2
    -

    -
  3. Other statements are allowed in the grib_filter syntax: -A complex example of grib_filter rules is the following to change temperature in a grib edition 1 file.
    -# Temperature
    -if ( level == 850 && indicatorOfParameter == 11 ) {
    -    print "found indicatorOfParameter=[indicatorOfParameter] level=[level] date=[date]";
    -    transient oldtype = type ;
    -    set identificationOfOriginatingGeneratingSubCentre=98;
    -    set gribTablesVersionNo = 128;
    -    set indicatorOfParameter = 130;
    -    set localDefinitionNumber=1;
    -    set marsClass="od";
    -    set marsStream="kwbc";
    -    # Negatively/Positively Perturbed Forecast
    -    if ( oldtype == 2 || oldtype == 3 ) {
    -      set marsType="pf";
    -      set experimentVersionNumber="4001";
    -    }
    -    # Control Forecast
    -    if ( oldtype == 1 ) {
    -      set marsType="cf";
    -      set experimentVersionNumber="0001";
    -    }
    -    set numberOfForecastsInEnsemble=11;
    -    write;
    -    print "indicatorOfParameter=[indicatorOfParameter] level=[level] date=[date]";
    -    print;
    -}
    -

    -
-
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_get.html b/html/grib_get.html deleted file mode 100644 index ee8b0aaaf..000000000 --- a/html/grib_get.html +++ /dev/null @@ -1,80 +0,0 @@ - - -grib_api: grib_get - - - - -
- -
-

grib_get

-DESCRIPTION

-Get values of some keys from a grib file. It is similar to grib_ls, but fails returning an error code when an error occurs (e.g. key not found).

-USAGE

-grib_get [options] grib_file grib_file ...

-OPTIONS

--f
- Force. Force the execution not to fail on error.
-
- -p key[:{s/d/l}],key[:{s/d/l}],...
- Declaration of keys to print. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be requested. Default type is string.
-
- -F format
- C style format for floating point values.
-
- -l Latitude,Longitude[,MODE,file]
- Value close to the point of a Latitude/Longitude. Allowed values for MODE are: 4 (4 values in the nearest points are printed) Default 1 (the value at the nearest point is printed) file (file is used as mask. The closer point with mask value>=0.5 is printed)
-
- -P key[:{s/d/l}],key[:{s/d/l}],...
- As -p adding the declared keys to the default list.
-
- -w key[:{s/d/l}]{=/!=}value,key[:{s/d/l}]{=/!=}value,...
- Where clause. Grib messages are processed only if they match all the key/value constraints. A valid constraint is of type key=value or key!=value. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be specified. Default type is string.
-
- -n namespace
- All the keys belonging to namespace are printed.
-
- -V
- Version.
-
- -W width
- Minimum width of each column in output. Default is 10.
-
- -m
- Mars keys are printed.
-
- -M
- Multi-grib support off. Turn off support for multiple fields in single grib message
-
- -g
- Copy GTS header.
-
- -G
- GRIBEX compatibility mode.
-
- -7
- Does not fail when the message has wrong length
-
-

-grib_get examples

-
    -
  1. grib_get fails if a key is not found.
    -
    ->grib_get -p gribname ../data/tigge_pf_ecmwf.grib2
    -
    -
  2. To get the step of the first GRIB message in a file:
    -
    ->grib_get -w count=1 -p step ../data/tigge_pf_ecmwf.grib2
    -
-
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_get_data.html b/html/grib_get_data.html deleted file mode 100644 index bcb3446a2..000000000 --- a/html/grib_get_data.html +++ /dev/null @@ -1,67 +0,0 @@ - - -grib_api: grib_get_data - - - - -
- -
-

grib_get_data

-DESCRIPTION

-Print a latitude, longitude, data values list

-USAGE

-grib_get_data [options] grib_file grib_file ...

-OPTIONS

--M
- Multi-grib support off. Turn off support for multiple fields in single grib message
-
- -m missingValue
- The missing value is given through this option. Any string is allowed and it is printed in place of the missing values. Default is to skip the missing values.
-
- -p key[:{s/d/l}],key[:{s/d/l}],...
- Declaration of keys to print. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be requested. Default type is string.
-
- -R key1=relative_error1,key2=relative_error2,...
- Compare floating point values using the relative error as tolerance. key1=relative_error will compare key1 using relative_error1. all=relative_error will compare all the floating point keys using relative_error. Default all=0.
-
- -F format
- C style format for values. Default is "%.10e"
-
- -w key[:{s/d/l}]{=/!=}value,key[:{s/d/l}]{=/!=}value,...
- Where clause. Grib messages are processed only if they match all the key/value constraints. A valid constraint is of type key=value or key!=value. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be specified. Default type is string.
-
- -f
- Force. Force the execution not to fail on error.
-
- -G
- GRIBEX compatibility mode.
-
- -7
- Does not fail when the message has wrong length
-
- -V
- Version.
-
-

-grib_get_data examples

-
    -
  1. To get a latitude, longitude, value list, skipping the missing values(=9999)
    ->grib_get_data ../data/reduced_gaussian_model_level.grib2
    -
  2. If you want to define your missing value=1111 and to print the string missing in place of it
    ->grib_get_data -m 1111:missing ../data/reduced_gaussian_model_level.grib2
    -
  3. If you want to print the value of other keys with the data value list
    ->grib_get_data -p centre,level,step ../data/reduced_gaussian_model_level.grib2
    -
-
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_keys.html b/html/grib_keys.html deleted file mode 100644 index f0e550fa0..000000000 --- a/html/grib_keys.html +++ /dev/null @@ -1,153 +0,0 @@ - - -grib_api: grib_keys - - - - -
- -
-

grib_keys

-DESCRIPTION

-Lists the keys available for a type of grib (-T option) or in a grib message from a file (-F option).

-USAGE

-grib_keys [options]

-OPTIONS

--T type
- To print the keys available in the given grib type. For a list of the availeble types see -L option.
-
- -F file
- To print the keys available in the grib file.
-
- -x
- Print the extended set of keys.
-
- -c
- Print only coded keys.
-
- -L
- List of available types.
-
- -t
- Print type information.
-
- -a
- Dump aliases.
-
-

-grib_keys examples

-
    -
  1. With the -L option a list of the available templates is printed
    -
    -> grib_keys -L \n
    -GRIB1
    -GRIB2
    -reduced_gg_ml_grib2
    -reduced_gg_pl_grib1
    -reduced_gg_sfc_grib1
    -reduced_gg_ml_grib1
    -reduced_gg_pl_grib2
    -reduced_gg_sfc_grib2
    -reduced_gg_sfc_jpeg_grib2
    -reduced_ll_sfc_grib1
    -reduced_ll_sfc_grib2
    -regular_gg_ml_grib1
    -regular_gg_ml_grib2
    -regular_gg_pl_grib1
    -regular_gg_pl_grib2
    -regular_ll_sfc_grib1
    -regular_ll_sfc_grib2
    -regular_ll_pl_grib1
    -regular_ll_pl_grib2
    -sh_ml_grib1
    -sh_ml_grib2
    -sh_pl_grib1
    -sh_pl_grib2
    -

    -
  2. To print the standard set of key available for a given type
    -
    -> grib_keys -T regular_ll_sfc_grib1
    -=================== regular_ll_sfc_grib1 
    -editionNumber
    -====> SECTION 1 <==== 
    -table2Version
    -centre
    -generatingProcessIdentifier
    -indicatorOfParameter
    -marsParam (read only)
    -indicatorOfTypeOfLevel
    -level
    -timeRangeIndicator
    -subCentre
    -decimalScaleFactor
    -dataDate
    -dataTime
    -stepUnits
    -stepRange
    -startStep
    -endStep
    -localDefinitionNumber
    -marsClass
    -marsType
    -marsStream
    -experimentVersionNumber
    -perturbationNumber
    -numberOfForecastsInEnsemble
    -name (read only)
    -units (read only)
    -bitmapPresent
    -====> SECTION 2 <==== 
    -numberOfVerticalCoordinateValues
    -Ni
    -Nj
    -latitudeOfFirstGridPointInDegrees
    -longitudeOfFirstGridPointInDegrees
    -earthIsOblate
    -uvRelativeToGrid
    -latitudeOfLastGridPointInDegrees
    -longitudeOfLastGridPointInDegrees
    -DjInDegrees
    -DiInDegrees
    -iScansNegatively
    -jScansPositively
    -jPointsAreConsecutive
    -alternativeRowScanning (read only)
    -numberOfDataPoints (read only)
    -numberOfValues (read only)
    -missingValue
    -====> SECTION 4 <==== 
    -binaryScaleFactor (read only)
    -referenceValue (read only)
    -bitsPerValue
    -sphericalHarmonics
    -complexPacking
    -integerPointValues
    -additionalFlagPresent
    -typeOfPacking
    -values
    -numberOfCodedValues (read only)
    -maximum (read only)
    -minimum (read only)
    -average (read only)
    -numberOfMissing (read only)
    -standardDeviation (read only)
    -skewness (read only)
    -kurtosis (read only)
    -isConstant (read only)
    -typeOfGrid
    -getNumberOfValues (read only)
    -====> SECTION 5 <==== 
    -

    -
-
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_ls.html b/html/grib_ls.html deleted file mode 100644 index b622cf759..000000000 --- a/html/grib_ls.html +++ /dev/null @@ -1,95 +0,0 @@ - - -grib_api: grib_ls - - - - -
- -
-

grib_ls

-DESCRIPTION

-List content of grib files printing values of some keys. It does not fail when a key is not found.

-USAGE

-grib_ls [options] grib_file grib_file ...

-OPTIONS

--p key[:{s/d/l}],key[:{s/d/l}],...
- Declaration of keys to print. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be requested. Default type is string.
-
- -F format
- C style format for floating point values.
-
- -P key[:{s/d/l}],key[:{s/d/l}],...
- As -p adding the declared keys to the default list.
-
- -w key[:{s/d/l}]{=/!=}value,key[:{s/d/l}]{=/!=}value,...
- Where clause. Grib messages are processed only if they match all the key/value constraints. A valid constraint is of type key=value or key!=value. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be specified. Default type is string.
-
- -B order by directive
- Order by. The output will be ordered according the order by directive. Order by example: "step asc, centre desc" (step ascending and centre discending)
-
- -l Latitude,Longitude[,MODE,file]
- Value close to the point of a Latitude/Longitude. Allowed values for MODE are: 4 (4 values in the nearest points are printed) Default 1 (the value at the nearest point is printed) file (file is used as mask. The closer point with mask value>=0.5 is printed)
-
- -i index
- Data value corresponding to the given index is printed.
-
- -n namespace
- All the keys belonging to namespace are printed.
-
- -m
- Mars keys are printed.
-
- -V
- Version.
-
- -W width
- Minimum width of each column in output. Default is 10.
-
- -M
- Multi-grib support off. Turn off support for multiple fields in single grib message
-
- -g
- Copy GTS header.
-
- -G
- GRIBEX compatibility mode.
-
- -7
- Does not fail when the message has wrong length
-
-

-grib_ls examples

-
    -
  1. Without options a default list of keys is printed.
    - The default list is different depending on the type of grib message.
    -
    -> grib_ls ../data/reduced*.grib1 ../data/regular*.grib1 ../data/reduced*.grib2 \n
    -

    -
  2. To print offset and count number in file use the keys offset and count
    - Also the total count in a set of files is available as countTotal
    -
    -> grib_ls -p offset,count,countTotal ../data/reduced*.grib1
    -

    -
  3. To list only a subset of messages use the -w (where option).
    - Only the pressure levels are listed with the following line.
    -
    -> grib_ls -w levType=pl ../tigge_pf_ecmwf.grib2 
    -

    -
  4. All the grib messages not on pressure levels are listed as follows:
    -
    -> grib_ls -w levType!=pl ../tigge_pf_ecmwf.grib2 
    -

    -
-
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/grib_set.html b/html/grib_set.html deleted file mode 100644 index 9a1976e5a..000000000 --- a/html/grib_set.html +++ /dev/null @@ -1,103 +0,0 @@ - - -grib_api: grib_set - - - - -
- -
-

grib_set

-DESCRIPTION

-Sets key/value pairs in the input grib file and writes each message to the output_grib_file. It fails when an error occurs (e.g. key not found).

-USAGE

-grib_set [options] grib_file grib_file ... output_grib_file

-OPTIONS

--s key[:{s/d/l}]=value,key[:{s/d/l}]=value,...
- Key/values to set. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be defined. By default the native type is set.
-
- -r
- Repack data. Sometimes after setting some keys involving properties of the packing algorithm a repacking of data is needed. This repacking is performed setting this -r option.
-
- -d value
- Set all the data values to "value".
-
- -p key[:{s/d/l}],key[:{s/d/l}],...
- Declaration of keys to print. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be requested. Default type is string.
-
- -P key[:{s/d/l}],key[:{s/d/l}],...
- As -p adding the declared keys to the default list.
-
- -w key[:{s/d/l}]=value,key[:{s/d/l}]=value,...
- Where clause. Set is only executed for grib messages matching all the key/value constraints. If a grib message does not match the constraints it is copied unchanged to the output_grib_file. This behaviour can be changed setting the option -S. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be defined. Default type is string.
-
- -7
- Does not fail when the message has wrong length
-
- -S
- Strict. Only grib messages matching all the constraints are copied to the output file
-
- -V
- Version.
-
- -M
- Multi-grib support off. Turn off support for multiple fields in single grib message
-
- -g
- Copy GTS header.
-
- -G
- GRIBEX compatibility mode.
-
- -f
- Force. Force the execution not to fail on error.
-
- -v
- Verbose.
-
-

-grib_set examples

-
    -
  1. To set productDefinitionTemplateNumber=2 only for the fields with productDefinitionTemplateNumber=11
    -
    ->grib_set -s productDefinitionTemplateNumber=2 -w productDefinitionTemplateNumber=11 ../data/tigge_pf_ecmwf.grib2 out.grib2
    -

    -
  2. To set productDefinitionTemplateNumber=2 only for the fields for which productDefinitionTemplateNumber is not equal to 11
    -
    ->grib_set -s productDefinitionTemplateNumber=2 -w productDefinitionTemplateNumber!=11 tigge_pf_ecmwf.grib2 out.grib2
    -

    -
  3. When a key is not used all the bits of its value should be set to 1 to indicate that it is missing. Since the length (number of octet) is different from a key to another, the value that we have to code for missing keys is not unique. To give an easy way to set a key to missing a string "missing" or "MISSING" is accepted by grib_set as follows:
    -
    ->grib_set -s scaleFactorOfFirstFixedSurface=missing,scaledValueOfFirstFixedSurface=MISSING ../data/regular_latlon_surface.grib2 out.grib2
    -

    - Since some values can not be set to missing you can get an error for those keys.
  4. To set scaleFactorOfSecondFixedSurface to missing only for the fields for which scaleFactorOfSecondFixedSurface is not missing:
    -
    ->grib_set -s scaleFactorOfSecondFixedSurface=missing -w scaleFactorOfSecondFixedSurface!=missing tigge_pf_ecmwf.grib2 out.grib2
    -

    -
  5. It's possible to produce a grib edition 2 file from a grib edition 1 just changing the edition number with grib_set. At this stage of development all the geography parameters, level and time information is correctly translated, for the product definition extra set calls must be done. To do this properly grib_convert is suggested.
    -
    -grib_set -s editionNumber=2 ../data/reduced_gaussian_pressure_level.grib1
    -

    -
  6. With grib edition 2 is possible to compress data using the jpeg algorithm. To change packing algorithm from grid_simple (simple packing) to grid_jpeg (jpeg2000 packing):
    -
    ->grib_set -s packingType=grid_jpeg ../data/regular_gaussian_model_level.grib2 out.grib2
    -

    -
  7. It's possible to ask grib_api to calculate the number of bits per value needed to pack a given field with a fixed number of decimal digits of precision. For example if we want to pack a temperature expressed in Kelvin with 1 digits of precision after the decimal point we can set changeDecimalPrecision=1
    -
    ->grib_set -s changeDecimalPrecision=1 ../data/regular_latlon_surface.grib2 ../data/out.grib2
    -rm -f ../data/out.grib2 | true
    -./grib_set -s changeDecimalPrecision=1 ../data/regular_latlon_surface.grib2 ../data/out.grib2
    -

    -
-
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/group__grib__handle.html b/html/group__grib__handle.html deleted file mode 100644 index 7f435cb94..000000000 --- a/html/group__grib__handle.html +++ /dev/null @@ -1,625 +0,0 @@ - - -grib_api: The grib_handle - - - - -
- -
-

The grib_handle

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Typedefs

typedef struct
-grib_handle 
grib_handle
typedef struct
-grib_multi_handle 
grib_multi_handle

Functions

int grib_count_in_file (grib_context *c, FILE *f, int *n)
 Counts the messages contained in a file resource.
grib_handlegrib_handle_new_from_file (grib_context *c, FILE *f, int *error)
 Create a handle from a file resource.
grib_handlegrib_handle_new_from_message (grib_context *c, void *data, size_t data_len)
 Create a handle from a user message in memory.
grib_handlegrib_handle_new_from_multi_message (grib_context *c, void **data, size_t *data_len, int *error)
 Create a handle from a user message in memory.
grib_handlegrib_handle_new_from_message_copy (grib_context *c, const void *data, size_t data_len)
 Create a handle from a user message.
grib_handlegrib_handle_new_from_template (grib_context *c, const char *res_name)
 Create a handle from a read_only template resource.
grib_handlegrib_handle_new_from_samples (grib_context *c, const char *res_name)
 Create a handle from a message contained in a samples directory.
grib_handlegrib_handle_clone (grib_handle *h)
 Clone an existing handle using the context of the original handle, The message is copied and reparsed.
int grib_handle_delete (grib_handle *h)
 Frees a handle, also frees the message if it is not a user message.
grib_multi_handlegrib_multi_handle_new (grib_context *c)
 Create an empty multi field handle.
int grib_multi_handle_append (grib_handle *h, int start_section, grib_multi_handle *mh)
 Append the sections starting with start_section of the message pointed by h at the end of the multi field handle mh.
int grib_multi_handle_delete (grib_multi_handle *mh)
 Delete multi field handle.
int grib_multi_handle_write (grib_multi_handle *mh, FILE *f)
 Write a multi field handle in a file.
-

Detailed Description

-The grib_handle is the structure giving access to parsed grib values by keys.

Typedef Documentation

- -
-
- - - - -
typedef struct grib_handle grib_handle
-
-
- -

-Grib handle, structure giving access to parsed grib values by keys

Examples:
-get.c, iterator.c, keys_iterator.c, multi.c, multi_write.c, nearest.c, precision.c, print_data.c, and set.c.
-
-

- -

-
- - - - -
typedef struct grib_multi_handle grib_multi_handle
-
-
- -

-Grib multi field handle, structure used to build multi fields messages.

Examples:
-multi_write.c.
-
-

-


Function Documentation

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
int grib_count_in_file (grib_context c,
FILE *  f,
int *  n 
)
-
-
- -

-Counts the messages contained in a file resource. -

-

Parameters:
- - - - -
c : the context from wich the handle will be created (NULL for default context)
f : the file resource
n : the number of messages in the file
-
-
Returns:
0 if OK, integer value on error
-
Examples:
-count_messages.f90.
-
-

- -

-
- - - - - - - - - -
grib_handle* grib_handle_clone (grib_handle h  ) 
-
-
- -

-Clone an existing handle using the context of the original handle, The message is copied and reparsed. -

-

Parameters:
- - -
h : The handle to be cloned
-
-
Returns:
the new handle, NULL if the message is invalid or a problem is encountered
- -
-

- -

-
- - - - - - - - - -
int grib_handle_delete (grib_handle h  ) 
-
-
- -

-Frees a handle, also frees the message if it is not a user message. -

-

See also:
grib_handle_new_from_message
-
Parameters:
- - -
h : The handle to be deleted
-
-
Returns:
0 if OK, integer value on error
-
Examples:
-get.c, iterator.c, multi.c, multi_write.c, nearest.c, precision.c, print_data.c, and set.c.
-
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
grib_handle* grib_handle_new_from_file (grib_context c,
FILE *  f,
int *  error 
)
-
-
- -

-Create a handle from a file resource. -

-The file is read until a message is found. The message is then copied. Remember always to delete the handle when it is not needed any more to avoid memory leaks.

-

Parameters:
- - - - -
c : the context from wich the handle will be created (NULL for default context)
f : the file resource
error : error code set if the returned handle is NULL and the end of file is not reached
-
-
Returns:
the new handle, NULL if the resource is invalid or a problem is encountered
-
Examples:
-get.c, iterator.c, keys_iterator.c, multi.c, multi_write.c, precision.c, print_data.c, and set.c.
-
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
grib_handle* grib_handle_new_from_message (grib_context c,
void *  data,
size_t  data_len 
)
-
-
- -

-Create a handle from a user message in memory. -

-The message will not be freed at the end. The message will be copied as soon as a modification is needed.

-

Parameters:
- - - - -
c : the context from which the handle will be created (NULL for default context)
data : the actual message
data_len : the length of the message in number of bytes
-
-
Returns:
the new handle, NULL if the message is invalid or a problem is encountered
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
grib_handle* grib_handle_new_from_message_copy (grib_context c,
const void *  data,
size_t  data_len 
)
-
-
- -

-Create a handle from a user message. -

-The message is copied and will be freed with the handle

-

Parameters:
- - - - -
c : the context from wich the handle will be created (NULL for default context)
data : the actual message
data_len : the length of the message in number of bytes
-
-
Returns:
the new handle, NULL if the message is invalid or a problem is encountered
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
grib_handle* grib_handle_new_from_multi_message (grib_context c,
void **  data,
size_t *  data_len,
int *  error 
)
-
-
- -

-Create a handle from a user message in memory. -

-The message will not be freed at the end. The message will be copied as soon as a modification is needed. This function works also with multi field messages.

-

Parameters:
- - - - - -
c : the context from which the handle will be created (NULL for default context)
data : the actual message
data_len : the length of the message in number of bytes
error : error code
-
-
Returns:
the new handle, NULL if the message is invalid or a problem is encountered
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
grib_handle* grib_handle_new_from_samples (grib_context c,
const char *  res_name 
)
-
-
- -

-Create a handle from a message contained in a samples directory. -

-The message is copied at the creation of the handle

-

Parameters:
- - - -
c : the context from wich the handle will be created (NULL for default context)
res_name : the resource name
-
-
Returns:
the new handle, NULL if the resource is invalid or a problem is encountered
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
grib_handle* grib_handle_new_from_template (grib_context c,
const char *  res_name 
)
-
-
- -

-Create a handle from a read_only template resource. -

-The message is copied at the creation of the handle

-

Parameters:
- - - -
c : the context from wich the handle will be created (NULL for default context)
res_name : the resource name
-
-
Returns:
the new handle, NULL if the resource is invalid or a problem is encountered
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
int grib_multi_handle_append (grib_handle h,
int  start_section,
grib_multi_handle mh 
)
-
-
- -

-Append the sections starting with start_section of the message pointed by h at the end of the multi field handle mh. -

-Remember always to delete the multi handle when it is not needed any more to avoid memory leaks.

-

Parameters:
- - - - -
h : The handle from which the sections are copied.
start_section : section number. Starting from this section all the sections to then end of the message will be copied.
mh : The multi field handle on which the sections are appended.
-
-
Returns:
0 if OK, integer value on error
-
Examples:
-multi_write.c.
-
-

- -

-
- - - - - - - - - -
int grib_multi_handle_delete (grib_multi_handle mh  ) 
-
-
- -

-Delete multi field handle. -

-

Parameters:
- - -
mh : The multi field handle to be deleted.
-
-
Returns:
0 if OK, integer value on error
-
Examples:
-multi_write.c.
-
-

- -

-
- - - - - - - - - -
grib_multi_handle* grib_multi_handle_new (grib_context c  ) 
-
-
- -

-Create an empty multi field handle. -

-Remember always to delete the multi handle when it is not needed any more to avoid memory leaks.

-

Parameters:
- - -
c : the context from wich the handle will be created (NULL for default context)
-
-
Examples:
-multi_write.c.
-
-

- -

-
- - - - - - - - - - - - - - - - - - -
int grib_multi_handle_write (grib_multi_handle mh,
FILE *  f 
)
-
-
- -

-Write a multi field handle in a file. -

-Remember always to delete the multi handle when it is not needed any more to avoid memory leaks.

-

Parameters:
- - - -
mh : The multi field handle to be written.
f : File on which the file handle is written.
-
-
Returns:
0 if OK, integer value on error
-
Examples:
-multi_write.c.
-
-

-


Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/interfacegrib__api_1_1grib__find__nearest.html b/html/interfacegrib__api_1_1grib__find__nearest.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/html/interfacegrib__api_1_1grib__get.html b/html/interfacegrib__api_1_1grib__get.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/html/interfacegrib__api_1_1grib__get__data.html b/html/interfacegrib__api_1_1grib__get__data.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/html/interfacegrib__api_1_1grib__get__element.html b/html/interfacegrib__api_1_1grib__get__element.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/html/interfacegrib__api_1_1grib__set.html b/html/interfacegrib__api_1_1grib__set.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/html/iterator_8c-example.html b/html/iterator_8c-example.html deleted file mode 100644 index b40396a26..000000000 --- a/html/iterator_8c-example.html +++ /dev/null @@ -1,103 +0,0 @@ - - -grib_api: iterator.c - - - - -
- -
-

iterator.c

iterator.c How to use an iterator on latitude, longitude, values.

-

00001 
-00010 /*
-00011  * C Implementation: iterator
-00012  *
-00013  * Description: how to use an iterator on lat/lon/values.
-00014  *
-00015  *
-00016  * Author: Enrico Fucile
-00017  *
-00018  *
-00019  */
-00020 
-00021 #include <stdio.h>
-00022 #include <stdlib.h>
-00023 #include <string.h>
-00024 
-00025 #include "grib_api.h"  
-00026 
-00027 void usage(char* prog) {
-00028   printf("Usage: %s grib_file\n",prog);
-00029   exit(1);
-00030 }
-00031 
-00032 int main(int argc, char** argv) {
-00033   FILE* in = NULL;
-00034   int err = 0;
-00035   double lat,lon,value,missingValue=0;
-00036   int n=0;
-00037   char* filename = NULL;
-00038 
-00039   /* Message handle. Required in all the grib_api calls acting on a message.*/
-00040   grib_handle *h = NULL;   
-00041   /* Iterator on lat/lon/values.*/
-00042   grib_iterator* iter=NULL;  
-00043   
-00044   if (argc != 2) usage(argv[0]);
-00045 
-00046   filename=strdup(argv[1]);
-00047 
-00048   in = fopen(filename,"r");
-00049   if(!in) {
-00050     printf("ERROR: unable to open file %s\n",filename);
-00051     return 1;
-00052   }
-00053 
-00054   /* Loop on all the messages in a file.*/
-00055   while ((h = grib_handle_new_from_file(0,in,&err)) != NULL ) { 
-00056         /* Check of errors after reading a message. */
-00057     if (err != GRIB_SUCCESS) GRIB_CHECK(err,0);                       
-00058 
-00059         /* Get the double representing the missing value in the field. */
-00060         GRIB_CHECK(grib_get_double(h,"missingValue",&missingValue),0);  
-00061 
-00062         /* A new iterator on lat/lon/values is created from the message handle h. */
-00063         iter=grib_iterator_new(h,0,&err);                                     
-00064     if (err != GRIB_SUCCESS) GRIB_CHECK(err,0);                       
-00065 
-00066     n = 0;
-00067         /* Loop on all the lat/lon/values. */
-00068     while(grib_iterator_next(iter,&lat,&lon,&value)) {   
-00069           /* You can now print lat and lon,  */
-00070       printf("- %d - lat=%f lon=%f value=",n,lat,lon);   
-00071           /* decide what to print if a missing value is found. */
-00072       if (value == missingValue ) printf("missing\n");   
-00073           /* and print the value if is not missing. */
-00074           else printf("%f\n",value);
-00075       n++;
-00076     }
-00077 
-00078         /* At the end the iterator is deleted to free memory. */
-00079     grib_iterator_delete(iter);               
-00080 
-00081     /* At the end the grib_handle is deleted to free memory. */
-00082     grib_handle_delete(h);            
-00083   }
-00084 
-00085 
-00086   fclose(in);
-00087 
-00088   return 0;
-00089 }
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/iterator__fortran_8_f-example.html b/html/iterator__fortran_8_f-example.html deleted file mode 100644 index ce78c9e76..000000000 --- a/html/iterator__fortran_8_f-example.html +++ /dev/null @@ -1,103 +0,0 @@ - - -grib_api: iterator_fortran.F - - - - -
- -
-

iterator_fortran.F

iterator_fortran.F How to use an iterator on latitude, longitude, values.

-

00001 C Copyright 2005-2016 ECMWF
-00002 C This software is licensed under the terms of the Apache Licence Version 2.0
-00003 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 C 
-00005 C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 C
-00008 C
-00009 C  Fortran 77 Implementation: iterator_fortran
-00010 C
-00011 C  Description: how to use an iterator on lat/lon/values.
-00012 C
-00013 C
-00014 C  Author: Enrico Fucile
-00015 C
-00016 C
-00017 C
-00018       program iterator
-00019       implicit none
-00020       include 'grib_api_f77.h'
-00021       integer ifile
-00022       integer iret,iter
-00023       real*8 lat,lon,value,missingValue
-00024       integer n,flags
-00025       character*256 filename
-00026       character*256 error
-00027 
-00028 C     Message identifier.
-00029       integer igrib
-00030 
-00031       ifile=5
-00032 
-00033       call grib_check(grib_open_file(ifile,
-00034      X'../../data/regular_latlon_surface.grib1','r'))
-00035 
-00036 C     Loop on all the messages in a file.
-00037   10  iret=grib_new_from_file(ifile,igrib)
-00038       if (igrib .eq. -1 )  then
-00039         if (iret .ne.0) then
-00040            call grib_check(iret)
-00041         endif
-00042         stop
-00043       endif
-00044 
-00045 C     get as a real8
-00046       call grib_check(grib_get_real8(igrib
-00047      X,'missingValue',missingValue))
-00048       write(*,*) 'missingValue=',missingValue
-00049 
-00050 C     A new iterator on lat/lon/values is created from the message igrib
-00051       flags = 0
-00052       call grib_check(grib_iterator_new(igrib,iter,flags))
-00053 
-00054       n = 0
-00055 C     Loop on all the lat/lon/values.
-00056   20  iret = grib_iterator_next(iter,lat,lon,value)
-00057       if ( iret .eq. 0 ) goto 30
-00058 C     You can now print lat and lon,
-00059       if ( value .eq. missingValue ) then
-00060 C     decide what to print if a missing value is found.
-00061         write(*,*) "- ",n," - lat=",lat," lon=",lon," value=missing"
-00062       else
-00063 C     or print the value if is not missing.
-00064         write(*,*) " ",n," lat=",lat," lon=",lon," value=",value
-00065       endif
-00066 
-00067       n=n+1
-00068 
-00069       goto 20
-00070   30  continue
-00071 
-00072 C     At the end the iterator is deleted to free memory.
-00073       call grib_check(grib_iterator_delete(iter))
-00074 
-00075       goto 10
-00076 
-00077       call grib_check(grib_release(igrib))
-00078 
-00079       call grib_check(grib_close_file(ifile))
-00080 
-00081       end
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/keys.html b/html/keys.html deleted file mode 100644 index 1c3a6b545..000000000 --- a/html/keys.html +++ /dev/null @@ -1,88 +0,0 @@ - - -grib_api: Grib API keys - - - - -
- -
-

Grib API keys

The GRIBEX routine used at ECMWF to encode and decode GRIB messages works on a number based table to retrive all the information from the message. This approach forces the user either to learn a code table or to use the documentation intensively. With grib_api a key name based access is provided so that all the information contained in the GRIB message is retrieved through alphanumeric names.
- All the key names are built from the official WMO documentation on the GRIB edition 1 and 2 coding standard removing the spaces in the key description and capitalizing the initials so that the caption:
-
-identification of originating generating centre
-
is transformed into the key name
-
-identificationOfOriginatingGeneratingCentre
-

- Some short names (aliases) are also provided, e.g. "centre" is an alias for identificationOfOriginatingGeneratingCentre. The names are always easily releated to the meaning of their value.
- A different set of keys is available for each message because the content is different. It is easy to find the keys available in a message by using the GRIB tools (grib_dump) or the library (keys_iterator.c).
-

-Coded and Computed keys

-There are two different types of keys: coded and computed.
- The coded keys are directly linked to octets of the GRIB message and their value is obtained by only decoding the octets. A list of all the coded keys in a message can be obtained using grib_dump without any option (use the -a option to obtain also their aliases).
- The computed keys are obtained by combining other keys (coded or computed) and when their value is set all the related keys are set in a cascade process.
- These keys provide a synthesis of the information contained in the GRIB message and are a safe way to set complex attributes such as the type of grid or the type of packing. They are also helpful in the interpretation of some octets such as the scanning mode whose bits are related to the way of scanning the grid. In this case the computed keys:
-
-iScansNegatively
-jScansPositively
-jPointsAreConsecutive
-alternativeRowScanning (available only for edition 2)
-

- will provide access to single bits of the scanning mode octect hiding its structure from the user.
- The keys can also have some attributes as read only, which means that the key cannot be set (e.g. 7777 at the end of the message), or edition specific that is the attribute of all the keys having different values in the two editions (e.g. longitudeOfFirstGridPoint) or being present in one edition only (e.g. alternativeRowScanning).
- Moreover there are some computed keys that cannot be "get" and can be considered as functions acting on the grib in some way. These keys are always characterised by a predicate in their name (e.g. setDecimalPrecision).
- For the computed keys we provide the following preliminary documentation that will be extended soon. -

-

-

-

-

-

-
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/keys__iterator_8c-example.html b/html/keys__iterator_8c-example.html deleted file mode 100644 index b060ca6fd..000000000 --- a/html/keys__iterator_8c-example.html +++ /dev/null @@ -1,115 +0,0 @@ - - -grib_api: keys_iterator.c - - - - -
- -
-

keys_iterator.c

keys_iterator.c How to get the names of all the keys defined in a message and how to iterate through them.

-

00001 
-00010 /*
-00011  * C Implementation: keys_iterator
-00012  *
-00013  * Description:
-00014  * Example on how to use keys_iterator functions and the
-00015  * grib_keys_iterator structure to get all the available
-00016  * keys in a message.
-00017  *
-00018  * Author: Enrico Fucile
-00019  *
-00020  *
-00021  */
-00022 
-00023 #include <assert.h>
-00024 #include <stdlib.h>
-00025 #include <stdio.h>
-00026 #include <unistd.h>
-00027 
-00028 #include "grib_api.h"
-00029 
-00030 #define MAX_KEY_LEN  255
-00031 #define MAX_VAL_LEN  1024
-00032 
-00033 static void usage(char* progname);
-00034 
-00035 int main(int argc, char *argv[])
-00036 {
-00037   /* To skip read only and not coded keys
-00038      unsigned long key_iterator_filter_flags=GRIB_KEYS_ITERATOR_SKIP_READ_ONLY ||
-00039      GRIB_KEYS_ITERATOR_SKIP_COMPUTED;
-00040   */
-00041   unsigned long key_iterator_filter_flags=GRIB_KEYS_ITERATOR_ALL_KEYS;
-00042 
-00043   /* valid name_spaces are ls and mars */
-00044   char* name_space="ls";
-00045 
-00046   /* name_space=NULL to get all the keys */
-00047   /* char* name_space=0; */
-00048 
-00049   FILE* f;
-00050   grib_handle* h=NULL;
-00051   grib_keys_iterator* kiter=NULL;
-00052   int err=0;
-00053   int grib_count=0;
-00054 
-00055   char value[MAX_VAL_LEN];
-00056   size_t vlen=MAX_VAL_LEN;
-00057 
-00058   if (argc != 2) usage(argv[0]);
-00059 
-00060   f = fopen(argv[1],"r");
-00061   if(!f) {
-00062     perror(argv[1]);
-00063     exit(1);
-00064   }
-00065 
-00066   while((h = grib_handle_new_from_file(0,f,&err)) != NULL) {
-00067 
-00068     grib_count++;
-00069     printf("-- GRIB N. %d --\n",grib_count);
-00070     if(!h) {
-00071       printf("ERROR: Unable to create grib handle\n");
-00072       exit(1);
-00073     }
-00074 
-00075     kiter=grib_keys_iterator_new(h,key_iterator_filter_flags,name_space);
-00076     if (!kiter) {
-00077       printf("ERROR: Unable to create keys iterator\n");
-00078       exit(1);
-00079     }
-00080 
-00081     while(grib_keys_iterator_next(kiter))
-00082     {
-00083       const char* name = grib_keys_iterator_get_name(kiter);
-00084       vlen=MAX_VAL_LEN;
-00085       GRIB_CHECK(grib_get_string(h,name,value,&vlen),name);
-00086       printf("%s = %s\n",name,value);
-00087     }
-00088 
-00089     grib_keys_iterator_delete(kiter);
-00090 
-00091   }
-00092 
-00093   return 0;
-00094 
-00095 }
-00096 
-00097 static void usage(char* progname) {
-00098   printf("\nUsage: %s grib_file\n",progname);
-00099   exit(1);
-00100 }
-00101 
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/keys__iterator_8f90-example.html b/html/keys__iterator_8f90-example.html deleted file mode 100644 index 999ae5a1a..000000000 --- a/html/keys__iterator_8f90-example.html +++ /dev/null @@ -1,86 +0,0 @@ - - -grib_api: keys_iterator.f90 - - - - -
- -
-

keys_iterator.f90

How to get the names of all the keys defined in a message and how to iterate through them.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description:
-00010 !       How to use keys_iterator to get all the available
-00011 !       keys in a message.
-00012 !
-00013 !  Author: Enrico Fucile 
-00014 !
-00015 !
-00016 program keys_iterator
-00017   use grib_api
-00018   implicit none
-00019   character(len=20)  :: name_space
-00020   integer            :: kiter,ifile,igrib,iret
-00021   character(len=256) :: key
-00022   character(len=256) :: value
-00023   character(len=512) :: all
-00024   integer            :: grib_count
-00025   
-00026   call grib_open_file(ifile, &
-00027        '../../data/regular_latlon_surface.grib1','r')
-00028   
-00029   ! Loop on all the messages in a file.
-00030   
-00031   call grib_new_from_file(ifile,igrib, iret)
-00032   
-00033   do while (iret /= GRIB_END_OF_FILE)
-00034 
-00035      grib_count=grib_count+1
-00036      write(*,*) '-- GRIB N. ',grib_count,' --'
-00037      
-00038      ! valid name_spaces are ls and mars
-00039      name_space='ls'
-00040      
-00041      call grib_keys_iterator_new(igrib,kiter,name_space)
-00042      
-00043      do
-00044         call grib_keys_iterator_next(kiter, iret) 
-00045         
-00046         if (iret .ne. 1) exit
-00047         
-00048         call grib_keys_iterator_get_name(kiter,key)
-00049         call grib_get(igrib,trim(key),value)
-00050         all=trim(key)// ' = ' // trim(value)
-00051         write(*,*) trim(all)
-00052         
-00053      end do
-00054      
-00055      call grib_keys_iterator_delete(kiter)
-00056      call grib_release(igrib)
-00057      call grib_new_from_file(ifile,igrib, iret)
-00058   end do
-00059   
-00060   
-00061   call grib_close_file(ifile)
-00062   
-00063 end program keys_iterator
-00064 
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/keys__iterator__fortran_8_f-example.html b/html/keys__iterator__fortran_8_f-example.html deleted file mode 100644 index 716896669..000000000 --- a/html/keys__iterator__fortran_8_f-example.html +++ /dev/null @@ -1,99 +0,0 @@ - - -grib_api: keys_iterator_fortran.F - - - - -
- -
-

keys_iterator_fortran.F

keys_iterator_fortran.F How to get the names of all the keys defined in a message and how to iterate through them.

-

00001 C Copyright 2005-2016 ECMWF
-00002 C This software is licensed under the terms of the Apache Licence Version 2.0
-00003 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 C 
-00005 C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 C
-00008 C
-00009 C  Fortran 77 Implementation: keys_iterator
-00010 C
-00011 C  Description:
-00012 C  Example on how to use keys_iterator functions and the
-00013 C  grib_keys_iterator structure to get all the available
-00014 C  keys in a message.
-00015 C
-00016 C  Author: Enrico Fucile
-00017 C
-00018 C
-00019 C
-00020       program keys_iterator
-00021       implicit none
-00022       include 'grib_api_f77.h'
-00023       character*20 name_space
-00024       integer kiter,ifile,igrib,iret
-00025       character*256 key
-00026       character*256 value
-00027       character*512 all
-00028       integer len,strlen
-00029       integer grib_count
-00030       len=256
-00031 
-00032       ifile=5
-00033 
-00034       call grib_check(grib_open_file(ifile,
-00035      X'../../data/regular_latlon_surface.grib1','r'))
-00036 
-00037       grib_count=0
-00038 C     Loop on all the messages in a file.
-00039   10  iret=grib_new_from_file(ifile,igrib)
-00040       if (igrib .eq. -1 )  then
-00041         if (iret .ne.0) then
-00042            call grib_check(iret)
-00043         endif
-00044         stop
-00045       endif
-00046 
-00047       grib_count=grib_count+1
-00048       write(*,'("-- GRIB N.",I4," --")') grib_count
-00049 
-00050 C     valid name_spaces are ls and mars
-00051       name_space='ls'
-00052 C     name_space=' ' to get all the keys */
-00053 C     name_space=' '
-00054 
-00055       call grib_check(
-00056      Xgrib_keys_iterator_new(igrib,kiter,name_space))
-00057 C     call grib_check(grib_keys_iterator_skip_read_only(kiter))
-00058 C     call grib_check(grib_keys_iterator_skip_function(kiter))
-00059 C     call grib_check(grib_keys_iterator_skip_not_coded(kiter))
-00060 
-00061   20  if (grib_keys_iterator_next(kiter) .ne. 1) goto 10
-00062 
-00063       call grib_check(grib_keys_iterator_get_name(kiter,key))
-00064       call grib_check(grib_get_string(igrib,key,value))
-00065       all='|' // trim(key)//'|' //  ' = ' //'|' //  trim(value) // '|' 
-00066       write(*,*) trim(all)
-00067 
-00068       goto 20
-00069 
-00070       call grib_check(grib_keys_iterator_delete(kiter))
-00071 
-00072       call grib_check(grib_release(igrib))
-00073 
-00074       call grib_check(grib_close_file(ifile))
-00075 
-00076       end
-00077 
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/multi_8c-example.html b/html/multi_8c-example.html deleted file mode 100644 index 5c432baea..000000000 --- a/html/multi_8c-example.html +++ /dev/null @@ -1,85 +0,0 @@ - - -grib_api: multi.c - - - - -
- -
-

multi.c

multi.c How to decode a grib message containing many fields.

-

00001 
-00010 /*
-00011  * C Implementation: multi  
-00012  *
-00013  * Description: How to decode grib messages containing multiple
-00014  *              fields. Try to turn on and off multi support to
-00015  *              see the difference. Default is OFF.
-00016  *                      For all the tools defalut is multi support ON.
-00017  *
-00018  *
-00019  * Author: Enrico Fucile
-00020  *
-00021  *
-00022  */
-00023 #include <stdio.h>
-00024 #include <stdlib.h>
-00025 
-00026 #include "grib_api.h"
-00027 
-00028 int main(int argc, char** argv) {
-00029   int err = 0;
-00030   long parameterCategory=0,parameterNumber=0,discipline=0;
-00031   FILE* in = NULL;
-00032   char* filename = "../../data/multi.grib2";
-00033   grib_handle *h = NULL;
-00034 
-00035   /* turn on support for multi fields messages */
-00036   grib_multi_support_on(0);
-00037 
-00038   /* turn off support for multi fields messages */
-00039   /* grib_multi_support_off(0); */
-00040 
-00041   in = fopen(filename,"r");
-00042   if(!in) {
-00043     printf("ERROR: unable to open file %s\n",filename);
-00044     return 1;
-00045   }
-00046 
-00047 
-00048   while ((h = grib_handle_new_from_file(0,in,&err)) != NULL ) {
-00049 
-00050     GRIB_CHECK(err,0);
-00051 
-00052     GRIB_CHECK(grib_get_long(h,"discipline",&discipline),0);
-00053     printf("discipline=%ld\n",discipline);
-00054 
-00055     GRIB_CHECK(grib_get_long(h,"parameterCategory",&parameterCategory),0);
-00056     printf("parameterCategory=%ld\n",parameterCategory);
-00057 
-00058     GRIB_CHECK(grib_get_long(h,"parameterNumber",&parameterNumber),0);
-00059     printf("parameterNumber=%ld\n",parameterNumber);
-00060 
-00061     if ( discipline == 0 && parameterCategory==2) {
-00062     if (parameterNumber == 2) printf("-------- u -------\n");
-00063     if (parameterNumber == 3) printf("-------- v -------\n");
-00064     }
-00065   }
-00066 
-00067   grib_handle_delete(h);
-00068 
-00069   fclose(in);
-00070   return 0;
-00071 }
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/multi_8f90-example.html b/html/multi_8f90-example.html deleted file mode 100644 index 6564020e2..000000000 --- a/html/multi_8f90-example.html +++ /dev/null @@ -1,72 +0,0 @@ - - -grib_api: multi.f90 - - - - -
- -
-

multi.f90

How to decode a grib message containing many fields.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: How to decode grib messages containing multiple
-00010 !               fields. Try to turn on and off multi support to
-00011 !               see the difference. Default is OFF.
-00012 !               For all the tools defalut is multi support ON.
-00013 !
-00014 !
-00015 !  Author: Enrico Fucile 
-00016 !
-00017 !
-00018 program multi
-00019   use grib_api
-00020   implicit none
-00021   
-00022   integer              :: iret
-00023   character(len = 256) :: error
-00024   integer(kind = 4)    :: step
-00025   integer              :: ifile,igrib
-00026 
-00027   call grib_open_file(ifile, '../../data/multi_created.grib2','r')
-00028 
-00029   !     turn on support for multi fields messages */
-00030   call grib_multi_support_on()
-00031 
-00032   !     turn off support for multi fields messages */
-00033   !call grib_multi_support_off()
-00034 
-00035   call grib_new_from_file(ifile,igrib, iret)
-00036   !     Loop on all the messages in a file.
-00037 
-00038   write(*,*) 'step'
-00039   do while (iret /= GRIB_END_OF_FILE)
-00040 
-00041      call grib_get(igrib,'step', step)
-00042      write(*,'(i3)') step
-00043      
-00044      call grib_new_from_file(ifile,igrib, iret)
-00045   
-00046   end do
-00047   call grib_close_file(ifile)
-00048 
-00049 end program multi
-00050 
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/multi__fortran_8_f-example.html b/html/multi__fortran_8_f-example.html deleted file mode 100644 index 9a8e32de4..000000000 --- a/html/multi__fortran_8_f-example.html +++ /dev/null @@ -1,99 +0,0 @@ - - -grib_api: multi_fortran.F - - - - -
- -
-

multi_fortran.F

multi_fortran.F How to decode a grib message containing many fields.

-

00001 C Copyright 2005-2016 ECMWF
-00002 C This software is licensed under the terms of the Apache Licence Version 2.0
-00003 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 C 
-00005 C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 C
-00008 C
-00009 C  Fortran 77 Implementation: multi_fortran
-00010 C
-00011 C  Description: How to decode grib messages containing multiple
-00012 C               fields. Try to turn on and off multi support to
-00013 C               see the difference. Default is OFF.
-00014 C         For all the tools defalut is multi support ON.
-00015 C
-00016 C
-00017 C  Author: Enrico Fucile
-00018 C
-00019 C
-00020 C
-00021       program multi
-00022       implicit none
-00023       include 'grib_api_f77.h'
-00024       integer iret
-00025       character*256 error
-00026       integer*4 parameterCategory,parameterNumber,discipline
-00027       integer ifile,igrib
-00028 
-00029       call grib_check( grib_open_file(ifile
-00030      X,'../../data/multi.grib2','r'))
-00031 
-00032 C     turn on support for multi fields messages */
-00033       call grib_check(grib_multi_support_on())
-00034 
-00035 C     turn off support for multi fields messages */
-00036 C     call grib_check(grib_multi_support_off())
-00037 
-00038 C     Loop on all the messages in a file.
-00039   10  iret=grib_new_from_file(ifile,igrib)
-00040       if (igrib .eq. -1 )  then
-00041         if (iret .ne.0) then
-00042        call grib_check(iret)
-00043         endif
-00044         stop
-00045       endif
-00046 
-00047 C     get as a integer*4
-00048       call grib_check(grib_get_int(igrib,'discipline',discipline))
-00049       write(*,*) 'discipline=',discipline
-00050 
-00051 C     get as a integer*4
-00052       call grib_check(grib_get_int(igrib,'parameterCategory'
-00053      X,parameterCategory))
-00054       write(*,*) 'parameterCategory=',parameterCategory
-00055 
-00056 C     get as a integer*4
-00057       call grib_check(grib_get_int(igrib,'parameterNumber'
-00058      X,parameterNumber))
-00059       write(*,*) 'parameterNumber=',parameterNumber
-00060 
-00061       if ( discipline .eq. 0 .and. parameterCategory .eq. 2) then
-00062         if (parameterNumber .eq. 2) then
-00063            write(*,*) "-------- u -------"
-00064         endif
-00065         if (parameterNumber .eq. 3) then
-00066            write(*,*) "-------- v -------"
-00067         endif
-00068       endif
-00069 
-00070       goto 10
-00071 
-00072       call grib_check(grib_release(igrib))
-00073 
-00074       call grib_check(grib_close_file(ifile))
-00075 
-00076       end
-00077 
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/namespacegrib__api.html b/html/namespacegrib__api.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/html/nearest_8c-example.html b/html/nearest_8c-example.html deleted file mode 100644 index debce4109..000000000 --- a/html/nearest_8c-example.html +++ /dev/null @@ -1,107 +0,0 @@ - - -grib_api: nearest.c - - - - -
- -
-

nearest.c

nearest.c How to find the nearest grid points.

-

00001 
-00010 /*
-00011  * C Implementation: fieldset
-00012  *
-00013  * Description: how to use a fieldset.
-00014  *
-00015  *
-00016  * Author: Enrico Fucile
-00017  *
-00018  *
-00019  */
-00020 
-00021 #include <stdio.h>
-00022 #include <stdlib.h>
-00023 #include <string.h>
-00024 
-00025 #include "grib_api.h"
-00026 
-00027 void usage(char* prog) {
-00028   printf("Usage: %s grib_file grib_file ...\n",prog);
-00029   exit(1);
-00030 }
-00031 
-00032 int main(int argc, char** argv) {
-00033   int err = 0;
-00034   long step=0;
-00035   size_t nfiles;
-00036   int i=0;
-00037   grib_fieldset* set=NULL;
-00038   grib_handle* h=NULL;
-00039   char param[20]={0,};
-00040   size_t len=20;
-00041   double lats[4]={0,};
-00042   double lons[4]={0,};
-00043   double values[4]={0,};
-00044   double distances[4]={0,};
-00045   int indexes[4]={0,};
-00046   char* order_by="param,step";
-00047 
-00048   size_t size=4;
-00049   double lat=-40,lon=15;
-00050   int mode=0;
-00051   int count;
-00052   char** filenames;
-00053   grib_nearest* nearest=NULL;
-00054 
-00055   if (argc < 2) usage(argv[0]);
-00056 
-00057   nfiles=argc-1;
-00058   filenames=(char**)malloc(sizeof(char*)*nfiles);
-00059   for (i=0;i<nfiles;i++)
-00060     filenames[i]=(char*)strdup(argv[i+1]);
-00061 
-00062   set=grib_fieldset_new_from_files(0,filenames,nfiles,0,0,0,order_by,&err);
-00063   GRIB_CHECK(err,0);
-00064 
-00065   printf("\nordering by %s\n",order_by);
-00066   printf("\n%d fields in the fieldset\n",grib_fieldset_count(set));
-00067   printf("n,step,param\n");
-00068 
-00069   mode=GRIB_NEAREST_SAME_GRID |  GRIB_NEAREST_SAME_POINT;
-00070   count=1;
-00071   while ((h=grib_fieldset_next_handle(set,&err))!=NULL) {
-00072     GRIB_CHECK(grib_get_long(h,"step",&step),0);
-00073         len=20;
-00074     GRIB_CHECK(grib_get_string(h,"param",param,&len),0);
-00075 
-00076     printf("%d %ld %s  ",count,step,param);
-00077     if (!nearest) nearest=grib_nearest_new(h,&err);
-00078     GRIB_CHECK(err,0);
-00079     GRIB_CHECK(grib_nearest_find(nearest,h,lat,lon,mode,lats,lons,values,distances,indexes,&size),0);
-00080     for (i=0;i<4;i++) printf("%d %.2f %.2f %g %g - ",
-00081          (int)indexes[i],lats[i],lons[i],distances[i],values[i]);
-00082     printf("\n");
-00083 
-00084     grib_handle_delete(h);
-00085     count++;
-00086   }
-00087 
-00088   if (nearest) grib_nearest_delete(nearest);
-00089 
-00090   if (set) grib_fieldset_delete(set);
-00091 
-00092   return 0;
-00093 }
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/nearest_8f90-example.html b/html/nearest_8f90-example.html deleted file mode 100644 index 4b615ce57..000000000 --- a/html/nearest_8f90-example.html +++ /dev/null @@ -1,104 +0,0 @@ - - -grib_api: nearest.f90 - - - - -
- -
-

nearest.f90

How to find the nearest grid points.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: how to use grib_find_nearest and grib_get_element 
-00010 !
-00011 !
-00012 !  Author: Enrico Fucile 
-00013 !
-00014 !
-00015 !
-00016 program find
-00017   use grib_api
-00018   implicit none
-00019   integer                                      :: npoints
-00020   integer                                      :: infile
-00021   integer                                      :: igrib, ios, i
-00022   real(8), dimension(:), allocatable  :: lats, lons
-00023   real(8), dimension(:), allocatable  :: nearest_lats, nearest_lons
-00024   real(8), dimension(:), allocatable  :: distances, values, lsm_values
-00025   integer(kind=kindOfInt), dimension(:), allocatable  :: indexes
-00026   real(kind=8)                        :: value
-00027 
-00028 ! initialization
-00029   open( unit=1, file="../../data/list_points",form="formatted",action="read")
-00030   read(unit=1,fmt=*) npoints
-00031   allocate(lats(npoints))
-00032   allocate(lons(npoints))
-00033   allocate(nearest_lats(npoints))
-00034   allocate(nearest_lons(npoints))
-00035   allocate(distances(npoints))
-00036   allocate(lsm_values(npoints))
-00037   allocate(values(npoints))
-00038   allocate(indexes(npoints))
-00039   do i=1,npoints
-00040      read(unit=1,fmt=*, iostat=ios) lats(i), lons(i)
-00041      if (ios /= 0) then
-00042         npoints = i - 1
-00043         exit
-00044      end if
-00045   end do
-00046   close(unit=1)
-00047   call grib_open_file(infile, &
-00048        '../../data/reduced_gaussian_lsm.grib1','r')
-00049   
-00050   !     a new grib message is loaded from file
-00051   !     igrib is the grib id to be used in subsequent calls
-00052   call grib_new_from_file(infile,igrib)
-00053   
-00054 
-00055   call grib_find_nearest(igrib, .true., lats, lons, nearest_lats, nearest_lons,lsm_values, distances, indexes)
-00056   call grib_release(igrib)
-00057   
-00058   call grib_close_file(infile)
-00059 
-00060 ! will apply it to another GRIB
-00061   call grib_open_file(infile, &
-00062        '../../data/reduced_gaussian_pressure_level.grib1','r')
-00063   call grib_new_from_file(infile,igrib)
-00064 
-00065   call grib_get_element(igrib,"values", indexes, values)
-00066   call grib_release(igrib)
-00067   call grib_close_file(infile)
-00068 
-00069   do i=1, npoints
-00070      print*,lats(i), lons(i), nearest_lats(i), nearest_lons(i), distances(i), lsm_values(i), values(i)
-00071   end do
-00072 
-00073   deallocate(lats)
-00074   deallocate(lons)
-00075   deallocate(nearest_lats)
-00076   deallocate(nearest_lons)
-00077   deallocate(distances)
-00078   deallocate(lsm_values)
-00079   deallocate(values)
-00080   deallocate(indexes)
-00081 
-00082 end program find
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/precision_8c-example.html b/html/precision_8c-example.html deleted file mode 100644 index b5c045e7a..000000000 --- a/html/precision_8c-example.html +++ /dev/null @@ -1,138 +0,0 @@ - - -grib_api: precision.c - - - - -
- -
-

precision.c

precision.c How to control precision when coding a grib field.

-

00001 
-00010 /*
-00011  * C Implementation: precision
-00012  *
-00013  * Description: how to control decimal precision when packing fields.
-00014  *
-00015  *
-00016  * Author: Enrico Fucile
-00017  *
-00018  *
-00019  */
-00020 #include <stdio.h>
-00021 #include <stdlib.h>
-00022 #include <math.h>
-00023 
-00024 #include "grib_api.h"
-00025 
-00026 int main(int argc, char** argv) {
-00027   int err = 0;
-00028   size_t size=0;
-00029 
-00030   FILE* in = NULL;
-00031   char* infile = "../../data/regular_latlon_surface.grib1";
-00032   FILE* out = NULL;
-00033   char* outfile = "out.grib1";
-00034   grib_handle *h = NULL;
-00035   const void* buffer = NULL;
-00036   double* values1=NULL;
-00037   double* values2=NULL;
-00038   double maxa=0,a=0;
-00039   double maxv=0,minv=0;
-00040   double maxr=0,r=0;
-00041   long decimalPrecision;
-00042   long bitsPerValue1=0, bitsPerValue2=0;
-00043   int i=0;
-00044 
-00045   in = fopen(infile,"r");
-00046   if(!in) {
-00047     printf("ERROR: unable to open file %s\n",infile);
-00048     return 1;
-00049   }
-00050 
-00051   out = fopen(outfile,"w");
-00052   if(!in) {
-00053     printf("ERROR: unable to open file %s\n",outfile);
-00054     return 1;
-00055   }
-00056 
-00057   /* create a new handle from a message in a file */
-00058   h = grib_handle_new_from_file(0,in,&err);
-00059   if (h == NULL) {
-00060     printf("Error: unable to create handle from file %s\n",infile);
-00061   }
-00062 
-00063   /* bitsPerValue before changing the packing parameters */
-00064   GRIB_CHECK(grib_get_long(h,"bitsPerValue",&bitsPerValue1),0);
-00065 
-00066   /* get the size of the values array*/
-00067   GRIB_CHECK(grib_get_size(h,"values",&size),0);
-00068 
-00069   values1 = malloc(size*sizeof(double));
-00070   /* get data values before changing the packing parameters*/
-00071   GRIB_CHECK(grib_get_double_array(h,"values",values1,&size),0);
-00072 
-00073   /* changing decimal precition to 2 means that 2 decimal digits
-00074      are preserved when packing.  */
-00075   decimalPrecision=2;
-00076   GRIB_CHECK(grib_set_long(h,"changeDecimalPrecision",decimalPrecision),0);
-00077    
-00078   /* bitsPerValue after changing the packing parameters */
-00079   GRIB_CHECK(grib_get_long(h,"bitsPerValue",&bitsPerValue2),0);
-00080 
-00081   values2 = malloc(size*sizeof(double));
-00082   /* get data values after changing the packing parameters*/
-00083   GRIB_CHECK(grib_get_double_array(h,"values",values2,&size),0);
-00084 
-00085   /* computing error */
-00086   maxa=0;
-00087   maxr=0;
-00088   maxv=values2[0];
-00089   minv=maxv;
-00090   for (i=0;i<size;i++) {
-00091      a=fabs(values2[i]-values1[i]);
-00092      if ( values2[i] > maxv ) maxv=values2[i];
-00093      if ( values2[i] < maxv ) minv=values2[i];
-00094      if ( values2[i] !=0 ) r=fabs((values2[i]-values1[i])/values2[i]);
-00095      if ( a > maxa ) maxa=a;
-00096      if ( r > maxr ) maxr=r;
-00097   }
-00098   printf("max absolute error = %g\n",maxa);
-00099   printf("max relative error = %g\n",maxr);
-00100   printf("min value = %g\n",minv);
-00101   printf("max value = %g\n",maxv);
-00102 
-00103   printf("old number of bits per value=%ld\n",(long)bitsPerValue1);
-00104   printf("new number of bits per value=%ld\n",(long)bitsPerValue2);
-00105 
-00106   /* get the coded message in a buffer */
-00107   GRIB_CHECK(grib_get_message(h,&buffer,&size),0);
-00108 
-00109   /* write the buffer in a file*/
-00110   if(fwrite(buffer,1,size,out) != size) 
-00111   {
-00112      perror(argv[1]);
-00113      exit(1);
-00114   }
-00115 
-00116   /* delete handle */
-00117   grib_handle_delete(h);
-00118 
-00119   fclose(in);
-00120   fclose(out);
-00121 
-00122   return 0;
-00123 }
-00124 
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/precision_8f90-example.html b/html/precision_8f90-example.html deleted file mode 100644 index b589c9846..000000000 --- a/html/precision_8f90-example.html +++ /dev/null @@ -1,119 +0,0 @@ - - -grib_api: precision.f90 - - - - -
- -
-

precision.f90

How to control precision when coding a grib field.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !
-00010 !  Description: how to control decimal precision when packing fields.
-00011 !
-00012 !
-00013 !  Author: Enrico Fucile 
-00014 !
-00015 !
-00016 !
-00017 program precision
-00018   use grib_api
-00019   implicit none
-00020   integer(kind = 4)                             :: size
-00021   integer                                       :: infile,outfile
-00022   integer                                       :: igrib
-00023   real(kind = 8), dimension(:), allocatable     :: values1
-00024   real(kind = 8), dimension(:), allocatable     :: values2
-00025   real(kind = 8)                                ::  maxa,a,maxv,minv,maxr,r
-00026   integer( kind = 4)                            :: decimalPrecision,bitsPerValue1,bitsPerValue2
-00027   integer                                       :: i, iret
-00028 
-00029   call grib_open_file(infile, &
-00030        '../../data/regular_latlon_surface_constant.grib1','r')
-00031 
-00032   call grib_open_file(outfile, &
-00033        '../../data/regular_latlon_surface_prec.grib1','w')
-00034 
-00035   !     a new grib message is loaded from file
-00036   !     igrib is the grib id to be used in subsequent calls
-00037   call grib_new_from_file(infile,igrib)
-00038 
-00039   !     bitsPerValue before changing the packing parameters
-00040   call grib_get(igrib,'bitsPerValue',bitsPerValue1)
-00041 
-00042   !     get the size of the values array
-00043   call grib_get_size(igrib,"values",size)
-00044 
-00045   allocate(values1(size), stat=iret)
-00046   allocate(values2(size), stat=iret)
-00047   !     get data values before changing the packing parameters*/
-00048   call grib_get(igrib,"values",values1)
-00049 
-00050   !     setting decimal precision=2 means that 2 decimal digits
-00051   !     are preserved when packing.
-00052   decimalPrecision=2
-00053   call grib_set(igrib,"changeDecimalPrecision", &
-00054        decimalPrecision)
-00055 
-00056   !     bitsPerValue after changing the packing parameters
-00057   call grib_get(igrib,"bitsPerValue",bitsPerValue2)
-00058 
-00059   !     get data values after changing the packing parameters
-00060   call grib_get(igrib,"values",values2)
-00061 
-00062   !     computing error
-00063   maxa=0
-00064   maxr=0
-00065   maxv=values2(1)
-00066   minv=maxv
-00067   do i=1,size
-00068      a=abs(values2(i)-values1(i))
-00069      if ( values2(i) .gt. maxv ) maxv=values2(i)
-00070      if ( values2(i) .lt. maxv ) minv=values2(i)
-00071      if ( values2(i) .ne. 0 ) then
-00072         r=abs((values2(i)-values1(i))/values2(i))
-00073      endif
-00074      if ( a .gt. maxa ) maxa=a
-00075      if ( r .gt. maxr ) maxr=r
-00076   enddo
-00077   write(*,*) "max absolute error = ",maxa
-00078   write(*,*) "max relative error = ",maxr
-00079   write(*,*) "min value = ",minv
-00080   write(*,*) "max value = ",maxv
-00081 
-00082   write(*,*) "old number of bits per value=",bitsPerValue1
-00083   write(*,*) "new number of bits per value=",bitsPerValue2
-00084 
-00085   !     write modified message to a file
-00086   call grib_write(igrib,outfile)
-00087 
-00088   call grib_release(igrib)
-00089 
-00090   call grib_close_file(infile)
-00091 
-00092   call grib_close_file(outfile)
-00093 
-00094   deallocate(values1)
-00095   deallocate(values2)
-00096 end program precision
-00097 
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/precision__fortran_8_f-example.html b/html/precision__fortran_8_f-example.html deleted file mode 100644 index ada3bf01d..000000000 --- a/html/precision__fortran_8_f-example.html +++ /dev/null @@ -1,118 +0,0 @@ - - -grib_api: precision_fortran.F - - - - -
- -
-

precision_fortran.F

precision_fortran.F How to control precision when coding a grib field.

-

00001 C Copyright 2005-2016 ECMWF
-00002 C This software is licensed under the terms of the Apache Licence Version 2.0
-00003 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 C 
-00005 C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 C
-00008 C
-00009 C  Fortran 77 Implementation: precision
-00010 C
-00011 C  Description: how to control decimal precision when packing fields.
-00012 C
-00013 C
-00014 C  Author: Enrico Fucile
-00015 C
-00016 C
-00017 C
-00018       program precision
-00019       implicit none
-00020       integer maxNumberOfValues
-00021       parameter (maxNumberOfValues=10000)
-00022       include 'grib_api_f77.h'
-00023       integer*4 size
-00024       integer infile,outfile
-00025       integer igrib
-00026       real*8 values1(maxNumberOfValues)
-00027       real*8 values2(maxNumberOfValues)
-00028       real*8 maxa,a,maxv,minv,maxr,r
-00029       integer*4 decimalPrecision,bitsPerValue1,bitsPerValue2
-00030       integer i
-00031 
-00032       call grib_check(grib_open_file(infile
-00033      X,'../../data/regular_latlon_surface.grib1','r'))
-00034 
-00035       call grib_check(grib_open_file(outfile
-00036      X,'../../data/regular_latlon_surface_prec.grib1','w'))
-00037 
-00038 C     a new grib message is loaded from file
-00039 C     igrib is the grib id to be used in subsequent calls
-00040       call grib_check(grib_new_from_file(infile,igrib))
-00041 
-00042 C     bitsPerValue before changing the packing parameters
-00043       call grib_check(grib_get_int(igrib,'bitsPerValue',bitsPerValue1))
-00044 
-00045 C     get the size of the values array
-00046       call grib_check(grib_get_size(igrib,"values",size))
-00047 
-00048 C     get data values before changing the packing parameters*/
-00049       call grib_check(grib_get_real8_array(igrib,"values",values1,size))
-00050 
-00051 C     setting decimal precision=2 means that 2 decimal digits
-00052 C     are preserved when packing.
-00053       decimalPrecision=2
-00054       call grib_check(grib_set_int(igrib,"changeDecimalPrecision"
-00055      X,decimalPrecision))
-00056 
-00057 C     bitsPerValue after changing the packing parameters
-00058       call grib_check(grib_get_int(igrib,"bitsPerValue",bitsPerValue2))
-00059 
-00060 C     get data values after changing the packing parameters
-00061       call grib_check(grib_get_real8_array(igrib,"values",values2,size))
-00062 
-00063 C     computing error
-00064       maxa=0
-00065       maxr=0
-00066       maxv=values2(1)
-00067       minv=maxv
-00068       do i=1,size
-00069         a=abs(values2(i)-values1(i))
-00070         if ( values2(i) .gt. maxv ) maxv=values2(i)
-00071         if ( values2(i) .lt. maxv ) minv=values2(i)
-00072         if ( values2(i) .ne. 0 ) then
-00073          r=abs((values2(i)-values1(i))/values2(i))
-00074         endif
-00075         if ( a .gt. maxa ) maxa=a
-00076         if ( r .gt. maxr ) maxr=r
-00077       enddo
-00078       write(*,*) "max absolute error = ",maxa
-00079       write(*,*) "max relative error = ",maxr
-00080       write(*,*) "min value = ",minv
-00081       write(*,*) "max value = ",maxv
-00082 
-00083       write(*,*) "old number of bits per value=",bitsPerValue1
-00084       write(*,*) "new number of bits per value=",bitsPerValue2
-00085 
-00086 C     write modified message to a file
-00087       call grib_check(grib_write(igrib,outfile))
-00088 
-00089       call grib_check(grib_release(igrib))
-00090 
-00091       call grib_check(grib_close_file(infile))
-00092 
-00093       call grib_check(grib_close_file(outfile))
-00094 
-00095       end
-00096 
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/print__data_8c-example.html b/html/print__data_8c-example.html deleted file mode 100644 index dc438e36b..000000000 --- a/html/print__data_8c-example.html +++ /dev/null @@ -1,94 +0,0 @@ - - -grib_api: print_data.c - - - - -
- -
-

print_data.c

print_data.c How to print all the data from a grib message.

-

00001 
-00010 /*
-00011  * C Implementation: print_data
-00012  *
-00013  * Description: prints all the data contained in a grib file
-00014  *
-00015  * Author: Enrico Fucile
-00016  *
-00017  *
-00018  */
-00019 #include <stdio.h>
-00020 #include <stdlib.h>
-00021 
-00022 #include "grib_api.h"
-00023 
-00024 void usage(char* prog) {
-00025   printf("usage: %s filename\n",prog);
-00026   exit(1);
-00027 }
-00028 
-00029 int main(int argc, char** argv) {
-00030   int err = 0,i;
-00031   double *values = NULL;
-00032   double max,min,average;
-00033   size_t values_len= 0;
-00034 
-00035   FILE* in = NULL;
-00036   char* filename ;
-00037   grib_handle *h = NULL;
-00038 
-00039   if (argc<2) usage(argv[0]);
-00040   filename=argv[1];
-00041 
-00042   in = fopen(filename,"r");
-00043   if(!in) {
-00044     printf("ERROR: unable to open file %s\n",filename);
-00045     return 1;
-00046   }
-00047 
-00048   /* create new handle from a message in a file*/
-00049   h = grib_handle_new_from_file(0,in,&err);
-00050   if (h == NULL) {
-00051     printf("Error: unable to create handle from file %s\n",filename);
-00052   }
-00053 
-00054 
-00055   /* get the size of the values array*/
-00056   GRIB_CHECK(grib_get_size(h,"values",&values_len),0);
-00057 
-00058   values = malloc(values_len*sizeof(double));
-00059 
-00060   /* get data values*/
-00061   GRIB_CHECK(grib_get_double_array(h,"values",values,&values_len),0);
-00062 
-00063   for(i = 0; i < values_len; i++)
-00064     printf("%d  %.10e\n",i+1,values[i]);
-00065 
-00066   free(values);
-00067 
-00068 
-00069   GRIB_CHECK(grib_get_double(h,"max",&max),0);
-00070   GRIB_CHECK(grib_get_double(h,"min",&min),0);
-00071   GRIB_CHECK(grib_get_double(h,"average",&average),0);
-00072 
-00073   printf("%d values found in %s\n",(int)values_len,filename);
-00074   printf("max=%.10e min=%.10e average=%.10e\n",max,min,average);
-00075 
-00076   grib_handle_delete(h);
-00077 
-00078   fclose(in);
-00079   return 0;
-00080 }
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/print__data_8f90-example.html b/html/print__data_8f90-example.html deleted file mode 100644 index 1a51ec51c..000000000 --- a/html/print__data_8f90-example.html +++ /dev/null @@ -1,88 +0,0 @@ - - -grib_api: print_data.f90 - - - - -
- -
-

print_data.f90

How to print all the data contained in a grib file.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: prints all the data contained in a grib file
-00010 !
-00011 !
-00012 !  Author: Anne Fouilloux
-00013 !
-00014 !
-00015 program print_data
-00016 use grib_api
-00017 implicit none
-00018 integer            :: ifile
-00019 integer            :: iret
-00020 integer            :: igrib
-00021 integer            :: i
-00022 real(kind=8), dimension(:), allocatable       :: values
-00023 integer(kind=4)    :: numberOfValues
-00024 real(kind=8)       :: average
-00025 real(kind=8)       :: max
-00026 real(kind=8)       :: min
-00027 character(len=256) :: error
-00028 
-00029 call grib_open_file(ifile, &
-00030            '../../data/constant_field.grib1','r')
-00031 
-00032 !     a new grib message is loaded from file
-00033 !     igrib is the grib id to be used in subsequent calls
-00034       call grib_new_from_file(ifile,igrib)
-00035 
-00036 
-00037 !     get the size of the values array
-00038       call grib_get_size(igrib,'values',numberOfValues)
-00039 
-00040 !     get data values
-00041   print*, 'number of values ', numberOfValues
-00042   allocate(values(numberOfValues), stat=iret)
-00043 
-00044   call grib_get(igrib,'values',values)
-00045 
-00046   do i=1,numberOfValues
-00047     write(*,*)'  ',i,values(i)
-00048   enddo
-00049 
-00050 
-00051   write(*,*)numberOfValues,' values found '
-00052 
-00053   call grib_get(igrib,'max',max)
-00054   write(*,*) 'max=',max
-00055   call grib_get(igrib,'min',min)
-00056   write(*,*) 'min=',min
-00057   call grib_get(igrib,'average',average)
-00058   write(*,*) 'average=',average
-00059 
-00060   call grib_release(igrib)
-00061 
-00062   call grib_close_file(ifile)
-00063 
-00064   deallocate(values)
-00065 
-00066 end program print_data
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/print__data__fortran_8_f-example.html b/html/print__data__fortran_8_f-example.html deleted file mode 100644 index ed14bddd3..000000000 --- a/html/print__data__fortran_8_f-example.html +++ /dev/null @@ -1,101 +0,0 @@ - - -grib_api: print_data_fortran.F - - - - -
- -
-

print_data_fortran.F

print_data_fortran.F How to print all the data from a grib message.

-

00001 C Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 C
-00008 C  Fortran 77  Implementation: print_data_fortran
-00009 C
-00010 C  Description: prints all the data contained in a grib file
-00011 C
-00012 C  Author: Enrico Fucile
-00013 C
-00014 C
-00015 C
-00016       program print_data_fortran
-00017       implicit none
-00018       integer maxNumberOfValues
-00019       parameter( maxNumberOfValues = 100000 )
-00020       include 'grib_api_f77.h'
-00021       integer ifile
-00022       integer iret
-00023       integer igrib
-00024       integer i
-00025       real*8 values(maxNumberOfValues)
-00026       integer*4 numberOfValues
-00027       real*8 average
-00028       real*8 max
-00029       real*8 min
-00030       character*256 error
-00031       integer*4 size
-00032 
-00033       size=maxNumberOfValues
-00034       ifile=5
-00035 
-00036       iret=grib_open_file(ifile
-00037      X,'../../data/constant_field.grib1','r')
-00038       call grib_check(iret)
-00039 
-00040 C     a new grib message is loaded from file
-00041 C     igrib is the grib id to be used in subsequent calls
-00042       call grib_check( grib_new_from_file(ifile,igrib) )
-00043 
-00044 
-00045 C     get the size of the values array
-00046       call grib_check(grib_get_size(igrib,'values',numberOfValues))
-00047       if ( numberOfValues .gt. maxNumberOfValues ) then
-00048         write(*,*)'ERROR: maxNumberOfValues too small numberOfValues=',
-00049      XnumberOfValues
-00050             stop
-00051       endif
-00052 
-00053 C     get data values
-00054       call grib_check(grib_get_real8_array(igrib,'values',values,size))
-00055       if ( size .ne. numberOfValues ) then
-00056         write(*,*) 'ERROR: wrong numberOfValues'
-00057         stop
-00058       endif
-00059 
-00060       do i=1,numberOfValues
-00061         write(*,*)'  ',i,values(i)
-00062       enddo
-00063 
-00064       average =average / numberOfValues
-00065 
-00066       write(*,*)numberOfValues,' values found '
-00067 
-00068       call grib_check(grib_get_real8(igrib,'max',max))
-00069       write(*,*) 'max=',max
-00070       call grib_check(grib_get_real8(igrib,'min',min))
-00071       write(*,*) 'min=',min
-00072       call grib_check(grib_get_real8(igrib,'average',average))
-00073       write(*,*) 'average=',average
-00074 
-00075       call grib_check(grib_release(igrib))
-00076 
-00077       call grib_check(grib_close_file(ifile))
-00078 
-00079       end
-

Generated on Tue Sep 22 15:18:21 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/set_8c-example.html b/html/set_8c-example.html deleted file mode 100644 index 3ec5e10ea..000000000 --- a/html/set_8c-example.html +++ /dev/null @@ -1,100 +0,0 @@ - - -grib_api: set.c - - - - -
- -
-

set.c

set.c How to set values through the key names.

-

00001 
-00010 /*
-00011  * C Implementation: set
-00012  *
-00013  * Description: how to set key values.
-00014  *
-00015  *
-00016  * Author: Enrico Fucile
-00017  *
-00018  *
-00019  */
-00020 #include <stdio.h>
-00021 #include <stdlib.h>
-00022 
-00023 #include "grib_api.h"
-00024 
-00025 int main(int argc, char** argv) {
-00026   int err = 0;
-00027   long centre=80;
-00028   long long_value=0;
-00029   char string_value[100];
-00030   size_t len = sizeof(string_value)/sizeof(char);
-00031   size_t size=0;
-00032 
-00033   FILE* in = NULL;
-00034   char* infile = "../../data/regular_latlon_surface.grib1";
-00035   FILE* out = NULL;
-00036   char* outfile = "out.grib1";
-00037   grib_handle *h = NULL;
-00038   const void* buffer = NULL;
-00039 
-00040   in = fopen(infile,"r");
-00041   if(!in) {
-00042     printf("ERROR: unable to open file %s\n",infile);
-00043     return 1;
-00044   }
-00045 
-00046   out = fopen(outfile,"w");
-00047   if(!in) {
-00048     printf("ERROR: unable to open file %s\n",outfile);
-00049     return 1;
-00050   }
-00051 
-00052   /* create a new handle from a message in a file */
-00053   h = grib_handle_new_from_file(0,in,&err);
-00054   if (h == NULL) {
-00055     printf("Error: unable to create handle from file %s\n",infile);
-00056   }
-00057 
-00058   /* set centre as a long */
-00059   GRIB_CHECK(grib_set_long(h,"centre",centre),0);
-00060 
-00061   /* get centre as a long */
-00062   GRIB_CHECK(grib_get_long(h,"centre",&long_value),0);
-00063   printf("centre long value=%ld\n",long_value);
-00064 
-00065   /* get centre as a string */
-00066   GRIB_CHECK(grib_get_string(h,"centre",string_value,&len),0);
-00067   printf("centre string value=%s\n",string_value);
-00068 
-00069   /* get the coded message in a buffer */
-00070   GRIB_CHECK(grib_get_message(h,&buffer,&size),0);
-00071 
-00072   /* write the buffer in a file*/
-00073   if(fwrite(buffer,1,size,out) != size) 
-00074   {
-00075      perror(argv[1]);
-00076      exit(1);
-00077   }
-00078 
-00079   /* delete handle */
-00080   grib_handle_delete(h);
-00081 
-00082   fclose(in);
-00083   fclose(out);
-00084 
-00085   return 0;
-00086 }
-

Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/set_8f90-example.html b/html/set_8f90-example.html deleted file mode 100644 index 0a93ce976..000000000 --- a/html/set_8f90-example.html +++ /dev/null @@ -1,107 +0,0 @@ - - -grib_api: set.f90 - - - - -
- -
-

set.f90

How to set values through the key names.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: how to set key values.
-00010 !
-00011 !
-00012 !  Author: Anne Fouilloux                            
-00013 !
-00014 !
-00015 program set
-00016   use grib_api
-00017   implicit none
-00018   integer(kind = 4)    :: centre, date
-00019   integer              :: infile,outfile
-00020   integer              :: igrib
-00021 
-00022 
-00023   centre = 80
-00024   call current_date(date)
-00025   call grib_open_file(infile, &
-00026        '../../data/regular_latlon_surface_constant.grib1','r')
-00027 
-00028   call grib_open_file(outfile, &
-00029        'out.grib1','w')
-00030 
-00031   !     a new grib message is loaded from file
-00032   !     igrib is the grib id to be used in subsequent calls
-00033   call grib_new_from_file(infile,igrib)
-00034 
-00035   call grib_set(igrib,'date',date)
-00036   !     set centre as a integer */
-00037   call grib_set(igrib,'centre',centre)
-00038 
-00039 ! check if it is correct in the actual GRIB message
-00040 
-00041   call check_settings(igrib)
-00042 
-00043   !     write modified message to a file
-00044   call grib_write(igrib,outfile)
-00045 
-00046   call grib_release(igrib)
-00047 
-00048   call grib_close_file(infile)
-00049 
-00050   call grib_close_file(outfile)
-00051 
-00052 contains
-00053 
-00054 !======================================
-00055 subroutine current_date(date)
-00056 integer, intent(out) :: date
-00057 
-00058 integer              :: val_date(8)
-00059 call date_and_time ( values = val_date)
-00060 
-00061 date = val_date(1)* 10000 + val_date(2)*100 + val_date(3) 
-00062 end subroutine current_date
-00063 !======================================
-00064 subroutine check_settings(gribid)
-00065   use grib_api
-00066   implicit none
-00067   integer, intent(in) :: gribid
-00068   
-00069   integer(kind = 4)    :: int_value
-00070   character(len = 10)  :: string_value
-00071 
-00072   !     get centre as a integer
-00073   call grib_get(gribid,'centre',int_value)
-00074   write(*,*) "get centre as a integer - centre = ",int_value
-00075   
-00076   !     get centre as a string
-00077   call grib_get(gribid,'centre',string_value)
-00078   write(*,*) "get centre as a string  - centre = ",string_value
-00079   
-00080   !     get date as a string
-00081   call grib_get(gribid,'dataDate',string_value)
-00082   write(*,*) "get date as a string    - date = ",string_value
-00083   
-00084 end subroutine check_settings
-00085 end program set
-

Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/set__bitmap_8f90-example.html b/html/set__bitmap_8f90-example.html deleted file mode 100644 index a723bc781..000000000 --- a/html/set__bitmap_8f90-example.html +++ /dev/null @@ -1,102 +0,0 @@ - - -grib_api: set_bitmap.f90 - - - - -
- -
-

set_bitmap.f90

How to set and use a bitmap.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: how to set a bitmap in a grib message 
-00010 !
-00011 !
-00012 !  Author: Enrico Fucile 
-00013 !
-00014 !
-00015 program set_bitmap
-00016   use grib_api
-00017   implicit none
-00018   integer                         :: infile,outfile
-00019   integer                         :: igrib, iret
-00020   integer                         :: numberOfValues
-00021   real, dimension(:), allocatable :: values
-00022   real                            :: missingValue
-00023   logical                         :: grib1Example
-00024 
-00025   grib1Example=.true.
-00026 
-00027   if (grib1Example) then
-00028     ! GRIB 1 example
-00029     call grib_open_file(infile,'../../data/regular_latlon_surface.grib1','r')
-00030   else
-00031     ! GRIB 2 example
-00032     call grib_open_file(infile,'../../data/regular_latlon_surface.grib2','r')
-00033   end if
-00034   
-00035   call grib_open_file(outfile,'out.grib','w')
-00036   
-00037   !     a new grib message is loaded from file
-00038   !     igrib is the grib id to be used in subsequent calls
-00039   call grib_new_from_file(infile,igrib)
-00040   
-00041   ! The missingValue is not coded in the message. 
-00042   ! It is a value we define as a placeholder for a missing value
-00043   ! in a point of the grid.
-00044   ! It should be choosen in a way that it cannot be confused 
-00045   ! with a valid field value
-00046   missingValue=9999
-00047   call grib_set(igrib, 'missingValue',missingValue)
-00048   write(*,*) 'missingValue=',missingValue
-00049 
-00050   ! get the size of the values array
-00051   call grib_get_size(igrib,'values',numberOfValues)
-00052   write(*,*) 'numberOfValues=',numberOfValues
-00053   
-00054   allocate(values(numberOfValues), stat=iret)
-00055 
-00056   ! get data values
-00057   call grib_get(igrib,'values',values)
-00058   
-00059   ! enable bitmap 
-00060   call grib_set(igrib,"bitmapPresent",1)
-00061 
-00062   ! some values are missing
-00063   values(1:10) = missingValue
-00064 
-00065   ! set the values (the bitmap will be automatically built)
-00066   call grib_set(igrib,'values', values)
-00067 
-00068   !  write modified message to a file
-00069   call grib_write(igrib,outfile)
-00070   
-00071   ! FREE MEMORY
-00072   call grib_release(igrib)
-00073   
-00074   call grib_close_file(infile)
-00075 
-00076   call grib_close_file(outfile)
-00077 
-00078   deallocate(values)
-00079 
-00080 end program set_bitmap
-

Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/set__fortran_8_f-example.html b/html/set__fortran_8_f-example.html deleted file mode 100644 index aa2fd952d..000000000 --- a/html/set__fortran_8_f-example.html +++ /dev/null @@ -1,89 +0,0 @@ - - -grib_api: set_fortran.F - - - - -
- -
-

set_fortran.F

set_fortran.F How to set values through the key names.

-

00001 C Copyright 2005-2016 ECMWF
-00002 C This software is licensed under the terms of the Apache Licence Version 2.0
-00003 C which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 C 
-00005 C In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 C virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 C
-00008 C
-00009 C  Fortran 77 Implementation: set_fortran
-00010 C
-00011 C  Description: how to set key values.
-00012 C
-00013 C
-00014 C  Author: Enrico Fucile
-00015 C
-00016 C
-00017 C
-00018       program set
-00019       implicit none
-00020       include 'grib_api_f77.h'
-00021       integer err
-00022       integer*4 centre
-00023       integer*4 int_value
-00024       character*10 string_value
-00025       character*20 string_centre
-00026       integer len
-00027       integer size
-00028       integer infile,outfile
-00029       integer igrib,iret
-00030       character*256 error
-00031 
-00032       infile=5
-00033       outfile=6
-00034 
-00035       call grib_check(grib_open_file(infile
-00036      X,'../../data/regular_latlon_surface.grib1','r'))
-00037 
-00038       call grib_check(grib_open_file(outfile
-00039      X,'../../data/out.grib1','w'))
-00040 
-00041 C     a new grib message is loaded from file
-00042 C     igrib is the grib id to be used in subsequent calls
-00043       call grib_check(grib_new_from_file(infile,igrib))
-00044 
-00045 C     set centre as a long */
-00046       centre=80
-00047       call grib_check(grib_set_int(igrib,'centre',centre))
-00048 
-00049 C     get centre as a integer*4
-00050       call grib_check(grib_get_int(igrib,'centre',int_value))
-00051       write(*,*) 'centre=',int_value
-00052 
-00053 C     get centre as a string
-00054       call grib_check(grib_get_string(igrib,'centre',string_value))
-00055       string_centre='centre='//string_value
-00056       write(*,*) string_centre
-00057 
-00058 C     write modified message to a file
-00059       call grib_check(grib_write(igrib,outfile))
-00060 
-00061       call grib_check(grib_release(igrib))
-00062 
-00063       call grib_check(grib_close_file(infile))
-00064 
-00065       call grib_check(grib_close_file(outfile))
-00066 
-00067       end
-

Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/set__missing_8f90-example.html b/html/set__missing_8f90-example.html deleted file mode 100644 index 4e3ec854a..000000000 --- a/html/set__missing_8f90-example.html +++ /dev/null @@ -1,69 +0,0 @@ - - -grib_api: set_missing.f90 - - - - -
- -
-

set_missing.f90

How to set a missing value in the header.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: how to set missing a key value.
-00010 !
-00011 !
-00012 !  Author: Enrico Fucile
-00013 !
-00014 !
-00015 !
-00016 program set
-00017   use grib_api
-00018   implicit none
-00019   integer              :: infile,outfile
-00020   integer              :: igrib
-00021 
-00022   infile=5
-00023   outfile=6
-00024 
-00025   call grib_open_file(infile, &
-00026        '../../data/reduced_gaussian_pressure_level.grib2','r')
-00027 
-00028   call grib_open_file(outfile, &
-00029        'out_surface_level.grib2','w')
-00030 
-00031   !     a new grib message is loaded from file
-00032   !     igrib is the grib id to be used in subsequent calls
-00033   call grib_new_from_file(infile,igrib)
-00034 
-00035   call grib_set(igrib,'typeOfFirstFixedSurface','sfc')
-00036   call grib_set_missing(igrib,'scaleFactorOfFirstFixedSurface')
-00037   call grib_set_missing(igrib,'scaledValueOfFirstFixedSurface')
-00038 
-00039   call grib_write(igrib,outfile)
-00040 
-00041   call grib_release(igrib)
-00042 
-00043   call grib_close_file(infile)
-00044 
-00045   call grib_close_file(outfile)
-00046 
-00047 end program set
-

Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/set__pv_8f90-example.html b/html/set__pv_8f90-example.html deleted file mode 100644 index 8c2ef4f7a..000000000 --- a/html/set__pv_8f90-example.html +++ /dev/null @@ -1,96 +0,0 @@ - - -grib_api: set_pv.f90 - - - - -
- -
-

set_pv.f90

How to set the list of levels.

-

00001 ! Copyright 2005-2016 ECMWF
-00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
-00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-00004 ! 
-00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
-00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
-00007 !
-00008 !
-00009 !  Description: how to set pv values.
-00010 !
-00011 !
-00012 !  Author: Anne Fouilloux
-00013 !
-00014 !
-00015 program set_pv
-00016   use grib_api
-00017   implicit none
-00018   integer                         :: numberOfLevels
-00019   integer                         :: numberOfCoefficients
-00020   integer                         :: outfile, igrib
-00021   integer                         :: i, ios
-00022   real, dimension(:),allocatable  :: pv
-00023   
-00024   numberOfLevels=60
-00025   numberOfCoefficients=2*(numberOfLevels+1)
-00026 
-00027   allocate(pv(numberOfCoefficients))
-00028 
-00029   ! read the model level coefficients from file
-00030   open( unit=1, file="../../data/60_model_levels", &
-00031                 form="formatted",action="read")
-00032 
-00033   do i=1,numberOfCoefficients,2
-00034      read(unit=1,fmt=*, iostat=ios) pv(i), pv(i+1)
-00035      if (ios /= 0) then
-00036         print *, "I/O error: ",ios
-00037         exit
-00038      end if
-00039   end do
-00040   
-00041   ! print coefficients
-00042   !do i=1,numberOfCoefficients,2
-00043   !  print *,"  a=",pv(i)," b=",pv(i+1)
-00044   !end do
-00045 
-00046   close(unit=1)
-00047 
-00048   call grib_open_file(outfile, 'out.grib1','w')
-00049   
-00050   !     a new grib message is loaded from file
-00051   !     igrib is the grib id to be used in subsequent calls
-00052   call grib_new_from_samples(igrib, "reduced_gg_sfc_grib1")
-00053 
-00054   !     set levtype to ml (model level)
-00055   call grib_set(igrib,'levtype','ml')
-00056 
-00057   !     set level 
-00058   call grib_set(igrib,'level',2)
-00059 
-00060   !     set PVPresent as an integer 
-00061   call grib_set(igrib,'PVPresent',1)
-00062   
-00063   call grib_set(igrib,'pv',pv)
-00064   
-00065   !     write modified message to a file
-00066   call grib_write(igrib,outfile)
-00067   
-00068   !  FREE MEMORY
-00069   call grib_release(igrib)
-00070   deallocate(pv)
-00071 
-00072   call grib_close_file(outfile)
-00073   
-00074 end program set_pv
-

Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- - diff --git a/html/tab_b.gif b/html/tab_b.gif deleted file mode 100644 index 0d623483f..000000000 Binary files a/html/tab_b.gif and /dev/null differ diff --git a/html/tab_l.gif b/html/tab_l.gif deleted file mode 100644 index 9b1e6337c..000000000 Binary files a/html/tab_l.gif and /dev/null differ diff --git a/html/tab_r.gif b/html/tab_r.gif deleted file mode 100644 index ce9dd9f53..000000000 Binary files a/html/tab_r.gif and /dev/null differ diff --git a/html/tools.html b/html/tools.html deleted file mode 100644 index f8a189fba..000000000 --- a/html/tools.html +++ /dev/null @@ -1,26 +0,0 @@ - - -grib_api: Grib tools - - - - -
- -
-

Grib tools

The following command line tools are provided to help users in all interactive and batch processing of grib data.
- Use of the tools is recommended whenever possible. They provide a ready and tested solution for many situations and their use will avoid the need to write new cod and thus speeding up your work.
- To make easier their use the tools are provided with a common set of options so that it's quick to apply the same options to different tools. We suggest to begin with grib_dump, grib_ls and grib_get to inspect the content of some files and then to learn about the other tools to change the content of the grib message (grib_set, grib_convert, grib_filter) or to copy some messages from a file (grib_copy) or to get a latitude/longitude/values list of data. A smart compare tool (grib_compare) is also provided to compare grib messages focusing on some keys or comparing data with a given precision.

-

-
Generated on Tue Sep 22 15:18:22 2009 for grib_api by  - -doxygen 1.5.3
- -