Last change
on this file since 2380 was
1637,
checked in by oabramkina, 6 years ago
|
Merging dev to trunk. Major changes:
(1) Grid mask is applied in the source filter of clients: unmasked values are replaced by NaN. It is not reconstructed any more by servers.
(2) Domain/axis mask has been incorporated into data index, with only data index sent to servers.
|
File size:
1.3 KB
|
Line | |
---|
1 | #include "file_writer_filter.hpp" |
---|
2 | #include "exception.hpp" |
---|
3 | #include "field.hpp" |
---|
4 | #include "utils.hpp" |
---|
5 | |
---|
6 | namespace xios |
---|
7 | { |
---|
8 | CFileWriterFilter::CFileWriterFilter(CGarbageCollector& gc, CField* field) |
---|
9 | : CInputPin(gc, 1) |
---|
10 | , field(field) |
---|
11 | { |
---|
12 | if (!field) |
---|
13 | ERROR("CFileWriterFilter::CFileWriterFilter(CField* field)", |
---|
14 | "The field cannot be null."); |
---|
15 | } |
---|
16 | |
---|
17 | void CFileWriterFilter::onInputReady(std::vector<CDataPacketPtr> data) |
---|
18 | { |
---|
19 | const bool detectMissingValue = ( !field->default_value.isEmpty() && |
---|
20 | ( (!field->detect_missing_value.isEmpty() || field->detect_missing_value == true) |
---|
21 | || field->hasGridMask()) ); |
---|
22 | |
---|
23 | CArray<double, 1> dataArray = (detectMissingValue) ? data[0]->data.copy() : data[0]->data; |
---|
24 | |
---|
25 | if (detectMissingValue) |
---|
26 | { |
---|
27 | const double missingValue = field->default_value; |
---|
28 | const size_t nbData = dataArray.numElements(); |
---|
29 | for (size_t idx = 0; idx < nbData; ++idx) |
---|
30 | { |
---|
31 | if (NumTraits<double>::isNan(dataArray(idx))) |
---|
32 | dataArray(idx) = missingValue; |
---|
33 | } |
---|
34 | } |
---|
35 | |
---|
36 | field->sendUpdateData(dataArray); |
---|
37 | } |
---|
38 | |
---|
39 | bool CFileWriterFilter::mustAutoTrigger() const |
---|
40 | { |
---|
41 | return true; |
---|
42 | } |
---|
43 | |
---|
44 | bool CFileWriterFilter::isDataExpected(const CDate& date) const |
---|
45 | { |
---|
46 | return true; |
---|
47 | } |
---|
48 | } // namespace xios |
---|
Note: See
TracBrowser
for help on using the repository browser.