ecCodes/ECC-1: Fortran interface added

This commit is contained in:
Shahram Najm 2014-12-29 12:49:37 +00:00
parent 9300cea24e
commit 4eb3ebf3f4
8 changed files with 1594 additions and 206 deletions

1
fortran/eccodes.mod Symbolic link
View File

@ -0,0 +1 @@
grib_api.mod

1236
fortran/eccodes_f90_tail.f90 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,7 @@ module grib_api
include "grib_api_constants.h"
include "grib_api_externals.h"
include "grib_api_visibility.h"
include "eccodes_visibility.h"
!> Create a new message in memory from an integer or character array containting the coded message.
!>
@ -38,6 +39,10 @@ module grib_api
module procedure grib_new_from_message_int4
module procedure grib_new_from_message_char
end interface grib_new_from_message
interface codes_new_from_message
module procedure codes_new_from_message_int4
module procedure codes_new_from_message_char
end interface codes_new_from_message
!> Get a value of specified index from an array key.
!>
@ -67,6 +72,12 @@ module grib_api
grib_get_real4_elements, &
grib_get_real8_elements
end interface grib_get_element
interface codes_get_element
module procedure codes_get_real4_element, &
codes_get_real8_element, &
codes_get_real4_elements, &
codes_get_real8_elements
end interface codes_get_element
!> Find the nearest point/points of a given latitude/longitude point.
!>
@ -110,6 +121,12 @@ module grib_api
grib_find_nearest_multiple
end interface grib_find_nearest
interface codes_find_nearest
module procedure codes_find_nearest_single, &
codes_find_nearest_four_single, &
codes_find_nearest_multiple
end interface codes_find_nearest
!> Get latitude/longitude and data values.
!>
!> Latitudes, longitudes, data values arrays are returned.
@ -132,3 +149,8 @@ module grib_api
module procedure grib_get_data_real4, &
grib_get_data_real8
end interface grib_get_data
interface codes_get_data
module procedure codes_get_data_real4, &
codes_get_data_real8
end interface codes_get_data

View File

@ -25,6 +25,11 @@
grib_index_get_string, &
grib_index_get_real8
end interface grib_index_get
interface codes_index_get
module procedure codes_index_get_int, &
codes_index_get_string, &
codes_index_get_real8
end interface codes_index_get
!> Get the number of distinct values of the key in argument contained in the index. The key must belong to the index.
!>
@ -42,6 +47,9 @@
interface grib_index_get_size
module procedure grib_index_get_size_int
end interface grib_index_get_size
interface codes_index_get_size
module procedure codes_index_get_size_int
end interface codes_index_get_size
!> Select the message subset with key==value.
!>
@ -61,6 +69,11 @@
grib_index_select_string, &
grib_index_select_real8
end interface grib_index_select
interface codes_index_select
module procedure codes_index_select_int, &
codes_index_select_string, &
codes_index_select_real8
end interface codes_index_select
!> Get the value for a key from a grib message.
!>
@ -101,6 +114,17 @@
grib_get_real4_array, &
grib_get_real8_array
end interface grib_get
interface codes_get
module procedure codes_get_int, &
codes_get_real4, &
codes_get_real8, &
codes_get_string, &
codes_get_int_array, &
codes_get_byte_array, &
codes_get_real4_array, &
codes_get_real8_array
end interface codes_get
!> Get the size of an array key.
!>
@ -117,6 +141,9 @@
interface grib_get_size
module procedure grib_get_size_int
end interface grib_get_size
interface codes_get_size
module procedure codes_get_size_int
end interface codes_get_size
!> Set the value for a key in a grib message.
!>
@ -150,9 +177,23 @@
grib_set_real4_array, &
grib_set_real8_array
end interface grib_set
interface codes_set
module procedure codes_set_int, &
codes_set_real4, &
codes_set_real8, &
codes_set_string, &
codes_set_int_array, &
codes_set_byte_array, &
codes_set_real4_array, &
codes_set_real8_array
end interface codes_set
interface grib_set_force
module procedure grib_set_force_real4_array, &
grib_set_force_real8_array
end interface grib_set_force
interface codes_set_force
module procedure codes_set_force_real4_array, &
codes_set_force_real8_array
end interface codes_set_force

View File

@ -21,6 +21,10 @@
module procedure grib_read_from_file_int4
module procedure grib_read_from_file_char
end interface grib_read_from_file
interface codes_read_from_file
module procedure codes_read_from_file_int4
module procedure codes_read_from_file_char
end interface codes_read_from_file
!> Reads nbytes bytes into the buffer from a file opened with grib_open_file.
!>
@ -39,6 +43,12 @@
module procedure grib_read_bytes_real8
module procedure grib_read_bytes_real4
end interface grib_read_bytes
interface codes_read_bytes
module procedure codes_read_bytes_int4
module procedure codes_read_bytes_char
module procedure codes_read_bytes_real8
module procedure codes_read_bytes_real4
end interface codes_read_bytes
!> Write nbytes bytes from the buffer in a file opened with grib_open_file.
!>
@ -57,6 +67,12 @@
module procedure grib_write_bytes_real8
module procedure grib_write_bytes_real4
end interface grib_write_bytes
interface codes_write_bytes
module procedure codes_write_bytes_int4
module procedure codes_write_bytes_char
module procedure codes_write_bytes_real8
module procedure codes_write_bytes_real4
end interface codes_write_bytes
!> Get the size of a coded message.
!>
@ -70,3 +86,6 @@
interface grib_get_message_size
module procedure grib_get_message_size_int
end interface grib_get_message_size
interface codes_get_message_size
module procedure codes_get_message_size_int
end interface codes_get_message_size

View File

@ -26,6 +26,12 @@
grib_index_get_string, &
grib_index_get_real8
end interface grib_index_get
interface codes_index_get
module procedure codes_index_get_int, &
codes_index_get_long, &
codes_index_get_string, &
codes_index_get_real8
end interface codes_index_get
!> Get the number of distinct values of the key in argument contained in the index. The key must belong to the index.
!>
@ -44,6 +50,10 @@
module procedure grib_index_get_size_int, &
grib_index_get_size_long
end interface grib_index_get_size
interface codes_index_get_size
module procedure codes_index_get_size_int, &
codes_index_get_size_long
end interface codes_index_get_size
!> Select the message subset with key==value.
!>
@ -64,6 +74,12 @@
grib_index_select_string, &
grib_index_select_real8
end interface grib_index_select
interface codes_index_select
module procedure codes_index_select_int, &
codes_index_select_long, &
codes_index_select_string, &
codes_index_select_real8
end interface codes_index_select
!> Get the value for a key from a grib message.
!>
@ -105,6 +121,17 @@
grib_get_real4_array, &
grib_get_real8_array
end interface grib_get
interface codes_get
module procedure codes_get_int, &
codes_get_long, &
codes_get_real4, &
codes_get_real8, &
codes_get_string, &
codes_get_int_array, &
codes_get_byte_array, &
codes_get_real4_array, &
codes_get_real8_array
end interface codes_get
!> Get the size of an array key.
!>
@ -122,6 +149,10 @@
module procedure grib_get_size_int, &
grib_get_size_long
end interface grib_get_size
interface codes_get_size
module procedure codes_get_size_int, &
codes_get_size_long
end interface codes_get_size
!> Set the value for a key in a grib message.
!>
@ -157,9 +188,25 @@
grib_set_real4_array, &
grib_set_real8_array
end interface grib_set
interface codes_set
module procedure codes_set_int, &
codes_set_long, &
codes_set_real4, &
codes_set_real8, &
codes_set_string, &
codes_set_int_array, &
codes_set_long_array, &
codes_set_byte_array, &
codes_set_real4_array, &
codes_set_real8_array
end interface codes_set
interface grib_set_force
module procedure grib_set_force_real4_array, &
grib_set_force_real8_array
end interface grib_set_force
interface codes_set_force
module procedure codes_set_force_real4_array, &
codes_set_force_real8_array
end interface codes_set_force

View File

@ -23,6 +23,12 @@
module procedure grib_read_from_file_char
module procedure grib_read_from_file_char_size_t
end interface grib_read_from_file
interface codes_read_from_file
module procedure codes_read_from_file_int4
module procedure codes_read_from_file_int4_size_t
module procedure codes_read_from_file_char
module procedure codes_read_from_file_char_size_t
end interface codes_read_from_file
!> Reads nbytes bytes into the buffer from a file opened with grib_open_file.
!>
@ -45,6 +51,16 @@
module procedure grib_read_bytes_real4
module procedure grib_read_bytes_real4_size_t
end interface grib_read_bytes
interface codes_read_bytes
module procedure codes_read_bytes_int4
module procedure codes_read_bytes_int4_size_t
module procedure codes_read_bytes_char
module procedure codes_read_bytes_char_size_t
module procedure codes_read_bytes_real8
module procedure codes_read_bytes_real8_size_t
module procedure codes_read_bytes_real4
module procedure codes_read_bytes_real4_size_t
end interface codes_read_bytes
!> Write nbytes bytes from the buffer in a file opened with grib_open_file.
!>
@ -67,6 +83,16 @@
module procedure grib_write_bytes_real4
module procedure grib_write_bytes_real4_size_t
end interface grib_write_bytes
interface codes_write_bytes
module procedure codes_write_bytes_int4
module procedure codes_write_bytes_int4_size_t
module procedure codes_write_bytes_char
module procedure codes_write_bytes_char_size_t
module procedure codes_write_bytes_real8
module procedure codes_write_bytes_real8_size_t
module procedure codes_write_bytes_real4
module procedure codes_write_bytes_real4_size_t
end interface codes_write_bytes
!> Get the size of a coded message.
!>
@ -81,3 +107,7 @@
module procedure grib_get_message_size_int
module procedure grib_get_message_size_size_t
end interface grib_get_message_size
interface codes_get_message_size
module procedure codes_get_message_size_int
module procedure codes_get_message_size_size_t
end interface codes_get_message_size

View File

@ -30,7 +30,6 @@
else
call grib_check(iret,'grib_set_missing','('//key//')')
endif
end subroutine grib_set_missing
!> Create a new index form a file. The file is indexed with the keys in argument.
@ -59,7 +58,6 @@
else
call grib_check(iret,'grib_index_create','('//filename//')')
endif
end subroutine grib_index_create
!> Add a file to an index.
@ -86,7 +84,6 @@
else
call grib_check(iret,'grib_index_add_file','('//filename//')')
endif
end subroutine grib_index_add_file
!> Get the number of distinct values of the key in argument contained in the index. The key must belong to the index.
@ -115,7 +112,6 @@
else
call grib_check(iret,'grib_index_get_size','('//key//')')
endif
end subroutine grib_index_get_size_long
!> Get the number of distinct values of the key in argument contained in the index. The key must belong to the index.
@ -144,7 +140,6 @@
else
call grib_check(iret,'grib_index_get_size','('//key//')')
endif
end subroutine grib_index_get_size_int
!> Get the distinct values of the key in argument contained in the index. The key must belong to the index. This function is used when the type of the key was explicitly defined as long or when the native type of the key is long.
@ -167,6 +162,7 @@
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: nb_values
nb_values = size(values)
iret=grib_f_index_get_int ( indexid, key, values , nb_values )
if (present(status)) then
@ -196,6 +192,7 @@
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: nb_values
nb_values = size(values)
iret=grib_f_index_get_long ( indexid, key, values , nb_values )
if (present(status)) then
@ -225,6 +222,7 @@
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: nb_values
nb_values = size(values)
iret=grib_f_index_get_real8 ( indexid, key, values , nb_values )
if (present(status)) then
@ -2721,7 +2719,6 @@
integer(kind=kindOfInt), intent(in) :: gribid
character(len=1), dimension(:), intent(out) :: message
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfSize_t) :: size_bytes
@ -2774,7 +2771,6 @@
integer(kind=kindOfInt), intent(in) :: multigribid
integer(kind=kindOfInt), intent(in) :: ifile
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
iret = grib_f_multi_write( multigribid, ifile )
@ -2846,7 +2842,6 @@
integer(kind=kindOfInt) :: intis_lsm
intis_lsm = 0
if (is_lsm) intis_lsm=1
npoints=size(inlats)
iret=grib_f_find_nearest_multiple(gribid,intis_lsm,inlats,inlons,outlats,outlons, &
@ -2892,7 +2887,6 @@
integer(kind=kindOfInt) :: intis_lsm =0
if (is_lsm) intis_lsm=1
iret=grib_f_find_nearest_single(gribid,intis_lsm,inlat,inlon,outlat,outlon, &
value,distance,index)
@ -2997,7 +2991,6 @@
integer(kind=kindOfInt) :: iret
iret=grib_f_gribex_mode_on()
if (present(status)) then
status = iret
else
@ -3018,7 +3011,6 @@
integer(kind=kindOfInt) :: iret
iret=grib_f_gribex_mode_off()
if (present(status)) then
status = iret
else
@ -3043,7 +3035,6 @@
subroutine grib_skip_computed ( iterid , status)
integer(kind=kindOfInt), intent(in) :: iterid
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
iret = grib_f_skip_computed ( iterid )
@ -3069,7 +3060,6 @@
subroutine grib_skip_coded ( iterid, status )
integer(kind=kindOfInt), intent(in) :: iterid
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
iret = grib_f_skip_coded ( iterid )
@ -3094,7 +3084,6 @@
subroutine grib_skip_duplicates ( iterid, status )
integer(kind=kindOfInt), intent(in) :: iterid
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
iret = grib_f_skip_duplicates ( iterid )
@ -3117,7 +3106,6 @@
subroutine grib_skip_read_only ( iterid, status )
integer(kind=kindOfInt), intent(in) :: iterid
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
iret = grib_f_skip_read_only ( iterid )
@ -3128,6 +3116,10 @@
endif
end subroutine grib_skip_read_only
!>
!> eccodes wrapper functions
!>
include "eccodes_f90_tail.f90"
end module grib_api