Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix generated raster result desc
  • Loading branch information
jdroenner committed Apr 7, 2025
commit 06d4237bb7f23ba720edbc74ef77fc559df50994
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,25 @@
from typing import Optional, Set
from typing_extensions import Self


class RasterResultDescriptor(BaseModel):
"""
A `ResultDescriptor` for raster queries
""" # noqa: E501
""" # noqa: E501
bands: List[RasterBandDescriptor]
data_type: RasterDataType = Field(alias="dataType")
spatial_grid: SpatialGridDescriptor = Field(alias="spatialGrid")
spatial_reference: StrictStr = Field(alias="spatialReference")
time: Optional[TimeInterval] = None
__properties: ClassVar[List[str]] = ["bands", "dataType", "spatialGrid", "spatialReference", "time"]
__properties: ClassVar[List[str]] = [
"bands", "dataType", "spatialGrid", "spatialReference", "time"]

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)


def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
Expand Down Expand Up @@ -110,12 +111,9 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[Self]:

_obj = cls.model_validate({
"bands": [RasterBandDescriptor.from_dict(_item) for _item in obj["bands"]] if obj.get("bands") is not None else None,
"bbox": SpatialPartition2D.from_dict(obj["bbox"]) if obj.get("bbox") is not None else None,
"dataType": obj.get("dataType"),
"resolution": SpatialResolution.from_dict(obj["resolution"]) if obj.get("resolution") is not None else None,
"spatialGrid": SpatialGridDescriptor.from_dict(obj["spatialGrid"]) if obj.get("spatialGrid") is not None else None,
"spatialReference": obj.get("spatialReference"),
"time": TimeInterval.from_dict(obj["time"]) if obj.get("time") is not None else None,
})
return _obj