Skip to content

Commit

Permalink
refine SSS QC
Browse files Browse the repository at this point in the history
  • Loading branch information
gmao-cda committed Oct 11, 2023
1 parent f34935b commit e4b33e5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/obs/decoder_sss_smap.f90
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ PROGRAM decoder_sss_smap
ALLOCATE( oqc(nobs) )
ALLOCATE( obhr(nobs) )

print *, "obsop_sst.f90:: starting nobs = ", nobs
print *, "decoder_sss_smap.f90:: starting nobs = ", nobs
do i=1,nobs
elem(i) = obs_data(i)%typ
rlon(i) = obs_data(i)%x_grd(1)
Expand Down
30 changes: 28 additions & 2 deletions src/obs/read_smap.f90
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ SUBROUTINE read_jpl_smap_l2_sss_h5(obsinfile, obs_data, nobs, Syyyymmddhh, delta
LOGICAL :: dodebug = .true.
INTEGER,PARAMETER :: QUAL_FLAG_SSS_USABLE_GOOD = 0
INTEGER,PARAMETER :: QUAL_FLAG_SSS_USABLE_BAD = 1
INTEGER,PARAMETER :: QUAL_FLAG_SSS_HAS_LAND = 1
INTEGER,PARAMETER :: QUAL_FLAG_SSS_HAS_ICE = 1

!-------------------------------------------------------------------------------
! Open the hdf5 file
Expand Down Expand Up @@ -361,13 +363,34 @@ SUBROUTINE read_jpl_smap_l2_sss_h5(obsinfile, obs_data, nobs, Syyyymmddhh, delta
where (NINT(sea_surface_salinity)==NINT(r4FillValue))
valid = .false.
end where
CALL h5_rdatt(fid, "/smap_sss", "valid_max", r4FillValue)
WRITE(6,*) "valid_max_yo=", r4FillValue
where(sea_surface_salinity > r4FillValue)
valid = .false.
end where
CALL h5_rdatt(fid, "/smap_sss", "valid_min", r4FillValue)
WRITE(6,*) "valid_min_yo=", r4FillValue
where( sea_surface_salinity < r4FillValue)
valid = .false.
endwhere

WRITE(6,*) "[msg] read_jpl_smap_l2_sss_h5::smap_sss: min, max=", &
minval(sea_surface_salinity, mask=valid), &
maxval(sea_surface_salinity, mask=valid)

CALL h5_rdvar2d(fid, "/smap_sss_uncertainty", stde)
CALL h5_rdatt(fid, "/smap_sss_uncertainty", "_FillValue", r4FillValue)
where (NINT(stde)==NINT(r4FillValue))
where (NINT(stde)==NINT(r4FillValue)) !
valid = .false.
end where
CALL h5_rdatt(fid, "/smap_sss_uncertainty", "valid_max", r4FillValue)
WRITE(6,*) "valid_max_error=", r4FillValue
where(stde > r4FillValue)
valid = .false.
end where
CALL h5_rdatt(fid, "/smap_sss_uncertainty", "valid_min", r4FillValue)
WRITE(6,*) "valid_min_error=", r4FillValue
where(stde < r4FillValue)
valid = .false.
end where
WRITE(6,*) "[msg] read_jpl_smap_l2_sss_h5::smap_sss_uncertainty: min, max=", &
Expand Down Expand Up @@ -419,7 +442,10 @@ SUBROUTINE read_jpl_smap_l2_sss_h5(obsinfile, obs_data, nobs, Syyyymmddhh, delta
CALL h5_rdvar2d(fid, "/quality_flag", quality_flag)
CALL h5_rdatt(fid, "/quality_flag", "_FillValue", i4FillValue)
if (dodebug) WRITE(6,*) "i4FillValue", i4FillValue
where (quality_flag == i4FillValue .or. IBITS(quality_flag,0,1)==QUAL_FLAG_SSS_USABLE_BAD) ! or BIT 0 QC FLAG is bad
where (quality_flag == i4FillValue .or. &
IBITS(quality_flag,0,1)==QUAL_FLAG_SSS_USABLE_BAD .or. & ! overall bad
IBITS(quality_flag,7,1)==QUAL_FLAG_SSS_HAS_LAND .or. & ! has land
IBITS(quality_flag,8,1)==QUAL_FLAG_SSS_HAS_ICE ) ! ! has ice
valid = .false.
end where
WRITE(6,*) "[msg] read_jpl_smap_l2_sss_h5::quality_flag: min, max=", &
Expand Down

0 comments on commit e4b33e5

Please sign in to comment.