mirror of https://github.com/ecmwf/eccodes.git
fortran ECC-357
This commit is contained in:
parent
00b8bcefea
commit
db9031d40f
|
@ -1577,6 +1577,33 @@ subroutine codes_get_string_array ( msgid, key, value, status )
|
|||
|
||||
end subroutine codes_get_string_array
|
||||
|
||||
!> Copy data values from a BUFR message msgid1 to another message msdid2
|
||||
!>
|
||||
!> In case of error, if the status parameter (optional) is not given, the program will
|
||||
!> exit with an error message.\n Otherwise the error message can be
|
||||
!> gathered with @ref codes_get_error_string.\n
|
||||
!> Note: This function supports the \b allocatable array attribute
|
||||
!>
|
||||
!> @param msgid1 id of the message from which the data are copied
|
||||
!> @param msgid2 id of the message to which the data are copied
|
||||
!> @param status CODES_SUCCESS if OK, integer value on error
|
||||
subroutine codes_bufr_copy_data ( msgid1, msgid2, status )
|
||||
integer(kind=kindOfInt), intent(in) :: msgid1
|
||||
integer(kind=kindOfInt), intent(in) :: msgid2
|
||||
integer(kind=kindOfInt),optional, intent(out) :: status
|
||||
integer(kind=kindOfInt) :: iret
|
||||
|
||||
|
||||
iret=codes_f_bufr_copy_data ( msgid1,msgid2 )
|
||||
|
||||
if (present(status)) then
|
||||
status = iret
|
||||
else
|
||||
call grib_check(iret,'bufr_copy_data','error while copying')
|
||||
endif
|
||||
|
||||
end subroutine codes_bufr_copy_data
|
||||
|
||||
!> Set the string values for an array key in a message.
|
||||
!>
|
||||
!> In case of error, if the status parameter (optional) is not given, the program will
|
||||
|
|
|
@ -34,6 +34,7 @@ integer, external :: grib_f_get_int, grib_f_get_long,grib_f_get_int_array, &
|
|||
grib_f_get_real4_element, grib_f_get_real8_element, &
|
||||
grib_f_get_real4_elements, grib_f_get_real8_elements, &
|
||||
grib_f_get_string,grib_f_get_string_array, &
|
||||
codes_f_bufr_copy_data, &
|
||||
grib_f_is_missing,grib_f_is_defined
|
||||
integer, external :: grib_f_new_from_index, &
|
||||
grib_f_index_new_from_file, &
|
||||
|
|
|
@ -2771,6 +2771,36 @@ int grib_f_get_string_array(int* gid, char* key, char* val,int* nvals,int* slen,
|
|||
return grib_f_get_string_array_( gid, key, val, nvals, slen, len);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int codes_f_bufr_copy_data_(int* gid1,int* gid2)
|
||||
{
|
||||
grib_handle *hin = get_handle(*gid1);
|
||||
grib_handle *hout = get_handle(*gid2);
|
||||
int err = GRIB_SUCCESS;
|
||||
size_t i;
|
||||
size_t lsize ;
|
||||
char** ckeys=0;
|
||||
|
||||
if(!hin || !hout ) return GRIB_INVALID_GRIB;
|
||||
|
||||
ckeys=codes_bufr_copy_data(hin,hout,&lsize,&err);
|
||||
if (err) return err;
|
||||
|
||||
for (i=0;i<lsize;i++) {
|
||||
grib_context_free(hin->context,ckeys[i]);
|
||||
}
|
||||
grib_context_free(hin->context,ckeys);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int codes_f_bufr_copy_data__(int* gid1,int* gid2){
|
||||
return codes_f_bufr_copy_data_(gid1, gid2);
|
||||
}
|
||||
int codes_f_bufr_copy_data(int* gid1,int* gid2){
|
||||
return codes_f_bufr_copy_data_(gid1, gid2);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Strip whitespace from the end of a string */
|
||||
|
|
|
@ -231,6 +231,7 @@ char** codes_bufr_copy_data(grib_handle* hin,grib_handle* hout, size_t* nkeys, i
|
|||
|
||||
kiter=codes_bufr_data_section_keys_iterator_new(hin);
|
||||
if (!kiter) return NULL;
|
||||
k=grib_sarray_new(hin->context,50,10);
|
||||
|
||||
while(codes_bufr_keys_iterator_next(kiter))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue