#NEWLINE# def zfactor( dataset ) : #NEWLINE# #INDENT# desc = arcpy . Describe ( dataset ) #NEWLINE# if ( desc . spatialReference . type != 'Geographic' ) : #NEWLINE# #INDENT# return 1.0 #NEWLINE# #UNINDENT# extent = desc . Extent #NEWLINE# extent_split = [ extent . XMin , extent . YMin , extent . XMax , extent . YMax ] #NEWLINE# top = float ( extent_split [ 3 ] ) #NEWLINE# bottom = float ( extent_split [ 1 ] ) #NEWLINE# if ( top > bottom ) : #NEWLINE# #INDENT# height = ( spatial_reference - bottom ) #NEWLINE# mid = ( ( height / 2 ) + bottom ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( top < bottom ) : #NEWLINE# #INDENT# height = ( bottom - top ) #NEWLINE# mid = ( ( height / 2 ) + top ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mid = top #NEWLINE# #UNINDENT# #UNINDENT# mid = math . radians ( mid ) #NEWLINE# spatial_reference = desc . SpatialReference #NEWLINE# semi_major_axis = spatial_reference . semiMajorAxis #NEWLINE# equatorial_length_of_degree = ( ( ( 2.0 * math . pi ) * float ( semi_major_axis ) ) / 360.0 ) #NEWLINE# decimal . getcontext ( ) . prec = 28 #NEWLINE# decimal . getcontext ( ) . rounding = decimal . ROUND_UP #NEWLINE# a = decimal . Decimal ( '1.0' ) #NEWLINE# b = decimal . Decimal ( str ( equatorial_length_of_degree ) ) #NEWLINE# c = decimal . Decimal ( str ( math . cos ( mid ) ) ) #NEWLINE# zfactor = ( a / ( b * c ) ) #NEWLINE# zfactor = ( '%06f' % zfactor . __abs__ ( ) ) #NEWLINE# return zfactor