7
7
8
8
9
9
def apply_metadata (input_metadata : CollectionMetadata , context : dict ) -> CollectionMetadata :
10
-
11
10
xstep = input_metadata .get ("x" , "step" )
12
11
ystep = input_metadata .get ("y" , "step" )
13
12
new_metadata = {
@@ -24,8 +23,6 @@ def fancy_upsample_function(array: np.array, factor: int = 2) -> np.array:
24
23
25
24
26
25
def apply_datacube (cube : XarrayDataCube , context : dict ) -> XarrayDataCube :
27
- array : xarray .DataArray = cube .get_array ()
28
-
29
26
cubearray : xarray .DataArray = cube .get_array ().copy () + 60
30
27
31
28
# We make prediction and transform numpy array back to datacube
@@ -37,7 +34,7 @@ def apply_datacube(cube: XarrayDataCube, context: dict) -> XarrayDataCube:
37
34
if cubearray .data .ndim == 4 and cubearray .data .shape [0 ] == 1 :
38
35
cubearray = cubearray [0 ]
39
36
predicted_array = fancy_upsample_function (cubearray .data , 2 )
40
- inspect (predicted_array , "test message " )
37
+ inspect (data = predicted_array , message = "predicted array " )
41
38
coord_x = np .linspace (
42
39
start = cube .get_array ().coords ["x" ].min (),
43
40
stop = cube .get_array ().coords ["x" ].max () + init_pixel_size_x ,
@@ -50,6 +47,10 @@ def apply_datacube(cube: XarrayDataCube, context: dict) -> XarrayDataCube:
50
47
num = predicted_array .shape [- 1 ],
51
48
endpoint = False ,
52
49
)
53
- predicted_cube = xarray .DataArray (predicted_array , dims = ["bands" , "x" , "y" ], coords = dict (x = coord_x , y = coord_y ))
50
+ predicted_cube = xarray .DataArray (
51
+ predicted_array ,
52
+ dims = ["bands" , "x" , "y" ],
53
+ coords = dict (x = coord_x , y = coord_y ),
54
+ )
54
55
55
56
return XarrayDataCube (predicted_cube )
0 commit comments