XarrayToRaster

Summary

Converts an xarray.Dataset to a multidimensional raster.

Discussion

xarray is a Python module that supports multidimensional arrays with labels of dimensions, coordinates, and attributes. It builds on and integrates NumPy and pandas, and deals with multidimensional data in the Python SciPy ecosystem for numerical computing. For more information, refer to the xarray documentation.

After an xarray.DataArray is processed with Python, you may want to convert it to an ArcGIS multidimensional raster for it to be used in ArcGIS environments.

Syntax

XarrayToRaster (in_xarray)
ParameterExplanationData Type
in_xarray

The input xarray.Dataset object to convert to a multidimensional raster.

xarray.Dataset
Return Value
Data TypeExplanation
Raster

The output raster.

Code sample

XarrayToRaster example

Python window sample for the XarrayToRaster function.

import arcpy
import xarray

# Get input Raster multidimensional information
inRas = arcpy.Raster('C:/data/temperature_3hour.crf', True)
inRas.mdinfo

# Convert Raster to Xarray Dataset
xrr = arcpy.ia.RasterToXarray(inRas)

# Upsample the data from originally 3 hour to hourly time interval
newXrr = xrr.resample(StdTime='1H').nearest(tolerance="1H")

#Convert Xarray dataset back to raster 
newRaster = arcpy.ia.RasterToXarray(newXrr)
newRaster.save("C:/output/temperature_hourly.crf")