Skip to content

Instantly share code, notes, and snippets.

@prl900
Last active July 24, 2018 02:02
Show Gist options
  • Save prl900/787d88a640f83f31326a0ec196ab2b20 to your computer and use it in GitHub Desktop.
Save prl900/787d88a640f83f31326a0ec196ab2b20 to your computer and use it in GitHub Desktop.
import datacube as dc
class BurnCube(dc.Datacube):
def __init__(self):
super(BurnCube, self).__init__(app='TreeMapping.getLandsatStack')
self.measurements = ['red','green','blue','nir','swir1','swir2']
self.res = (-100,100)
def load_cube(self, lon, lat, period):
query = {
'time': period,
'lat': lat,
'lon': lon,
'measurements' : self.measurements,
'resolution': self.res,
}
dss = self.find_datasets(product='ls8_nbart_albers', **query)
return self.load('ls8_nbart_albers', group_by='solar_day', datasets=dss, resampling='bilinear', **query)
lon = (146.0852,146.3702) # min to max
lat = (-41.5985,-41.7314)
reftime = ('2013-01-01','2017-12-31') # period used for the calculation of geometric median
bc = BurnCube()
data = bc.load_cube(lon, lat, reftime)
print(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment