Skip to content

Commit 6c400a2

Browse files
committed
Only write landmask once
1 parent 3536d24 commit 6c400a2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

core/src/Xios.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "include/ModelMetadata.hpp"
2424
#include "include/ParallelNetcdfFile.hpp"
2525
#include "include/Xios.hpp"
26+
#include "include/gridNames.hpp"
2627

2728
#include <boost/algorithm/string.hpp>
2829
#include <boost/date_time/posix_time/posix_time.hpp>
@@ -944,11 +945,13 @@ void Xios::createField(const std::string fieldId)
944945
throw std::runtime_error("Xios: Failed to create field '" + fieldId + "'");
945946
}
946947

947-
// Restarts are read "once", everything else is written "instant"ly (no averaging)
948+
// Set the operation type
948949
std::string operation;
949-
if (configGetInputRestartFieldNames().count(fieldId) > 0) {
950+
if (configGetInputRestartFieldNames().count(fieldId) > 0 || fieldId == maskName) {
951+
// Restarts are read "once" and the mask is fixed so only written once
950952
operation = "once";
951953
} else {
954+
// Otherwise, read/write all timesteps without post-processing
952955
operation = "instant";
953956
}
954957
if (cxios_is_defined_field_operation(field)) {

0 commit comments

Comments
 (0)