77
88
99def apply_metadata (input_metadata : CollectionMetadata , context : dict ) -> CollectionMetadata :
10-
1110 xstep = input_metadata .get ("x" , "step" )
1211 ystep = input_metadata .get ("y" , "step" )
1312 new_metadata = {
@@ -24,8 +23,6 @@ def fancy_upsample_function(array: np.array, factor: int = 2) -> np.array:
2423
2524
2625def apply_datacube (cube : XarrayDataCube , context : dict ) -> XarrayDataCube :
27- array : xarray .DataArray = cube .get_array ()
28-
2926 cubearray : xarray .DataArray = cube .get_array ().copy () + 60
3027
3128 # We make prediction and transform numpy array back to datacube
@@ -37,7 +34,7 @@ def apply_datacube(cube: XarrayDataCube, context: dict) -> XarrayDataCube:
3734 if cubearray .data .ndim == 4 and cubearray .data .shape [0 ] == 1 :
3835 cubearray = cubearray [0 ]
3936 predicted_array = fancy_upsample_function (cubearray .data , 2 )
40- inspect (predicted_array , "test message " )
37+ inspect (data = predicted_array , message = "predicted array " )
4138 coord_x = np .linspace (
4239 start = cube .get_array ().coords ["x" ].min (),
4340 stop = cube .get_array ().coords ["x" ].max () + init_pixel_size_x ,
@@ -50,6 +47,10 @@ def apply_datacube(cube: XarrayDataCube, context: dict) -> XarrayDataCube:
5047 num = predicted_array .shape [- 1 ],
5148 endpoint = False ,
5249 )
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+ )
5455
5556 return XarrayDataCube (predicted_cube )
0 commit comments