Skip to content

Commit

Permalink
Merge pull request #8 from opendatacube/cleanup_todos
Browse files Browse the repository at this point in the history
Cleanup TODOs.
  • Loading branch information
SpacemanPaul authored Jul 17, 2023
2 parents 82a85dd + 11fe482 commit 4a5ed4e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
15 changes: 10 additions & 5 deletions eo3/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Generator,
Iterable,
List,
Mapping,
Optional,
Sequence,
Set,
Expand Down Expand Up @@ -433,9 +434,9 @@ def as_geo_docs(self) -> Tuple[CRS, Dict[str, GridDoc], Dict[str, MeasurementDoc
# Validate assumption: All grids should have same CRS
if crs is None:
crs = grid.crs
# TODO: CRS equality is tricky. This may not work.
# We're assuming a group of measurements specify their CRS
# the same way if they are the same.
# CRS equality is tricky. This may not work.
# We're assuming a group of measurements specify their CRS
# the same way if they are the same.
elif grid.crs != crs:
raise ValueError(
f"Measurements have different CRSes in the same dataset:\n"
Expand Down Expand Up @@ -628,6 +629,7 @@ def write_from_ndarray(
nodata: int = None,
overview_resampling=Resampling.nearest,
overviews: Optional[Tuple[int, ...]] = DEFAULT_OVERVIEWS,
tags: Optional[Mapping[str, str]] = None,
) -> WriteResult:
"""
Writes a 2D/3D image to disk using rasterio.
Expand All @@ -649,6 +651,9 @@ def write_from_ndarray(
from `rasterio.enums.Resampling`
Default is `Resampling.nearest`.
:param tags:
File tags.
:notes:
If array is an instance of a `h5py.Dataset`, then the output
file will include blocksizes based on the `h5py.Dataset's`
Expand All @@ -661,8 +666,8 @@ def write_from_ndarray(
f"measurement output file already exists? {out_filename}"
)

# TODO: Old packager never passed in tags. Perhaps we want some?
tags = {}
if tags is None:
tags = {}

dtype = array.dtype.name

Expand Down
8 changes: 3 additions & 5 deletions eo3/schema/dataset.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ properties:
# Either an epsg code ('epsg:1234') (preferred!) or a WKT string if no EPSG is possible.
type: string

# TODO: more thorough geometry check?
# Should be a valid geojson geometry - a polygon or a multipolygon
geometry:
type: object

Expand Down Expand Up @@ -73,14 +73,12 @@ properties:

properties:
datetime:
# TODO: "string" type is problematic as they're
# currently parsed directly into datetime objects...
# TODO: "string" type is problematic as they're currently parsed directly into datetime objects...
# type: string
format: date-time

odc:processing_datetime:
# TODO: "string" type is problematic as they're
# currently parsed directly into datetime objects...
# TODO: "string" type is problematic as they're currently parsed directly into datetime objects...
# type: string
format: date-time
required:
Expand Down
2 changes: 0 additions & 2 deletions eo3/serialise.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ def from_doc(doc: Dict, skip_validation=False) -> Eo3DatasetDocBase:
del doc["grid_spatial"]
DATASET_SCHEMA.validate(doc)

# TODO: stable cattrs (<1.0) balks at the $schema variable.
del doc["$schema"]
location = doc.pop("location", None)
if location:
doc["locations"] = [location]
Expand Down
1 change: 0 additions & 1 deletion eo3/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ def _validate_ds_against_data(
else:
expected_dtype = expected_measurement.dtype
band_dtype = ds.dtypes[band - 1]
# TODO: NaN handling
if expected_dtype != band_dtype:
yield ValidationMessage.error(
"different_dtype",
Expand Down

0 comments on commit 4a5ed4e

Please sign in to comment.