Example - Transform Bounds

[1]:
import rioxarray # for the extension to load
import xarray

%matplotlib inline
[2]:
xds = xarray.open_dataarray("MODIS_ARRAY.nc")
[3]:
xds.rio.bounds()
[3]:
(-7274009.649486291, 5003777.3385, -7227678.3778335, 5050108.61015275)

API Reference: rio.transform_bounds()

[4]:
xds.rio.transform_bounds(
    "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84"
    " +datum=WGS84 +units=m +no_defs",
    densify_pts=100,
)
[4]:
(-10374232.525903117,
 5591295.917919335,
 -10232919.684719983,
 5656912.314724255)
[5]:
xds.rio.transform_bounds(
    "+init=epsg:4326",
    densify_pts=1,
)
[5]:
(-93.19331639028637, 44.99999999595885, -91.92388153951472, 45.41666666258786)