mirror of https://github.com/ecmwf/eccodes.git
Fix spelling errors in example code
This commit is contained in:
parent
ffaf91cd19
commit
c9004a56b6
|
@ -88,7 +88,7 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* relase the clone's handle */
|
||||
/* release the clone's handle */
|
||||
codes_handle_delete(clone_handle);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
/*
|
||||
* C Implementation: bufr_expanded
|
||||
*
|
||||
* Description: how to read all the exapanded data values from BUFR messages.
|
||||
* Description: how to read all the expanded data values from BUFR messages.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -62,7 +62,7 @@ int main(int argc,char* argv[])
|
|||
/* allocate array for data values */
|
||||
values = (double*)malloc(values_len*sizeof(double));
|
||||
|
||||
/* get the exapanded data values*/
|
||||
/* get the expanded data values*/
|
||||
CODES_CHECK(codes_get_double_array(h, "numericValues", values, &values_len),0);
|
||||
|
||||
for(i = 0; i < values_len; i++)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
!
|
||||
!
|
||||
! FOTRAN 90 Implementation: bufr_attributes
|
||||
! FORTRAN 90 Implementation: bufr_attributes
|
||||
!
|
||||
! Description: how to read attributes of keys in BUFR messages.
|
||||
!
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
!
|
||||
! FORTRAN 90 Implementation: bufr_expanded
|
||||
!
|
||||
! Description: how to read all the exapanded data values from BUFR messages.
|
||||
! Description: how to read all the expanded data values from BUFR messages.
|
||||
!
|
||||
!
|
||||
program bufr_expanded
|
||||
|
@ -39,7 +39,7 @@ real(kind=8), dimension(:), allocatable :: values
|
|||
! i.e. unpack the data values
|
||||
call codes_set(ibufr,"unpack",1);
|
||||
|
||||
! get the exapanded data values
|
||||
! get the expanded data values
|
||||
call codes_get(ibufr,'numericValues',values)
|
||||
|
||||
numberOfValues=size(values)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
!
|
||||
!
|
||||
! FOTRAN 90 Implementation: bufr_get_keys
|
||||
! FORTRAN 90 Implementation: bufr_get_keys
|
||||
!
|
||||
! Description: how to read values of different type of keys from BUFR messages.
|
||||
!
|
||||
|
@ -62,7 +62,7 @@ character(len=9) :: typicalDate
|
|||
|
||||
! ---- array of integer ----------------
|
||||
|
||||
! get the exapanded descriptors
|
||||
! get the expanded descriptors
|
||||
call codes_get(ibufr,'bufrdcExpandedDescriptors',descriptors)
|
||||
|
||||
do i=1,size(descriptors)
|
||||
|
@ -71,7 +71,7 @@ character(len=9) :: typicalDate
|
|||
|
||||
! ---- array of real ----------------
|
||||
|
||||
! get the exapanded data values
|
||||
! get the expanded data values
|
||||
call codes_get(ibufr,'numericValues',values)
|
||||
|
||||
do i=1,size(values)
|
||||
|
@ -96,7 +96,7 @@ character(len=9) :: typicalDate
|
|||
|
||||
end do
|
||||
|
||||
! close file
|
||||
! close file
|
||||
call codes_close_file(ifile)
|
||||
|
||||
|
||||
|
|
|
@ -8,29 +8,28 @@
|
|||
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
!
|
||||
!
|
||||
! FOTRAN 90 Implementation: bufr_get_string_array
|
||||
! FORTRAN 90 Implementation: bufr_get_string_array
|
||||
!
|
||||
! Description: how to get an array of strings from a BUFR message.
|
||||
|
||||
program bufr_get_string_array
|
||||
use eccodes
|
||||
implicit none
|
||||
integer :: ifile
|
||||
integer :: iret,i,n
|
||||
integer :: ibufr
|
||||
integer :: strsize
|
||||
integer, parameter :: max_strsize = 20
|
||||
character(len=max_strsize) , dimension(:),allocatable :: stationOrSiteName
|
||||
use eccodes
|
||||
implicit none
|
||||
integer :: ifile
|
||||
integer :: iret,i,n
|
||||
integer :: ibufr
|
||||
integer :: strsize
|
||||
integer, parameter :: max_strsize = 20
|
||||
character(len=max_strsize) , dimension(:),allocatable :: stationOrSiteName
|
||||
|
||||
call codes_open_file(ifile,'../../data/bufr/pgps_110.bufr','r')
|
||||
|
||||
call codes_bufr_new_from_file(ifile,ibufr,iret)
|
||||
|
||||
|
||||
! unpack the data values
|
||||
call codes_set(ibufr,'unpack',1)
|
||||
|
||||
! get the width of the strings which is te same for all of them
|
||||
! get the width of the strings which is the same for all of them
|
||||
call codes_get(ibufr,'stationOrSiteName->width',strsize)
|
||||
|
||||
! the width is given in bits
|
||||
|
@ -57,12 +56,10 @@ character(len=max_strsize) , dimension(:),allocatable :: stationOrSiteName
|
|||
deallocate(stationOrSiteName)
|
||||
|
||||
! release memory associated with bufr handle
|
||||
! ibufr won't be accessible any more from codes_release on
|
||||
! ibufr won't be accessible after this
|
||||
call codes_release(ibufr)
|
||||
|
||||
! close file
|
||||
call codes_close_file(ifile)
|
||||
|
||||
|
||||
end program bufr_get_string_array
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
!
|
||||
!
|
||||
! FOTRAN 90 Implementation: bufr_read_scatterometer
|
||||
! FORTRAN 90 Implementation: bufr_read_scatterometer
|
||||
!
|
||||
! Description: how to read data for a given beam from scatterometer BUFR messages.
|
||||
!
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
!
|
||||
!
|
||||
! FOTRAN 90 Implementation: bufr_read_synop
|
||||
! FORTRAN 90 Implementation: bufr_read_synop
|
||||
!
|
||||
! Description: how to read SYNOP BUFR messages.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
!
|
||||
!
|
||||
! FOTRAN 90 Implementation: bufr_read_tropical_cyclone
|
||||
! FORTRAN 90 Implementation: bufr_read_tropical_cyclone
|
||||
!
|
||||
! Description: how to read data for a tropical cyclone BUFR message.
|
||||
!
|
||||
|
|
|
@ -50,7 +50,7 @@ program bufr_set_keys
|
|||
! write modified message to a file
|
||||
call codes_write(ibufr,outfile)
|
||||
|
||||
! relase the handle
|
||||
! release the handle
|
||||
call codes_release(ibufr)
|
||||
|
||||
! next message from source
|
||||
|
|
|
@ -8,22 +8,23 @@
|
|||
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
!
|
||||
!
|
||||
! FOTRAN 90 Implementation: get_product_kind
|
||||
! FORTRAN 90 Implementation: get_product_kind
|
||||
!
|
||||
! Description: how to process a file containing a mix of messages
|
||||
! and print the kind of product (e.g. GRIB, BUFR etc)
|
||||
!
|
||||
program get_product_kind
|
||||
use eccodes
|
||||
implicit none
|
||||
integer :: ifile
|
||||
integer :: iret
|
||||
integer :: ihandle
|
||||
integer :: count=0
|
||||
character(len=32) :: product_kind
|
||||
character(len=120) :: infile_name
|
||||
use eccodes
|
||||
implicit none
|
||||
integer :: ifile
|
||||
integer :: iret
|
||||
integer :: ihandle
|
||||
integer :: count=0
|
||||
character(len=32) :: product_kind
|
||||
character(len=120) :: infile_name
|
||||
|
||||
call getarg(1, infile_name)
|
||||
write(*,*) 'infile_name|',infile_name,'|'
|
||||
call codes_open_file(ifile,infile_name,'r')
|
||||
|
||||
! the first message is loaded from file
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
!
|
||||
!
|
||||
! FOTRAN 90 Implementation: grib_clone
|
||||
! FORTRAN 90 Implementation: grib_clone
|
||||
!
|
||||
! Description: how to create a new GRIB message by cloning
|
||||
! an existing message.
|
||||
|
|
|
@ -51,7 +51,7 @@ def example():
|
|||
# write the cloned message to a file
|
||||
codes_write(clone_id, fout)
|
||||
|
||||
# relase the clone's handle
|
||||
# release the clone's handle
|
||||
codes_release(clone_id)
|
||||
|
||||
# release the source's handle
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/sh
|
||||
# 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.
|
||||
#
|
||||
|
||||
. ./include.sh
|
||||
|
||||
#Define a common label for all the tmp files
|
||||
label="bufr_dump_decode_fortran_test"
|
||||
|
||||
#Create log file
|
||||
fLog=${label}".log"
|
||||
rm -f $fLog
|
||||
|
||||
tempBufr=outfile.bufr
|
||||
tempDir=${label}.dir
|
||||
mkdir -p $tempDir
|
||||
|
||||
bufr_files=`cat ${data_dir}/bufr/bufr_data_files.txt`
|
||||
|
||||
# If FORTRAN is enabled, then the pkgconfig should be one level above the test dir
|
||||
PKGCONFIG_FILE=../eccodes_f90.pc
|
||||
CACHE_FILE=../CMakeCache.txt
|
||||
|
||||
COMPILE_AND_RUN=0
|
||||
|
||||
if command -v pkg-config >/dev/null 2>&1; then
|
||||
if [ -f "$PKGCONFIG_FILE" ]; then
|
||||
# Work out the Fortran compiler and flags from pkgconfig
|
||||
COMPILER=`pkg-config --variable=FC $PKGCONFIG_FILE`
|
||||
FLAGS_COMPILER=`pkg-config --cflags $PKGCONFIG_FILE`
|
||||
FLAGS_LINKER=`pkg-config --libs $PKGCONFIG_FILE`
|
||||
|
||||
# The pkgconfig variables refer to the install directory. Change to build dir
|
||||
BUILD_DIR=`grep -w eccodes_BINARY_DIR $CACHE_FILE | cut -d'=' -f2`
|
||||
INSTALL_DIR=`grep -w CMAKE_INSTALL_PREFIX $CACHE_FILE | cut -d'=' -f2`
|
||||
FLAGS_LINKER=`echo $FLAGS_LINKER | sed -e "s:$INSTALL_DIR:$BUILD_DIR:g"`
|
||||
FLAGS_COMPILER=`echo $FLAGS_COMPILER | sed -e "s:$INSTALL_DIR:$BUILD_DIR:g"`
|
||||
|
||||
# TODO: For now only support when shared libs enabled
|
||||
SHARED_LIBS=`grep -w BUILD_SHARED_LIBS $CACHE_FILE | cut -d'=' -f2`
|
||||
if [ "$SHARED_LIBS" = "ON" ]; then
|
||||
COMPILE_AND_RUN=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $tempDir
|
||||
|
||||
for file in ${bufr_files}
|
||||
do
|
||||
tempSrc=$label.$file.f90
|
||||
tempExe=$label.$file.exe
|
||||
filePath=${data_dir}/bufr/$file
|
||||
|
||||
# Generate F90 code from BUFR file
|
||||
${tools_dir}bufr_dump -Dfortran ${filePath} > $tempSrc
|
||||
|
||||
# Compile
|
||||
if [ $COMPILE_AND_RUN -eq 1 ]; then
|
||||
$COMPILER -ffree-line-length-0 -g -o $tempExe $tempSrc $FLAGS_COMPILER $FLAGS_LINKER
|
||||
# valgrind --error-exitcode=1 ./$tempExe
|
||||
./$tempExe $filePath
|
||||
fi
|
||||
|
||||
rm -f $tempExe $tempSrc
|
||||
done
|
Loading…
Reference in New Issue