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
- increasing
display_max_rows
to a very large number (this is an option of xarray) - writing to an npz file, this resulted in a file I could only open in python, not allowing me to see it in plain text
- exporting it to a normal python file (instead of jupyter notebook) and trying to print it from there
CodePudding user response:
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