1

I'm puzzled by different results I get from application of SplineWithBarrier (Spatial Analyst) using Modelbuilder and by external Python scripting:

  import arcpy
  points_shp = "pointShape.shp"
  faults_shp = "faultsShape.shp"
  outGrid = "r_out"
  arcpy.gp.SplineWithBarriers_sa(points_shp, "id", faults_shp, "10", outGrid, "1")

This is the code I got from the model builder. While results there are as expected (smooth surface with discontinuities) I used it in an external script. The resulting surface derived from the external script, however, shows, that smoothing was skipped. Before I tried the version from model builder I followed the example from the ArcGIS help. Same result - the grid is created, but again smoothing step is skipped. My first code was:

  import arcpy
  points_shp = "pointShape.shp"
  faults_shp = "faultsShape.shp"
  outGrid = "r_out"
  arcpy.CheckOutExtension("Spatial")
  outSplineBarriers = SplineWithBarriers(points_shp, "id", faults_shp, 10, 1)
  outSplineBarriers.save(outGrid)

That's the syntax from the help:

SplineWithBarriers (Input_point_features, Z_value_field, {Input_barrier_features}, {Output_cell_size}, {Smoothing_Factor})

Why is smoothing not activated? Where is my mistake?

1

You show the smoothing factor as a string in the first example, and an integer in the second. Did you check to make sure the input parameters are formatted correctly? Also, Z_value_field = "id" seems like a suspect field name for an elevation value.

  • Actually, "id" is used to code the elevation, derived from a polyline shape. The integer vs. string thing in the code snippet from the model builder and from the ArcGis help is confusing to me. Actually, the smoothing factor is double according to arcgis help, while output_cell_size is of type "analyse_cell_size" or so (hope, remembering it correctly). Actually, I can not call an "arcpy.analyse_cell_size"-module. So confused again. However, Arcgis help states an example comparable to my first code (actually the second one in my previous mail). They don't use smoothing in it. hmmm??? – tlange Feb 20 '15 at 19:15
0

Last week, I achieved, what cost me some of my productive time.

As I assumed, the problem wassn't related to wrong formatting in the code itself. It was tricky as simple. There is a conflict related to the international language settings created by SplineWithBarriers() which actuelly Java code. If your systems decimal delimiter is ",", which is usual in Germany than you can use point decimal delimiter in your python code. It doesn't matter. You have to change system decimal delimiter to '.'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.