Skip to content

bump() returns an unnamed DataArray and has no name= parameter, unlike perlin/worley/generate_terrain #3608

Description

@brendancol

The synthetic-terrain generators share an output convention: perlin, worley, and generate_terrain each take a name argument and set it on the returned DataArray. bump does not. It returns an unnamed DataArray and has no name parameter.

import numpy as np, xarray as xr
from xrspatial.bump import bump
from xrspatial.perlin import perlin
from xrspatial.worley import worley
from xrspatial.terrain import generate_terrain

agg = xr.DataArray(np.zeros((10, 10)), dims=['y', 'x'])
print(perlin(agg.copy()).name)             # 'perlin'
print(worley(agg.copy()).name)             # 'worley'
print(generate_terrain(agg.copy()).name)   # 'terrain'
np.random.seed(0)
print(bump(agg=agg.copy()).name)           # None

Someone who passes name= to the other generators finds the argument missing on bump, and anything that keys off .name (plot titles, dataset merges) comes back empty.

One more thing I noticed in the signature: the count docstring lists it as a required int, but the parameter is Optional[int] = None with a computed default of width * height // 10 (capped at 10M). The docstring should say so.

Proposed fix, non-breaking: add a keyword-only name: str = 'bump' parameter and set it on the returned DataArray in both the agg and width/height paths, and correct the count docstring.

Not covered here because it is breaking: agg is keyword-only in bump but positional-first in the sibling generators, so bump(some_dataarray) raises where perlin(some_dataarray) works. Making agg positional would break the historical bump(width, height) call, so it needs its own deprecation plan.

Found by the api-consistency deep-sweep, 2026-07-02.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions