def test_scale_units_vel(self): """Test scale_units for velocities """ for out_unit in self.vel_units: scale = coords.scale_units(out_unit, "m/s") if out_unit == "m/s": assert scale == 1.0 elif out_unit.find("km/s") == 0: assert scale == 0.001 else: assert scale == 100.0
def test_scale_units_angles(self): """Test scale_units for angles """ for out_unit in self.deg_units: scale = coords.scale_units(out_unit, "deg") if out_unit.find("deg") == 0: assert scale == 1.0 elif out_unit.find("rad") == 0: assert scale == np.pi / 180.0 else: assert scale == 1.0 / 15.0
def test_scale_units_dist(self): """Test scale_units for distances """ for out_unit in self.dist_units: scale = coords.scale_units(out_unit, "m") if out_unit == "m": assert scale == 1.0 elif out_unit.find("km") == 0: assert scale == 0.001 else: assert scale == 100.0
def test_deprecation_warning_scale_units(self): """Test deprecation warning for this function""" import warnings warnings.simplefilter("always") scale1 = pysat.utils.scale_units("happy", "happy") with warnings.catch_warnings(record=True) as war: scale2 = coords.scale_units("happy", "happy") assert scale1 == scale2 assert len(war) == 1 assert war[0].category == DeprecationWarning
def test_scale_units_same(self): """ Test scale_units when both units are the same """ scale = coords.scale_units("happy", "happy") assert scale == 1.0