<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Ioannis,</div><div class=""><br class=""></div>Sorry, I oversaw one point in your script, the "density weighted sum”. However, <div class=""><blockquote type="cite" class=""><div class="Section1" style="page: Section1;"><div class="" style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="EN-US" class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">I would like to calculate the average value for big number of files wrfoutput which it seems to be infeasible with the revised version of the script (readwrite_dust_all_2_Jack….</span></div></div></blockquote><div class="">for which dimension do you want to calculate the average? time? level? It was not clear in your first email and unfortunately it is still not clear in your recent email what you mean by “average”. If the rest of your files have been written at each time step as it seems to be with the two files you uploaded, then the only possible average will be in “levels” if you want the output as indicated in the last email.</div><div class=""><br class=""></div><div class="">Sure, you wouldn’t use “readwrite_dust_all_2_Jack…” script to read multiple files. In this case you need the “addfiles” function. Please, find attached a modification of your latest script. Unlike the earlier script, I have stayed as close as possible to the original coding and I have only added “addfiles” and “dim_sum_n” functions to your script. You can read more about the functions in the documentation.</div><div class=""><br class=""></div><div class="">Assuming you mean to calculate average in the vertical direction, just switch between</div><div class="">;==</div><div class=""><div class=""> dust_tot = dust_J(level,:,:)</div><div class="">;==</div><div class="">and</div><div class="">;==</div><div class=""> ;+dust_tot = dim_avg_n(dust_J,0)</div></div><div class="">;==</div><div class="">in lines 54 and 56 respectively, otherwise for the two data files you uploaded, the modified script should give you the exact numbers as your original script(you should confirm it). If you add more files, the modified script should print to the output file multiple columns representing values from each file.</div><div class=""><br class=""></div><div class="">If you need further clarification/help, don’t hesitate to write back to the ncl-talk. </div><div class=""><br class=""></div><div class="">Jack</div><div class=""><br class=""></div><div class=""></div></div></body></html>