Skip to content

Commit

Permalink
fix another potential invalid grib id error in alchimia (to be checked)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcesari committed Feb 28, 2023
1 parent 0c80cad commit 2ea7560
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions volgrid6d/volgrid6d_alchimia_class.F03
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ subroutine make_vg6d(mayvfn,mybin,mybout,vg6din,vg6dout,allvarcomputed)
vg6din%voldati(:,:,ilevel,itime,itimerange,ivarin)
ENDIF

CALL copy (vg6din%gaid(ilevel,itime,itimerange,ivarin), &
CALL copy(vg6din%gaid(ilevel,itime,itimerange,ivarin), &
vg6dout%gaid(ilevel,itime,itimerange,ivarout))
! save the first valid gaid for helping successive variable conversion
IF (.NOT.c_e(gaid_template)) &
Expand Down Expand Up @@ -210,13 +210,15 @@ subroutine make_vg6d(mayvfn,mybin,mybout,vg6din,vg6dout,allvarcomputed)
if (ivarin == 0) ivarin=firsttrue(c_e(vg6dout%gaid(ilevel,itime,itimerange,:))) ! if not found is enought from one present variables
ivarout = index_c(newbout,mayvfn%fnds(i)%bout(ivar))

if (ivarin > 0 .and. ivarout > 0 )then

!print *, "DDD search",newbout(ivarout)
!print *, "DDD index",index_c(mybout,newbout(ivarout))
!if ( index_c(mybout,newbout(ivarout)) > 0)then

call copy (vg6dout%gaid(ilevel,itime,itimerange,ivarin), vg6dout%gaid(ilevel,itime,itimerange,ivarout))
IF (ivarin > 0 .AND. ivarout > 0) THEN
!print *, "DDD search",newbout(ivarout)
!print *, "DDD index",index_c(mybout,newbout(ivarout))
!if ( index_c(mybout,newbout(ivarout)) > 0)then
! the following identity happened and generated invalid grib id error
! is it a reasonable case or a bug?
IF (ivarin /= ivarout) &
CALL copy(vg6dout%gaid(ilevel,itime,itimerange,ivarin), &
vg6dout%gaid(ilevel,itime,itimerange,ivarout))

#ifdef HAVE_LIBGRIBAPI
if (c_e(grid_id_get_gaid(vg6dout%gaid(ilevel,itime,itimerange,ivarout)))) then
Expand Down

0 comments on commit 2ea7560

Please sign in to comment.