//------------------------------------------------------------------------------ // documentation is inherited void N2OComponent::setData( const string& varName, const message_data& data ) throw ( h_exception ) { try { if( varName == D_PREINDUSTRIAL_N2O ) { H_ASSERT( data.date == Core::undefinedIndex() , "date not allowed" ); N0 = data.getUnitval( U_PPBV_N2O ); } else if( varName == D_EMISSIONS_N2O ) { H_ASSERT( data.date != Core::undefinedIndex(), "date required" ); N2O_emissions.set(data.date, data.getUnitval( U_TG_N ) ); } else if( varName == D_NAT_EMISSIONS_N2O ) { H_ASSERT( data.date != Core::undefinedIndex(), "date required" ); N2O_natural_emissions.set(data.date, data.getUnitval( U_TG_N ) ); } else if( varName == D_CONVERSION_N2O ) { H_ASSERT( data.date == Core::undefinedIndex(), "date not allowed" ); UC_N2O = data.getUnitval(U_TG_PPBV); } else if( varName == D_INITIAL_LIFETIME_N2O ) { H_ASSERT( data.date == Core::undefinedIndex(), "date not allowed" ); TN2O0 = data.getUnitval( U_YRS ); } else { H_THROW( "Unknown variable name while parsing " + getComponentName() + ": " + varName ); } } catch( h_exception& parseException ) { H_RETHROW( parseException, "Could not parse var: "+varName ); } }
//------------------------------------------------------------------------------ // documentation is inherited void OzoneComponent::setData( const string& varName, const message_data& data ) throw ( h_exception ) { H_LOG( logger, Logger::DEBUG ) << "Setting " << varName << "[" << data.date << "]=" << data.value_str << std::endl; try { if ( varName == D_PREINDUSTRIAL_O3 ) { H_ASSERT( data.date == Core::undefinedIndex() , "date not allowed" ); PO3 = data.getUnitval(U_DU_O3); } else if( varName == D_EMISSIONS_NOX ) { H_ASSERT( data.date != Core::undefinedIndex(), "date required" ); NOX_emissions.set( data.date, data.getUnitval(U_TG_N)); } else if( varName == D_EMISSIONS_CO ) { H_ASSERT( data.date != Core::undefinedIndex(), "date required" ); CO_emissions.set( data.date, data.getUnitval(U_TG_CO)); } else if( varName == D_EMISSIONS_NMVOC ) { H_ASSERT( data.date != Core::undefinedIndex(), "date required" ); NMVOC_emissions.set( data.date, data.getUnitval(U_TG_NMVOC)); } else { H_THROW( "Unknown variable name while parsing " + getComponentName() + ": " + varName ); } } catch( h_exception& parseException ) { H_RETHROW( parseException, "Could not parse var: "+varName ); } }