I have a sequence of functions, arcpy and non arcpy functions. The functions run with a small problem which I guess has something to do with a file. This file i used in the functions, arcpy.exists returns true but I cannot see the file in the gdb of the location that is fed to arcpy.exists. Any idea how the function could return true if the file is not there?
The file I'm talking about is the in the transformed_bars
variable.
# Local variables:
points_CSV = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s1_points_CSV"
mask_Tbl = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s1_mask_Tbl"
Points = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s2_Points"
Lines = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s2_Lines"
mask = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s2_mask"
CreateTin4 = "D:\\ARNO\\Analysis\\ArcGIS\\s3_Tin"
TINtoRaster = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s3_TINtoRaster"
TinFiltered = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s3_TinFiltered"
Asp_Tin = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s4_Asp_Tin"
Int_Tin = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s4_Int_Tin"
Reclass_Int_2 = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s5_ReclassifiedTin"
RasterT_Reclass1 = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s5_ReclassifiedProjected"
RasterT_Reclass1_Layer = "Shapefiles"
lines_polygons = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\sx_LinedPolygons"
Link_lines = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\sx_linkLines"
transformed_bars = "D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\sx_trans"
All the variables are assigned to locations as is illustrated above, all are findable except for the transformed bars one.
fn_short = fn.split('\\')[-1]
eiland = fn_short.split('_')[0]
fn_straight = 'D:\\ARNO\\Analysis\\ArcGIS\\ArcPyScripts\\Data\\Out_straight_csv\\{}\\{}'.format(eiland, fn_short.split('.')[0]+'_trans.csv')
# This is a function I made that makes the folder if it doesn't exist
createIfNotExist('D:\\ARNO\\Analysis\\ArcGIS\\ArcPyScripts\\Data\\Out_straight_csv\\{}'.format(eiland))
# Process: Transform points
transform_points(fn,fn_straight)
print 'transformed'
# Process: Make XY Event Layer (2), read the csv files to use them
arcpy.MakeXYEventLayer_management(fn_straight, "x", "y", points_CSV, "PROJCS['RD_New',GEOGCS['GCS_Amersfoort',DATUM['D_Amersfoort',SPHEROID['Bessel_1841',6377397.155,299.1528128]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Double_Stereographic'],PARAMETER['False_Easting',155000.0],PARAMETER['False_Northing',463000.0],PARAMETER['Central_Meridian',5.38763888888889],PARAMETER['Scale_Factor',0.9999079],PARAMETER['Latitude_Of_Origin',52.15616055555555],UNIT['Meter',1.0]];-30515500 -30279500 10000;-100000 10000;-100000 10000;0.001;0.001;0.001;IsHighPrecision", "depth")
# Process: Aggregate Points, creating the mask
arcpy.AggregatePoints_cartography(points_CSV, mask, "2000 Meters")
# Process: Feature To Point, create points from the layer made before
arcpy.FeatureToPoint_management(points_CSV, Points, "CENTROID")
# Process: Points To Line, create lines to use this in the tin making
arcpy.PointsToLine_management(Points, Lines, "key", "dist", "NO_CLOSE")
# Process: Create TIN, create the tin
arcpy.CreateTin_3d(CreateTin4, "", """D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s2_Lines Shape.Z Soft_Line <None>;
D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s2_Points depth Mass_Points <None>;
D:\\ARNO\\Analysis\\ArcGIS\\Scratch.gdb\\s2_mask Shape.Z Soft_Clip <None>""", "DELAUNAY")
# Process: TIN to Raster, make raster of the tin (dem)
arcpy.TinRaster_3d(CreateTin4, TINtoRaster, "FLOAT", "LINEAR", "CELLSIZE 30", "1")
# Process: Filter, filter out some things
arcpy.gp.Filter_sa(TINtoRaster, TinFiltered, "LOW", "NODATA")
# Process: Raster Calculator, erase the 0 things
arcpy.sa.SetNull(TinFiltered,TinFiltered,'VALUE >= 0')
print 'creating aspect'
# Process: Aspect, get the aspect
arcpy.Aspect_3d(TinFiltered, Asp_Tin)
# Process: Int, ..
arcpy.Int_3d(Asp_Tin, Int_Tin)
# Process: Reclassify, get the right aspects
remapstring = get_remap(Int_Tin)
arcpy.gp.Reclassify_sa(Int_Tin, "VALUE", remapstring, Reclass_Int_2, "DATA")
# Process: Raster to Polygon, create polygons
arcpy.RasterToPolygon_conversion(Reclass_Int_2, RasterT_Reclass1, "SIMPLIFY", "VALUE")
# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(RasterT_Reclass1, transformed_bars, "( Shape_Area >= 150000) AND (gridcode = 2 )", "", "Shape Shape VISIBLE NONE;OBJECTID OBJECTID VISIBLE NONE;Shape_Length Shape_Length VISIBLE NONE;Shape_Area Shape_Area VISIBLE NONE;ID ID VISIBLE NONE;GRIDCODE GRIDCODE VISIBLE NONE")
straight_folder = 'D:\\ARNO\\Analysis\\ArcGIS\\ArcPyScripts\\Data\\straight_shape_folder\\{}'.format(eiland)
createIfNotExist(straight_folder)
## arcpy.FeatureToPolygon_management(transformed_bars, os.path.join(straight_folder,shape_name)) ## try to get the transformed_bars so I can see them.
print 'projecting'
# Process: Define Projection
arcpy.DefineProjection_management(transformed_bars, "PROJCS['RD_New',GEOGCS['GCS_Amersfoort',DATUM['D_Amersfoort',SPHEROID['Bessel_1841',6377397.155,299.1528128]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Double_Stereographic'],PARAMETER['False_Easting',155000.0],PARAMETER['False_Northing',463000.0],PARAMETER['Central_Meridian',5.38763888888889],PARAMETER['Scale_Factor',0.9999079],PARAMETER['Latitude_Of_Origin',52.15616055555555],UNIT['Meter',1.0]]")
# Process: Polygon To Line
arcpy.PolygonToLine_management(transformed_bars, lines_polygons, "IDENTIFY_NEIGHBORS")
# Process: Densify
arcpy.Densify_edit(lines_polygons, "DISTANCE", "1 Meters", "0.1 Meters", "10")
# link lines creating
out_csv = create_sourceTargetCSV(fn_straight) # in = transformed csv, returns out csv
create_linklines_rubbersheeting(Link_lines,out_csv) # in = location of shapefile, output csv of sourcetargetcsv
# Process: Rubbersheet Features
arcpy.RubbersheetFeatures_edit(lines_polygons, Link_lines, "", "LINEAR")
# lines to polygons
print os.path.join(shape_folder,shape_name)
arcpy.FeatureToPolygon_management(lines_polygons,os.path.join(shape_folder,shape_name))`
createIfNotExists()
function you should also add the code of the function. however i cannot see where you are checking iftransformed_bars
exists... it is very hard to help with the given information