Skip to content

Commit

Permalink
Gridspec in virtual product tests (#1512)
Browse files Browse the repository at this point in the history
* Fix spelling mistale in deprecation warning.

* Update virtual products tests to use odc-geo gridspec.

* Update whats_new.rst.

* Lintage.

* Correct values to tile_shape.
  • Loading branch information
SpacemanPaul committed Nov 13, 2023
1 parent e74a27b commit 41c33cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
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

0 comments on commit 41c33cf

Please sign in to comment.