Reputation: 83
I am trying to view the full output of
print(MyDataArray)
instead of the shortened version which displays
array([[[[[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
...,
[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00]],
(this is a code snippet and not the full output i get)
basically i'm trying to get rid of the ...
.
I would like to see this output just as plain text, or written to a text file. I would like to maintain the current formatting.
I have already tried a number of things
display_max_rows
to a very large number (this is an option of xarray)Upvotes: 2
Views: 1834
Reputation: 83
I just solved my own question, I'm posting this information if somebody also encounters this problem. My solution is a workaround
new_numpy_ndarray = existing_xarray_DataArray.to_numpy()
np.set_printoptions(threshold=np.Inf)
print(new_numpy_array)
this allows you to then view your array in full. Thank you to whoever recommended
np.set_printoptions(threshold=np.Inf)
this gave me the idea to convert my array to numpy
Upvotes: 4