From 4eb3ebf3f482204379603c80289defab01c17732 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 29 Dec 2014 12:49:37 +0000 Subject: [PATCH] ecCodes/ECC-1: Fortran interface added --- fortran/eccodes.mod | 1 + fortran/eccodes_f90_tail.f90 | 1236 ++++++++++++++++++++++++++++++ fortran/grib_f90_head.f90 | 22 + fortran/grib_f90_int.f90 | 43 +- fortran/grib_f90_int_size_t.f90 | 19 + fortran/grib_f90_long_int.f90 | 51 +- fortran/grib_f90_long_size_t.f90 | 30 + fortran/grib_f90_tail.f90 | 398 +++++----- 8 files changed, 1594 insertions(+), 206 deletions(-) create mode 120000 fortran/eccodes.mod create mode 100644 fortran/eccodes_f90_tail.f90 diff --git a/fortran/eccodes.mod b/fortran/eccodes.mod new file mode 120000 index 000000000..1df4f8eb1 --- /dev/null +++ b/fortran/eccodes.mod @@ -0,0 +1 @@ +grib_api.mod \ No newline at end of file diff --git a/fortran/eccodes_f90_tail.f90 b/fortran/eccodes_f90_tail.f90 new file mode 100644 index 000000000..9ddee0d37 --- /dev/null +++ b/fortran/eccodes_f90_tail.f90 @@ -0,0 +1,1236 @@ +!> +!> Wrapper for eccodes +!> +subroutine codes_set_missing ( gribid, key, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_set_missing ( gribid, key, status ) +end subroutine codes_set_missing + +! +subroutine codes_index_create ( indexid, filename, keys, status ) + integer(kind=kindOfInt), intent(inout) :: indexid + character(len=*), intent(in) :: filename + character(len=*), intent(in) :: keys + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_index_create ( indexid, filename, keys, status ) +end subroutine codes_index_create + +! +subroutine codes_index_add_file ( indexid, filename, status ) + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: filename + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_index_add_file ( indexid, filename, status ) +end subroutine codes_index_add_file + +! +subroutine codes_index_get_size_long( indexid, key, size, status ) + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + integer(kind=kindOfLong), intent(out) :: size + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_index_get_size_long( indexid, key, size, status ) +end subroutine codes_index_get_size_long + +! +subroutine codes_index_get_size_int( indexid, key, size, status ) + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + integer(kind=kindOfInt), intent(out) :: size + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_index_get_size_int( indexid, key, size, status ) +end subroutine codes_index_get_size_int + +! +subroutine codes_index_get_int( indexid, key, values, status ) + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + integer(kind=kindOfInt), dimension(:), intent(out) :: values + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_index_get_int( indexid, key, values, status ) +end subroutine codes_index_get_int + +! +subroutine codes_index_get_long( indexid, key, values, status ) + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + integer(kind=kindOfLong), dimension(:), intent(out) :: values + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_index_get_long( indexid, key, values, status ) +end subroutine codes_index_get_long + +! +subroutine codes_index_get_real8( indexid, key, values, status ) + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + real(kind=kindOfDouble), dimension(:), intent(out) :: values + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_index_get_real8( indexid, key, values, status ) +end subroutine codes_index_get_real8 + +! +subroutine codes_index_get_string( indexid, key, values, status ) + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + character(len=*), dimension(:), intent(out) :: values + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + integer(kind=kindOfInt) :: size_value + + call grib_index_get_string( indexid, key, values, status ) +end subroutine codes_index_get_string + +! +subroutine codes_index_select_string( indexid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + character(len=*), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_index_select_string( indexid, key, value, status ) +end subroutine codes_index_select_string + +! +subroutine codes_index_select_int( indexid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + integer(kind=kindOfInt), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_index_select_int( indexid, key, value, status ) +end subroutine codes_index_select_int + +! +subroutine codes_index_select_long( indexid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + integer(kind=kindOfLong), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_index_select_long( indexid, key, value, status ) +end subroutine codes_index_select_long + +! +subroutine codes_index_select_real8( indexid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + real(kind=kindOfDouble), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_index_select_real8( indexid, key, value, status ) +end subroutine codes_index_select_real8 + +! +subroutine codes_new_from_index ( indexid, gribid , status) + integer(kind=kindOfInt),intent(in) :: indexid + integer(kind=kindOfInt),intent(out) :: gribid + integer(kind=kindOfInt),optional,intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_new_from_index ( indexid, gribid , status) +end subroutine codes_new_from_index + +! +subroutine codes_index_read ( indexid, filename, status ) + integer(kind=kindOfInt), intent(inout) :: indexid + character(len=*), intent(in) :: filename + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_index_read ( indexid, filename, status ) +end subroutine codes_index_read + +! +subroutine codes_index_write ( indexid, filename, status ) + integer(kind=kindOfInt), intent(inout) :: indexid + character(len=*), intent(in) :: filename + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_index_write ( indexid, filename, status ) +end subroutine codes_index_write + +! +subroutine codes_index_release ( indexid, status ) + integer(kind=kindOfInt), intent(in) :: indexid + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_index_release ( indexid, status ) +end subroutine codes_index_release + +! +subroutine codes_open_file ( ifile, filename, mode, status ) + integer(kind=kindOfInt),intent(out) :: ifile + character(len=*), intent(in) :: filename + character(LEN=*), intent(in) :: mode + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_open_file ( ifile, filename, mode, status ) +end subroutine codes_open_file + +! +subroutine codes_read_bytes_char ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + character(len=1),dimension(:), intent(out) :: buffer + integer(kind=kindOfInt), intent(in) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret + + call grib_read_bytes_char ( ifile, buffer, nbytes, status ) +end subroutine codes_read_bytes_char + +! +subroutine codes_read_bytes_char_size_t ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + character(len=1),dimension(:), intent(out) :: buffer + integer(kind=kindOfSize_t), intent(in) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_read_bytes_char_size_t ( ifile, buffer, nbytes, status ) +end subroutine codes_read_bytes_char_size_t + +! +subroutine codes_read_bytes_int4 ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + integer(kind=4),dimension(:), intent(out) :: buffer + integer(kind=kindOfInt), intent(in) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret + + call grib_read_bytes_int4 ( ifile, buffer, nbytes, status ) +end subroutine codes_read_bytes_int4 + +! +subroutine codes_read_bytes_int4_size_t ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + integer(kind=4),dimension(:), intent(out) :: buffer + integer(kind=kindOfSize_t), intent(in) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_read_bytes_int4_size_t ( ifile, buffer, nbytes, status ) +end subroutine codes_read_bytes_int4_size_t + +! +subroutine codes_read_bytes_real4 ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=4),dimension(:), intent(out) :: buffer + integer(kind=kindOfInt), intent(in) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret + + call grib_read_bytes_real4 ( ifile, buffer, nbytes, status ) +end subroutine codes_read_bytes_real4 + +! +subroutine codes_read_bytes_real4_size_t ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=4),dimension(:), intent(out) :: buffer + integer(kind=kindOfSize_t), intent(inout) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_read_bytes_real4_size_t ( ifile, buffer, nbytes, status ) +end subroutine codes_read_bytes_real4_size_t + +! +subroutine codes_read_bytes_real8 ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=8),dimension(:), intent(out) :: buffer + integer(kind=kindOfInt), intent(in) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret + + call grib_read_bytes_real8 ( ifile, buffer, nbytes, status ) +end subroutine codes_read_bytes_real8 + +! +subroutine codes_read_bytes_real8_size_t ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=8),dimension(:), intent(out) :: buffer + integer(kind=kindOfSize_t), intent(inout) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_read_bytes_real8_size_t ( ifile, buffer, nbytes, status ) +end subroutine codes_read_bytes_real8_size_t + +! +subroutine codes_read_from_file_int4 ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + integer(kind=4),dimension(:), intent(out) :: buffer + integer(kind=kindOfInt), intent(inout) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret + + call grib_read_from_file_int4 ( ifile, buffer, nbytes, status ) +end subroutine codes_read_from_file_int4 + +! +subroutine codes_read_from_file_int4_size_t ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + integer(kind=4),dimension(:), intent(out) :: buffer + integer(kind=kindOfSize_t), intent(inout) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_read_from_file_int4_size_t ( ifile, buffer, nbytes, status ) +end subroutine codes_read_from_file_int4_size_t + +! +subroutine codes_read_from_file_real4 ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=4),dimension(:), intent(out) :: buffer + integer(kind=kindOfInt), intent(inout) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret + + call grib_read_from_file_real4 ( ifile, buffer, nbytes, status ) +end subroutine codes_read_from_file_real4 + +! +subroutine codes_read_from_file_real4_size_t ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=4),dimension(:), intent(out) :: buffer + integer(kind=kindOfSize_t), intent(inout) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_read_from_file_real4_size_t ( ifile, buffer, nbytes, status ) +end subroutine codes_read_from_file_real4_size_t + +! +subroutine codes_read_from_file_real8 ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=8),dimension(:), intent(out) :: buffer + integer(kind=kindOfInt), intent(inout) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret + + call grib_read_from_file_real8 ( ifile, buffer, nbytes, status ) +end subroutine codes_read_from_file_real8 + +! +subroutine codes_read_from_file_real8_size_t ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=8),dimension(:), intent(out) :: buffer + integer(kind=kindOfSize_t), intent(inout) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_read_from_file_real8_size_t ( ifile, buffer, nbytes, status ) +end subroutine codes_read_from_file_real8_size_t + +! +subroutine codes_read_from_file_char ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + character(len=1),dimension(:), intent(out) :: buffer + integer(kind=kindOfInt), intent(inout) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret + + call grib_read_from_file_char ( ifile, buffer, nbytes, status ) +end subroutine codes_read_from_file_char + +! +subroutine codes_read_from_file_char_size_t ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + character(len=1),dimension(:), intent(out) :: buffer + integer(kind=kindOfSize_t), intent(inout) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_read_from_file_char_size_t ( ifile, buffer, nbytes, status ) +end subroutine codes_read_from_file_char_size_t + +! +subroutine codes_write_bytes_char ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + character(len=1), dimension(:),intent(in) :: buffer + integer(kind=kindOfInt), intent(in) :: nbytes + integer(kind=kindOfInt),optional,intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret + + call grib_write_bytes_char ( ifile, buffer, nbytes, status ) +end subroutine codes_write_bytes_char + +! +subroutine codes_write_bytes_char_size_t ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + character(len=1), dimension(:),intent(in) :: buffer + integer(kind=kindOfSize_t), intent(in) :: nbytes + integer(kind=kindOfInt),optional,intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_write_bytes_char_size_t ( ifile, buffer, nbytes, status ) +end subroutine codes_write_bytes_char_size_t + +! +subroutine codes_write_bytes_int4 ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + integer(kind=4), dimension(:),intent(in) :: buffer + integer(kind=kindOfInt), intent(in) :: nbytes + integer(kind=kindOfInt),optional,intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret + + call grib_write_bytes_int4 ( ifile, buffer, nbytes, status ) +end subroutine codes_write_bytes_int4 + +! +subroutine codes_write_bytes_int4_size_t ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + integer(kind=4), dimension(:),intent(in) :: buffer + integer(kind=kindOfSize_t), intent(in) :: nbytes + integer(kind=kindOfInt),optional,intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_write_bytes_int4_size_t ( ifile, buffer, nbytes, status ) +end subroutine codes_write_bytes_int4_size_t + +! +subroutine codes_write_bytes_real4 ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=4), dimension(:),intent(in) :: buffer + integer(kind=kindOfInt), intent(in) :: nbytes + integer(kind=kindOfInt),optional,intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret + + call grib_write_bytes_real4 ( ifile, buffer, nbytes, status ) +end subroutine codes_write_bytes_real4 + +! +subroutine codes_write_bytes_real4_size_t ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=4), dimension(:),intent(in) :: buffer + integer(kind=kindOfSize_t), intent(in) :: nbytes + integer(kind=kindOfInt),optional,intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_write_bytes_real4_size_t ( ifile, buffer, nbytes, status ) +end subroutine codes_write_bytes_real4_size_t + +! +subroutine codes_write_bytes_real8 ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=8), dimension(:),intent(in) :: buffer + integer(kind=kindOfInt), intent(in) :: nbytes + integer(kind=kindOfInt),optional,intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret + + call grib_write_bytes_real8 ( ifile, buffer, nbytes, status ) +end subroutine codes_write_bytes_real8 + +! +subroutine codes_write_bytes_real8_size_t ( ifile, buffer, nbytes, status ) + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=8), dimension(:),intent(in) :: buffer + integer(kind=kindOfSize_t), intent(in) :: nbytes + integer(kind=kindOfInt),optional,intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_write_bytes_real8_size_t ( ifile, buffer, nbytes, status ) +end subroutine codes_write_bytes_real8_size_t + +! +subroutine codes_close_file ( ifile , status ) + integer(kind=kindOfInt),intent(in) :: ifile + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_close_file ( ifile , status ) +end subroutine codes_close_file + +! +subroutine codes_count_in_file ( ifile, n , status) + integer(kind=kindOfInt),intent(in) :: ifile + integer(kind=kindOfInt),intent(out) :: n + integer(kind=kindOfInt),optional,intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_count_in_file ( ifile, n , status) +end subroutine codes_count_in_file + +! +subroutine codes_headers_only_new_from_file ( ifile, gribid , status) + integer(kind=kindOfInt),intent(in) :: ifile + integer(kind=kindOfInt),intent(out) :: gribid + integer(kind=kindOfInt),optional,intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_headers_only_new_from_file ( ifile, gribid , status) +end subroutine codes_headers_only_new_from_file + +! +subroutine codes_new_from_file ( ifile, gribid , status) + integer(kind=kindOfInt),intent(in) :: ifile + integer(kind=kindOfInt),intent(out) :: gribid + integer(kind=kindOfInt),optional,intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_new_from_file ( ifile, gribid , status) +end subroutine codes_new_from_file + +! +subroutine codes_new_from_message_char( gribid, message, status ) + integer(kind=kindOfInt),intent(out) :: gribid + character(len=1), dimension(:),intent(in) :: message + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfSize_t) :: size_bytes + integer(kind=kindOfInt) :: iret + + call grib_new_from_message_char( gribid, message, status ) +end subroutine codes_new_from_message_char + +! +subroutine codes_new_from_message_int4 ( gribid, message, status ) + integer(kind=kindOfInt),intent(out) :: gribid + integer(kind=4), dimension(:),intent(in) :: message + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfSize_t) :: size_bytes + integer(kind=kindOfInt) :: iret + + call grib_new_from_message_int4 ( gribid, message, status ) +end subroutine codes_new_from_message_int4 + +! +subroutine codes_new_from_samples ( gribid, samplename, status ) + integer(kind=kindOfInt), intent(out) :: gribid + character(len=*), intent(in) :: samplename + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_new_from_samples ( gribid, samplename, status ) +end subroutine codes_new_from_samples + +! +subroutine codes_release ( gribid, status ) + integer(kind=kindOfInt), intent(in) :: gribid + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_release ( gribid, status ) +end subroutine codes_release + +! +subroutine codes_clone ( gribid_src, gribid_dest, status ) + integer(kind=kindOfInt), intent(in) :: gribid_src + integer(kind=kindOfInt), intent(out) :: gribid_dest + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_clone ( gribid_src, gribid_dest, status ) +end subroutine codes_clone + +! +subroutine codes_util_sections_copy ( gribid_from, gribid_to, what, gribid_out,status ) + integer(kind=kindOfInt), intent(in) :: gribid_from + integer(kind=kindOfInt), intent(in) :: gribid_to + integer(kind=kindOfInt), intent(out) :: gribid_out + integer(kind=kindOfInt), intent(in) :: what + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_util_sections_copy ( gribid_from, gribid_to, what, gribid_out,status ) +end subroutine codes_util_sections_copy + +! +subroutine codes_copy_namespace ( gribid_src, namespace, gribid_dest, status ) + integer(kind=kindOfInt), intent(in) :: gribid_src + integer(kind=kindOfInt), intent(in) :: gribid_dest + character(LEN=*), intent(in) :: namespace + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_copy_namespace ( gribid_src, namespace, gribid_dest, status ) +end subroutine codes_copy_namespace + +! +subroutine codes_check ( status,caller,string ) + integer(kind=kindOfInt), intent(in) :: status + character(len=*), intent(in) :: caller + character(len=*), intent(in) :: string + + call grib_check ( status,caller,string ) +end subroutine codes_check + +! +subroutine codes_get_data_real4 ( gribid, lats, lons, values, status ) + integer(kind=kindOfInt), intent(in) :: gribid + real ( kind = kindOfFloat ), dimension(:),intent(out) :: lats, lons + real ( kind = kindOfFloat ), dimension(:),intent(out) :: values + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfSize_t) :: npoints + + call grib_get_data_real4 ( gribid, lats, lons, values, status ) +end subroutine codes_get_data_real4 + +! +subroutine codes_get_data_real8 ( gribid, lats, lons, values, status ) + integer(kind=kindOfInt), intent(in) :: gribid + real ( kind = kindOfDouble ), dimension(:),intent(out) :: lats, lons + real ( kind = kindOfDouble ), dimension(:),intent(out) :: values + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfSize_t) :: npoints + + call grib_get_data_real8 ( gribid, lats, lons, values, status ) +end subroutine codes_get_data_real8 + +! +subroutine codes_keys_iterator_new ( gribid, iterid, namespace, status ) + integer(kind=kindOfInt), intent(in) :: gribid + integer(kind=kindOfInt), intent(inout) :: iterid + character(LEN=*), intent(in) :: namespace + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_keys_iterator_new ( gribid, iterid, namespace, status ) +end subroutine codes_keys_iterator_new + +! +subroutine codes_keys_iterator_next ( iterid , status) + integer(kind=kindOfInt), intent(in) :: iterid + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_keys_iterator_next ( iterid , status) +end subroutine codes_keys_iterator_next + +! +subroutine codes_keys_iterator_delete ( iterid , status) + integer(kind=kindOfInt), intent(in) :: iterid + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_keys_iterator_delete ( iterid , status) +end subroutine codes_keys_iterator_delete + +! +subroutine codes_keys_iterator_get_name ( iterid, name, status ) + integer(kind=kindOfInt), intent(in) :: iterid + character(LEN=*), intent(out) :: name + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_keys_iterator_get_name ( iterid, name, status ) +end subroutine codes_keys_iterator_get_name + +! +subroutine codes_keys_iterator_rewind ( iterid, status ) + integer(kind=kindOfInt), intent(in) :: iterid + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_keys_iterator_rewind ( iterid, status ) +end subroutine codes_keys_iterator_rewind + +! +subroutine codes_dump ( gribid , status) + integer(kind=kindOfInt), intent(in) :: gribid + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_dump ( gribid , status) +end subroutine codes_dump + +! +subroutine codes_get_error_string ( error, error_message, status ) + integer(kind=kindOfInt), intent(in) :: error + character(len=*), intent(out) :: error_message + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_get_error_string ( error, error_message, status ) +end subroutine codes_get_error_string + +! +subroutine codes_get_size_int ( gribid, key, size , status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfInt), intent(out) :: size + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_get_size_int ( gribid, key, size , status) +end subroutine codes_get_size_int + +! +subroutine codes_get_size_long ( gribid, key, size , status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfLong), intent(out) :: size + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_get_size_long ( gribid, key, size , status) +end subroutine codes_get_size_long + +! +subroutine codes_get_int(gribid,key,value,status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind = kindOfInt), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_get_int(gribid,key,value,status) +end subroutine codes_get_int + +! +subroutine codes_get_long(gribid,key,value,status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind = kindOfLong), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_get_long(gribid,key,value,status) +end subroutine codes_get_long + +! +subroutine codes_is_missing(gribid,key,is_missing,status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind = kindOfInt), intent(out) :: is_missing + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_is_missing(gribid,key,is_missing,status) +end subroutine codes_is_missing + +! +subroutine codes_is_defined(gribid,key,is_defined,status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind = kindOfInt), intent(out) :: is_defined + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_is_defined(gribid,key,is_defined,status) +end subroutine codes_is_defined + +! +subroutine codes_get_real4 ( gribid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + real(kind = kindOfFloat), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_get_real4 ( gribid, key, value, status ) +end subroutine codes_get_real4 + +! +subroutine codes_get_real8 ( gribid, key, value , status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + real(kind = kindOfDouble), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_get_real8 ( gribid, key, value , status) +end subroutine codes_get_real8 + +! +subroutine codes_get_string ( gribid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + character(len=*), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_get_string ( gribid, key, value, status ) +end subroutine codes_get_string + +! +subroutine codes_get_int_array ( gribid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfInt), dimension(:), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_get_int_array ( gribid, key, value, status ) +end subroutine codes_get_int_array + +! +subroutine codes_get_long_array ( gribid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfLong), dimension(:), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_get_long_array ( gribid, key, value, status ) +end subroutine codes_get_long_array + +! +subroutine codes_get_byte_array ( gribid, key, value, length, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + character(len=1), dimension(:), intent(out) :: value + integer(kind=kindOfInt), optional, intent(out) :: length + integer(kind=kindOfInt), optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + character :: bytes(size(value)) + + call grib_get_byte_array ( gribid, key, value, length, status ) +end subroutine codes_get_byte_array + +! +subroutine codes_get_real4_array ( gribid, key, value, status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + real(kind = kindOfFloat), dimension(:), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_get_real4_array ( gribid, key, value, status) +end subroutine codes_get_real4_array + +! +subroutine codes_get_real8_array ( gribid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + real(kind = kindOfDouble), dimension(:), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_get_real8_array ( gribid, key, value, status ) +end subroutine codes_get_real8_array + +! +subroutine codes_get_real4_element ( gribid, key, index,value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfInt), intent(in) :: index + real(kind = kindOfFloat), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_get_real4_element ( gribid, key, index,value, status ) +end subroutine codes_get_real4_element + +! +subroutine codes_get_real8_element ( gribid, key, index,value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfInt), intent(in) :: index + real(kind = kindOfDouble), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_get_real8_element ( gribid, key, index,value, status ) +end subroutine codes_get_real8_element + +! +subroutine codes_get_real4_elements ( gribid, key, index,value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfInt),dimension(:), intent(in) :: index + real(kind = kindOfFloat), dimension(:), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) ::npoints + + call grib_get_real4_elements ( gribid, key, index,value, status ) +end subroutine codes_get_real4_elements + +! +subroutine codes_get_real8_elements ( gribid, key, index,value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfInt),dimension(:), intent(in) :: index + real(kind = kindOfDouble), dimension(:), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: npoints + + call grib_get_real8_elements ( gribid, key, index,value, status ) +end subroutine codes_get_real8_elements + +! +subroutine codes_set_int ( gribid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfInt), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_set_int ( gribid, key, value, status ) +end subroutine codes_set_int + +! +subroutine codes_set_long ( gribid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfLong), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_set_long ( gribid, key, value, status ) +end subroutine codes_set_long + +! +subroutine codes_set_real4 ( gribid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + real(kind = kindOfFloat), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_set_real4 ( gribid, key, value, status ) +end subroutine codes_set_real4 + +! +subroutine codes_set_real8 ( gribid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + real(kind = kindOfDouble), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_set_real8 ( gribid, key, value, status ) +end subroutine codes_set_real8 + +! +subroutine codes_set_int_array ( gribid, key, value, status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfInt), dimension(:), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_set_int_array ( gribid, key, value, status) +end subroutine codes_set_int_array + +! +subroutine codes_set_long_array ( gribid, key, value, status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfLong), dimension(:), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_set_long_array ( gribid, key, value, status) +end subroutine codes_set_long_array + +! +subroutine codes_set_byte_array ( gribid, key, value, length, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + character(len=1), dimension(:), intent(in) :: value + integer(kind=kindOfInt), optional, intent(out) :: length + integer(kind=kindOfInt), optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + character :: bytes(size(value)) + + call grib_set_byte_array ( gribid, key, value, length, status ) +end subroutine codes_set_byte_array + +! +subroutine codes_set_real4_array ( gribid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + real(kind = kindOfFloat), dimension(:), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_set_real4_array ( gribid, key, value, status ) +end subroutine codes_set_real4_array + +! +subroutine codes_set_real8_array ( gribid, key, value, status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + real(kind = kindOfDouble), dimension(:), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_set_real8_array ( gribid, key, value, status) +end subroutine codes_set_real8_array + +! +subroutine codes_set_force_real4_array ( gribid, key, value, status ) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + real(kind = kindOfFloat), dimension(:), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_set_force_real4_array ( gribid, key, value, status ) +end subroutine codes_set_force_real4_array + +! +subroutine codes_set_force_real8_array ( gribid, key, value, status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + real(kind = kindOfDouble), dimension(:), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + + call grib_set_force_real8_array ( gribid, key, value, status) +end subroutine codes_set_force_real8_array + +! +subroutine codes_set_string ( gribid, key, value , status) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + character(len=*), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_set_string ( gribid, key, value , status) +end subroutine codes_set_string + +! +subroutine codes_get_message_size_int ( gribid, nbytes, status) + integer(kind=kindOfInt), intent(in) :: gribid + integer(kind=kindOfInt), intent(out) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfSize_t) :: ibytes + + call grib_get_message_size_int ( gribid, nbytes, status) +end subroutine codes_get_message_size_int + +! +subroutine codes_get_message_size_size_t ( gribid, nbytes, status) + integer(kind=kindOfInt), intent(in) :: gribid + integer(kind=kindOfSize_t), intent(out) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_get_message_size_size_t ( gribid, nbytes, status) +end subroutine codes_get_message_size_size_t + +! +subroutine codes_copy_message ( gribid, message, status ) + 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 + + call grib_copy_message ( gribid, message, status ) +end subroutine codes_copy_message + +! +subroutine codes_write ( gribid, ifile , status) + integer(kind=kindOfInt), intent(in) :: gribid + integer(kind=kindOfInt), intent(in) :: ifile + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_write ( gribid, ifile , status) +end subroutine codes_write + +! +subroutine codes_multi_write ( multigribid, ifile , status) + integer(kind=kindOfInt), intent(in) :: multigribid + integer(kind=kindOfInt), intent(in) :: ifile + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_multi_write ( multigribid, ifile , status) +end subroutine codes_multi_write + +! +subroutine codes_multi_append ( ingribid, startsection, multigribid , status) + integer(kind=kindOfInt), intent(in) :: ingribid + integer(kind=kindOfInt), intent(in) :: startsection + integer(kind=kindOfInt), intent(out) :: multigribid + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_multi_append ( ingribid, startsection, multigribid , status) +end subroutine codes_multi_append + +! +subroutine codes_find_nearest_multiple(gribid,is_lsm, & + inlats,inlons,outlats,outlons, & + values,distances, indexes,status) + integer(kind=kindOfInt), intent(in) :: gribid + logical, intent(in) :: is_lsm + real(kind = kindOfDouble), dimension(:), intent(in) :: inlats + real(kind = kindOfDouble), dimension(:), intent(in) :: inlons + real(kind = kindOfDouble), dimension(:), intent(out) :: outlats + real(kind = kindOfDouble), dimension(:), intent(out) :: outlons + real(kind = kindOfDouble), dimension(:), intent(out) :: distances + real(kind = kindOfDouble), dimension(:), intent(out) :: values + integer(kind = kindOfInt), dimension(:), intent(out) :: indexes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: npoints + integer(kind=kindOfInt) :: intis_lsm + + call grib_find_nearest_multiple(gribid,is_lsm, & + inlats,inlons,outlats,outlons, & + values,distances, indexes,status) +end subroutine codes_find_nearest_multiple + +! +subroutine codes_find_nearest_single(gribid,is_lsm, & + inlat,inlon,outlat,outlon, & + value,distance, index,status) + integer(kind=kindOfInt), intent(in) :: gribid + logical, intent(in) :: is_lsm + real(kind = kindOfDouble), intent(in) :: inlat + real(kind = kindOfDouble), intent(in) :: inlon + real(kind = kindOfDouble), intent(out) :: outlat + real(kind = kindOfDouble), intent(out) :: outlon + real(kind = kindOfDouble), intent(out) :: distance + real(kind = kindOfDouble), intent(out) :: value + integer(kind = kindOfInt), intent(out) :: index + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: intis_lsm =0 + + call grib_find_nearest_single(gribid,is_lsm, & + inlat,inlon,outlat,outlon, & + value,distance, index,status) +end subroutine codes_find_nearest_single + +! +subroutine codes_find_nearest_four_single(gribid,is_lsm, & + inlat,inlon,outlat,outlon, & + value,distance, index,status) + integer(kind=kindOfInt), intent(in) :: gribid + logical, intent(in) :: is_lsm + real(kind = kindOfDouble), intent(in) :: inlat + real(kind = kindOfDouble), intent(in) :: inlon + real(kind = kindOfDouble), dimension(4), intent(out) :: outlat + real(kind = kindOfDouble), dimension(4), intent(out) :: outlon + real(kind = kindOfDouble), dimension(4), intent(out) :: distance + real(kind = kindOfDouble), dimension(4), intent(out) :: value + integer(kind = kindOfInt), dimension(4), intent(out) :: index + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: intis_lsm =0 + + call grib_find_nearest_four_single(gribid,is_lsm, & + inlat,inlon,outlat,outlon, & + value,distance, index,status) + end subroutine codes_find_nearest_four_single + +! +subroutine codes_multi_support_on (status ) + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_multi_support_on (status ) +end subroutine codes_multi_support_on + +! +subroutine codes_multi_support_off ( status ) + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_multi_support_off ( status ) +end subroutine codes_multi_support_off + +! +subroutine codes_gribex_mode_on (status ) + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_gribex_mode_on (status ) +end subroutine codes_gribex_mode_on + +! +subroutine codes_gribex_mode_off (status ) + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_gribex_mode_off (status ) +end subroutine codes_gribex_mode_off + +! +subroutine codes_skip_computed ( iterid , status) + integer(kind=kindOfInt), intent(in) :: iterid + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_skip_computed ( iterid , status) +end subroutine codes_skip_computed + +! +subroutine codes_skip_coded ( iterid, status ) + integer(kind=kindOfInt), intent(in) :: iterid + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_skip_coded ( iterid, status ) +end subroutine codes_skip_coded + +! +subroutine codes_skip_duplicates ( iterid, status ) + integer(kind=kindOfInt), intent(in) :: iterid + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_skip_duplicates ( iterid, status ) +end subroutine codes_skip_duplicates + +! +subroutine codes_skip_read_only ( iterid, status ) + integer(kind=kindOfInt), intent(in) :: iterid + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + + call grib_skip_read_only ( iterid, status ) +end subroutine codes_skip_read_only diff --git a/fortran/grib_f90_head.f90 b/fortran/grib_f90_head.f90 index 8520b6732..53cab53f8 100644 --- a/fortran/grib_f90_head.f90 +++ b/fortran/grib_f90_head.f90 @@ -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 diff --git a/fortran/grib_f90_int.f90 b/fortran/grib_f90_int.f90 index c46e11558..b2474ee77 100644 --- a/fortran/grib_f90_int.f90 +++ b/fortran/grib_f90_int.f90 @@ -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. !> @@ -40,8 +45,11 @@ !> @param size number of distinct values of the key in the index !> @param status GRIB_SUCCESS if OK, integer value on error interface grib_index_get_size - module procedure grib_index_get_size_int + 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 diff --git a/fortran/grib_f90_int_size_t.f90 b/fortran/grib_f90_int_size_t.f90 index 7251317e6..7289701de 100644 --- a/fortran/grib_f90_int_size_t.f90 +++ b/fortran/grib_f90_int_size_t.f90 @@ -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 diff --git a/fortran/grib_f90_long_int.f90 b/fortran/grib_f90_long_int.f90 index 2fddc7078..552022612 100644 --- a/fortran/grib_f90_long_int.f90 +++ b/fortran/grib_f90_long_int.f90 @@ -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. !> @@ -41,9 +47,13 @@ !> @param size number of distinct values of the key in the index !> @param status GRIB_SUCCESS if OK, integer value on error interface grib_index_get_size - module procedure grib_index_get_size_int, & - grib_index_get_size_long + 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 diff --git a/fortran/grib_f90_long_size_t.f90 b/fortran/grib_f90_long_size_t.f90 index ae9230f5f..333bc4698 100644 --- a/fortran/grib_f90_long_size_t.f90 +++ b/fortran/grib_f90_long_size_t.f90 @@ -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 diff --git a/fortran/grib_f90_tail.f90 b/fortran/grib_f90_tail.f90 index 444bb2bfc..c0ec31841 100644 --- a/fortran/grib_f90_tail.f90 +++ b/fortran/grib_f90_tail.f90 @@ -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. @@ -47,19 +46,18 @@ !> @param keys : comma separated list of keys for the index. The type of the key can be explicitly declared appending :l for long, :d for double, :s for string to the key name. If the type is not declared explicitly, the native type is assumed. !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_index_create ( indexid, filename, keys, status ) - integer(kind=kindOfInt), intent(inout) :: indexid - character(len=*), intent(in) :: filename - character(len=*), intent(in) :: keys - integer(kind=kindOfInt),optional, intent(out) :: status - integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt), intent(inout) :: indexid + character(len=*), intent(in) :: filename + character(len=*), intent(in) :: keys + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret - iret=grib_f_index_new_from_file(filename,keys,indexid) - if (present(status)) then - status = iret - else + iret=grib_f_index_new_from_file(filename,keys,indexid) + if (present(status)) then + status = iret + else call grib_check(iret,'grib_index_create','('//filename//')') - endif - + endif end subroutine grib_index_create !> Add a file to an index. @@ -75,18 +73,17 @@ !> @param filename name of the file I want to add to the index !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_index_add_file ( indexid, filename, status ) - integer(kind=kindOfInt), intent(in) :: indexid - character(len=*), intent(in) :: filename - integer(kind=kindOfInt),optional, intent(out) :: status - integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: filename + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret - iret=grib_f_index_add_file(indexid,filename) - if (present(status)) then - status = iret - else - call grib_check(iret,'grib_index_add_file','('//filename//')') - endif - + iret=grib_f_index_add_file(indexid,filename) + if (present(status)) then + status = iret + 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. @@ -103,19 +100,18 @@ !> @param size number of distinct values of the key in the index !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_index_get_size_long( indexid, key, size, status ) - integer(kind=kindOfInt), intent(in) :: indexid - character(len=*), intent(in) :: key - integer(kind=kindOfLong), intent(out) :: size - integer(kind=kindOfInt),optional, intent(out) :: status - integer(kind=kindOfInt) :: iret - - iret=grib_f_index_get_size_long(indexid,key,size) - if (present(status)) then - status = iret - else - call grib_check(iret,'grib_index_get_size','('//key//')') - endif + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + integer(kind=kindOfLong), intent(out) :: size + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + iret=grib_f_index_get_size_long(indexid,key,size) + if (present(status)) then + status = iret + 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. @@ -132,19 +128,18 @@ !> @param size number of distinct values of the key in the index !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_index_get_size_int( indexid, key, size, status ) - integer(kind=kindOfInt), intent(in) :: indexid - character(len=*), intent(in) :: key - integer(kind=kindOfInt), intent(out) :: size - integer(kind=kindOfInt),optional, intent(out) :: status - integer(kind=kindOfInt) :: iret - - iret=grib_f_index_get_size_int(indexid,key,size) - if (present(status)) then - status = iret - else - call grib_check(iret,'grib_index_get_size','('//key//')') - endif + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + integer(kind=kindOfInt), intent(out) :: size + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + iret=grib_f_index_get_size_int(indexid,key,size) + if (present(status)) then + status = iret + 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. @@ -161,19 +156,20 @@ !> @param values array of values. The array must be allocated before entering this function and its size must be enough to contain all the values. !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_index_get_int( indexid, key, values, status ) - integer(kind=kindOfInt), intent(in) :: indexid - character(len=*), intent(in) :: key - integer(kind=kindOfInt), dimension(:), intent(out) :: values - 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 - status = iret - else - call grib_check(iret,'grib_index_get','('//key//')') - endif + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + integer(kind=kindOfInt), dimension(:), intent(out) :: values + 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 + status = iret + else + call grib_check(iret,'grib_index_get','('//key//')') + endif end subroutine grib_index_get_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. @@ -190,19 +186,20 @@ !> @param values array of values. The array must be allocated before entering this function and its size must be enough to contain all the values. !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_index_get_long( indexid, key, values, status ) - integer(kind=kindOfInt), intent(in) :: indexid - character(len=*), intent(in) :: key - integer(kind=kindOfLong), dimension(:), intent(out) :: values - 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 - status = iret - else - call grib_check(iret,'grib_index_get','('//key//')') - endif + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + integer(kind=kindOfLong), dimension(:), intent(out) :: values + 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 + status = iret + else + call grib_check(iret,'grib_index_get','('//key//')') + endif end subroutine grib_index_get_long !> 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. @@ -219,19 +216,20 @@ !> @param values array of values. The array must be allocated before entering this function and its size must be enough to contain all the values. !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_index_get_real8( indexid, key, values, status ) - integer(kind=kindOfInt), intent(in) :: indexid - character(len=*), intent(in) :: key - real(kind=kindOfDouble), dimension(:), intent(out) :: values - 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 - status = iret - else - call grib_check(iret,'grib_index_get','('//key//')') - endif + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + real(kind=kindOfDouble), dimension(:), intent(out) :: values + 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 + status = iret + else + call grib_check(iret,'grib_index_get','('//key//')') + endif end subroutine grib_index_get_real8 !> Get the distinct values of the key in argument contained in the index. @@ -310,11 +308,11 @@ !> @param value value of the key to select !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_index_select_int( indexid, key, value, status ) - integer(kind=kindOfInt), intent(in) :: indexid - character(len=*), intent(in) :: key - integer(kind=kindOfInt), intent(in) :: value - integer(kind=kindOfInt),optional, intent(out) :: status - integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + integer(kind=kindOfInt), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret iret=grib_f_index_select_int ( indexid, key, value ) if (present(status)) then @@ -338,11 +336,11 @@ !> @param value value of the key to select !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_index_select_long( indexid, key, value, status ) - integer(kind=kindOfInt), intent(in) :: indexid - character(len=*), intent(in) :: key - integer(kind=kindOfLong), intent(in) :: value - integer(kind=kindOfInt),optional, intent(out) :: status - integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt), intent(in) :: indexid + character(len=*), intent(in) :: key + integer(kind=kindOfLong), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret iret=grib_f_index_select_long ( indexid, key, value ) if (present(status)) then @@ -636,20 +634,20 @@ !> @param nbytes number of bytes to be read !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_read_bytes_real4 ( ifile, buffer, nbytes, status ) - integer(kind=kindOfInt),intent(in) :: ifile - real(kind=4),dimension(:), intent(out) :: buffer - integer(kind=kindOfInt), intent(in) :: nbytes - integer(kind=kindOfInt),optional, intent(out) :: status - integer(kind=kindOfSize_t) :: ibytes - integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=4),dimension(:), intent(out) :: buffer + integer(kind=kindOfInt), intent(in) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfSize_t) :: ibytes + integer(kind=kindOfInt) :: iret - ibytes=nbytes - iret=grib_f_read_file(ifile,buffer,ibytes) - if (present(status)) then - status = iret - else - call grib_check(iret,'grib_read_bytes','') - endif + ibytes=nbytes + iret=grib_f_read_file(ifile,buffer,ibytes) + if (present(status)) then + status = iret + else + call grib_check(iret,'grib_read_bytes','') + endif end subroutine grib_read_bytes_real4 !> Reads nbytes bytes into the buffer from a file opened with grib_open_file. @@ -665,18 +663,18 @@ !> @param nbytes number of bytes to be read !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_read_bytes_real4_size_t ( ifile, buffer, nbytes, status ) - integer(kind=kindOfInt),intent(in) :: ifile - real(kind=4),dimension(:), intent(out) :: buffer - integer(kind=kindOfSize_t), intent(inout) :: nbytes - integer(kind=kindOfInt),optional, intent(out) :: status - integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt),intent(in) :: ifile + real(kind=4),dimension(:), intent(out) :: buffer + integer(kind=kindOfSize_t), intent(inout) :: nbytes + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret - iret=grib_f_read_file(ifile,buffer,nbytes) - if (present(status)) then - status = iret - else - call grib_check(iret,'grib_read_bytes','') - endif + iret=grib_f_read_file(ifile,buffer,nbytes) + if (present(status)) then + status = iret + else + call grib_check(iret,'grib_read_bytes','') + endif end subroutine grib_read_bytes_real4_size_t !> Reads nbytes bytes into the buffer from a file opened with grib_open_file. @@ -1800,15 +1798,15 @@ integer(kind=kindOfInt),optional, intent(out) :: status integer(kind=kindOfInt) :: iret - iret=grib_f_get_size_long ( gribid, key, size ) - if (iret /= 0) then - call grib_f_write_on_fail(gribid) - endif - if (present(status)) then + iret=grib_f_get_size_long ( gribid, key, size ) + if (iret /= 0) then + call grib_f_write_on_fail(gribid) + endif + if (present(status)) then status = iret - else + else call grib_check(iret,'grib_get_size',key) - endif + endif end subroutine grib_get_size_long !> Get the integer value of a key from a grib message. @@ -1850,22 +1848,22 @@ !> @param value the integer(4) value !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_get_long(gribid,key,value,status) - integer(kind=kindOfInt), intent(in) :: gribid - character(len=*), intent(in) :: key - integer(kind = kindOfLong), intent(out) :: value - integer(kind=kindOfInt),optional, intent(out) :: status - integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind = kindOfLong), intent(out) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret iret=grib_f_get_long ( gribid, key, value ) - if (iret /= 0) then - call grib_f_write_on_fail(gribid) - endif + if (iret /= 0) then + call grib_f_write_on_fail(gribid) + endif if (present(status)) then - status = iret + status = iret else - call grib_check(iret,'grib_get',key) + call grib_check(iret,'grib_get',key) endif - end subroutine grib_get_long + end subroutine grib_get_long !> Check if the value of a key is MISSING. !> @@ -2063,9 +2061,9 @@ call grib_f_write_on_fail(gribid) endif if (present(status)) then - status = iret + status = iret else - call grib_check(iret,'grib_get',key) + call grib_check(iret,'grib_get',key) endif end subroutine grib_get_long_array @@ -2330,21 +2328,21 @@ !> @param value integer(4) value !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_set_long ( gribid, key, value, status ) - integer(kind=kindOfInt), intent(in) :: gribid - character(len=*), intent(in) :: key - integer(kind=kindOfLong), intent(in) :: value - integer(kind=kindOfInt),optional, intent(out) :: status - integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfLong), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret - iret=grib_f_set_long ( gribid, key, value ) - if (iret /= 0) then - call grib_f_write_on_fail(gribid) - endif - if (present(status)) then + iret=grib_f_set_long ( gribid, key, value ) + if (iret /= 0) then + call grib_f_write_on_fail(gribid) + endif + if (present(status)) then status = iret - else + else call grib_check(iret,'grib_set',key) - endif + endif end subroutine grib_set_long !> Set the real(4) value for a key in a grib message. @@ -2444,12 +2442,12 @@ !> @param value integer(4) array value !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_set_long_array ( gribid, key, value, status) - integer(kind=kindOfInt), intent(in) :: gribid - character(len=*), intent(in) :: key - integer(kind=kindOfLong), dimension(:), intent(in) :: value - integer(kind=kindOfInt),optional, intent(out) :: status - integer(kind=kindOfInt) :: iret - integer(kind=kindOfInt) :: nb_values + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + integer(kind=kindOfLong), dimension(:), intent(in) :: value + integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values nb_values = size(value) iret=grib_f_set_long_array ( gribid, key, value, nb_values ) @@ -2457,9 +2455,9 @@ call grib_f_write_on_fail(gribid) endif if (present(status)) then - status = iret + status = iret else - call grib_check(iret,'grib_set',key) + call grib_check(iret,'grib_set',key) endif end subroutine grib_set_long_array @@ -2476,14 +2474,14 @@ !> @param length (optional) output: number of values written !> @param status (optional) GRIB_SUCCESS if OK, integer value on error subroutine grib_set_byte_array ( gribid, key, value, length, status ) - integer(kind=kindOfInt), intent(in) :: gribid - character(len=*), intent(in) :: key - character(len=1), dimension(:), intent(in) :: value - integer(kind=kindOfInt), optional, intent(out) :: length - integer(kind=kindOfInt), optional, intent(out) :: status - integer(kind=kindOfInt) :: iret - integer(kind=kindOfInt) :: nb_values - character :: bytes(size(value)) + integer(kind=kindOfInt), intent(in) :: gribid + character(len=*), intent(in) :: key + character(len=1), dimension(:), intent(in) :: value + integer(kind=kindOfInt), optional, intent(out) :: length + integer(kind=kindOfInt), optional, intent(out) :: status + integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: nb_values + character :: bytes(size(value)) nb_values = size (value) bytes = transfer (value, bytes) @@ -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 @@ -2771,17 +2768,16 @@ !> @param ifile file id of a file opened with \ref grib_open_file !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_multi_write ( multigribid, ifile , status) - integer(kind=kindOfInt), intent(in) :: multigribid - integer(kind=kindOfInt), intent(in) :: ifile - integer(kind=kindOfInt),optional, intent(out) :: status - - integer(kind=kindOfInt) :: iret + 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 ) if (present(status)) then - status = iret + status = iret else - call grib_check(iret,'grib_multi_write','') + call grib_check(iret,'grib_multi_write','') endif end subroutine grib_multi_write @@ -2797,19 +2793,19 @@ !> @param multigribid id of the output multi filed grib !> @param status GRIB_SUCCESS if OK, integer value on error subroutine grib_multi_append ( ingribid, startsection, multigribid , status) - integer(kind=kindOfInt), intent(in) :: ingribid - integer(kind=kindOfInt), intent(in) :: startsection - integer(kind=kindOfInt), intent(out) :: multigribid - integer(kind=kindOfInt),optional, intent(out) :: status + integer(kind=kindOfInt), intent(in) :: ingribid + integer(kind=kindOfInt), intent(in) :: startsection + integer(kind=kindOfInt), intent(out) :: multigribid + integer(kind=kindOfInt),optional, intent(out) :: status - integer(kind=kindOfInt) :: iret + integer(kind=kindOfInt) :: iret - iret = grib_f_multi_append( ingribid, startsection, multigribid ) - if (present(status)) then - status = iret - else - call grib_check(iret,'grib_multi_append','') - endif + iret = grib_f_multi_append( ingribid, startsection, multigribid ) + if (present(status)) then + status = iret + else + call grib_check(iret,'grib_multi_append','') + endif end subroutine grib_multi_append !> Find the nearest point of a given latitude/longitude point. @@ -2846,11 +2842,10 @@ 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, & - values,distances,indexes,npoints) + values,distances,indexes,npoints) if (present(status)) then status = iret @@ -2892,9 +2887,8 @@ 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) + value,distance,index) if (present(status)) then status = iret @@ -2919,8 +2913,8 @@ !> @param index zero based index !> @param value value of the field in the nearest point !> @param status GRIB_SUCCESS if OK, integer value on error - subroutine grib_find_nearest_four_single(gribid,is_lsm, & - inlat,inlon,outlat,outlon, & + subroutine grib_find_nearest_four_single(gribid,is_lsm, & + inlat,inlon,outlat,outlon, & value,distance, index,status) integer(kind=kindOfInt), intent(in) :: gribid logical, intent(in) :: is_lsm @@ -2938,12 +2932,12 @@ if (is_lsm) intis_lsm=1 iret=grib_f_find_nearest_four_single(gribid,intis_lsm,inlat,inlon,outlat,outlon, & - value,distance,index) + value,distance,index) if (present(status)) then - status = iret + status = iret else - call grib_check(iret,'grib_find_nearest_four_single','') + call grib_check(iret,'grib_find_nearest_four_single','') endif end subroutine grib_find_nearest_four_single @@ -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 -