Commit 4516bbcf authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

more info when adding fails

parent 2fb20b40
Loading
Loading
Loading
Loading
+42 −8
Original line number Diff line number Diff line
@@ -2490,18 +2490,43 @@ endif
    !
    integer ix, iy, it
    res=0
    if (b%no_phases .ne. a%no_phases) res=-1
    if (b%no_lam    .ne. a%no_lam   ) res=-2
    if (b%no_xpix   .ne. a%no_xpix  ) res=-3
    if (b%no_ypix   .ne. a%no_ypix  ) res=-4
    if (res<0) return
    if (b%no_phases .ne. a%no_phases) then
        call msg_warning('scan_point_append', msg='number of phases is different',&
            values=msg_fmt('("target=",i0,", source=",i0)',[b%no_phases, a%no_phases]))
        res=-1
        return
    end if
    if (b%no_lam    .ne. a%no_lam   ) then
        call msg_warning('scan_point_append', msg='number of wavelength bands is different',&
            values=msg_fmt('("target=",i0,", source=",i0)',[b%no_lam, a%no_lam]))
        res=-1
        return
    end if
    if ( b%no_xpix .ne. a%no_xpix ) then
        call msg_warning('scan_point_append', msg='number of x-pixels is different',&
            values=msg_fmt('("target=",i0,", source=",i0)',[b%no_xpix, a%no_xpix]))
        res=-1
        return
    end if
    if ( b%no_ypix .ne. a%no_ypix ) then
        call msg_warning('scan_point_append', msg='number of y-pixels is different',&
            values=msg_fmt('("target=",i0,", source=",i0)',[b%no_ypix, a%no_ypix]))
        res=-1
        return
    end if
    res = phase_scan_append(b%centerbin, a%centerbin)
    if (res<0) return
    if (res<0) then
        call msg_warning('scan_point_append', msg='phase_scan_append failed (ctr)')
        return
    end if
    do it=0, b%no_lam
        do ix=1, b%no_xpix
            do iy=1, b%no_ypix
                res = phase_scan_append(b%pixelbin(it,ix,iy), a%pixelbin(it,ix,iy))
                if (res<0) return
                if (res<0) then
                    call msg_warning('scan_point_append', msg='phase_scan_append failed')
                    return
                end if
            end do
        end do
    end do
@@ -2529,12 +2554,21 @@ endif
        b%file = trim(cfile)
    else
        if (b%number_of_points .ne. a%number_of_points ) then
            call msg_warning('scan_struct_append', &
                msg='number of points is different',&
                values=msg_fmt('("numor=",i0," expected=",i0,", actual=",i0)',&
                        [a%id, b%number_of_points, a%number_of_points]))
            res=-1
            return
        end if
        do i=1, b%number_of_points
            res = scan_point_append(b%scan_point(i), a%scan_point(i))
            if (res.ne.0) exit
            if (res.ne.0) then
                call msg_warning('scan_struct_append', &
                    msg='scan point append failed',&
                    values=msg_fmt('("numor=",i0)', a%id))
                exit
            end if
        end do
    end if
  end function scan_struct_append
+11 −3
Original line number Diff line number Diff line
@@ -1593,11 +1593,19 @@ CONTAINS
    numor_loop: do i=1, iparf()
        numor = int(rparf(i))
        j = data_manager_find(numor)
        if (j<=0) cycle numor_loop
        if (j<=0) then
            call msg_warning('drspine', msg='run not found', &
                              values=msg_fmt('("run=",i0)',numor))
            cycle numor_loop
        end if
        if ( .not. is_valid_scan(data_scan(j))) cycle numor_loop
        write(*,*) "*** adding echo ", numor, " ***"
        ires = scan_struct_append(data_scan(k), data_scan(j))
        if (ires.ne.0) call msg_error('drspine', msg='adding failed')
        if (ires.ne.0) then
            call msg_error('drspine', msg='adding failed', &
                 values=msg_fmt('("numor=",i0)', numor),err=ERROR_DATA_PROCESSING)
        else
            write(*,*) "*** added echo ", numor, " ***"
        end if
    end do numor_loop

    call unused( 1, 1, 1, ier)