diff --git a/himan-lib/source/json_parser.cpp b/himan-lib/source/json_parser.cpp index 4cc367b00..89db37a2e 100644 --- a/himan-lib/source/json_parser.cpp +++ b/himan-lib/source/json_parser.cpp @@ -1346,36 +1346,39 @@ void TargetProducer(const boost::property_tree::ptree& pt, const shared_ptrRadonDB().GetProducerDefinition(static_cast(pid)); - - if (!prodInfo.empty()) + if (conf->DatabaseType() != kNoDatabase) { - if (prodInfo["ident_id"].empty() || prodInfo["model_id"].empty()) - { - itsLogger.Warning("Centre or ident information not found for producer " + prodInfo["ref_prod"]); - } - else + auto r = GET_PLUGIN(radon); + auto prodInfo = r->RadonDB().GetProducerDefinition(static_cast(pid)); + + if (!prodInfo.empty()) { - prod.Centre(stol(prodInfo["ident_id"])); - prod.Process(stol(prodInfo["model_id"])); - } + if (prodInfo["ident_id"].empty() || prodInfo["model_id"].empty()) + { + itsLogger.Warning("Centre or ident information not found for producer " + prodInfo["ref_prod"]); + } + else + { + prod.Centre(stol(prodInfo["ident_id"])); + prod.Process(stol(prodInfo["model_id"])); + } - prod.Name(prodInfo["ref_prod"]); + prod.Name(prodInfo["ref_prod"]); - if (prodInfo["producer_class"].empty()) - { - prod.Class(kGridClass); + if (prodInfo["producer_class"].empty()) + { + prod.Class(kGridClass); + } + else + { + prod.Class(static_cast(stoi(prodInfo["producer_class"]))); + } } - else + else if (conf->DatabaseType() != kNoDatabase) { - prod.Class(static_cast(stoi(prodInfo["producer_class"]))); + itsLogger.Warning("Unknown target producer: " + pt.get("target_producer")); } } - else if (conf->DatabaseType() != kNoDatabase) - { - itsLogger.Warning("Unknown target producer: " + pt.get("target_producer")); - } conf->TargetProducer(prod); } }