def test_get_computed_f_using_sqaures(self): """geomag.ChannelConverterTest.test_get_computed_f_using_sqaures Computed f is the combination of the 3 vector components from either the geographic coordinate system (X,Y,Z), or the observatory coordinate system (h,e,z). """ h = 2 e = 2 z = 2 fv = channel.get_computed_f_using_squares(h, e, z) fs = math.sqrt(12) assert_almost_equal(fv, fs, 8, 'Expect fv to almost equal sqrt(12)', True)
def get_deltaf_from_obs(obs): """Get deltaf given observatory coordinate values Parameters ---------- obs: obspy.core.Stream stream containing the observatory components H, D or E, Z, and F. Returns ------- obspy.core.Stream stream object containing delta f values """ h = obs.select(channel='H')[0] z = obs.select(channel='Z')[0] fs = obs.select(channel='F')[0] e = __get_obs_e_from_obs(obs) fv = ChannelConverter.get_computed_f_using_squares(h, e, z) G = ChannelConverter.get_deltaf(fv, fs) return obspy.core.Stream((__get_trace('G', h.stats, G), ))
def get_deltaf_from_geo(geo): """Get deltaf given geographic coordinate values Parameters ---------- obs: obspy.core.Stream stream containing the observatory components H, D or E, Z, and F. Returns ------- obspy.core.Stream stream object containing delta f values """ x = geo.select(channel='X')[0] y = geo.select(channel='Y')[0] z = geo.select(channel='Z')[0] fs = geo.select(channel='F')[0] fv = ChannelConverter.get_computed_f_using_squares(x, y, z) G = ChannelConverter.get_deltaf(fv, fs) return obspy.core.Stream((__get_trace('G', x.stats, G), ))
def get_deltaf_from_obs(obs): """Get deltaf given observatory coordinate values Parameters ---------- obs: obspy.core.Stream stream containing the observatory components H, D or E, Z, and F. Returns ------- obspy.core.Stream stream object containing delta f values """ h = obs.select(channel='H')[0] z = obs.select(channel='Z')[0] fs = obs.select(channel='F')[0] e = __get_obs_e_from_obs(obs) fv = ChannelConverter.get_computed_f_using_squares(h, e, z) G = ChannelConverter.get_deltaf(fv, fs) return obspy.core.Stream(( __get_trace('G', h.stats, G), ))
def get_deltaf_from_geo(geo): """Get deltaf given geographic coordinate values Parameters ---------- obs: obspy.core.Stream stream containing the observatory components H, D or E, Z, and F. Returns ------- obspy.core.Stream stream object containing delta f values """ x = geo.select(channel='X')[0] y = geo.select(channel='Y')[0] z = geo.select(channel='Z')[0] fs = geo.select(channel='F')[0] fv = ChannelConverter.get_computed_f_using_squares(x, y, z) G = ChannelConverter.get_deltaf(fv, fs) return obspy.core.Stream(( __get_trace('G', x.stats, G), ))