Skip to content

Commit

Permalink
Moving the group_by_location function to the stack-based example so t…
Browse files Browse the repository at this point in the history
…here is no confusion about the internal use of stacks in the v2 codebase.
  • Loading branch information
andrewdhicks committed Dec 15, 2015
1 parent 4aea5c4 commit da06679
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion examples/band_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,22 @@

from affine import Affine

from datacube.api import make_storage_unit, group_storage_units_by_location
from datacube.api import make_storage_unit
from datacube.index import index_connect
from datacube.storage.access.core import StorageUnitStack, StorageUnitVariableProxy
from datacube.ui import parse_expressions

from datacube.storage.storage import fuse_sources, _dataset_time, DatasetSource, RESAMPLING


def group_storage_units_by_location(sus):
dims = ('longitude', 'latitude')
stacks = {}
for su in sus:
stacks.setdefault(tuple(su.coordinates[dim].begin for dim in dims), []).append(su)
return stacks


def ndv_to_nan(a, ndv=-999):
a = a.astype(numpy.float32)
a[a == ndv] = numpy.nan
Expand Down

0 comments on commit da06679

Please sign in to comment.