Created
October 15, 2019 07:02
-
-
Save ghtmtt/95deacf660cdc9b9bdc83a41b6a4df2e to your computer and use it in GitHub Desktop.
takes a list of qdatetime objects and returns the difference from every object respect to the first one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vl = iface.activeLayer() | |
s = 0 | |
l = [] | |
for i, j in enumerate(vl.getFeatures()): | |
l.append(j['time'].toPyDateTime()) | |
ll = [] | |
for i, j in enumerate(l): | |
if i == 0: | |
ll.append(0) | |
try: | |
diff = l[i+1] - l[0] | |
# maggiore di un minuto e minore di un ora allora scrivi minuti | |
if diff.seconds > 60 and diff.seconds < 3600: | |
val = diff.seconds / 60 | |
ll.append(val) | |
except: | |
pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment