From 663fb23b5cefdb9e1ffbd5dc9def7e76732d0b48 Mon Sep 17 00:00:00 2001 From: Hal Simpson <hasimpson@usgs.gov> Date: Thu, 19 Mar 2015 10:54:09 -0600 Subject: [PATCH] Made changes and added a test, to deal with new observatory metadata dictionary format --- geomagio/edge/ObservatoryMetadata_test.py | 51 ++++++++++++++--------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/geomagio/edge/ObservatoryMetadata_test.py b/geomagio/edge/ObservatoryMetadata_test.py index 61cbd9961..510569281 100644 --- a/geomagio/edge/ObservatoryMetadata_test.py +++ b/geomagio/edge/ObservatoryMetadata_test.py @@ -7,28 +7,40 @@ import obspy.core METADATA = { 'BOU': { - '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', - 'data_interval_type': 'filtered 1-minute (00:15-01:45)', - 'declination_base': 20000, - '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', - '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-secondvalues using the INTERMAGNET' + - ' gaussian filter centered on the minute. ', + 'data_interval_type': { + 'minute': 'filtered 1-minute (00:15-01:45) ', + 'second': 'Average 1-Second' + }, + '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', + '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-secondvalues using the INTERMAGNET' + + ' gaussian filter centered on the minute. ' + } } } +DATA_INTERVAL_TYPE = { + 'minute': 'filtered 1-minute (00:29-01:30) ', + 'second': 'filtered 1-Second' +} + + def test_set_metadata(): """geomagio.edge.ObservatoryMetadata_test.test_set_metadata() """ @@ -47,7 +59,8 @@ def test_set_metadata(): # Test custom metadata stats = obspy.core.Stats() - observatorymetadata = ObservatoryMetadata(METADATA) + observatorymetadata = ObservatoryMetadata(METADATA, DATA_INTERVAL_TYPE) observatorymetadata.set_metadata(stats, 'BOU', 'MVH', 'quasi-definitive', 'second') assert_equals(stats['declination_base'], 20000) + assert_equals(stats['data_interval_type'], 'filtered 1-Second') -- GitLab