Note that if ipos2(ipdtn) is 0, then we will attempt to do an access of array element 0 of ipdtmpl(), which does not exist, causing memory errors.
This happens some pdts don't use the secondary time units. In this case, the original programmer has put a 0 in the ipos2 array. However, this is wrong because it is still accessed, even though the secondary time is not used.
In degrib2, in prvtime.F90, we have:
data ipos2 /70, 26, 33, 27, 29, 28, 42, 41, 270, 22, 30, 0, 0, 32, & 35, 430, 33, 1090/
Later we have:
Note that if ipos2(ipdtn) is 0, then we will attempt to do an access of array element 0 of ipdtmpl(), which does not exist, causing memory errors.
This happens some pdts don't use the secondary time units. In this case, the original programmer has put a 0 in the ipos2 array. However, this is wrong because it is still accessed, even though the secondary time is not used.