Good morning, I am new to python, but I need it for my research in computational climate simulations for its power.
I need to write a 2D array into a text file, but what I obtain is the correct array, although each value appears within [[ ]];
I use the scripting written below, how should I modify it in order to avoid it to write the parenthesis?
for time in range(data_var_ model.shape[0]):
outfile_model=o pen('msl_data_m odel.txt','a')
outfile_model.w rite(str(data_v ar_model[time,:,:])+' ')
outfile_model.w rite('\n')
With this routine the output looks this way:
[[ [ 101135.46875 ]]
[ [ 101137.046875 ]]
[ [ 101132.5546875]]
[ [ 101133.2109375]]
[ [ 101131.5703125]]
[ [ 101131.65625 ]]
[ [ 101135.890625 ]]
[ [ 101133.203125 ]]
[ [ 101130.5234375]]
[ [ 101134.0390625]]]
Thanks a lot,
simone
I need to write a 2D array into a text file, but what I obtain is the correct array, although each value appears within [[ ]];
I use the scripting written below, how should I modify it in order to avoid it to write the parenthesis?
for time in range(data_var_ model.shape[0]):
outfile_model=o pen('msl_data_m odel.txt','a')
outfile_model.w rite(str(data_v ar_model[time,:,:])+' ')
outfile_model.w rite('\n')
With this routine the output looks this way:
[[ [ 101135.46875 ]]
[ [ 101137.046875 ]]
[ [ 101132.5546875]]
[ [ 101133.2109375]]
[ [ 101131.5703125]]
[ [ 101131.65625 ]]
[ [ 101135.890625 ]]
[ [ 101133.203125 ]]
[ [ 101130.5234375]]
[ [ 101134.0390625]]]
Thanks a lot,
simone
Comment