Skip to content

.to_rioxarray method for async_geotiff._array.Array #93

Open

Description

@raybell-md

I ended up writing a util in #92 (comment)

To convert an async_geotiff._array.Array to an xarray.DataArray.

Open to adding the util here. No preference if this util (along with many other utils) should stay with the user as not to bloat this project.

Activity

  1. weiji14 commented on Feb 18, 2026

    @weiji14
    Member

    We've discussed internally whether to add an xarray BackendEntrypoint (answer is: not sure 😆). We would need to be careful to add xarray as an optional dependency so that the core package remains unbloated.

    And just in case you're interested, I wrote a similar to_xarray() method at https://github.com/developmentseed/pixelverse/pull/24/changes#diff-8feec44dae0c09e9044a272dadfb9775d686299a5822d4ca7c62bc8531f7a2dd, though this was using async-tiff instead of async-geotiff (haven't got around to rewrite it yet), and the coordinates was using rasterix (for some lazy indexing).

  2. kylebarron commented on Feb 18, 2026

    @kylebarron
    Member

    I think without adding a whole BackendEntrypoint, having a to_xarray method on Array could be in scope (xarray would be a conditional dependency)

  3. kylebarron commented on Feb 18, 2026

    @kylebarron
    Member

    rasterix looks really nice. Thanks @dcherian!

    So it should be one line of code to create an xarray indexer from an Array:

    from rasterix import RasterIndex
    
    index = RasterIndex.from_transform(
    	array.transform,
    	width=array.width,
    	height=array.height,
    	crs=array.crs,
    )

    Then one line of code to assign that to your array

    # Assign to data
    ds_manual = xr.Dataset(
        {"data": (("y", "x"), np.random.rand(100, 100))},
        coords=xr.Coordinates.from_xindex(index),
    )
    ds_manual
  4. dcherian commented on Feb 18, 2026

    @dcherian

    rasterix looks really nice.

    ahem... it looks.... rasterized. 🥁

    Image
  5. kylebarron commented on Feb 20, 2026

    @kylebarron
    Member

    Put up one thought here: #95

  6. kylebarron commented on May 5, 2026

    @kylebarron
    Member

    One way to manage async-geotiff - xarray integration is to offload it to other tools, like lazycogs, which is exploring rasterix integration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions