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)
Parameter | Explanation | Data Type |
in_xarray | The input xarray.Dataset object to convert to a multidimensional raster. | xarray.Dataset |
Data Type | Explanation |
Raster | The output raster. |
Code sample
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.XarrayToRaster(newXrr)
newRaster.save("C:/output/temperature_hourly.crf")