Skip to content

Commit 60bc5b4

Browse files
authored
Update mowingDetection_UDF.py
moved the position of all_na/all_zero conditional in forcepy_pixel to speed up processing
1 parent ead8368 commit 60bc5b4

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

python/ts/mowingDetection/mowingDetection_UDF.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -432,27 +432,29 @@ def forcepy_pixel(inarray, outarray, dates, sensors, bandnames, nodata, nproc):
432432

433433
np.seterr(all='ignore')
434434
ts = inarray.squeeze()
435-
dateList = []
436-
437-
if profileAnalytics:
438-
for imgDate in dates:
439-
dateList.append(imgDate)
440-
else:
441-
for imgDate in dates:
442-
dateList.append(serial_date_to_string(imgDate))
443-
444-
date = np.array(dateList)
445-
435+
446436
nodata = nodata
447437

448438
all_no_data = np.all(ts == nodata)
449439
all_zero = np.all(ts == 0)
450-
440+
451441
if all_no_data:
452442
return
453443
elif all_zero:
454444
return
455445
else:
446+
447+
dateList = []
448+
449+
if profileAnalytics:
450+
for imgDate in dates:
451+
dateList.append(imgDate)
452+
else:
453+
for imgDate in dates:
454+
dateList.append(serial_date_to_string(imgDate))
455+
456+
date = np.array(dateList)
457+
456458
try:
457459
if profileAnalytics:
458460
x = date

0 commit comments

Comments
 (0)