DEFAULT_INTERVAL_SPECIFIC = { "day": { "data_interval_type": "1-day (00:00-23:59)", "filter_comments": [ "Scalar and Vector 1-day values are computed from average of 1-minute values in the day (00:00-23:59)", ], }, "hour": { "data_interval_type": "1-hour (00-59)", "filter_comments": [ "Scalar and Vector 1-hour values are computed from average of 1-minute values in the hour (00-59)", ], }, "minute": { "data_interval_type": "1-minute", "filter_comments": [ "Scalar and Vector 1-minute values are computed from 1 Hz values using an INTERMAGNET gaussian filter centered on the start of the minute (00:15-01:45))." ], }, "second": { "data_interval_type": "1-second", "filter_comments": [ "Vector 1-second values are computed from 10 Hz values using a Blackman filter (123 taps, cutoff 0.25Hz) centered on the start of the second." ], }, } DEFAULT_ASL_METADATA = { "ANMO": { "metadata": { "network": "IU", "elevation": 1820, "geodetic_latitude": 34.94591, "geodetic_longitude": -106.4572, "station_name": "Albuquerque", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "CASY": { "metadata": { "network": "IU", "elevation": 10, "geodetic_latitude": -66.2792, "geodetic_longitude": 110.5354, "station_name": "Casey", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "COLA": { "metadata": { "network": "IU", "elevation": 200, "geodetic_latitude": 64.8736, "geodetic_longitude": -147.8616, "station_name": "College Outpost", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "COR": { "metadata": { "network": "IU", "elevation": 110, "geodetic_latitude": 44.5855, "geodetic_longitude": -123.3046, "station_name": "Corvallis", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "KBS": { "metadata": { "network": "IU", "elevation": 90, "geodetic_latitude": 78.9154, "geodetic_longitude": 11.9385, "station_name": "Ny-Alesund", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "KONO": { "metadata": { "network": "IU", "elevation": 558, "geodetic_latitude": 59.6521, "geodetic_longitude": 9.5946, "station_name": "Kongsberg", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "RSSD": { "metadata": { "network": "IU", "elevation": 2090, "geodetic_latitude": 44.1212, "geodetic_longitude": -104.0359, "station_name": "Black Hills", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "SBA": { "metadata": { "network": "IU", "elevation": 50, "geodetic_latitude": -77.8492, "geodetic_longitude": 166.7572, "station_name": "Scott Base", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "SFJD": { "metadata": { "network": "IU", "elevation": 330, "geodetic_latitude": 66.9961, "geodetic_longitude": -50.6207, "station_name": "Sondre Stromfjord", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "SSPA": { "metadata": { "network": "IU", "elevation": 270, "geodetic_latitude": 40.6358, "geodetic_longitude": -77.8876, "station_name": "Standing Stone, Pennsylvania", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "QSPA": { "metadata": { "network": "IU", "elevation": 2850, "geodetic_latitude": -89.9289, "geodetic_longitude": 144.4382, "station_name": "South Pole Remote Earth Science Observatory", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "E62A": { "metadata": { "network": "N4", "elevation": 365, "geodetic_latitude": 46.6201, "geodetic_longitude": -69.5227, "station_name": "Eastport", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "E46A": { "metadata": { "network": "N4", "elevation": 269, "geodetic_latitude": 46.3665, "geodetic_longitude": -84.3062, "station_name": "Lake Superior", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "PAB": { "metadata": { "network": "IU", "elevation": 950, "geodetic_latitude": 39.5446, "geodetic_longitude": -4.3499, "station_name": "San Pablo, Spain", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "WCI": { "metadata": { "network": "IU", "elevation": 210, "geodetic_latitude": 38.2289, "geodetic_longitude": -86.2939, "station_name": "Wyandotte Cave, Indiana, USA", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "KSU1": { "metadata": { "network": "US", "elevation": 317, "geodetic_latitude": 39.1009, "geodetic_longitude": -96.6094, "station_name": "Kansas State University", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "EYMN": { "metadata": { "network": "US", "elevation": 475, "geodetic_latitude": 47.9462, "geodetic_longitude": -91.4953, "station_name": "Ely, Minnesota, USA", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "GOGA": { "metadata": { "network": "US", "elevation": 150, "geodetic_latitude": 33.41476, "geodetic_longitude": -83.47327, "station_name": "Godfrey, GA, USA", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "DGMT": { "metadata": { "network": "US", "elevation": 646, "geodetic_latitude": 48.4702, "geodetic_longitude": -104.1959, "station_name": "Dagmar Montana, USA", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "DWPF": { "metadata": { "network": "IU", "elevation": 30, "geodetic_latitude": 28.1103, "geodetic_longitude": -81.4327, "station_name": "Disney Wilderness Preserve, Florida, USA", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "ECSD": { "metadata": { "network": "US", "elevation": 478, "geodetic_latitude": 43.7337, "geodetic_longitude": -96.6141, "station_name": "EROS Data Center, Sioux Falls, South Dakota, USA", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "HRV": { "metadata": { "network": "IU", "elevation": 200, "geodetic_latitude": 42.5064, "geodetic_longitude": -71.5583, "station_name": "Adam Dziewonski Observatory (Oak Ridge), Massachusetts, USA", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "O20A": { "metadata": { "network": "N4", "elevation": 1915, "geodetic_latitude": 40.1348, "geodetic_longitude": -108.2416, "station_name": "White River City, CO, USA", "agency_name": "United States Geological Survey (USGS)", "declination_base": None, }, "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, } class VariometerMetadata(object): """Helper class for providing all the metadata needed for a geomag timeseries. Notes ----- Currently the only method is set_metadata. Eventually this will probably pull from a database, or maybe a config file. """ def __init__(self, metadata=None, interval_specific=None): self.metadata = metadata or DEFAULT_ASL_METADATA self.interval_specific = interval_specific or DEFAULT_INTERVAL_SPECIFIC def set_metadata(self, stats, observatory, channel, type, interval): """Set timeseries metadata (aka a traces stats) Parameters ---------- stats : obspy.core.trace.stats the class associated with a given obspy trace, which contains it's metadata observatory : string the observatory code to look up. channel : str single character channel {H, E, D, Z, F} type : {'variation', 'quasi-definitive'} data type. interval : {'minute', 'second'} data interval. Returns ------- obspy.core.trace.stats the combined stats and the default metadata. """ stats["channel"] = channel stats["data_interval"] = interval stats["data_type"] = type if observatory not in self.metadata: print(f"Observatory '{observatory}' not found in metadata.") print("Available Observatories:", self.metadata.keys()) return # copy in standard metadata metadata = self.metadata[observatory]["metadata"] for key in metadata: stats[key] = metadata[key] # copy in interval specific metadata interval_specific = self.interval_specific if "interval_specific" in self.metadata[observatory]: interval_specific = self.metadata[observatory]["interval_specific"] # stats['data_interval_type'] = data_interval_type[interval] if interval in interval_specific: for key in interval_specific[interval]: stats[key] = interval_specific[interval][key]