IODA Bundle
Transforms/TransformBuilder.cpp
Go to the documentation of this file.
1
/*
2
* (C) Copyright 2020 NOAA/NWS/NCEP/EMC
3
*
4
* This software is licensed under the terms of the Apache Licence Version 2.0
5
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6
*/
7
8
#include "
TransformBuilder.h
"
9
10
#include "eckit/exception/Exceptions.h"
11
12
#include "
ScalingTransform.h
"
13
#include "
OffsetTransform.h
"
14
15
16
static
const
char
*
TRANSFORMS_SECTION
=
"transforms"
;
17
static
const
char
*
OFFSET_KEY
=
"offset"
;
18
static
const
char
*
SCALE_KEY
=
"scale"
;
19
20
namespace
Ingester
21
{
22
std::shared_ptr<Transform>
TransformBuilder::makeTransform
(
const
eckit::Configuration& conf)
23
{
24
std::shared_ptr <Transform>
transform
;
25
if
(conf.has(
OFFSET_KEY
))
26
{
27
transform
= std::make_shared<OffsetTransform>(conf.getFloat(
OFFSET_KEY
));
28
}
29
else
if
(conf.has(
SCALE_KEY
))
30
{
31
transform
= std::make_shared<ScalingTransform>(conf.getFloat(
SCALE_KEY
));
32
}
33
else
34
{
35
throw
eckit::BadParameter(
"Tried to create unknown export transform type. "
36
"Check your configuration."
);
37
}
38
39
return
transform
;
40
}
41
42
Transforms
TransformBuilder::makeTransforms
(
const
eckit::Configuration& conf)
43
{
44
Transforms
transforms;
45
if
(conf.has(
TRANSFORMS_SECTION
))
46
{
47
for
(
const
auto
& transformConf : conf.getSubConfigurations(
TRANSFORMS_SECTION
))
48
{
49
transforms.push_back(
makeTransform
(transformConf));
50
}
51
}
52
53
return
transforms;
54
}
55
}
// namespace Ingester
TRANSFORMS_SECTION
static const char * TRANSFORMS_SECTION
Definition:
Transforms/TransformBuilder.cpp:16
OFFSET_KEY
static const char * OFFSET_KEY
Definition:
Transforms/TransformBuilder.cpp:17
SCALE_KEY
static const char * SCALE_KEY
Definition:
Transforms/TransformBuilder.cpp:18
OffsetTransform.h
ScalingTransform.h
TransformBuilder.h
Ingester::TransformBuilder::makeTransform
static std::shared_ptr< Transform > makeTransform(const eckit::Configuration &conf)
Create transform given the configuration.
Definition:
Transforms/TransformBuilder.cpp:22
Ingester::TransformBuilder::makeTransforms
static Transforms makeTransforms(const eckit::Configuration &conf)
Uses makeTransform to loop through the list of transforms in the configuration.
Definition:
Transforms/TransformBuilder.cpp:42
Ingester
Definition:
bufr2ioda.cpp:28
Ingester::Transforms
std::vector< std::shared_ptr< Transform > > Transforms
Definition:
Transforms/Transform.h:28
plotting-05-ObsGroup.transform
transform
Definition:
plotting-05-ObsGroup.py:41
iodaconv
src
bufr
BufrParser
Exports
Transforms
TransformBuilder.cpp
Generated on Fri Aug 20 2021 11:49:12 for IODA Bundle by
1.9.1