Esempio n. 1
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
MagnitudeProcessor::Status MagnitudeProcessor_mb::computeMagnitude(
	double amplitude,
	const std::string &unit,
	double period, double snr,
	double delta, double depth,
	const DataModel::Origin *, const DataModel::SensorLocation *,
	const DataModel::Amplitude *,
	double &value) {
	// Clip depth to 0
	if ( depth < 0 ) depth = 0;

	if ( amplitude <= 0 )
		return AmplitudeOutOfRange;

	// maximum allowed period is 3 s according to IASPEI standard (pers. comm. Peter Bormann)
	if ( period < 0.4 || period > 3.0 )
		return PeriodOutOfRange;

	if ( !convertAmplitude(amplitude, unit, ExpectedAmplitudeUnit) )
		return InvalidAmplitudeUnit;

	// amplitude is nanometers, whereas compute_mb wants micrometers
	bool valid = Magnitudes::compute_mb(amplitude*1.E-3, period, delta, depth+1, &value);
	value = correctMagnitude(value);
	return valid ? OK : Error;
}
Esempio n. 2
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
MagnitudeProcessor::Status MagnitudeProcessor_Mjma::computeMagnitude(
	double amplitude, const std::string &unit,
	double, double, double delta, double depth,
	const DataModel::Origin *, const DataModel::SensorLocation *,
	const DataModel::Amplitude *,
	double &value) {
	if ( delta < DELTA_MIN || delta > DELTA_MAX )
		return DistanceOutOfRange;

	if ( amplitude <= 0 )
		return AmplitudeOutOfRange;

	// Clip depth to 0
	if ( depth < 0 ) depth = 0;

	if ( depth > DEPTH_MAX )
		return DepthOutOfRange;

	if ( !convertAmplitude(amplitude, unit, ExpectedAmplitudeUnit) )
		return InvalidAmplitudeUnit;

	double a1 = 1.73, a2 = 0., a3 = -0.83;
	double r = Math::Geo::deg2km(delta);

	value = correctMagnitude(log10(amplitude) + a1*log10(r) + a2*r + a3 + 0.44);

	return OK;
}
Esempio n. 3
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
MagnitudeProcessor::Status MagnitudeProcessor_ML::computeMagnitude(
	double amplitude, const std::string &unit,
	double, double, double delta, double depth,
	const DataModel::Origin *, const DataModel::SensorLocation *,
	const DataModel::Amplitude *,
	double &value) {
	if ( amplitude <= 0 )
		return AmplitudeOutOfRange;

	// Clip depth to 0
	if ( depth < 0 ) depth = 0;

	double distanceKm = Math::Geo::deg2km(delta);
	if ( maxDistanceKm > 0 && distanceKm > maxDistanceKm )
		return DistanceOutOfRange;

	if ( !convertAmplitude(amplitude, unit, ExpectedAmplitudeUnit) )
		return InvalidAmplitudeUnit;

	try {
		value = log10(amplitude) - logA0(distanceKm);
	}
	catch ( Core::ValueException & ) {
		return DistanceOutOfRange;
	}

	value = correctMagnitude(value);

	return OK;
}
Esempio n. 4
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
MagnitudeProcessor::Status MagnitudeProcessor_mB::computeMagnitude(
	double amplitude, // in micrometers per second
	double,           // period is unused
	double delta,     // in degrees
	double depth,     // in kilometers
	double &value)
{
	// Clip depth to 0
	if ( depth < 0 ) depth = 0;

	bool status = Magnitudes::compute_mb(amplitude*1.E-3, 2*M_PI, delta, depth+1, &value);
	value -= 0.14; // HACK until we have an optimal calibration function
	value = correctMagnitude(value);
	return status ? OK : Error;
}
Esempio n. 5
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
MagnitudeProcessor::Status MagnitudeProcessor_msbb::computeMagnitude(
	double amplitude, // in micrometers per second
	double period,      // in seconds
	double delta,     // in degrees
	double depth,     // in kilometers
	double &value)
{
	if ( delta < DELTA_MIN || delta > DELTA_MAX )
		return DistanceOutOfRange;

	// Clip depth to 0
	if ( depth < 0 ) depth = 0;

	if ( depth > DEPTH_MAX )
		return DepthOutOfRange; // strictly speaking it would be 60 km

	// Convert amplitude unit from meters to micrometers
	value = correctMagnitude(log10((amplitude*1E06)/(2*M_PI)) + 1.66*log10(delta) + 3.3);

	return OK;
}