38 #ifndef RACK_PRODUCT_OP
39 #define RACK_PRODUCT_OP "ProductOP"
42 #include <drain/Log.h>
49 #include <drain/RegExp.h>
50 #include <drain/util/SmartMap.h>
51 #include <drain/util/TreeOrdered.h>
53 #include "data/Data.h"
54 #include "data/DataSelector.h"
55 #include "data/ODIM.h"
56 #include "data/ODIMPath.h"
57 #include "data/ODIMPathTools.h"
58 #include "data/QuantityMap.h"
65 #include "ProductBase.h"
77 template <
class MS,
class MD>
97 std::cerr <<
'#' << __FUNCTION__ <<
" copy ct " << product.
getName() << this->dataSelector <<
'\n';
117 if (!odim.quantity.empty())
118 return odim.quantity;
120 return inputQuantity;
126 void processH5(
const Hi5Tree &src, Hi5Tree &dst)
const;
151 mout.unimplemented(__FUNCTION__);
180 setEncoding(srcODIM, dstData);
181 setGeometry(srcODIM, dstData);
183 mout.
debug(
"final dstData: " , dstData );
225 void setEncodingNEW(
PlainData<dst_t> & dstData,
const std::string quantity =
"",
const std::string type =
"")
const;
250 template <
class MS,
class MD>
252 const std::string quantity,
const std::string type)
const {
256 if (dstData.odim.quantity.empty())
257 dstData.odim.quantity = quantity;
260 dstData.odim.type = type;
262 const std::string & qty = quantity.empty() ? dstData.odim.quantity : quantity;
265 mout.
warn(
"No quantity in metadata or as argument" );
270 dstData.odim.updateValues(targetEncoding);
272 dstData.odim.updateValues(targetEncoding);
274 dstData.data.setScaling(odim.scaling);
307 template <
class MS,
class MD>
315 dst.data.setScaling(dst.odim.scaling);
321 template <
class MS,
class MD>
329 mout.
debug2(
"DataSelector: ", this->dataSelector);
336 mout.debug3(
"collect the applicable paths");
337 ODIMPathList dataPaths;
343 this->dataSelector.getPaths(src, dataPaths);
344 mout.debug3(
"populate the dataset map, paths=" , dataPaths.size() );
346 for (
const ODIMPath & path: dataPaths){
347 mout.debug3(
"add: " , index ,
'\t' , path );
377 mout.
debug2(
"DataSets: " , sweeps.size() );
383 mout.
unimplemented(
"consider and test .data.attributes instead");
399 mout.
attention(
"storing product in path: " , parent ,
'|' , child );
400 Hi5Tree & dstProduct = dst[parent][child];
405 this->computeSingleProduct(sweeps, dstProductDataset);
408 dst[
"what"].data.attributes[
"object"] = this->odim.object;
409 dstProduct[
"what"].data.attributes[
"product"] = odim.product;
410 dstProduct[
"what"].data.attributes[
"prodpar"] = odim.prodpar;
412 ProductBase::setRackVersion(dstProduct[
"how"].data.attributes);
419 template <
class MS,
class MD>
423 mout.debug3(
"start" );
426 mout.
warn(
"no data" );
429 for (
const auto & entry: src) {
430 mout.debug3(
"calling processDataSet for elev=", entry.first,
" #datasets=", entry.second.size());
431 processDataSet(entry.second, dstProduct);
445 template <
class MS,
class MD>
451 mout.
debug(
"start" );
455 mout.
debug(
"target quantity: " , odim.quantity );
458 const std::string & quantity = !odim.quantity.empty() ? odim.quantity : srcData.odim.quantity;
460 dstData.odim.quantity = quantity;
469 this->initDst(srcData.odim, dstData);
472 processData(srcData, dstData);
virtual const std::string & getName() const
Return the name of an instance.
Definition: BeanLike.h:69
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition: Log.h:310
Logger & attention(const TT &... args)
Possible error, but execution can continue. Special type of Logger::warn().
Definition: Log.h:474
Logger & unimplemented(const TT &... args)
Feature to be done. Special type of Logger::note().
Definition: Log.h:509
Logger & note(const TT &... args)
For top-level information.
Definition: Log.h:487
Logger & warn(const TT &... args)
Possible error, but execution can continue.
Definition: Log.h:428
Logger & debug(const TT &... args)
Public, yet typically used "internally", when TIMING=true.
Definition: Log.h:678
Logger & debug2(const TT &... args)
Debug information.
Definition: Log.h:688
Computes dot product of intensities of two images.
Definition: PixelVectorOp.h:364
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition: Data.h:1213
Data structure consisting of plain data and an optional quality data.
Definition: Data.h:1144
Definition: ODIMPath.h:82
static const group_t WHAT
Metadata group /what , at any depth.
Definition: ODIMPath.h:127
static const group_t DATASET
First level group, /dataset + digit .
Definition: ODIMPath.h:106
static const group_t HOW
Metadata group /how , at any depth.
Definition: ODIMPath.h:133
static const group_t DATA
Second level group, /data + digit .
Definition: ODIMPath.h:109
static const group_t WHERE
Metadata group /where , at any depth.
Definition: ODIMPath.h:130
ODIM metadata (quantity, gain, offset, undetect, nodata, date, time)
Definition: ODIM.h:79
Essential class for storing radar data.
Definition: Data.h:302
Base class for radar data processors. Input can be in polar or Cartesian coordinates.
Definition: ProductBase.h:82
static void applyODIM(ODIM &productODIM, const ODIM &srcODIM, bool applyDefaults=false)
Sets target quantity and encoding, if unset. If input odim.
Definition: ProductBase.cpp:117
static void completeEncoding(ODIM &productODIM, const std::string &targetEncoding)
Modifies encoding. If type is changed, resets scaling first.
Definition: ProductBase.cpp:183
ODIMPathElem appendResults
If set, appends outputs in an hdf5 structure instead of overwriting.
Definition: ProductConf.h:93
DstType< MD > dst_t
Type of output, that is, destination.
Definition: ProductOp.h:86
SrcType< MS const > src_t
Type of input, that is, source.
Definition: ProductOp.h:83
MD odim
The default data parameters for encoding output (the product).
Definition: ProductOp.h:98
virtual const std::string & getOutputQuantity(const std::string &inputQuantity="") const
Returns the primary output quantity (ODIM what:quantity , like DBZH)
Definition: ProductOp.h:116
virtual void initDst(const MS &srcODIM, PlainData< dst_t > &dstData) const
initialises dst data by setting suitable ODIM metadata and geometry.
Definition: ProductOp.h:176
virtual void setGeometry(const MS &srcODIM, PlainData< dst_t > &dstData) const =0
Sets automagically the suitable dst parameters.
ProductOp(const std::string &name, const std::string &description)
Default constructor.
Definition: ProductOp.h:91
Definition: QuantityMap.h:50
bool setQuantityDefaults(EncodingODIM &dst, const std::string &quantity, const std::string &values="") const
Sets default values of given quantity - but not the quantity itself. Optionally overrides with user v...
Definition: QuantityMap.cpp:398
Namespace for images and image processing tools.
Definition: AccumulationArray.cpp:45
Definition: DataSelector.cpp:44
Writable data type.
Definition: Data.h:122
Read-only data type.
Definition: Data.h:112