AnsweredAssumed Answered

Pesky computer rounding in arcpy

Question asked by pk_davidson on Dec 22, 2015
Latest reply on Dec 23, 2015 by pk_davidson

As an addendum to my NULL SHAPE question...

 

I've just hit a very strange issue.

For days I've been working with various FeatureClasses (in file geodatabases,  and in enterprise geodatabases, etc... trying a variety of workspaces)

 

And for days, using an UpdateCursor, I've been successfully writing points as (0.0, 0.0)

 

This evening, I suddenly had the code:

fields = ['OID@', 'SHAPE@X', 'SHAPE@Y']

with  arcpy.da.UpdateCursor(myFC, fields) as cursor : 

    for row in cursor:

        row[1] = 0.0

        row[2] = 0.0

        cursor.updateRow(row)

 

 

 

Start writing non zero values into the XY locations.

When I read the data back in:

Shape(X, Y):(7.45058059692e-09,7.45058059692e-09)

 

Ok, sure, it's quite small and I could effectively work with it via a small delta function but that makes no sense.

0.0 should not have a rounding effect, should it.

 

Any ideas why this suddenly started happening?

Like I say, for days it's been written as 0.0 and read back that way.

And the datasets have always been in the same state plane coord system so unless I missed something and I'm dealing with some small projection error...  But from the same dataset back to the dataset should have no projection translation...

 

It might be that my PC has flaked some bits and ....

And I'll reboot and try again but this seems very strange.

Outcomes