Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygon Drill example not reproducible #930

Closed
clausmichele opened this issue May 4, 2020 · 2 comments
Closed

Polygon Drill example not reproducible #930

clausmichele opened this issue May 4, 2020 · 2 comments

Comments

@clausmichele
Copy link

The Polygon Drill Example assumes that loaded data has the attribute geobox, which is not present in my case with Sentinel-2 data loaded with ODC:

<xarray.Dataset>
Dimensions:  (time: 392, x: 12, y: 18)
Coordinates:
  * time     (time) datetime64[ns] 2015-07-04T10:13:37.922000 ... 2020-03-17T10:27:53.506057
  * y        (y) float64 5.144e+06 5.144e+06 5.144e+06 ... 5.144e+06 5.144e+06
  * x        (x) float64 6.932e+05 6.932e+05 6.932e+05 ... 6.933e+05 6.933e+05
Data variables:
    B04_10m  (time, y, x) uint16 254 267 252 242 234 236 ... 154 109 204 128 127
Attributes:
    crs:      EPSG:32632

How to apply polygon drill using the provided code?

@Kirill888
Copy link
Member

@clausmichele can you please provide more details about how and where you are running code and what version of datacube you are using.
Also what happens when you do this print(your_dataset.geobox) ?

.geobox is a dynamic property computed from crs data stored in special way inside xarray dataset/dataarray. We have recently changed the location of that data. It used to be stored as an attribute of the dataset and dataarray object, but that was too easy to lose when performing operations on loaded data. Newer versions of datacube create an extra coordinate with CRS metadata, judging by your printout you are using older version of datacube, and your dataset does have .crs attribute and so I would expect .geobox to return a valid object.

@clausmichele
Copy link
Author

My fault sorry, it is indeed returning a valid object on a loaded dataset, maybe I missed something when I was trying yesterday.
On the other hand, if I store the same dataset to a netcdf file with write_dataset_to_netcdf(dataset,'path'), imported from datacube.drivers.netcdf, and then I load it again with dataset = xarray.open_dataset('path') I can't use the .geobox attribute anymore. I see now that this last part was already tracked in this issue, so I'll close this.
Thanks for the support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants