<HTML> <BODY BGCOLOR=#ccccdd LINK=#0000aa VLINK=#0000ff ALINK=#ff0000 ><BASE TARGET="bottom_target"><PRE>
<A NAME='DA_JO_AND_GRADY'><A href='../../html_code/minimisation/da_jo_and_grady.inc.html#DA_JO_AND_GRADY' TARGET='top_target'><IMG SRC="../../gif/bar_red.gif" border=0></A>

subroutine da_jo_and_grady(iv, re, jot, jo, jo_grad_y) 1,29

   !-----------------------------------------------------------------------
   ! Purpose: TBD
   !-----------------------------------------------------------------------

   implicit none

   type (iv_type), intent(in)   :: iv          ! Innovation vector (O-B).
   type (y_type),  intent(in)   :: re          ! Residual vector (O-A).
   real,           intent(out)  :: jot         ! Obs cost function.
   type (jo_type), intent(out)  :: jo          ! Obs cost function.
   type (y_type),  intent(out)  :: jo_grad_y   ! Grad_y(Jo)


   real    :: jo_sound, jo_sonde_sfc,jo_synop, jo_geoamv, jo_polaramv, &amp;
              jo_airep, jo_pilot, jo_satem, &amp;
              jo_metar, jo_ships, jo_gpspw, &amp;
              jo_ssmi_tb, jo_ssmi_rv, jo_ssmt1, jo_ssmt2, &amp;
              jo_pseudo, jo_qscat, jo_buoy, &amp;
              jo_profiler, jo_radar, jo_gpsref, jo_bogus, jo_rain, &amp;
              jo_radiance, jo_airsr, jo_mtgirs, jo_tamdar, jo_tamdar_sfc
   integer :: i,k

   if (trace_use) call da_trace_entry("da_jo_and_grady")

   !-------------------------------------------------------------------------
   ! [1.0] Compute components of Grad_y(Jo):
   !-------------------------------------------------------------------------


   if (iv%info(sound)%nlocal &gt; 0) then
      call da_jo_and_grady_sound(iv, re, jo, jo_grad_y)
      jo_sound = jo%sound_u + jo%sound_v + jo%sound_t + jo%sound_q

      if (print_detail_grad) then
         write(unit=stdout, fmt='(a, e24.12)') &amp;
            ' jo_sound          ', jo_sound, &amp;
            '   jo%sound_u      ', jo%sound_u, &amp;
            '   jo%sound_v      ', jo%sound_v, &amp;
            '   jo%sound_t      ', jo%sound_t, &amp;
            '   jo%sound_q      ', jo%sound_q
      end if

   else
      jo % sound_u = 0.0
      jo % sound_v = 0.0
      jo % sound_t = 0.0
      jo % sound_q = 0.0
      jo_sound     = 0.0
   end if

   if (iv%info(sonde_sfc)%nlocal &gt; 0) then
      call da_jo_and_grady_sonde_sfc(iv, re, jo, jo_grad_y)
      jo_sonde_sfc = jo%sonde_sfc_u + jo%sonde_sfc_v + jo%sonde_sfc_t + &amp;
         jo%sonde_sfc_q + jo%sonde_sfc_p

      if (print_detail_grad) then
         write(unit=stdout, fmt='(a, e24.12)') &amp;
            ' jo_sonde_sfc      ', jo_sonde_sfc,     &amp;
            '   jo%sonde_sfc_u  ', jo%sonde_sfc_u, &amp;
            '   jo%sonde_sfc_v  ', jo%sonde_sfc_v, &amp;
            '   jo%sonde_sfc_t  ', jo%sonde_sfc_t, &amp;
            '   jo%sonde_sfc_p  ', jo%sonde_sfc_p, &amp;
            '   jo%sonde_sfc_q  ', jo%sonde_sfc_q
      end if
   else
      jo % sonde_sfc_u = 0.0
      jo % sonde_sfc_v = 0.0
      jo % sonde_sfc_t = 0.0
      jo % sonde_sfc_p = 0.0
      jo % sonde_sfc_q = 0.0
      jo_sonde_sfc = 0.0
   end if



   if (iv%info(mtgirs)%nlocal &gt; 0) then
      call da_jo_and_grady_mtgirs(iv, re, jo, jo_grad_y)
      jo_mtgirs = jo%mtgirs_u + jo%mtgirs_v + jo%mtgirs_t + jo%mtgirs_q

      if (print_detail_grad) then
         write(unit=stdout, fmt='(a, e24.12)') &amp;
            ' jo_mtgirs          ', jo_mtgirs, &amp;
            '   jo%mtgirs_u      ', jo%mtgirs_u, &amp;
            '   jo%mtgirs_v      ', jo%mtgirs_v, &amp;
            '   jo%mtgirs_t      ', jo%mtgirs_t, &amp;
            '   jo%mtgirs_q      ', jo%mtgirs_q
      end if

   else
      jo % mtgirs_u = 0.0
      jo % mtgirs_v = 0.0
      jo % mtgirs_t = 0.0
      jo % mtgirs_q = 0.0
      jo_mtgirs     = 0.0
   end if

   if (iv%info(tamdar)%nlocal &gt; 0) then
      call da_jo_and_grady_tamdar(iv, re, jo, jo_grad_y)
      jo_tamdar = jo%tamdar_u + jo%tamdar_v + jo%tamdar_t + jo%tamdar_q

      if (print_detail_grad) then
         write(unit=stdout, fmt='(a, e24.12)') &amp;
            ' jo_tamdar          ', jo_tamdar, &amp;
            '   jo%tamdar_u      ', jo%tamdar_u, &amp;
            '   jo%tamdar_v      ', jo%tamdar_v, &amp;
            '   jo%tamdar_t      ', jo%tamdar_t, &amp;
            '   jo%tamdar_q      ', jo%tamdar_q
      end if
   else
      jo % tamdar_u = 0.0
      jo % tamdar_v = 0.0
      jo % tamdar_t = 0.0
      jo % tamdar_q = 0.0
      jo_tamdar     = 0.0
   end if

   if (iv%info(tamdar_sfc)%nlocal &gt; 0) then
      call da_jo_and_grady_tamdar_sfc(iv, re, jo, jo_grad_y)
      jo_tamdar_sfc = jo%tamdar_sfc_u + jo%tamdar_sfc_v + jo%tamdar_sfc_t + &amp;
         jo%tamdar_sfc_q + jo%tamdar_sfc_p

      if (print_detail_grad) then
         write(unit=stdout, fmt='(a, e24.12)') &amp;
            ' jo_tamdar_sfc      ', jo_tamdar_sfc,     &amp;
            '   jo%tamdar_sfc_u  ', jo%tamdar_sfc_u, &amp;
            '   jo%tamdar_sfc_v  ', jo%tamdar_sfc_v, &amp;
            '   jo%tamdar_sfc_t  ', jo%tamdar_sfc_t, &amp;
            '   jo%tamdar_sfc_p  ', jo%tamdar_sfc_p, &amp;
            '   jo%tamdar_sfc_q  ', jo%tamdar_sfc_q
      end if

   else
      jo % tamdar_sfc_u = 0.0
      jo % tamdar_sfc_v = 0.0
      jo % tamdar_sfc_t = 0.0
      jo % tamdar_sfc_p = 0.0
      jo % tamdar_sfc_q = 0.0
      jo_tamdar_sfc     = 0.0

   end if

   if (iv%info(synop)%nlocal &gt; 0) then
      call da_jo_and_grady_synop(iv, re, jo, jo_grad_y)
      jo_synop = jo%synop_u + jo%synop_v + jo%synop_t + jo%synop_p + jo%synop_q

      if (print_detail_grad) then
         write(unit=stdout, fmt='(a, e24.12)') &amp;
            ' jo_synop          ', jo_synop, &amp;
            '   jo%synop_u      ', jo%synop_u, &amp;
            '   jo%synop_v      ', jo%synop_v, &amp;
            '   jo%synop_t      ', jo%synop_t, &amp;
            '   jo%synop_p      ', jo%synop_p, &amp;
            '   jo%synop_q      ', jo%synop_q
      end if
   else
      jo % synop_u = 0.0
      jo % synop_v = 0.0
      jo % synop_t = 0.0
      jo % synop_p = 0.0
      jo % synop_q = 0.0
      jo_synop = 0.0
   end if

   if (iv%info(geoamv)%nlocal &gt; 0) then
      call da_jo_and_grady_geoamv(iv, re, jo, jo_grad_y)
      jo_geoamv = jo%geoamv_u + jo%geoamv_v
      if (print_detail_grad) then
         write(unit=stdout, fmt='(a, e24.12)') &amp;
            ' jo_geoamv         ', jo_geoamv, &amp;
            '   jo%geoamv_u     ', jo%geoamv_u, &amp;
            '   jo%geoamv_v     ', jo%geoamv_v
      end if
   else
      jo % geoamv_u = 0.0
      jo % geoamv_v = 0.0
      jo_geoamv = 0.0
   end if

   if (iv%info(polaramv)%nlocal &gt; 0) then
      call da_jo_and_grady_polaramv(iv, re, jo, jo_grad_y)
      jo_polaramv = jo%polaramv_u + jo%polaramv_v
      if (print_detail_grad) then
         write(unit=stdout, fmt='(a, e24.12)') &amp;
            ' jo_polaramv       ', jo_polaramv, &amp;
            '   jo%polaramv_u   ', jo%polaramv_u, &amp;
            '   jo%polaramv_v   ', jo%polaramv_v
      end if
   else
      jo % polaramv_u = 0.0
      jo % polaramv_v = 0.0
      jo_polaramv = 0.0
   end if

   if (iv%info(airep)%nlocal &gt; 0) then
      call da_jo_and_grady_airep(iv, re, jo, jo_grad_y)
      jo_airep = jo%airep_u + jo%airep_v + jo%airep_t + jo%airep_q

      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_airep          ', jo_airep, &amp;
               '   jo%airep_u      ', jo%airep_u, &amp;
               '   jo%airep_v      ', jo%airep_v, &amp;
               '   jo%airep_t      ', jo%airep_t, &amp;
               '   jo%airep_q      ', jo%airep_q
      end if
   else
      jo % airep_u = 0.0
      jo % airep_v = 0.0
      jo % airep_t = 0.0
      jo % airep_q = 0.0
      jo_airep = 0.0
   end if

   if (iv%info(pilot)%nlocal &gt; 0) then
      call da_jo_and_grady_pilot(iv, re, jo, jo_grad_y)
      jo_pilot = jo%pilot_u + jo%pilot_v
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_pilot          ', jo_pilot, &amp;
               '   jo%pilot_u      ', jo%pilot_u, &amp;
               '   jo%pilot_v      ', jo%pilot_v
      end if
   else
      jo % pilot_u = 0.0
      jo % pilot_v = 0.0
      jo_pilot = 0.0
   end if

   if (iv%info(satem)%nlocal &gt; 0) then
      call da_jo_and_grady_satem(iv, re, jo, jo_grad_y)
      jo_satem = jo%satem_thickness
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_satem          ', jo_satem, &amp;
               '   jo%satem_thckns ', jo%satem_thickness
      end if
   else
      jo % satem_thickness = 0.0
      jo_satem = 0.0
   end if

   if (iv%info(metar)%nlocal &gt; 0) then
      call da_jo_and_grady_metar(iv, re, jo, jo_grad_y)
      jo_metar = jo%metar_u + jo%metar_v + jo%metar_t + jo%metar_p + jo%metar_q
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_metar          ', jo_metar, &amp;
               '   jo%metar_u      ', jo%metar_u, &amp;
               '   jo%metar_v      ', jo%metar_v, &amp;
               '   jo%metar_t      ', jo%metar_t, &amp;
               '   jo%metar_p      ', jo%metar_p, &amp;
               '   jo%metar_q      ', jo%metar_q
      end if
   else
      jo % metar_u = 0.0
      jo % metar_v = 0.0
      jo % metar_t = 0.0
      jo % metar_p = 0.0
      jo % metar_q = 0.0
      jo_metar = 0.0
   end if

   if (iv%info(ships)%nlocal &gt; 0) then
      call da_jo_and_grady_ships(iv, re, jo, jo_grad_y)
      jo_ships = jo%ships_u + jo%ships_v + jo%ships_t + jo%ships_p + jo%ships_q
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_ships          ', jo_ships, &amp;
               '   jo%ships_u      ', jo%ships_u, &amp;
               '   jo%ships_v      ', jo%ships_v, &amp;
               '   jo%ships_t      ', jo%ships_t, &amp;
               '   jo%ships_p      ', jo%ships_p, &amp;
               '   jo%ships_q      ', jo%ships_q
      end if
   else
      jo % ships_u = 0.0
      jo % ships_v = 0.0
      jo % ships_t = 0.0
      jo % ships_p = 0.0
      jo % ships_q = 0.0
      jo_ships = 0.0
   end if

   if (iv%info(gpspw)%nlocal &gt; 0) then
      call da_jo_and_grady_gpspw(iv, re, jo, jo_grad_y)
      jo_gpspw = jo%gpspw_tpw
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_gpspw          ', jo_gpspw, &amp;
               '   jo%gpspw_tpw    ', jo%gpspw_tpw
      end if
   else
      jo % gpspw_tpw = 0.0
      jo_gpspw = 0.0
   end if

   if (iv%info(gpsref)%nlocal &gt; 0) then
      call da_jo_and_grady_gpsref(iv, re, jo, jo_grad_y)
      jo_gpsref = jo%gpsref_ref
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_gpsref         ', jo_gpsref, &amp;
               '   jo%gpsref_ref   ', jo%gpsref_ref
      end if
   else
      jo % gpsref_ref = 0.0
      jo_gpsref = 0.0
   end if

   if (iv%info(ssmi_tb)%nlocal &gt; 0) then
      call da_jo_and_grady_ssmi_tb (iv, re, jo, jo_grad_y)
      jo_ssmi_tb = jo % ssmi_tb19v + jo % ssmi_tb19h + jo % ssmi_tb22v + &amp;
         jo % ssmi_tb37v + jo % ssmi_tb37h + jo % ssmi_tb85v + &amp;
         jo % ssmi_tb85h 
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_ssmi_tb        ', jo_ssmi_tb, &amp;
               '   jo%ssmi_tb19v   ', jo%ssmi_tb19v, &amp;
               '   jo%ssmi_tb19h   ', jo%ssmi_tb19h, &amp;
               '   jo%ssmi_tb22v   ', jo%ssmi_tb22v, &amp;
               '   jo%ssmi_tb37v   ', jo%ssmi_tb37v, &amp;
               '   jo%ssmi_tb37h   ', jo%ssmi_tb37h, &amp;
               '   jo%ssmi_tb85v   ', jo%ssmi_tb85v, &amp;
               '   jo%ssmi_tb85h   ', jo%ssmi_tb85h
      end if
   else
      jo % ssmi_tb19v = 0.0
      jo % ssmi_tb19h = 0.0
      jo % ssmi_tb22v = 0.0
      jo % ssmi_tb37v = 0.0
      jo % ssmi_tb37h = 0.0
      jo % ssmi_tb85v = 0.0
      jo % ssmi_tb85h = 0.0
      jo_ssmi_tb = 0.0
   end if

   if (iv%info(ssmi_rv)%nlocal &gt; 0) then
      call da_jo_and_grady_ssmi_rv(iv, re, jo, jo_grad_y)
      jo_ssmi_rv = jo % ssmir_speed + jo % ssmir_tpw
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_ssmi_rv        ', jo_ssmi_rv, &amp;
               '   jo%ssmir_speed  ', jo%ssmir_speed, &amp;
               '   jo%ssmir_tpw    ', jo%ssmir_tpw
      end if
   else
      jo % ssmir_speed = 0.0
      jo % ssmir_tpw   = 0.0
      jo_ssmi_rv = 0.0
   end if

   if (iv%info(ssmt1)%nlocal &gt; 0) then
      call da_jo_and_grady_ssmt1(iv, re, jo, jo_grad_y)
      jo_ssmt1 = jo%ssmt1_t
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_ssmt1          ', jo_ssmt1, &amp;
               '   jo%ssmt1_t      ', jo%ssmt1_t
      end if
   else
      jo % ssmt1_t = 0.0
      jo_ssmt1 = 0.0
   end if

   if (iv%info(ssmt2)%nlocal &gt; 0) then
      call da_jo_and_grady_ssmt2(iv, re, jo, jo_grad_y)  
      jo_ssmt2 = jo%ssmt2_rh
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_ssmt2          ', jo_ssmt2, &amp;
               '   jo%ssmt2_rh     ', jo%ssmt2_rh
      end if
   else
      jo % ssmt2_rh = 0.0
      jo_ssmt2 = 0.0
   end if

   if (iv%info(radar)%nlocal &gt; 0) then
      call da_jo_and_grady_radar(iv, re, jo, jo_grad_y)
      jo_radar = jo%radar_rv + jo%radar_rf + jo%radar_rrn + jo%radar_rsn + jo%radar_rgr + jo%radar_rqv
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_radar          ', jo_radar, &amp;
               '   jo%radar_rv     ', jo%radar_rv, &amp;
               '   jo%radar_rf     ', jo%radar_rf, &amp;
               '   jo%radar_rrn    ', jo%radar_rrn, &amp;
               '   jo%radar_rsn    ', jo%radar_rsn, &amp;
               '   jo%radar_rgr    ', jo%radar_rgr, &amp;
               '   jo%radar_rqv    ', jo%radar_rqv
      end if
   else
      jo % radar_rv  = 0.0
      jo % radar_rf  = 0.0
      jo % radar_rrn = 0.0
      jo % radar_rsn = 0.0
      jo % radar_rgr = 0.0
      jo % radar_rqv = 0.0
      jo_radar = 0.0
   end if

   if (iv%info(rain)%nlocal &gt; 0) then
       call da_jo_and_grady_rain(iv, re, jo, jo_grad_y)
       jo_rain = jo%rain_r
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_rain          ', jo_rain, &amp;
               '   jo%rain_r      ', jo%rain_r
      end if
   else
      jo % rain_r = 0.0
      jo_rain = 0.0
   end if

   if (iv%info(pseudo)%nlocal &gt; 0) then
      call da_jo_and_grady_pseudo(iv, re, jo, jo_grad_y)    
      jo_pseudo = jo%pseudo_u + jo%pseudo_v + jo%pseudo_t + jo%pseudo_p + jo%pseudo_q
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_pseudo          ', jo_pseudo, &amp;
               '   jo%pseudo_u      ', jo%pseudo_u, &amp;
               '   jo%pseudo_v      ', jo%pseudo_v, &amp;
               '   jo%pseudo_t      ', jo%pseudo_t, &amp;
               '   jo%pseudo_p      ', jo%pseudo_p, &amp;
               '   jo%pseudo_q      ', jo%pseudo_q
      end if
   else
      jo % pseudo_u = 0.0
      jo % pseudo_v = 0.0
      jo % pseudo_t = 0.0
      jo % pseudo_p = 0.0
      jo % pseudo_q = 0.0
      jo_pseudo = 0.0
   end if
   
   if (iv%info(qscat)%nlocal &gt; 0) then
      call da_jo_and_grady_qscat(iv, re, jo, jo_grad_y)
      jo_qscat = jo%qscat_u + jo%qscat_v
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_qscat           ', jo_qscat, &amp;
               '   jo%qscat_u       ', jo%qscat_u, &amp;
               '   jo%qscat_v       ', jo%qscat_v
      end if
   else
      jo % qscat_u = 0.0
      jo % qscat_v = 0.0
      jo_qscat = 0.0
   end if

   if (iv%info(profiler)%nlocal &gt; 0) then
      call da_jo_and_grady_profiler (iv, re, jo, jo_grad_y)
      jo_profiler = jo%profiler_u + jo%profiler_v
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_profiler        ', jo_profiler, &amp;
               '   jo%profiler_u    ', jo%profiler_u, &amp;
               '   jo%profiler_v    ', jo%profiler_v
      end if
   else
      jo % profiler_u = 0.0
      jo % profiler_v = 0.0
      jo_profiler = 0.0
   end if

   if (iv%info(bogus)%nlocal &gt; 0) then
      call da_jo_and_grady_bogus (iv, re, jo, jo_grad_y)
      jo_bogus = jo%bogus_u + jo%bogus_v + jo%bogus_slp + jo%bogus_t + jo%bogus_q
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_bogus           ', jo_bogus, &amp;
               '   jo%bogus_u       ', jo%bogus_u, &amp;
               '   jo%bogus_v       ', jo%bogus_v, &amp;
               '   jo%bogus_t       ', jo%bogus_t, &amp;
               '   jo%bogus_slp     ', jo%bogus_slp, &amp;
               '   jo%bogus_q       ', jo%bogus_q
      end if
   else
      jo % bogus_u   = 0.0
      jo % bogus_v   = 0.0
      jo % bogus_t   = 0.0
      jo % bogus_q   = 0.0
      jo % bogus_slp = 0.0
      jo_bogus = 0.0
   end if

   if (iv%info(buoy)%nlocal &gt; 0) then
      call da_jo_and_grady_buoy (iv, re, jo, jo_grad_y)
      jo_buoy = jo%buoy_u + jo%buoy_v + jo%buoy_t + jo%buoy_p + jo%buoy_q
      if (print_detail_grad) then
          write(unit=stdout, fmt='(a, e24.12)') &amp;
               ' jo_buoy            ', jo_buoy, &amp;
               '   jo%buoy_u        ', jo%buoy_u, &amp;
               '   jo%buoy_v        ', jo%buoy_v, &amp;
               '   jo%buoy_t        ', jo%buoy_t, &amp;
               '   jo%buoy_p        ', jo%buoy_p, &amp;
               '   jo%buoy_q        ', jo%buoy_q
      end if
   else
      jo % buoy_u = 0.0
      jo % buoy_v = 0.0
      jo % buoy_t = 0.0
      jo % buoy_p = 0.0
      jo % buoy_q = 0.0
      jo_buoy = 0.0
   end if

   jo_radiance = 0.0
#if defined(CRTM) || defined(RTTOV)
   if (iv%num_inst &gt; 0) then
      call da_jo_and_grady_rad (iv, re, jo, jo_grad_y)

      if (use_rad) then
         do i=1,iv%num_inst
            do k=1,iv%instid(i)%nchan
               jo_radiance = jo_radiance + jo%rad(i)%jo_ichan(k)
            end do
         end do
      end if
      if (print_detail_grad) then
         write(unit=stdout, fmt='(a, e24.12)') &amp;
            ' jo_radiance       ', jo_radiance
         do i = 1, iv%num_inst
            write(unit=stdout, fmt='(a, e24.12)') &amp;
               trim('   jo_'//iv%instid(i)%rttovid_string), sum(jo%rad(i)%jo_ichan(:))
         end do
      end if
   end if
#endif

   if (iv%info(airsr)%nlocal &gt; 0) then
      call da_jo_and_grady_airsr(iv, re, jo, jo_grad_y)
      jo_airsr = jo%airsr_t + jo%airsr_q

      if (print_detail_grad) then
         write(unit=stdout, fmt='(a, e24.12)') &amp;
            ' jo_airsr          ', jo_airsr, &amp;
            '   jo%airsr_t      ', jo%airsr_t, &amp;
            '   jo%airsr_q      ', jo%airsr_q
      end if
   else
      jo%airsr_t = 0.0
      jo%airsr_q = 0.0
      jo_airsr = 0.0
   end if

   !-------------------------------------------------------------------------
   ! [2.0] Jo = 1/2 * (yo-y)**2/ob_err_variance:
   !-------------------------------------------------------------------------

   jo%total = jo_sound + jo_sonde_sfc+jo_geoamv + jo_polaramv + jo_synop + jo_satem + &amp;
      jo_pilot + jo_airep + jo_metar + jo_ships + &amp;
      jo_gpspw + jo_ssmi_tb + jo_ssmi_rv + jo_ssmt1 + jo_ssmt2 + &amp;
      jo_pseudo + jo_qscat + jo_profiler + jo_buoy + &amp;
      jo_radar + jo_gpsref + jo_bogus + jo_radiance + jo_airsr + jo_mtgirs + &amp;
      jo_tamdar + jo_tamdar_sfc + jo_rain 

   jot = jo%total

   if (print_detail_grad) then
      write(unit=stdout, fmt='(a, e24.12)') &amp;
         '   jo%total      ', jot

      write(unit=stdout, fmt='(a, e24.12)') &amp;
         '   jo_sound        ', jo_sound, &amp;
         '   jo_sonde_sfc    ', jo_sonde_sfc, &amp;
         '   jo_geoamv       ', jo_geoamv, &amp;
         '   jo_polaramv     ', jo_polaramv, &amp;
         '   jo_synop        ', jo_synop, &amp;
         '   jo_satem        ', jo_satem, &amp;
         '   jo_pilot        ', jo_pilot, &amp;
         '   jo_airep        ', jo_airep, &amp;
         '   jo_metar        ', jo_metar, &amp;
         '   jo_ships        ', jo_ships, &amp;
         '   jo_gpspw        ', jo_gpspw, &amp;
         '   jo_ssmi_tb      ', jo_ssmi_tb, &amp;
         '   jo_ssmi_rv      ', jo_ssmi_rv, &amp;
         '   jo_ssmt1        ', jo_ssmt1, &amp;
         '   jo_ssmt2        ', jo_ssmt2, &amp;
         '   jo_pseudo       ', jo_pseudo, &amp;
         '   jo_qscat        ', jo_qscat, &amp;
         '   jo_profiler     ', jo_profiler, &amp;
         '   jo_buoy         ', jo_buoy, &amp;
         '   jo_radar        ', jo_radar, &amp;
         '   jo_gpsref       ', jo_gpsref, &amp;
         '   jo_bogus        ', jo_bogus,  &amp;
         '   jo_radiance     ', jo_radiance, &amp;
         '   jo_airsr        ', jo_airsr,&amp;
         '   jo_mtgirs       ', jo_mtgirs, &amp;
         '   jo_tamdar       ', jo_tamdar, &amp;
         '   jo_tamdar_sfc   ', jo_tamdar_sfc, &amp;
         '   jo_rain         ', jo_rain

   end if

   if (trace_use) call da_trace_exit("da_jo_and_grady")

end subroutine da_jo_and_grady