Hi all,
I also agree that this is a really serious issue in practical terms so please post back here if you have any news about this.
Today I really had to deal with the shapefile I mentioned in my original post and this is a work around I came up with based on responses from Vince Angelo. It is far from generic but it worked in my situation. You will likely need to adjust it and check it for your cases. I must acknowledge my colleague helped me figure out the ins and outs of the _fix_short function. He's really good with binary stuff.
"""Rewrite a shapefile to a feature class in ArcGIS 10.3.1 and fix SHORT integer.
This example assumes input shapefile in_shp with columns WBID and DBAREA.
DBAREA is a DOUBLE and WBID is the incriminated integer column.
"""
import numpy
in_shp = 'c:/temp/poly.shp'
out_fc = 'c:/temp/db.gdb/poly'
def _fix_short(a):
"""Fix 16 bit SHORT to the right 32 bit LONG in ArcGIS 10.3 context.
a -- input integer to convert to unsigned 32 bit integer
For reasoning see https://community.esri.com/thread/159997
"""
i = 65535 # i.e. int(16*'1', 2), the largest 16 bit integer
return numpy.int32(numpy.int16(a) & i)
# create the new output feature class
sr = arcpy.Describe(in_fc).spatialReference
out_fc = arcpy.management.CreateFeatureclass(
os.path.dirname(out_fc),
os.path.basename(out_fc),
"POLYGON", spatial_reference = sr
).getOutput(0)
arcpy.management.AddField(staging_lakes, "WBID", "LONG")
arcpy.management.AddField(staging_lakes, "DBAREA", "DOUBLE")
# rewrite rows using cursors
with arcpy.da.SearchCursor(in_fc, ["SHAPE@", "WBID", "DBAREA"]) as sc:
with arcpy.da.InsertCursor(staging_lakes, ["SHAPE@", "WBID", "DBAREA"]) as ic:
for row in sc:
wbid = _fix_wbid(row[1])
ic.insertRow([row[0], wbid, row[2]])
Filip.