Examples: Fortran

This commit is contained in:
Shahram Najm 2024-01-13 17:14:08 +00:00
parent 080f08363d
commit 3b86b179c4
6 changed files with 15 additions and 16 deletions

View File

@ -10,7 +10,7 @@
! Description: How to copy a BUFR message in memory ! Description: How to copy a BUFR message in memory
! !
! !
program copy program bufr_copy_message
use eccodes use eccodes
implicit none implicit none
integer :: err, sub_centre integer :: err, sub_centre
@ -50,4 +50,4 @@ program copy
call codes_close_file(outfile) call codes_close_file(outfile)
deallocate (message) deallocate (message)
end program copy end program

View File

@ -9,7 +9,7 @@
! Description: Count messages before processing ! Description: Count messages before processing
! !
! !
program get program grib_count_messages
use eccodes use eccodes
implicit none implicit none
@ -25,11 +25,10 @@ program get
integer :: numberOfPointsAlongAParallel integer :: numberOfPointsAlongAParallel
integer :: numberOfPointsAlongAMeridian integer :: numberOfPointsAlongAMeridian
real, dimension(:), allocatable :: values real, dimension(:), allocatable :: values
integer :: numberOfValues integer(8) :: numberOfValues
real :: average, min_val, max_val real :: average, min_val, max_val
call codes_open_file(ifile, & call codes_open_file(ifile, '../../data/tigge_pf_ecmwf.grib2', 'r')
'../../data/tigge_pf_ecmwf.grib2', 'r')
! count the messages in the file ! count the messages in the file
call codes_count_in_file(ifile, n) call codes_count_in_file(ifile, n)
@ -106,4 +105,4 @@ program get
deallocate (igrib) deallocate (igrib)
end program get end program

View File

@ -21,8 +21,8 @@ program grib_get_keys
real :: longitudeOfFirstPointInDegrees real :: longitudeOfFirstPointInDegrees
real :: latitudeOfLastPointInDegrees real :: latitudeOfLastPointInDegrees
real :: longitudeOfLastPointInDegrees real :: longitudeOfLastPointInDegrees
integer :: numberOfPointsAlongAParallel integer(4) :: numberOfPointsAlongAParallel
integer :: numberOfPointsAlongAMeridian integer(8) :: numberOfPointsAlongAMeridian
real, dimension(:), allocatable :: values real, dimension(:), allocatable :: values
integer :: numberOfValues integer :: numberOfValues
real :: average, min_val, max_val real :: average, min_val, max_val

View File

@ -12,7 +12,7 @@
! rather than the new ALLOCATABLE array ! rather than the new ALLOCATABLE array
! !
! !
program print_data program print_data_static
use grib_api use grib_api
implicit none implicit none
integer :: ifile integer :: ifile
@ -55,4 +55,4 @@ program print_data
call grib_release(igrib) call grib_release(igrib)
call grib_close_file(ifile) call grib_close_file(ifile)
end program print_data end program

View File

@ -11,7 +11,7 @@
! !
! !
! !
program set program set_missing
use eccodes use eccodes
implicit none implicit none
integer :: infile, outfile integer :: infile, outfile
@ -48,4 +48,4 @@ program set
call codes_close_file(infile) call codes_close_file(infile)
call codes_close_file(outfile) call codes_close_file(outfile)
end program set end program

View File

@ -9,7 +9,7 @@
! Description: how to set key values. ! Description: how to set key values.
! !
! !
program set program set_missing_fortran
use eccodes use eccodes
implicit none implicit none
integer :: infile, outfile integer :: infile, outfile
@ -40,4 +40,4 @@ program set
call codes_close_file(outfile) call codes_close_file(outfile)
end program set end program