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

Gridspec in virtual product tests #1512

Merged
merged 5 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion datacube/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ def __hash__(self):


@deprecat(
reason='This version of GridSpec has been deprecated. Please use the GridSpec class definted in odc-geo.',
reason='This version of GridSpec has been deprecated. Please use the GridSpec class defined in odc-geo.',
version='1.9.0'
)
class GridSpec:
Expand Down
1 change: 1 addition & 0 deletions docs/about/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ v1.9.next
- Postgis index driver performance tuning (:pull:`1480`)
- Cleanup and formalise spatial index API and expose in CLI (:pull:`1481`)
- Increase minimum Python version to 3.10 (:pull:`1509`)
- Virtual product tests using odc-geo GridSpec (:pull:`1512`)


v1.8.next
Expand Down
11 changes: 6 additions & 5 deletions tests/api/test_virtual.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
import numpy
import xarray as xr

from datacube.model import DatasetType, MetadataType, Dataset, GridSpec
from datacube.model import Product, MetadataType, Dataset
from odc.geo import CRS
from odc.geo.gridspec import GridSpec
from datacube.virtual import construct_from_yaml, catalog_from_yaml, VirtualProductException
from datacube.virtual import DEFAULT_RESOLVER, Transformation
from datacube.virtual.impl import Datacube
Expand Down Expand Up @@ -77,11 +78,11 @@ def example_product(name):
pixelquality = dict(name='pixelquality', dtype='int16', nodata=0, units='1',
flags_definition=flags)

result = DatasetType(example_metadata_type(),
dict(name=name, description="", metadata_type='eo', metadata={}))
result = Product(example_metadata_type(),
dict(name=name, description="", metadata_type='eo', metadata={}))
result.grid_spec = GridSpec(crs=CRS('EPSG:3577'),
tile_size=(100000., 100000.),
resolution=(-25, 25))
tile_shape=(4000, 4000),
resolution=25)
if '_pq_' in name:
result.definition = {'name': name, 'measurements': [pixelquality]}
else:
Expand Down