McLeodx McLeodx - 1 month ago 15
Python Question

Convert to np.array, some values automatically being divided

I'm converting a list of strings into a list of lists, and then converting that list into a np.array. The format of each list 5 element array within the np.array of arrays is [latitude, longitude, elevation, index, classifier]. The classifier is

1
if the elevation is above 0.00 (land) or
0
if the elevation is 0.00 (sea).

I've just noticed something strange, which is that list before being converted to an np.array has the correct values for each entry, ie:

[-33.765, 151.303, 49.227, 1373, 1],
[-33.765, 151.305, 0.0, 1374, 0]


where after being converted to an np.array, entries that have a classifier value of
1
(land) have been represented using e, whereas sea entries have remained the same, ie:

[ -33.792 151.402 0. 3635. 0. ]
[ -3.37950000e+01 1.50900000e+02 7.75430000e+01 3.63600000e+03
1.00000000e+00]


I'm not sure even where to begin to try to figure out why this could/would happen. Is this some functionality of numpy arrays that I don't yet understand?

It's just taking in a .txt file containing geodesic coords in this format:

-33.750 151.025 90.882

Answer

The e represents scientific notation. I am not sure why this only happens with the land case, but this StackOverflow question could be helpful in setting up numpy.set_print_options with suppress=True to force floating-point formatting.