Skip to content
Merged
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
3 changes: 3 additions & 0 deletions src/opsinputs/CxWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "ufo/filters/Variable.h"
#include "ufo/filters/Variables.h"
#include "ufo/GeoVaLs.h"
#include "ufo/ScopedDefaultGeoVaLFormatChange.h"

namespace opsinputs {

Expand Down Expand Up @@ -71,6 +72,7 @@ CxWriter::~CxWriter() {
void CxWriter::priorFilter(const ufo::GeoVaLs & gv) {
oops::Log::trace() << "CxWriter priorFilter" << std::endl;

ufo::ScopedDefaultGeoVaLFormatChange change(gv, ufo::GeoVaLFormat::REDUCED);
LocalEnvironment localEnvironment;
setupEnvironment(localEnvironment);

Expand All @@ -83,6 +85,7 @@ void CxWriter::postFilter(const ufo::GeoVaLs & gv,
const ufo::ObsDiagnostics &) {
oops::Log::trace() << "CxWriter postFilter" << std::endl;

ufo::ScopedDefaultGeoVaLFormatChange change(gv, ufo::GeoVaLFormat::REDUCED);
LocalEnvironment localEnvironment;
setupEnvironment(localEnvironment);

Expand Down
3 changes: 3 additions & 0 deletions src/opsinputs/VarObsWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "ufo/filters/Variables.h"
#include "ufo/GeoVaLs.h"
#include "ufo/ObsDiagnostics.h"
#include "ufo/ScopedDefaultGeoVaLFormatChange.h"

namespace opsinputs {

Expand Down Expand Up @@ -91,6 +92,7 @@ VarObsWriter::~VarObsWriter() {
void VarObsWriter::priorFilter(const ufo::GeoVaLs & gv) {
oops::Log::trace() << "VarObsWriter priorFilter" << std::endl;

ufo::ScopedDefaultGeoVaLFormatChange change(gv, ufo::GeoVaLFormat::REDUCED);
LocalEnvironment localEnvironment;
setupEnvironment(localEnvironment);

Expand All @@ -103,6 +105,7 @@ void VarObsWriter::postFilter(const ufo::GeoVaLs & gv,
const ufo::ObsDiagnostics & obsdiags) {
oops::Log::trace() << "VarObsWriter postFilter" << std::endl;

ufo::ScopedDefaultGeoVaLFormatChange change(gv, ufo::GeoVaLFormat::REDUCED);
LocalEnvironment localEnvironment;
setupEnvironment(localEnvironment);

Expand Down
35 changes: 17 additions & 18 deletions src/opsinputs/opsinputs_fill_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1321,21 +1321,21 @@ subroutine opsinputs_fill_fillrealfromgeoval( &
Hdr, OpsVarName, JediToOpsLayoutMapping % NumOpsObs, Real1, &
GeoVals, JediVarName, JediToOpsLayoutMapping)
else
if (ufo_vars_getindex(GeoVals % variables, JediVarName) > 0) then
! Retrieve GeoVal
call ufo_geovals_get_var(GeoVals, JediVarName, GeoVal)
if (GeoVal % nval /= 1) then
write (ErrorMessage, '("GeoVal ",A," contains more than one value per location. &
&Only the first of these values will be written to the VarObs file")') JediVarName
call gen_warn(RoutineName, ErrorMessage)
! Try to retrieve GeoVal
call ufo_geovals_get_var(GeoVals, JediVarName, GeoVal, must_be_found = .false.)
if (associated(GeoVal)) then
if (GeoVal % nval /= 1) then
write (ErrorMessage, '("GeoVal ",A," contains more than one value per location. &
&Only the first of these values will be written to the VarObs file")') JediVarName
call gen_warn(RoutineName, ErrorMessage)
end if
end if

! Fill the OPS data structures
call Ops_Alloc(Hdr, OpsVarName, NumObs, Real1)
where (GeoVal % vals(1,:) /= MissingReal)
Real1 = GeoVal % vals(1,:)
end where
end if
end if
end subroutine opsinputs_fill_fillrealfromgeoval

Expand Down Expand Up @@ -1384,10 +1384,9 @@ subroutine opsinputs_fill_fillreal2dfromgeovalforsinglelevelobs( &

MissingReal = missing_value(0.0_c_float)

if (ufo_vars_getindex(GeoVals % variables, JediVarName) > 0) then
! Retrieve GeoVal
call ufo_geovals_get_var(GeoVals, JediVarName, GeoVal)

! Try to retrieve GeoVal
call ufo_geovals_get_var(GeoVals, JediVarName, GeoVal, must_be_found = .false.)
if (associated(GeoVal)) then
! Fill the OPS data structures
call Ops_Alloc(Hdr, OpsVarName, NumObs, Real2, num_levels = int(GeoVal % nval, kind = 8))
where (transpose(GeoVal % vals) /= MissingReal)
Expand Down Expand Up @@ -1498,9 +1497,9 @@ subroutine opsinputs_fill_fillrealfromgeovalformultilevelobs( &

MissingReal = missing_value(0.0_c_float)

if (ufo_vars_getindex(GeoVals % variables, JediVarName) > 0) then
! Retrieve GeoVal
call ufo_geovals_get_var(GeoVals, JediVarName, GeoVal)
! Try to retrieve GeoVal
call ufo_geovals_get_var(GeoVals, JediVarName, GeoVal, must_be_found = .false.)
if (associated(GeoVal)) then
! Fill the OPS data structures
call Ops_Alloc(Hdr, OpsVarName, JediToOpsLayoutMapping % NumOpsObs, Real1)
! Loop over each multi-level profile
Expand Down Expand Up @@ -1563,9 +1562,9 @@ subroutine opsinputs_fill_fillreal2dfromgeovalformultilevelobs( &

MissingReal = missing_value(0.0_c_float)

if (ufo_vars_getindex(GeoVals % variables, JediVarName) > 0) then
! Retrieve GeoVal
call ufo_geovals_get_var(GeoVals, JediVarName, GeoVal)
! Try to retrieve GeoVal
call ufo_geovals_get_var(GeoVals, JediVarName, GeoVal, must_be_found = .false.)
if (associated(GeoVal)) then
! Determine the number of levels in this GeoVaL. This governs the number of levels in the
! output array.
numLevels = GeoVal % nval
Expand Down
Loading