Skip to content

Commit

Permalink
Set proper limits for flag_alt_oper_mode (6a c2 tx pn)
Browse files Browse the repository at this point in the history
  • Loading branch information
remkos committed May 29, 2024
1 parent b998633 commit b8d095e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions conf/rads.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2834,14 +2834,17 @@ Global RADS configuration file
<if sat="6a">
<flag_values>LRM RAW RMC</flag_values>
<plot_range>0 2</plot_range>
<limits>0 2</limits>
</if>
<elseif sat="c2">
<flag_values>LRM SAR SARIN</flag_values>
<plot_range>0 2</plot_range>
<limits>0 2</limits>
</elseif>
<elseif sat="tx pn">
<flag_values>side_A side_B POS</flag_values>
<plot_range>0 2</plot_range>
<limits>0 2</limits>
</elseif>
<else>
<data source="flags">0</data>
Expand Down
17 changes: 15 additions & 2 deletions src/rads.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3075,7 +3075,7 @@ subroutine rads_set_limits_info (info)
S%cycles(2) = min(S%cycles(2), rads_time_to_cycle (S, time()+sec1970))
endif
else if (var%name == 'flags') then
call rads_set_limits_by_flagmask (S, info%limits)
call rads_set_limits_by_flagmask (S, info%limits, .true.)
endif
end subroutine rads_set_limits_info
end subroutine rads_set_limits
Expand All @@ -3085,16 +3085,29 @@ end subroutine rads_set_limits
! Set limits based on flagmask
!
! SYNOPSIS
subroutine rads_set_limits_by_flagmask (S, limits)
subroutine rads_set_limits_by_flagmask (S, limits, force)
use rads_misc
type(rads_sat), intent(inout) :: S
real(eightbytereal), intent(inout) :: limits(2)
logical, optional :: force
!
! PURPOSE
! Set the limits of individual quality/flag variables based on the traditional flagmask.
! Do not overrule already set limits, unless the optional input 'forece'
!
! ARGUMENTS
! S : Satellite/mission dependent structure
! limits(2): Two components of the flagmask 1=do not allow, 2=require
! force : (optional) Force overruling already existing limits
!****-------------------------------------------------------------------
integer :: i, ios, mask(2), bits(2)
mask = 0
where (limits == limits) mask = nint(limits) ! Because it is not guaranteed for every compiler that nint(nan)=0
! Loop through all variables to find those with field between 2501 and 2516
do i = 1,S%nvar
if (.not.any(S%var(i)%field >= 2501 .and. S%var(i)%field <= 2516)) cycle
! Do not overrule already set limits, unless 'force' is provided
if (any(isan_(S%var(i)%info%limits)) .and. .not.(present(force) .and. force)) cycle
bits = (/0,1/) ! Default values
read (S%var(i)%info%dataname, *, iostat=ios) bits
if (S%var(i)%info%dataname == 'surface_type') then
Expand Down

0 comments on commit b8d095e

Please sign in to comment.