Group data returned by LSD query by spatial cell

17 views
Skip to first unread message

Branimir Sesar

unread,
Jul 8, 2016, 4:10:03 PM7/8/16
to lsd-...@googlegroups.com
Hi all,

Does anyone have a snippet of code that groups data returned by LSD
query by spatial cell?

Cheers,

Brani

Eddie Schlafly

unread,
Jul 8, 2016, 6:01:11 PM7/8/16
to lsd-...@googlegroups.com
Are you looking for the group_by_static_cell=True argument to
query.execute? That will send the mapper an iterator that iterates
over all the temporal cells in a given spatial cell.

Rough code:

qstr = 'select * from ps1_det'
query = db.query(qstr)
query.execute(mapper, group_by_static_cell=True, bounds=bounds)

def mapper(qresult):
res = colgroup.fromiter(qresult)
# res now holds all of the data in some spatial cell

There's also qresult.static_cell, which you could also use as part of
a map/reduce chain if you needed to...
> --
> You received this message because you are subscribed to the Google Groups
> "lsd-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to lsd-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Branimir Sesar

unread,
Jul 9, 2016, 1:15:40 PM7/9/16
to lsd-...@googlegroups.com
To make it work, I had to use

res = colgroup.fromiter(qresult, blocks=True)

Thanks, Eddie :)

Cheers,

Brani
Reply all
Reply to author
Forward
0 new messages