exposed julian, datetime functions in fortran

This commit is contained in:
Enrico Fucile 2016-11-08 14:11:12 +00:00
parent 18b297dc52
commit a9506e7381
4 changed files with 86 additions and 1 deletions

View File

@ -2573,6 +2573,56 @@ subroutine codes_set_samples_path ( path, status )
end subroutine codes_set_samples_path
subroutine codes_julian_to_datetime ( jd,year,month,day,hour,minute,second, status )
real(kind=kindOfDouble) , intent(in) :: jd
integer(kind=kindOfLong) , intent(out) :: year,month,day,hour,minute,second
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
iret=grib_f_julian_to_datetime(jd,year,month,day,hour,minute,second)
if (iret /= 0) then
if (present(status)) then
status = iret
else
call grib_check(iret,'codes_julian_to_datetime',' ')
endif
return
endif
end subroutine codes_julian_to_datetime
subroutine codes_datetime_to_julian ( year,month,day,hour,minute,second,jd, status )
integer(kind=kindOfLong) , intent(in) :: year,month,day,hour,minute,second
real (kind=kindOfDouble) , intent(out) :: jd
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
iret=grib_f_datetime_to_julian(year,month,day,hour,minute,second,jd)
if (iret /= 0) then
if (present(status)) then
status = iret
else
call grib_check(iret,'codes_datetime_to_julian',' ')
endif
return
endif
end subroutine codes_datetime_to_julian
subroutine codes_copy_key( msgin,msgout, key,type, status )
integer(kind=kindOfInt), intent(in) :: msgin,msgout,type
character(len=*), intent(in) :: key
integer(kind=kindOfInt),optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
iret=grib_f_copy_key ( msgin,msgout, key, type, status )
if (iret /= 0) then
if (present(status)) then
status = iret
else
call grib_check(iret,'codes_copy_key',key)
endif
return
endif
end subroutine codes_copy_key
end module eccodes

View File

@ -27,3 +27,4 @@ public :: codes_clone, codes_copy_namespace
public :: codes_index_get,codes_index_select,&
codes_index_create,codes_index_get_size,codes_index_release,&
codes_grib_util_sections_copy
public :: codes_datetime_to_julian,codes_julian_to_datetime,codes_copy_key

View File

@ -68,3 +68,4 @@ integer, external :: grib_f_clone, grib_f_copy_namespace
external :: grib_f_check
integer, external :: grib_f_util_sections_copy
integer, external :: grib_f_set_definitions_path, grib_f_set_samples_path
integer, external :: grib_f_julian_to_datetime, grib_f_datetime_to_julian, grib_f_copy_key

View File

@ -1363,6 +1363,18 @@ int grib_f_clone(int* gidsrc,int* giddest){
return grib_f_clone_(gidsrc, giddest);
}
/*****************************************************************************/
int grib_f_copy_key_(int* gidsrc,int* giddest,const char* key,int *type,int len){
char buf[512]={0,};
grib_handle *src = get_handle(*gidsrc);
grib_handle *dest = get_handle(*giddest);
if(src!=NULL && dest!=NULL){
return codes_copy_key(src,dest,cast_char(buf,key,len),*type);
}
return GRIB_INVALID_GRIB;
}
/*****************************************************************************/
int grib_f_util_sections_copy_(int* gidfrom,int* gidto,int* what,int *gidout){
int err=0;
@ -3104,3 +3116,24 @@ int grib_f_set_samples_path__(char* path, int len){
int grib_f_set_samples_path(char* path, int len){
return grib_f_set_samples_path_(path, len);
}
int grib_f_julian_to_datetime(double* jd,long* year,long* month,long* day,long *hour,long *minute,long *second) {
return grib_julian_to_datetime(*jd,year,month,day,hour,minute,second);
}
int grib_f_julian_to_datetime_(double* jd,long* year,long* month,long* day,long *hour,long *minute,long *second) {
return grib_julian_to_datetime(*jd,year,month,day,hour,minute,second);
}
int grib_f_julian_to_datetime__(double* jd,long* year,long* month,long* day,long *hour,long *minute,long *second) {
return grib_julian_to_datetime(*jd,year,month,day,hour,minute,second);
}
int grib_f_datetime_to_julian(long* year,long* month,long* day, long* hour,long* minute,long* second,double* jd) {
return grib_datetime_to_julian(*year,*month,*day,*hour,*minute,*second,jd);
}
int grib_f_datetime_to_julian_(long* year,long* month,long* day, long* hour,long* minute,long* second,double* jd) {
return grib_datetime_to_julian(*year,*month,*day,*hour,*minute,*second,jd);
}
int grib_f_datetime_to_julian__(long* year,long* month,long* day, long* hour,long* minute,long* second,double* jd) {
return grib_datetime_to_julian(*year,*month,*day,*hour,*minute,*second,jd);
}