Commit ecf2e1478e8de966f7424534ef9185cd0d552b48

Authored by Benjamin Renard
1 parent 193183ca

Use resampled table param in downloaded files (#8758)

Showing 1 changed file with 29 additions and 7 deletions   Show diff stats
src/ParamOutputImpl/Download/DownloadOutput.cc
@@ -90,8 +90,15 @@ namespace AMDA { @@ -90,8 +90,15 @@ namespace AMDA {
90 if (!tableParamIds.empty()) 90 if (!tableParamIds.empty())
91 for (auto tableParamId : tableParamIds) { 91 for (auto tableParamId : tableParamIds) {
92 AMDA::Parameters::ParameterSPtr tableParam = _parameterManager.getParameter(tableParamId.second); 92 AMDA::Parameters::ParameterSPtr tableParam = _parameterManager.getParameter(tableParamId.second);
93 - tableParam ->openConnection(this);  
94 - AMDA::Info::ParamInfoSPtr tableInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(tableParamId.second); 93 + if ((_downloadProperties.getTimeResolution() > 0) && (_downloadProperties.getOutputStructure() != ONE_FILE_PER_PARAMETER_PER_INTERVAL)) {
  94 + // Use resampled table param
  95 + tableParam = _parameterManager.getSampledParameter(
  96 + tableParamId.second,
  97 + "classic",
  98 + _downloadProperties.getTimeResolution(),
  99 + tableParam->getGapThreshold(), true);
  100 + }
  101 + tableParam ->openConnection(this);
95 } 102 }
96 } 103 }
97 } 104 }
@@ -114,13 +121,20 @@ namespace AMDA { @@ -114,13 +121,20 @@ namespace AMDA {
114 return; 121 return;
115 AMDA::Info::ParamInfoSPtr processInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(paramId); 122 AMDA::Info::ParamInfoSPtr processInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(paramId);
116 if (isFullVariable || (pParam->isTableIndexParam() && processInfo->getProcessInfo().empty())) { 123 if (isFullVariable || (pParam->isTableIndexParam() && processInfo->getProcessInfo().empty())) {
  124 + if ((_downloadProperties.getTimeResolution() > 0) && (_downloadProperties.getOutputStructure() != ONE_FILE_PER_PARAMETER_PER_INTERVAL)) {
  125 + //Use resampled table param
  126 + pParam = _parameterManager.getSampledParameter(
  127 + paramId,
  128 + "classic",
  129 + _downloadProperties.getTimeResolution(),
  130 + pParam->getGapThreshold(), true);
  131 + }
117 pParam->openConnection(this); 132 pParam->openConnection(this);
118 ParamProperties* paramProperties = new ParamProperties(); 133 ParamProperties* paramProperties = new ParamProperties();
119 paramProperties->setOriginalId(paramId); 134 paramProperties->setOriginalId(paramId);
120 - paramProperties->setOutputId(paramId); 135 + paramProperties->setOutputId(pParam->getId());
121 _downloadProperties.addParamProperties(paramProperties); 136 _downloadProperties.addParamProperties(paramProperties);
122 pParam->init(this, _timeIntervalList); 137 pParam->init(this, _timeIntervalList);
123 -  
124 } 138 }
125 AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(paramId); 139 AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(paramId);
126 const std::vector<std::string>& paramLinkedParams = paramInfo->getLinkedParamList(); 140 const std::vector<std::string>& paramLinkedParams = paramInfo->getLinkedParamList();
@@ -175,13 +189,21 @@ namespace AMDA { @@ -175,13 +189,21 @@ namespace AMDA {
175 AMDA::Parameters::ParameterSPtr tableParam = _parameterManager.getParameter(tableParamId.second); 189 AMDA::Parameters::ParameterSPtr tableParam = _parameterManager.getParameter(tableParamId.second);
176 if (tableParam == NULL) 190 if (tableParam == NULL)
177 continue; 191 continue;
  192 + if ((_downloadProperties.getTimeResolution() > 0) && (_downloadProperties.getOutputStructure() != ONE_FILE_PER_PARAMETER_PER_INTERVAL)) {
  193 + //Use resampled table param
  194 + tableParam = _parameterManager.getSampledParameter(
  195 + tableParamId.second,
  196 + "classic",
  197 + _downloadProperties.getTimeResolution(),
  198 + tableParam->getGapThreshold(), true);
  199 + }
178 tableParam -> init(this, _timeIntervalList); 200 tableParam -> init(this, _timeIntervalList);
179 if (table.second->isFullVariable(&_parameterManager)) { 201 if (table.second->isFullVariable(&_parameterManager)) {
180 - addAditionalDownloadParams(tableParamId.second, true); 202 + addAditionalDownloadParams(tableParam->getId(), true);
181 } else { 203 } else {
182 - _tableParamsList.push_back(tableParamId.second); 204 + _tableParamsList.push_back(tableParam->getId());
183 } 205 }
184 - AMDA::Info::ParamInfoSPtr tableInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(tableParamId.second); 206 + AMDA::Info::ParamInfoSPtr tableInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(tableParam->getId());
185 for (auto linkedParamId : tableInfo->getLinkedParamList()) { 207 for (auto linkedParamId : tableInfo->getLinkedParamList()) {
186 addAditionalDownloadParams(linkedParamId, false); 208 addAditionalDownloadParams(linkedParamId, false);
187 } 209 }