Summary
In xrspatial/slope.py, the public slope() function annotates its name parameter as name: str = 'slope'. The other terrain functions all annotate the same parameter as Optional[str]:
aspect() (aspect.py): name: Optional[str] = 'aspect'
northness() (aspect.py): name: Optional[str] = 'northness'
eastness() (aspect.py): name: Optional[str] = 'eastness'
curvature() (curvature.py): name: Optional[str] = 'curvature'
Why it matters
slope() hands name straight to xr.DataArray(name=name), which accepts None. So slope(agg, name=None) runs fine, but the str annotation tells type checkers and IDE users that None is invalid. The hint contradicts the runtime behavior and breaks consistency with the rest of the family.
Fix
Change the annotation to name: Optional[str] = 'slope' and import Optional in slope.py (the module currently imports only Union from typing). Widening a type hint accepts a superset of the old values, so this is non-breaking and needs no deprecation shim.
Severity
MEDIUM. A type-hint inconsistency that misleads users and tooling. Found by the api-consistency sweep.
Summary
In
xrspatial/slope.py, the publicslope()function annotates itsnameparameter asname: str = 'slope'. The other terrain functions all annotate the same parameter asOptional[str]:aspect()(aspect.py):name: Optional[str] = 'aspect'northness()(aspect.py):name: Optional[str] = 'northness'eastness()(aspect.py):name: Optional[str] = 'eastness'curvature()(curvature.py):name: Optional[str] = 'curvature'Why it matters
slope()handsnamestraight toxr.DataArray(name=name), which acceptsNone. Soslope(agg, name=None)runs fine, but thestrannotation tells type checkers and IDE users thatNoneis invalid. The hint contradicts the runtime behavior and breaks consistency with the rest of the family.Fix
Change the annotation to
name: Optional[str] = 'slope'and importOptionalin slope.py (the module currently imports onlyUnionfromtyping). Widening a type hint accepts a superset of the old values, so this is non-breaking and needs no deprecation shim.Severity
MEDIUM. A type-hint inconsistency that misleads users and tooling. Found by the api-consistency sweep.