An error occurred while loading the file. Please try again.
-
Remi Cresson authoredd81f2f14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# -*- coding: utf-8 -*-
import pyotb
import scenes
import tests_data
from scenes_test_base import ScenesTestBase
# Baseline
xs_dn_ref = tests_data.DIMAP1_XS
p_dn_ref = tests_data.DIMAP1_P
xs_toa_ref = pyotb.OpticalCalibration(tests_data.DIMAP1_XS)
p_toa_ref = pyotb.OpticalCalibration(tests_data.DIMAP1_P)
roi = [2500, 2500, 500, 500] # For pxs we test the central area only, because
# bayes method messes with nodata outside image boundaries
pyotb_pxs = pyotb.BundleToPerfectSensor
pxs_dn_ref = pyotb_pxs({"inxs": xs_dn_ref, "inp": p_dn_ref})
pxs_toa_ref = pyotb_pxs({"inxs": xs_toa_ref, "inp": p_toa_ref})
# Inputs
sc = scenes.spot.get_local_spot67drs_scene(
dimap_xs=tests_data.DIMAP1_XS,
dimap_pan=tests_data.DIMAP1_P
)
xs = sc.get_xs()
pan = sc.get_pan()
pxs = sc.get_pxs()
class Spot67ImageryTest(ScenesTestBase):
def test_instanciate_sc(self):
assert sc
def test_xs_dn(self):
self.compare_images(image=xs, reference=xs_dn_ref)
def test_xs_toa(self):
self.compare_images(image=xs.reflectance(), reference=xs_toa_ref)
def test_pan_dn(self):
self.compare_images(image=pan, reference=p_dn_ref)
def test_pan_toa(self):
self.compare_images(image=pan.reflectance(), reference=p_toa_ref)
def test_pxs_dn(self):
self.compare_images(image=pxs, reference=pxs_dn_ref, roi=roi)
def test_pxs_toa(self):
self.compare_images(
image=pxs.reflectance(), reference=pxs_toa_ref, roi=roi
)
def test_pxs_dn_msk_drilled(self):
"""
Dummy test since no cloud in the input scene.
This test just checks that the code is running but not guarantee that
the results are good.
"""
self.compare_images(
image=pxs.cld_msk_drilled(), reference=pxs_dn_ref, roi=roi
)
def test_pxs_toa_msk_drilled(self):
"""
Dummy test since no cloud in the input scene.
This test just checks that the code is running but not guarantee that
the results are good.
"""
self.compare_images(
image=pxs.reflectance().cld_msk_drilled(),
reference=pxs_toa_ref,
roi=roi
)
def slice(self, inp):
return inp[2048:512, 2048:512, :]
def test_pxs_dn_msk_drilled_cached(self):
"""
Dummy test since no cloud in the input scene.
This test just checks that the code is running but not guarantee that
the results are good.
"""
for _ in range(2):
self.compare_images(
image=pxs.cld_msk_drilled().cached(),
reference=pxs_dn_ref,
roi=roi
)
def test_pxs_toa_msk_drilled_cached(self):
"""
Dummy test since no cloud in the input scene.
This test just checks that the code is running but not guarantee that
the results are good.
"""
for _ in range(2):
self.compare_images(
image=pxs.reflectance().cld_msk_drilled().cached(),
reference=pxs_toa_ref,
roi=roi
)
def test_print(self):
print(sc)
print(xs)
print(pan)
print(pxs)
if __name__ == '__main__':
#unittest.main()
Spot67ImageryTest().test_pxs_toa_msk_drilled_cached()