Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nina.Hakansson committed Mar 7, 2024
1 parent 370fa1d commit f40368a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions level1c4pps/tests/test_seviri2pps.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def get_fake_scene():
scene = Scene()
start_time = dt.datetime(2020, 1, 1, 12)
scene['VIS006'] = xr.DataArray(
[[1, 2],
[3, 4]],
[[1.0, 2.0],
[3.0, 4.0]],
dims=('y', 'x'),
attrs={'calibration': 'reflectance',
'sun_earth_distance_correction_applied': True,
Expand Down Expand Up @@ -299,6 +299,8 @@ def test_add_ancillary_datasets(self):
lats = np.array([[1.1, 2.1], [3.1, 4.1]])
sunz = np.array([[1.2, 2.2], [3.2, 4.2]])
satz = np.array([[1.3, 2.3], [3.3, 4.3]])
suna = np.array([[5.2, 2.2], [5.2, 1.2]])
sata = np.array([[3.3, 2.3], [3.3, 7.3]])
azidiff = np.array([[1.4, 2.4], [3.4, 4.4]])

ir_108 = xr.DataArray(data=np.array([[0.1, 0.2], [0.3, 0.4]]),
Expand All @@ -312,6 +314,7 @@ def test_add_ancillary_datasets(self):
scene = {'IR_108': ir_108}
seviri2pps.add_ancillary_datasets(scene, lons=lons, lats=lats,
sunz=sunz, satz=satz,
suna=suna, sata=sata,
azidiff=azidiff)

# Test lon/lat
Expand Down Expand Up @@ -398,7 +401,7 @@ def test_get_encoding(self):
enc_exp_time = {'units': 'days since 2004-01-01 00:00',
'calendar': 'standard',
'_FillValue': None,
'chunksizes': [1]}
'chunksizes': (1,)}
enc_exp_acq = {'units': 'milliseconds since 2009-07-01 12:15',
'calendar': 'standard',
'_FillValue': -9999.0}
Expand Down Expand Up @@ -426,7 +429,11 @@ def test_get_encoding(self):
'acq_time': enc_exp_acq
}
encoding = seviri2pps.get_encoding_seviri(scene)
self.assertDictEqual(encoding, encoding_exp)
for key in encoding_exp:
print(key)
print(encoding[key],encoding_exp[key])

self.assertDictEqual(encoding[key], encoding_exp[key])

def test_get_header_attrs(self):
"""Test get the header attributes."""
Expand Down

0 comments on commit f40368a

Please sign in to comment.