def test_update_longitude(self): """Test update_longitude """ coords.update_longitude(self.testInst, lon_name="longitude") assert np.all(self.testInst.data['longitude'] < 180.0) assert np.all(self.testInst.data['longitude'] >= -180.0)
def test_bad_lon_name_update_longitude(self): """Test update_longitude with a bad longitude name""" self.py_inst = pysat.Instrument(platform='pysat', name="testing") self.py_inst.load(date=self.inst_time) with pytest.raises(ValueError): coords.update_longitude(self.py_inst, lon_name="not longitude")
def test_calc_solar_local_time_w_update_longitude(self): """Test calc_solar_local_time with update_longitude""" coords.calc_solar_local_time(self.testInst, lon_name="longitude", slt_name='slt') coords.update_longitude(self.testInst, lon_name="longitude") coords.calc_solar_local_time(self.testInst, lon_name="longitude", slt_name='slt2') assert (abs(self.testInst['slt'] - self.testInst['slt2'])).max() < 1.0e-6
def test_update_longitude(self, name): """Test update_longitude """ self.py_inst = pysat.Instrument(platform='pysat', name=name) self.py_inst.load(date=self.inst_time) # Test instruments initially define longitude between 0-360 deg assert np.all(self.py_inst.data['longitude'] < 360.0) assert np.all(self.py_inst.data['longitude'] >= 0.0) # Longitude defaults to updating range from -180 to 180 deg coords.update_longitude(self.py_inst, lon_name="longitude") assert np.all(self.py_inst.data['longitude'] < 180.0) assert np.all(self.py_inst.data['longitude'] >= -180.0)
def test_calc_solar_local_time_w_neg_longitude(self): """Test calc_solar_local_time with longitudes from -180 to 180 deg""" self.py_inst = pysat.Instrument(platform='pysat', name="testing") self.py_inst.load(date=self.inst_time) coords.calc_solar_local_time(self.py_inst, lon_name="longitude", slt_name='slt') coords.update_longitude(self.py_inst, lon_name="longitude") coords.calc_solar_local_time(self.py_inst, lon_name="longitude", slt_name='slt2') assert (abs(self.py_inst['slt'] - self.py_inst['slt2'])).max() < 1.0e-6
def test_bad_lon_name_update_longitude(self): """Test update_longitude with a bad longitude name""" coords.update_longitude(self.testInst, lon_name="not longitude")