Skip to content

Commit

Permalink
Fix various whitespace and docstring formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese committed Aug 1, 2022
1 parent ed8f465 commit 795c977
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 45 deletions.
2 changes: 1 addition & 1 deletion satpy/modifiers/parallax.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ class ParallaxCorrectionModifier(ModifierBase):
The modifier takes optional global parameters, all of which are optional.
They affect various steps in the algorithm. Setting them may impact
performance::
performance:
cth_resampler
Resampler to use when resampling (cloud top) height to the base area.
Expand Down
14 changes: 7 additions & 7 deletions satpy/tests/reader_tests/test_aapp_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,20 @@ def test_read(self):
for name in ['1', '2', '3a']:
key = make_dataid(name=name, calibration='reflectance')
res = fh.get_dataset(key, info)
assert(res.min() == 0)
assert(res.max() >= 100)
assert res.min() == 0
assert res.max() >= 100
mins.append(res.min().values)
maxs.append(res.max().values)
if name == '3a':
assert(np.all(np.isnan(res[:2, :])))
assert np.all(np.isnan(res[:2, :]))

for name in ['3b', '4', '5']:
key = make_dataid(name=name, calibration='reflectance')
res = fh.get_dataset(key, info)
mins.append(res.min().values)
maxs.append(res.max().values)
if name == '3b':
assert(np.all(np.isnan(res[2:, :])))
assert np.all(np.isnan(res[2:, :]))

np.testing.assert_allclose(mins, [0., 0., 0., 204.10106939, 103.23477235, 106.42609758])
np.testing.assert_allclose(maxs, [108.40391775, 107.68545158, 106.80061233,
Expand All @@ -136,7 +136,7 @@ def test_angles(self):
info = {}
key = make_dataid(name='solar_zenith_angle')
res = fh.get_dataset(key, info)
assert(np.all(res == 0))
assert np.all(res == 0)

def test_navigation(self):
"""Test reading the lon and lats."""
Expand All @@ -149,10 +149,10 @@ def test_navigation(self):
info = {}
key = make_dataid(name='longitude')
res = fh.get_dataset(key, info)
assert(np.all(res == 0))
assert np.all(res == 0)
key = make_dataid(name='latitude')
res = fh.get_dataset(key, info)
assert(np.all(res == 0))
assert np.all(res == 0)

def test_interpolation(self):
"""Test reading the lon and lats."""
Expand Down
16 changes: 8 additions & 8 deletions satpy/tests/reader_tests/test_aapp_mhs_amsub_l1c.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ def test_read(self):
key = make_dataid(name=name, calibration='brightness_temperature')
res = fh_.get_dataset(key, info)

assert(res.min() == chmin[chn])
assert(res.max() == chmax[chn])
assert res.min() == chmin[chn]
assert res.max() == chmax[chn]

def test_angles(self):
"""Test reading the angles."""
Expand All @@ -431,8 +431,8 @@ def test_angles(self):
key = make_dataid(name='solar_zenith_angle')
res = fh_.get_dataset(key, info)

assert(np.all(res[2] == 0))
assert(np.all(res[1] == 0))
assert np.all(res[2] == 0)
assert np.all(res[1] == 0)
expected = np.array([76.82, 77.09, 77.33, 77.56, 77.77, 77.97, 78.16, 78.34, 78.51,
78.68, 78.83, 78.99, 79.13, 79.27, 79.4, 79.53, 79.66, 79.78,
79.9, 80.01, 80.13, 80.23, 80.34, 80.45, 80.55, 80.65, 80.75,
Expand All @@ -458,8 +458,8 @@ def test_navigation(self):
key = make_dataid(name='longitude')
res = fh_.get_dataset(key, info)

assert(np.all(res[2] == 0))
assert(np.all(res[1] == 0))
assert np.all(res[2] == 0)
assert np.all(res[1] == 0)
expected = np.array([78.7602, 78.6999, 78.6407, 78.5827, 78.5255, 78.4692,
78.4134, 78.3583, 78.3035, 78.2492, 78.1951, 78.1412,
78.0875, 78.0338, 77.9801, 77.9264, 77.8726, 77.8186,
Expand All @@ -481,8 +481,8 @@ def test_navigation(self):
key = make_dataid(name='latitude')
res = fh_.get_dataset(key, info)

assert(np.all(res[2] == 0))
assert(np.all(res[1] == 0))
assert np.all(res[2] == 0)
assert np.all(res[1] == 0)
expected = np.array([71.5994, 72.0651, 72.4976, 72.9013, 73.2799, 73.6362, 73.9728,
74.2919, 74.5953, 74.8844, 75.1607, 75.4254, 75.6796, 75.924,
76.1597, 76.3872, 76.6073, 76.8206, 77.0275, 77.2287, 77.4245,
Expand Down
44 changes: 22 additions & 22 deletions satpy/tests/reader_tests/test_eps_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,46 +107,46 @@ def setUp(self):
def test_read_all(self):
"""Test initialization."""
self.fh._read_all()
assert(self.fh.scanlines == 1080)
assert(self.fh.pixels == 2048)
assert self.fh.scanlines == 1080
assert self.fh.pixels == 2048

def test_dataset(self):
"""Test getting a dataset."""
did = make_dataid(name='1', calibration='reflectance')
res = self.fh.get_dataset(did, {})
assert(isinstance(res, xr.DataArray))
assert(res.attrs['platform_name'] == 'Metop-C')
assert(res.attrs['sensor'] == 'avhrr-3')
assert(res.attrs['name'] == '1')
assert(res.attrs['calibration'] == 'reflectance')
assert(res.attrs['units'] == '%')
assert isinstance(res, xr.DataArray)
assert res.attrs['platform_name'] == 'Metop-C'
assert res.attrs['sensor'] == 'avhrr-3'
assert res.attrs['name'] == '1'
assert res.attrs['calibration'] == 'reflectance'
assert res.attrs['units'] == '%'

did = make_dataid(name='4', calibration='brightness_temperature')
res = self.fh.get_dataset(did, {})
assert(isinstance(res, xr.DataArray))
assert(res.attrs['platform_name'] == 'Metop-C')
assert(res.attrs['sensor'] == 'avhrr-3')
assert(res.attrs['name'] == '4')
assert(res.attrs['calibration'] == 'brightness_temperature')
assert(res.attrs['units'] == 'K')
assert isinstance(res, xr.DataArray)
assert res.attrs['platform_name'] == 'Metop-C'
assert res.attrs['sensor'] == 'avhrr-3'
assert res.attrs['name'] == '4'
assert res.attrs['calibration'] == 'brightness_temperature'
assert res.attrs['units'] == 'K'

def test_navigation(self):
"""Test the navigation."""
did = make_dataid(name='longitude')
res = self.fh.get_dataset(did, {})
assert(isinstance(res, xr.DataArray))
assert(res.attrs['platform_name'] == 'Metop-C')
assert(res.attrs['sensor'] == 'avhrr-3')
assert(res.attrs['name'] == 'longitude')
assert isinstance(res, xr.DataArray)
assert res.attrs['platform_name'] == 'Metop-C'
assert res.attrs['sensor'] == 'avhrr-3'
assert res.attrs['name'] == 'longitude'

def test_angles(self):
"""Test the navigation."""
did = make_dataid(name='solar_zenith_angle')
res = self.fh.get_dataset(did, {})
assert(isinstance(res, xr.DataArray))
assert(res.attrs['platform_name'] == 'Metop-C')
assert(res.attrs['sensor'] == 'avhrr-3')
assert(res.attrs['name'] == 'solar_zenith_angle')
assert isinstance(res, xr.DataArray)
assert res.attrs['platform_name'] == 'Metop-C'
assert res.attrs['sensor'] == 'avhrr-3'
assert res.attrs['name'] == 'solar_zenith_angle'

@mock.patch('satpy.readers.eps_l1b.EPSAVHRRFile.__getitem__')
def test_get_full_angles_twice(self, mock__getitem__):
Expand Down
6 changes: 3 additions & 3 deletions satpy/tests/reader_tests/test_sar_c_safe.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def setUp(self, mocked_rio_open):

def test_instantiate(self):
"""Test initialization of file handlers."""
assert(self.test_fh._polarization == 'vv')
assert(self.test_fh.calibration == self.calfh)
assert(self.test_fh.noise == self.noisefh)
assert self.test_fh._polarization == 'vv'
assert self.test_fh.calibration == self.calfh
assert self.test_fh.noise == self.noisefh
self.mocked_rio_open.assert_called()

@mock.patch('rioxarray.open_rasterio')
Expand Down
7 changes: 3 additions & 4 deletions satpy/tests/writer_tests/test_ninjotiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,9 @@ def test_image(self, iwsi, save_dataset):
img = FakeImage(dataset, 'L')
ret = ntw.save_image(img, filename='bla.tif', compute=False)
nt.save.assert_called()
assert(nt.save.mock_calls[0][2]['compute'] is False)
assert(nt.save.mock_calls[0][2]['ch_min_measurement_unit']
< nt.save.mock_calls[0][2]['ch_max_measurement_unit'])
assert(ret == nt.save.return_value)
assert nt.save.mock_calls[0][2]['compute'] is False
assert nt.save.mock_calls[0][2]['ch_min_measurement_unit'] < nt.save.mock_calls[0][2]['ch_max_measurement_unit']
assert ret == nt.save.return_value

def test_convert_units_self(self):
"""Test that unit conversion to themselves do nothing."""
Expand Down

0 comments on commit 795c977

Please sign in to comment.