-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht.rast.udf.html
44 lines (33 loc) · 1.44 KB
/
t.rast.udf.html
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
<h2>DESCRIPTION</h2>
This module is designed to apply a user defined Python function (UDF) to
a raster time series (STRDS). This module will accept a single STRDS as input and
will generate a single STRDS as output.
<p>
User defined function mus follow the API definition provided by the openEO UDF API initiative.
<p>
This module requires the openEO UDF API installed in the python path. It also requireds python3.7 to run.
<H2>EXAMPLES</H2>
Compute the sum of all (x,y) slices in the time series cube along the time axis (0):
<div class="code"><pre>
def rct_sum(udf_data):
tile_results = []
for tile in udf_data.raster_collection_tiles:
tile_sum = numpy.sum(tile.data, axis=0)
rows, cols = tile_sum.shape
array3d = numpy.ndarray([1, rows, cols])
array3d[0] = tile_sum
if tile.start_times is not None and tile.end_times is not None:
starts = pandas.DatetimeIndex([tile.start_times[0]])
ends = pandas.DatetimeIndex([tile.end_times[-1]])
else:
starts = None
ends = None
rct = RasterCollectionTile(id=tile.id + "_sum", extent=tile.extent, data=array3d,
start_times=starts, end_times=ends)
tile_results.append(rct)
udf_data.set_raster_collection_tiles(tile_results)
rct_sum(data)
</pre></div>
<h2>AUTHOR</h2>
Sören Gebbert
<p><i>Last changed: $Date: 2016-09-19 12:29:41 +0200 (Mo, 19. Sep 2016) $</i>