Skip to content
Snippets Groups Projects
Commit cb5b9e72 authored by Hal Simpson's avatar Hal Simpson
Browse files

moved from edge directory

parent 84ace4ff
No related branches found
No related tags found
No related merge requests found
"""Tests for ObservatoryMetadata.py"""
from ObservatoryMetadata import ObservatoryMetadata
from nose.tools import assert_equals
import obspy.core
METADATA = {
'BOU': {
'metadata': {
'station_name': 'Boulder',
'agency_name': 'United States Geological Survey (USGS)',
'geodetic_latitude': '-90',
'geodetic_longitude': '-180',
'elevation': '-1000',
'sensor_orientation': 'HDZF',
'sensor_sampling_rate': '0.01 second',
'declination_base': 20000,
'is_gin': False,
'is_intermagnet': False,
'conditions_of_use': 'The Conditions of Use for data provided' +
' through INTERMAGNET and acknowledgement templates' +
' can be found at www.intermagnet.org'
},
'interval_specific': {
'minute': {
'data_interval_type': 'filtered 1-minute (00:15-01:45) ',
'filter_comments': ['Vector 1-minute values are computed' +
' from 1-second values using the INTERMAGNET gaussian' +
' filter centered on the minute. Scalar 1-minute values' +
' are computed from 1-second values using the' +
' INTERMAGNET gaussian filter centered on the minute. ']
},
'second': {
'data_interval_type': 'Average 1-Second'
}
}
}
}
DATA_INTERVAL_TYPE = {
'minute': {'data_interval_type': 'filtered 1-minute (00:29-01:30) '},
'second': {'data_interval_type': 'filtered 1-Second'}
}
def test_set_metadata():
"""geomagio.edge.ObservatoryMetadata_test.test_set_metadata()
"""
# Test set_metadata by passing in a stats class, and looking
# for parameters that are both passed in, and aquired from the default
# metadata.
observatorymetadata = ObservatoryMetadata()
stats = obspy.core.Stats()
stats.channel = 'MVH'
stats.location = 'R0'
stats.data_interval = 'second'
stats.data_type = 'quasi-definitive'
observatorymetadata.set_metadata(stats, 'BOU', 'MVH',
'quasi-definitive', 'second')
assert_equals(stats['declination_base'], 5527)
# Test custom metadata
stats = obspy.core.Stats()
observatorymetadata = ObservatoryMetadata(METADATA, DATA_INTERVAL_TYPE)
observatorymetadata.set_metadata(stats, 'BOU', 'MVH',
'quasi-definitive', 'second')
assert_equals(stats['declination_base'], 20000)
print stats
assert_equals(stats['data_interval_type'], 'Average 1-Second')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment