Create a voxel layer

A voxel layer represents multidimensional volumetric, regularly gridded data. The data source for a voxel layer can be a netCDF file, scene layer package, or scene service. ArcGIS Pro provides multiple geoprocessing tools and workflows to create data sources suitable for a voxel layer. Various workflows allow you to create multidimensional data from 3D point input, from geostatistical analysis or by converting existing multidimensional data, such as raster data, to be visualized as a voxel layer. See supported voxel formats and frequently asked questions for additional information on voxel layers.

Note:

The Feature to NetCDF tool will not produce an output suitable for a voxel layer.

Create a voxel layer from point input using geostatistical analysis

You interpolate and visualize point data as a voxel layer. For example, you can analyze the oxygen levels of a study area over time. In ArcGIS, a geostatistical analysis allows you to analyze these types of patterns. You can visualize the dissolved oxygen measurements taken at various depths and perform 3D geostatistical interpolation to predict the oxygen levels throughout the entire study area. You can create a 3D netCDF file from the geostatistical analysis and visualize it as a voxel layer in a local scene. If a local scene is active the geostatistical analysis tools output the voxel layer to the scene. Compatible tools include Empirical Bayesian Kriging 3D, IDW 3D, and Nearest Neighbor 3D.

  1. Click the Analysis tab and click Tools Tools.
  2. In the Geoprocessing pane, search for Empirical Bayesian Kriging 3D, click to open the tool, and set the following parameters:
    • Input Features—The input point feature layer that will be interpolated
    • Elevation Field—The field that holds a height value for each point
    • Value Field—The field containing the measured values to be interpolated
    • Output Geostatistical Layer—The geostatistical layer produced
  3. Click Run Run.

    The geostatistical layer is produced.

  4. In the Geoprocessing pane, search for GA Layer 3D To NetCDF, click to open the tool, and set the following parameters:
    • Input 3D Geostatistcal Layer—The 3D geostatistical layer from step 3
    • Output netCDF file—The name of the output netCDF file
  5. Click Run Run.

The voxel layer displays in the scene.

Create a voxel layer from point input using the Create Space Time Cube tool

Multidimensional data can represent x,y, and time as a height dimension. For example, you can analyze the storm pattern of a study area over time. In ArcGIS Pro, a space-time cube allows you to analyze these types of patterns. A space-time cube can summarize a set of points into a netCDF file by aggregating them into space-time bins. Within each bin, the points are centered, and specified attributes are aggregated. For all bin locations, the counts and summary field values are evaluated. Because a voxel layer requires regularly gridded data, the aggregation shape must be of type fishnet. The result is an x,y,t volumetric data structure.

  1. Click the Analysis tab and click Tools Tools.
  2. In the Geoprocessing pane, search for Create Space Time Cube by Aggregating Points, click to open the tool, and set the following parameters:
    • Input Features—The input point feature layer to be aggregated.
    • Output Space Time Cube—The output netCDF file that will be produced.
    • Time Field—The field containing the date and time for each point.
    • Time Step Interval—The number of seconds, minutes, hours, days, weeks or years that will represent a single time step.
    • Distance Interval—The size of the bins used to aggregate the input features.
    • Summary Fields—The numeric field containing attribute values used to calculate the specified statistic when aggregating into a space-time cube.
    • Aggregation Shape Type—Choose Fishnet Grid.
  3. Click Run Run.

    The space-time cube is produced.

  4. Click the Map tab and click Add Data Add Data.

    Voxel layers require an active local scene.

  5. Click Add Multidimensional Voxel Layer Add Multidimensional Voxel Layer and specify the output netCDF created in step 3.
  6. Click OK.

The voxel layer displays in the scene.

Create a voxel layer from multidimensional raster

Multidimensional data comes in a variety of formats. Currently voxel layers only support netCDF data. You can export data in other multidimensional formats such as GRIB, HDF, and CRF to a netCDF file using the Copy Raster tool.

  1. Click the Analysis tab and click Tools Tools.
  2. In the Geoprocessing pane, search for Copy Raster, click to open the tool, and set the following parameters:
    • Input Raster—Set this to the input multidimensional raster.
    • Output Raster Dataset—Set this to the output netCDF file with the .nc file extension.
    • No Data Value—Remove the default value and keep blank.
    • Format—Choose NetCDF format.

    Voxel layers require data to be regularly gridded.

  3. Click Run Run.

    The netCDF file is produced.

  4. Click the Map tab and click Add Data Add Data.

    Voxel layers require an active local scene.

  5. Click Add Multidimensional Voxel Layer Add Multidimensional Voxel Layer and specify the output netCDF created in step 3.
  6. Click OK.

The voxel layer displays in the scene.

Create a voxel layer from a .csv file

In this example, a netCDF file is generated using a .csv file. The .csv file will have five columns: X, Y, Z, T, and Data. It is also assumed the .csv file is gridded evenly in all dimensions. After you create the netCDF file, you can run the Make Multidimensional Voxel Layer tool and save it as a layer file to be added to a local scene.

from netCDF4 import Dataset
import numpy as np
import pandas as pd
import arcpy

#Create a pandas dataframe and insert data from CSV/TEXT file
filePath = "myFile.csv"
dfPoints = pd.read_csv(filePath)

#Sort values to ensure they are in the correct order
dfPoints = dfPoints.sort_values(by=['T','Z','Y','X'])

#Create domain for longitude/latitude
#Each domain has unique values, no repeating numbers, and are sorted (to be monotonic)
xDomain = np.sort(np.unique(dfPoints.iloc[:,0].values)) # 0th column contains x values
yDomain = np.sort(np.unique(dfPoints.iloc[:,1].values)) # 1st column contains y values
zDomain = np.sort(np.unique(dfPoints.iloc[:,2].values)) # 2nd column contains z values
tDomain = np.sort(np.unique(dfPoints.iloc[:,3].values)) # 3rd column contains t values

#Create NetCDF file
outDataSet = Dataset('myNetCDF.nc', 'w', format = 'NETCDF4') # Creates the output NetCDF file
outDataSet.createDimension('x', len(xDomain))                # Creates the x dimension
outDataSet.createDimension('y', len(yDomain))                # Creates the y dimension
outDataSet.createDimension('z', len(zDomain))                # Creates the z dimension
outDataSet.createDimension('t', len(tDomain))                # Creates the t dimension

#Create variables
ncX = outDataSet.createVariable('x', np.float32, 'x') # Create variable x
ncY = outDataSet.createVariable('y', np.float32, 'y') # Create variable y
ncZ = outDataSet.createVariable('z', np.float32, 'z') # Create variable z
ncT = outDataSet.createVariable('t', np.float32, 't') # Create variable t

#Create variable data with dimensions (t,z,y,x). The fill value is set to -99999 which are values to be ignored by client.
ncData = outDataSet.createVariable('data',np.float32,('t','z','y','x'),fill_value = -99999) 

#Assign values
ncX[:] = xDomain[:]
ncY[:] = yDomain[:]
ncZ[:] = zDomain[:]
ncT[:] = tDomain[:]

#The dataframe 'Data' column must be reshaped to match the dimension shapes and placed into the ncData variable
ncData[:,:,:,:]  = np.reshape(
    dfPoints['Data'].values,
    (tDomain.shape[0],zDomain.shape[0],yDomain.shape[0],xDomain.shape[0])
    )

#Assign variable attributes

ncData.long_name = "My test data"

ncZ.positive = 'up'

ncX.standard_name = 'projection_x_coordinate'
ncX.units = 'm'

ncY.standard_name = 'projection_y_coordinate'
ncY.units = 'm'

ncT.units = 'hours since 2000-01-01 00:00:00'

#Assign global attribute. This attribute is to assign a coordinate system.
outDataSet.esri_pe_string = 'PROJCS["ETRS_1989_UTM_Zone_32N_7stellen",GEOGCS["GCS_ETRS_1989",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",2500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",9.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0],AUTHORITY["Esri",102328]]'

outDataSet.close()

# Create the voxel layer
arcpy.md.MakeMultidimensionalVoxelLayer(outDataSet, "TestVoxelLayer")

# Save the voxel layer to a layer file
arcpy.management.SaveToLayerFile(
    in_layer="TestVoxelLayer",
    out_layer=r"C:\Temp\TestVoxelLayer.lyrx",
    is_relative_path=None,
    version="CURRENT"
)

Related topics