SUBROUTINE RESIDUALS 1,3
#if defined (DOC)
*
***s/r RESIDUALS  - RESIDUALS
*
*
*Author  : P. Koclas *CMC/CMDA  Nov 1998
*
*Revision: J. Halle  *CMC/CMDA  Jan 2000
*          add processing of TOVS radiances
*        - P. KOclas *CMC/CMDA  Sept 200
*                   -CHANGES FOR V06 version
*        - J. Halle  *CMDA/AES  dec 2000
*                   -adapt to TOVS level 1b.
*          JM Belanger CMDA/SMC  Jan 2001
*                   . 32 bits conversion (add call to cprob8to4)
*         P. KOCLAS Sept 2001
*                   . eliminate unnecessary call to suprep
*                   . ad call to sigmaop ( this enables output of fge in post file)
*         S. Pellerin *ARMA/SMC nov. 2001
*                   . reordering of declaration dependencies (for Linux compilation)
*         Y.J. Rochon *ARQX Sept 2010
*                   . Added test with LSIMOB
*
*    -------------------
**    Purpose: TRANSFER resduals O-A to O-P for all observations.
*
*Arguments
*    -NONE-
#endif
      IMPLICIT NONE
*implicits
#include "comlun.cdk"
#include "comdimo.cdk"
#include "cparbrp.cdk"
#include "comoabdy.cdk"
#include "comoahdr.cdk"
#include "comoba.cdk"
#include "comct0.cdk"
*
C
      INTEGER J,JDATA
*---------------------------------------------------------------------
      WRITE(NULOUT,FMT=9000)
 9000 FORMAT(//,3(" *****************"),/
     S     ," BEGIN RESIDUAL CALCULATION",/
     S     ,3(" *****************"),/)
C
C*    1. Preliminary initializations
C     .  ---------------------------
C
 100  CONTINUE
C
C     .   3.4.3 Convert CMA ---> BURP file and write it
C
C
c     CALL SUPREP
      DO JDATA=1,NDATA
         ROBDATA(NCMOMF,JDATA) =  PPMIS
      ENDDO
      IF (.NOT.LSIMOB) CALL SIGMAOP
C
C     Transfer REAL*8 part of CMA to REAL*4
C     (follows observation operators computations).

      call cprob8to4
C
      CALL VINT3DFD(NCMOMA)
C
      DO JDATA=1,NDATA
         ROBDATA(NCMOMF,JDATA) =  ROBDATA(NCMOMA,JDATA)
      ENDDO
      DO j =1,1
         CALL PRNTHDR(j,NULOUT)
         CALL PRNTBDY(j,NULOUT)
      END DO
c     CALL SUPREP
      CALL  FILBRPPOST
      RETURN
      END