possible bug in observation vetting logic

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
stef
Posts: 185
Joined: Tue Mar 13, 2007 6:38 pm
Location: Independent researcher
Contact:

possible bug in observation vetting logic

#1 Unread post by stef »

I'm aware that I4DVAR is deprecated, but I still use it for learning and working through the tutorial.

Is there a bug in I4DVAR in case an observation lies exactly on the bottom-most rho point? In the vetting logic, there seems to be a logic bug around the cancellation of the background-extracted values at observation locations and the computation of the adjoint forcing. It might only occur if BGQC is undefined.

Consider the case where an observation lies exactly on the bottom-most rho point. The program flow for I4DVAR is something like:

Code: Select all

background(
    wrtObsScale(ng)=.TRUE.
    call main3d(
	call output(
	    call obs_write(
		CALL extract_obs3d(
		    IF ((Zobs(iobs).gt.0.0_r8).and.(Zobs(iobs).le.1.0_r8)) THEN
		      ObsVetting(iobs)=0.0_r8
		      ! OBSVETTING IS SET TO ZERO, BECAUSE THE POINT LIES ON THE BOTTOM-MOST RHO POINT
		    
		    END IF
		)
		ObsScale(iobs)=ObsVetting(iobs)
		! OBSSCALE IS SET TO ZERO
		
		NLmodVal(iobs)=ObsScale(iobs)*NLmodVal(iobs)
		! NLMODVAL IS SET TO ZERO (!!!)
           ))))
increment(
    call ad_main3d(
	call ad_misfit(
          ADmodVal(iobs)=ObsErr(iobs)*                                  
                       (NLmodVal(iobs)+TLmodVal(iobs)-ObsVal(iobs))
	  ! ADMODVAL IS SET TO OBSERR * (0-OBSVAL) (!!!)

          ObsScale(ic)=ObsScaleGlobal(iobs)
	  ! OBSSCALE IS SET TO 0

	  # ifdef BGQC
	  !
	  !-----------------------------------------------------------------------
	  !  Reject observations that fail background quality control check.
	  !-----------------------------------------------------------------------
	  !
	          DO iobs=1,Nobs(ng)
	            ADmodVal(iobs)=ObsScale(iobs)*ADmodVal(iobs)
	          END DO
	  # endif
	  ! IF BGQC IS DEFINED, THE BUG DOES NOT APPEAR SINCE ADJOINT FORCING IS SET TO ZERO
    
The problem is that if BGQC is *not* defined, the ADmodVal forcing for the adjoint is nonsensical, since the the forcing was computed against a (incorrect) background of zero. This yields nonsensical values for the first adjoint solution. In my specific case, this caused a negative total cost function (!).

stef
Posts: 185
Joined: Tue Mar 13, 2007 6:38 pm
Location: Independent researcher
Contact:

Re: possible bug in observation vetting logic

#2 Unread post by stef »

In tutorial slide Tutorial_10_2019.pdf slide it says
If deeper than z_r(:,:,1), observations are rejected.
Is it *strictly* deeper?

In the condition above it says

Code: Select all

... Zobs(iobs).le.1.0_r8 ...
I have no experience with "clustering due shallowing of bathymetry during smoothing and coarse level half-thickness (-h < Zobs < Adepth(:,:,1)) in deep water" as commented in extract_obs.F, so I'm not sure if it's as simple as adjusting the .le. to .lt.?

Post Reply