GeoscienceAustralia / dea-notebooks

Repository for Digital Earth Australia Jupyter Notebooks: tools and workflows for geospatial analysis with Open Data Cube and Xarray
https://docs.dea.ga.gov.au/notebooks/
Apache License 2.0
448 stars 128 forks source link

dea_datahandling/load_ard is not preserving attributes #374

Closed cbur24 closed 5 years ago

cbur24 commented 5 years ago

The data-arrays inside the returned xarray dataset from load_ard do not retain the crs/geobox attributes.

reproducible example (run on the sandbox):

import datacube
import sys
sys.path.append("../Scripts")
from dea_datahandling import load_ard

query = {
    'x': (153.40, 153.45),
    'y': (-28.85, -28.90),
    'time': ('2018-01', '2018-03'),
    'measurements': ['nbart_red', 'nbart_green', 'nbart_blue'],
    'output_crs': 'EPSG:3577',
    'resolution': (-30, 30),
    'group_by': 'solar_day'
}

dc = datacube.Datacube(app="test")
ds = load_ard(dc=dc, **query, products=['ga_ls8c_ard_3'])

#select data array from dataset
da = ds.nbart_red.isel(time=1)
print(da.crs)
robbibt commented 5 years ago

Suspect that this is being caused by a bug in xarray. Have created an issue here, will see what they come back with: https://github.com/pydata/xarray/issues/3348