diff --git a/geomagio/edge/EdgeFactory.py b/geomagio/edge/EdgeFactory.py index 525999834e0e0dd383e6a9d33fe310cd83454db7..d07f3fa5e194ea9792360bca048773171792ddd8 100644 --- a/geomagio/edge/EdgeFactory.py +++ b/geomagio/edge/EdgeFactory.py @@ -333,6 +333,10 @@ class EdgeFactory(TimeseriesFactory): element=channel, location=self.locationCode, ) + # geomag-algorithms *should* treat starttime/endtime as inclusive everywhere; + # according to its author, EdgeCWB is inclusive of starttime, but exclusive of + # endtime, to satisfy seismic standards/requirements, to precision delta/2; + half_delta = TimeseriesUtility.get_delta_from_interval(interval) / 2 try: data = self.client.get_waveforms( sncl.network, @@ -340,7 +344,7 @@ class EdgeFactory(TimeseriesFactory): sncl.location, sncl.channel, starttime, - endtime, + endtime + half_delta, ) except TypeError: # get_waveforms() fails if no data is returned from Edge diff --git a/geomagio/edge/MiniSeedFactory.py b/geomagio/edge/MiniSeedFactory.py index ff03c0406497c2a5bfab0c2b5f1dccdf2f279d42..daf02420c82e3fd0f21b14d41d4f9b6c1e5428ed 100644 --- a/geomagio/edge/MiniSeedFactory.py +++ b/geomagio/edge/MiniSeedFactory.py @@ -358,9 +358,20 @@ class MiniSeedFactory(TimeseriesFactory): element=channel, location=self.locationCode, ) + # geomag-algorithms *should* treat starttime/endtime as inclusive everywhere; + # according to its author, EdgeCWB is inclusive of starttime, but exclusive of + # endtime, to satisfy seismic standards/requirements, to precision delta/2; + half_delta = TimeseriesUtility.get_delta_from_interval(interval) / 2 data = self.client.get_waveforms( - sncl.network, sncl.station, sncl.location, sncl.channel, starttime, endtime + sncl.network, + sncl.station, + sncl.location, + sncl.channel, + starttime, + endtime + half_delta, ) + for trace in data: + trace.data = trace.data.astype(data[0].data.dtype) data.merge() if data.count() == 0 and add_empty_channels: data += self._get_empty_trace( diff --git a/geomagio/iaga2002/IAGA2002Writer.py b/geomagio/iaga2002/IAGA2002Writer.py index bd215ef98deae916d2cbdf83610b25b4d5d1adc2..4aac8db92a27426ec88ef4bc48d9dd7e9ab8f60a 100644 --- a/geomagio/iaga2002/IAGA2002Writer.py +++ b/geomagio/iaga2002/IAGA2002Writer.py @@ -87,11 +87,15 @@ class IAGA2002Writer(object): self._format_header("Sensor Orientation", stats.sensor_orientation) ) if "sensor_sampling_rate" in stats: - buf.append( - self._format_header( - "Digital Sampling", str(1 / stats.sensor_sampling_rate) + " second" + try: + buf.append( + self._format_header( + "Digital Sampling", + str(1 / stats.sensor_sampling_rate) + " second", + ) ) - ) + except TypeError: + buf.append(self._format_header("Digital Sampling", "")) if "data_interval_type" in stats: buf.append( self._format_header("Data Interval Type", stats.data_interval_type)