Resumen
Converts an xarray.Dataset to a multidimensional raster.
Debate
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.
Sintaxis
XarrayToRaster (in_xarray)
Parámetro | Explicación | Tipo de datos |
in_xarray | The input xarray.Dataset object to convert to a multidimensional raster. | xarray.Dataset |
Tipo de datos | Explicación |
Raster | The output raster. |
Muestra de código
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")