XarrayToRaster

Résumé

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.

Syntaxe

XarrayToRaster (in_xarray)
ParamètreExplicationType de données
in_xarray

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

xarray.Dataset
Valeur renvoyée
Type de donnéesExplication
Raster

The output raster.

Exemple de code

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")