Hi all - using ArcGIS Pro 2.8, so-so python skills
I am trying to create a time series showing air quality over time in a specific sample site. I can create several Voxel layers of the data for different time stamps (days) but I am unsure how to:
- Combine the voxel layers into one voxel layer that can be time enabled OR
- Create time enabled Voxel layers to use in a time series.
Essentially I would like to create something similar to this oceans output here.
The workflow I have followed is similar to that of the Interpolate 3D oxygen measurements in Monterey Bay found here. I have 5 days worth of air quality data captured from a drone at different elevations. This input data has a time field. I create interpolated results for each day using the Emperical Baysian Kriging 3D tool. Then I convert each output to a Voxel layer to visualise as a predicted volumetric cube using the GA Layer 3D to NetCDF tool.
So I have 5 voxel layers with no time dimensions. What is the best approach to create a time capable voxel layer? Can you edit existing voxel layers to add a time dimension? Or do you have to follow a different procedure?
My python code for the process for reference is below:
# import modules
import os
import arcpy
import datetime as dt
def EBK_Process(pm_field):
'''Main Process creating interpolation output'''
try:
# To prevent overwriting outputs change option to False.
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r"C:\Users\TasB\DroneMapping.gdb"
# Check out any necessary licenses.
arcpy.CheckOutExtension("GeoStats")
print("Checked out GeoStats License")
# input variables
drone_csv = r"C:\Users\TasB\Inputs\DroneAirQuality.csv"
out_points_fc = "drone_loc"
x_coords = "Longitude"
y_coords = "Latitude"
z_coords = "Altitude m"
# create points fc from csv table
xy_fc = arcpy.XYTableToPoint_management(drone_csv, out_points_fc,
x_coords, y_coords, z_coords,
arcpy.SpatialReference(4326, 115700))
# create a list of date values to loop through
date_list = []
with arcpy.da.SearchCursor(xy_fc, "GMT_Date") as date_cursor:
for row in date_cursor:
if row[0] not in date_list:
date_list.append(row[0])
del date_cursor
for date in date_list:
# create date_str for output names
date_str = dt.datetime.strptime(date, '%m/%d/%Y').strftime('%Y%m%d')
# select date field for sample process
clause = """ "GMT_Date" = '%s' """ % date
new_select = arcpy.SelectLayerByAttribute_management(xy_fc, "NEW_SELECTION", clause)
select_copy = arcpy.CopyFeatures_management(new_select,"xy_copy")
# specify input spatial reference from existing fc
dsc = arcpy.Describe("DroneAirQuality_Proj")
coord_sys = dsc.SpatialReference
# define projection
copy_proj = arcpy.Project_management(select_copy,
"drone_loc_proj", coord_sys)
# run ebk 3D analysis tool
output_ebk_layer = "ebk_" + pm_field + "_" + date_str
out_ebk = arcpy.EmpiricalBayesianKriging3D_ga(copy_proj,
"Shape.Z",
pm_field,
output_ebk_layer,
"METER", "",
"EXPONENTIAL",
"LOGEMPIRICAL",
100,
1, 100,
"FIRST", None,
"NBRTYPE=Standard3D
RADIUS=nan NBR_MAX=2 NBR_MIN=1 SECTOR_TYPE=TWELVE_SECTORS",
None, "PREDICTION",
0.5, "EXCEED",None)
print("EBK Created")
if pm_field == "PM2_5":
pm_field = "PM25"
out_voxel = os.path.join(r"C:\Users\TasB\Outputs", pm_field + "_" + date_str + ".nc")
predict_points = output_ebk_layer + " PREDICTION #;" + output_ebk_layer + " PREDICTION_STANDARD_ERROR #"
arcpy.GALayer3DToNetCDF_ga(out_ebk, out_voxel, "3D_GRIDDED_POINTS", "2.21662307693026 Meters", "2.01896153844129 Meters", "3.12820512820513 Meters", None, predict_points, None)
arcpy.CheckInExtension("GeoStats")
print("Checked in GeoStats License")
print("Process Completed Successuflly")
except arcpy.ExecuteError:
print(arcpy.GetMessages(2))
if __name__ == '__main__':
# Global Environment settings
EBK_Process("PM2_5")
EBK_Process("PM10")