I have a python script that loops through a multipart point file and runs the Skyline and Skyline Graph tools for each point object.
However, I get empty skyline (.shp) outputs for some (but not all) points and the corresponding skyline graph tables (.dbf files) are created with identical values for all 360 rows as follows:
HORIZ_ANG, ZENITH_ANG, HOR_AN_GEO, ZEN_AN_INV
297.92434, 90.00196, 182.07566, -0.00196
297.92434, 90.00196, 182.07566, -0.00196
...
Here's a simplified overview of how the script works:
Input
- 3D point file with x, y, z, and id fields
- DEM (10 m or 30 m cell size)
Workflow
- Loop through each sample point in input shapefile, and for each point:
- Create a temporary z-enabled feature class (.shp) and insert a 3D point using SHAPE@XYZ from the input point file
- Buffer temporary point (50,000 meters) to define clipping area (needed to clip a national scale DEM to practical size)
- Clip a temporary DEM to buffered area
- Reclassify DEM to contain positive values only (this was a previous cause of problems)
- Debug before running Skyline and Skyline Graphs tools:
- Check point file was created, is z-enabled, and has z value
- Check DEM was created and has valid values
- Check for matching spatial reference systems
- Check point lies within extent of DEM
- Run the Skyline tool, output .shp file to new folder
- Run the Skyline Graph tool, output .dbf to new folder
I have tested various possibilities for why some points fail and others don’t, for example:
- The Z value assigned to the point using SHAPE@XYZ vs. the Z value of the input DEM surface (I found no systematic pattern between successful and failed points)
- Adding a small offset to the point Z value (e.g. 0.1) to test for potential numerical precision and/or floating point issues
- The input surface resolution (I tended to get more ‘fails’ using a 10 m DEM over a 30 m DEM)
- The buffer extent around the point, used to clip a temporary DEM
- The chosen max horizon radius
I have not found a clear cause yet. I also tried running the tools manually using the temporary point and DEM files created in the script as input, but with the same outcome.
Does anyone have any ideas why this problem happens?