Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/ufo/operators/gnssro/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ add_subdirectory( BndROPP2D )
add_subdirectory( utils )
add_subdirectory( QC )
add_subdirectory( BendMetOffice )
add_subdirectory( RefNLPEP2D )

PREPEND( _p_refncep_files "operators/gnssro/RefNCEP" ${refncep_src_files} )
PREPEND( _p_refmetoffice_files "operators/gnssro/RefMetOffice" ${refmetoffice_src_files} )
Expand All @@ -16,6 +17,7 @@ PREPEND( _p_bndropp2d_files "operators/gnssro/BndROPP2D" ${bndropp2d_src_
PREPEND( _p_utils_files "operators/gnssro/utils" ${utils_src_files} )
PREPEND( _p_qc_files "operators/gnssro/QC" ${qc_src_files} )
PREPEND( _p_metoffice_files "operators/gnssro/BendMetOffice" ${bendmetoffice_src_files} )
PREPEND( _p_refnlpep2d_files "operators/gnssro/RefNLPEP2D" ${refnlpep2d_files} )

set ( gnssro_src_files
${_p_refncep_files}
Expand All @@ -26,5 +28,6 @@ set ( gnssro_src_files
${_p_utils_files}
${_p_qc_files}
${_p_metoffice_files}
PARENT_SCOPE
${_p_refnlpep2d_files}
PARENT_SCOPE
)
63 changes: 62 additions & 1 deletion src/ufo/operators/gnssro/QC/ufo_roobserror_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ subroutine ufo_roobserror_prior(self)
real(kind_real), allocatable :: obsLocR(:) ! The local radius of curvature at the observation location
real(kind_real), allocatable :: obsValue(:)
real(kind_real), allocatable :: obsErr(:)
real(kind_real), allocatable :: obsRefr(:) ! observed atmosphericRefractivity (N-units)
real(kind_real), allocatable :: obsNLPEP(:) ! observed nonLocalPseudoExcessPhase (m)
real(kind_real), allocatable :: errScaleFactor(:) ! Factor to map one kind of error to another
real(kind_real), allocatable :: averageTemp(:) ! The average model temperature
integer(c_int), allocatable :: obsSaid(:)
integer(c_int), allocatable :: QCflags(:)
Expand Down Expand Up @@ -376,8 +379,66 @@ subroutine ufo_roobserror_prior(self)
call abor1_ftn(err_msg)
end select

case ("nonLocalPseudoExcessPhase")

! Get scale factors to convert refractivity errors into non-local pseudo excess phase errors.
! This part is common to any technique that repurposes a refractivity error model.
allocate(errScaleFactor(nobs))
if (obsspace_has(self%obsdb, "ObsValue", "atmosphericRefractivity") .AND. &
& obsspace_has(self%obsdb, "ObsValue", "nonLocalPseudoExcessPhase")) then
allocate(obsRefr(nobs))
allocate(obsNLPEP(nobs))
call obsspace_get_db(self%obsdb, "ObsValue", "atmosphericRefractivity", obsRefr)
call obsspace_get_db(self%obsdb, "ObsValue", "nonLocalPseudoExcessPhase", obsNLPEP)

do iob = 1, nobs
errScaleFactor(iob) = obsNLPEP(iob) / obsRefr(iob)
end do
deallocate(obsRefr)
deallocate(obsNLPEP)
else
write(err_msg,*) "ufo_roobserror_mod: could not access observations of &
&atmosphericRefractivity and nonLocalPseudoExcessPhase while computing &
&errors for nonLocalPseudoExcessPhase from refractivity; error cannot &
&be properly scaled"
call abor1_ftn(err_msg)
end if

select case (trim(self%errmodel))

case ("NCEP")

allocate(obsZ(nobs))
allocate(obsLat(nobs))
call obsspace_get_db(self%obsdb, "MetaData", "height", obsZ)
call obsspace_get_db(self%obsdb, "MetaData", "latitude", obsLat)
call refractivity_obserr_NCEP(obsLat, obsZ, nobs, obsErr, QCflags, missing)
do iob = 1, nobs
if (QCflags(iob) .eq. 0) then
! Scale refractivity error to nonLocalPseudoExcessPhase error.
obsErr(iob) = obsErr(iob) * errScaleFactor(iob)
end if
end do

write(err_msg,*) 'ufo_roobserror_mod: setting up nonLocalPseudoExcessPhase &
&obs error with NCEP method'
call fckit_log%debug(err_msg)
deallocate(obsZ)
deallocate(obsLat)
! up date obs error
call obsspace_put_db(self%obsdb, "FortranERR", trim(self%variable), obsErr)

case default
write(err_msg,*) 'ufo_roobserror_mod: only NCEP error model is available &
&for variable nonLocalPseudoExcessPhase'
call abor1_ftn(err_msg)
end select

deallocate(errScaleFactor)

case default
call abor1_ftn("ufo_roobserror_prior: variable has to be bending_angle or refractivity")
call abor1_ftn('ufo_roobserror_prior: variable has to be bendingAngle, &
&atmosphericRefractivity, or nonLocalPseudoExcessPhase')
end select

deallocate(QCflags)
Expand Down
22 changes: 22 additions & 0 deletions src/ufo/operators/gnssro/RefNLPEP2D/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (C) Copyright 2025 Space Sciences and Engineering, LLC (dba PlanetiQ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set ( refnlpep2d_files
ObsGnssroRefNLPEP2D.h
ObsGnssroRefNLPEP2D.cc
ObsGnssroRefNLPEP2DTLAD.h
ObsGnssroRefNLPEP2DTLAD.cc
ObsGnssroRefNLPEP2DParameters.h
PARENT_SCOPE
)
Loading