<div dir="ltr">Hello:<div><br></div><div>My code still runs out of memory, but not nearly as fast.  This is helpful by itself.</div><div><br></div><div>I have included two version of the code for users who desire to make GEFS mean map plots.  You have to create GEFS/GEFS_XX directories where XX is the GEFS member.</div><div><br></div><div>1) Plotting sea level values of mean GEFS temperatures, humidity, winds, and sea-level pressure.</div><div><br></div><div>2) 700 mb mean GEFS temperatures, humidity, winds, and height.</div><div><br></div><div>I have modified the code sent by Mary to skip over missing files.  This step goes way back to a previous ncl-talk (thanks to Guido who gave a suggestion how to skip over missing files).  Without it, the code can fail if a file is missing.</div><div><br></div><div>I am not sure why the second map does not show a variable title, like the first.  I haven&#39;t had a chance to check timings, yet.</div><div><br></div><div>I don&#39;t see an easy way to take the initial time in the forecast variable &quot;summary,&quot; include the forecast time in hours, and get the real time. So, I still calculate times externally.  I have included &quot;variable.file&quot; in case someone has a suggestion.  We would need to grab the actual time, and then find the new time by adding the number of hours.</div><div><br></div><div>Barry</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 18, 2017 at 6:28 PM, Mary Haley <span dir="ltr">&lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Barry,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">We could provide you with a profiling version of NCL, in which you run your script like normal, but then ncl produces a supplemental file with information about how long certain code segments are taking. It breaks it down by percentage of time spent in various sections.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">This profiling information is a bit clunky because you have to run a script on it and then view it from a browser, but these extra steps may be worth it in order to find out where the code is slow.<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default">To see a sample of how the profiler works, go to:</div><div class="gmail_default"><br></div></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Document/Tools/Profiler/multiple_plots/" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Tools/Profiler/<wbr>multiple_plots/<br></a></div><div class="gmail_default"><br></div>and click on any one of the *.xml (the &quot;<a href="http://www.ncl.ucar.edu/Document/Tools/Profiler/multiple_plots/multiple_plots_ncl__multiple_plots.xml" target="_blank">multiple_plots_ncl__multiple_<wbr>plots.xml</a>&quot; is the main one and a good place to start)<div class="gmail_default" style="font-size:small;display:inline">​.  Look for lines that are colored </div>​<div class="gmail_default" style="font-size:small;display:inline">​in red, as these indicate where more time is being spent.</div><div><div class="gmail_default" style="font-size:small;display:inline">​</div><div><div class="gmail_default" style="font-size:small">You can also use &quot;get_cpu_time()&quot; to track the timings yourself. For example, if you want to time how long it takes to create each set of panel plots, then you would have code that looks like this:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><font face="monospace, monospace">  start_time = get_cpu_time()</font></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">  plot(0) = gsn_csm_contour_map(wks,t_ave,<wbr>res1)</font></div><div class="gmail_default"><font face="monospace, monospace">  plot(1) = gsn_csm_contour_map(wks,rh_<wbr>ave,res2)</font></div><div class="gmail_default"><font face="monospace, monospace">  plotB   = gsn_csm_vector(wks,u_ave_new(:<wbr>:4,::4), \</font></div><div class="gmail_default"><font face="monospace, monospace">                            v_ave_new(::4,::4),vecres)</font></div><div class="gmail_default"><font face="monospace, monospace">  plotD   = gsn_csm_contour(wks,z_ave_new,<wbr>res3)</font></div><div class="gmail_default"><font face="monospace, monospace">  overlay(plot(0),plotB)</font></div><div class="gmail_default"><font face="monospace, monospace">  overlay(plot(1),plotD)</font></div><div class="gmail_default"><font face="monospace, monospace">  gsn_panel(wks,plot,(/2,1/),<wbr>resP)    ; now draw as one plot</font></div></div><div class="gmail_default"><font face="monospace, monospace">  end_time = get_cpu_time()</font></div><div class="gmail_default"><font face="monospace, monospace">  print(&quot;Elapsed time for plotting = &quot; + (end_time-start_time)</font></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you plan to do a lot of these timings, then I recommend a function.  :-)</div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"><br></font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">procedure print_elapsed_time(stime,<wbr>etime,title)</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">begin</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  print(&quot;</font><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">===<wbr>==</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====&quot;)</span></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  print(&quot;Elapsed time for &quot; + title + &quot;: &quot; + (etime-stime))</font></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><font face="monospace, monospace">  print(&quot;</font><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">===<wbr>==</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====</span><span style="font-family:monospace,monospace">=====&quot;)</span></div></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">end</font></div><div class="gmail_default" style="font-size:small"><span style="font-family:monospace,monospace"><br></span></div><div class="gmail_default" style="font-size:small">Then your code would be:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><font face="monospace, monospace">  start_plot_time = get_cpu_time()</font></div><div class="gmail_default"><font face="monospace, monospace">  plot(0) = gsn_csm_contour_map(wks,t_ave,<wbr>res1)</font></div><div class="gmail_default"><font face="monospace, monospace">  plot(1) = gsn_csm_contour_map(wks,rh_<wbr>ave,res2)</font></div><div class="gmail_default"><font face="monospace, monospace">  plotB   = gsn_csm_vector(wks,u_ave_new(:<wbr>:4,::4), \</font></div><div class="gmail_default"><font face="monospace, monospace">                            v_ave_new(::4,::4),vecres)</font></div><div class="gmail_default"><font face="monospace, monospace">  plotD   = gsn_csm_contour(wks,z_ave_new,<wbr>res3)</font></div><div class="gmail_default"><font face="monospace, monospace">  overlay(plot(0),plotB)</font></div><div class="gmail_default"><font face="monospace, monospace">  overlay(plot(1),plotD)</font></div><div class="gmail_default"><font face="monospace, monospace">  gsn_panel(wks,plot,(/2,1/),<wbr>resP)    ; now draw as one plot</font></div><div class="gmail_default"><font face="monospace, monospace">  end_plot_time = get_cpu_time()</font></div><div class="gmail_default"><font face="monospace, monospace">  print_elapsed time(start_plot_time,end_plot_<wbr>time,&quot;Plotting&quot;)</font></div><div class="gmail_default"><br></div><div class="gmail_default">Note that I changed the name from &quot;start_time/end_time to start_plot_time/end_plot_time. This is in case you do a bunch of these, then you can print all the timings at the end, and it also helps keep track of what timings these are associated with.</div><div class="gmail_default"><br></div><div class="gmail_default"><font face="monospace, monospace">  start_read_time = get_cpu_time()</font></div><div class="gmail_default"><font face="monospace, monospace">  .... Code that calls addfile and reads data</font></div><div class="gmail_default"><font face="monospace, monospace">  end_read_time = get_cpu_time()</font></div><div class="gmail_default"><font face="monospace, monospace">  ...</font></div><div class="gmail_default"><font face="monospace, monospace">  start_ave_time = get_cpu_time()</font></div><div class="gmail_default"><font face="monospace, monospace">  .... code that calls average_subset function a bunch of times</font></div><div class="gmail_default"><font face="monospace, monospace">  end_ave_time = get_cpu_time()</font></div><div class="gmail_default"><font face="monospace, monospace">  ...</font></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">  start_plot_time = get_cpu_time()</font></div><div><font face="monospace, monospace">  ,,, code that creates and draws plots ...</font></div><div><div class="gmail_default"><font face="monospace, monospace">  end_plot_time = get_cpu_time()</font></div></div><div><font face="monospace, monospace"><br></font></div></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">  print_elapsed time(start_read_time,end_read_<wbr>time,&quot;Reading data&quot;)</font></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">  print_elapsed time(start_ave_time,end_ave_<wbr>time,&quot;Averages&quot;)</font></div><div></div></div><div><div class="gmail_default"><font face="monospace, monospace">  print_elapsed time(start_plot_time,end_plot_<wbr>time,&quot;Plotting&quot;)</font></div></div><div><br></div></div><div class="gmail_default">Of course, you don&#39;t have to put all the elapsed timing prints at the end.  You can print them out right when the code is done, so you immediately have the information.  It just depends on what you are interested in.</div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">As a side, and Dave or Rick may want to correct me on my understanding on this, but I think one thing that can make your code slow is that you have a lot of print statements. Every time you do something like this:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">   print(&quot;x = &quot; + x)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">versus this:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">print(x)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I believe a string gets stored somewhere in memory. If you have a lot of these, then NCL will get noticeably slower and slower, especially if you are doing this inside do loops with a lot of iterations. I don&#39;t know if you really have enough print statements for this to be a problem, but it&#39;s worth making a mental note of this issue.</div><span class="HOEnZb"><font color="#888888"><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></font></span></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 17, 2017 at 8:06 PM, Barry Lynn <span dir="ltr">&lt;<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear Mary:<div><br></div><div>Thank you. Very helpful!</div><div><br></div><div>I had noticed that my code was running very, very slowly, but being relatively &quot;new&quot; to NCL programming was not sure why.  (Also, it was, as you noted, running out of memory since I &quot;dialed back&quot; the RAM on my account.)</div><div><br></div><div>I will try your code and compare, and get back to the list about the timing differences.</div><span class="m_-5610480789294355575HOEnZb"><font color="#888888"><div><br></div><div>Barry</div></font></span></div><div class="m_-5610480789294355575HOEnZb"><div class="m_-5610480789294355575h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 18, 2017 at 12:26 AM, Mary Haley <span dir="ltr">&lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Barry,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Rick is out this afternoon.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Part of what Rick is suggesting is that if you are done with a variable, then you should delete it in order to free up memory for later calculations. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If I may provide some honest comments about your script overall: if you use some simple &quot;clean coding practices&quot;, this will make it *much* easier for you to debug your own code, and it will certainly make it easier for other people to debug it. It will also help you see where you might have some memory issues.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Here are some suggestions for improving your script:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><b>[1] Use &quot;delete&quot; to remove variables you don&#39;t need any more:</b></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"><span style="white-space:pre-wrap">        </span>t_ave=t_ave-273.16  ; convert to C                                                                        </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        z_ave=z_ave/10.  ; convert to dam                                                                         </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        printMinMax(z_ave,False)</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        u = u * 3.6</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        v = v * 3.6</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        copy_VarCoords(u,u_ave)                         ; copy coord vars to speed                                </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        copy_VarCoords(v,v_ave)                         ; copy coord vars to speed                                </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        copy_VarCoords(z,z_ave)                         ; copy coord vars to speed                                </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        copy_VarCoords(t,t_ave)                         ; copy coord vars to speed                                </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        copy_VarCoords(rh,rh_ave)                         ; copy coord vars to speed   </font></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you no longer need the &quot;u&quot;, &quot;v&quot;, &quot;z&quot;, etc variables, then delete them:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"><span style="white-space:pre-wrap">        </span>t_ave=t_ave-273.16  ; convert to C                                                                        </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        z_ave=z_ave/10.  ; convert to dam                                                                         </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        printMinMax(z_ave,False)</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        u = u * 3.6</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        v = v * 3.6</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        copy_VarCoords(u,u_ave)                         ; copy coord vars to speed                                </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        copy_VarCoords(v,v_ave)                         ; copy coord vars to speed                                </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        copy_VarCoords(z,z_ave)                         ; copy coord vars to speed                                </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        copy_VarCoords(t,t_ave)                              </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        copy_VarCoords(rh,rh_ave)</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">        delete([/u,v,z,t,rh/])                          ;  no longer needed</font></div><div class="gmail_default" style="font-size:small">  </div><div class="gmail_default" style="font-size:small"><b>[2] You are reading several variables and not doing anything with them but printing them out. Reading them in uses memory. </b></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If all you need to do is print them, then print them directly. An example:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">      lv0 = fin-&gt;lv_ISBL0</font></div><div class="gmail_default"><font face="monospace, monospace">      print(&quot;lv0 = &quot; + lv0)</font></div><div class="gmail_default"><font face="monospace, monospace">      lv8 = fin-&gt;lv_ISBL8</font></div><div class="gmail_default"><font face="monospace, monospace">      print(&quot;lv8 = &quot; + lv8)</font></div><div class="gmail_default"><font face="monospace, monospace">      lv10 = fin-&gt;lv_ISBL10</font></div><div class="gmail_default"><font face="monospace, monospace">      print(&quot;lv10 = &quot; + lv10)</font></div></div><div class="gmail_default"><br></div><div class="gmail_default">Do this instead, to save memory:</div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">      print(&quot;lv0 = &quot; + fin-&gt;lv_ISBL0)</font></div><div class="gmail_default"><font face="monospace, monospace">      print(&quot;lv8 = &quot; + fin-&gt;lv_ISBL8)<br></font></div><div class="gmail_default"><font face="monospace, monospace">      print(&quot;lv10 = &quot; + fin-&gt;lv_ISBL10)</font><br></div><div class="gmail_default"><br></div></div><div class="gmail_default"><br></div><b>[3] Avoid putting unchanged code inside do loops.</b></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Your script has two do loops with a bunch of code inside of them that doesn&#39;t change.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Do loops can be slow, so it&#39;s important to keep as much code *outside* of a do loop as possible.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">As an example, these are your two outside do loops:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><font face="monospace, monospace">  do n=0,n_files -1,1</font></div><div class="gmail_default"><font face="monospace, monospace">    do i_dir = 0,n_dirWRF-1</font><br></div><div class="gmail_default"><br></div><div class="gmail_default">Inside these two loops, you have code that looks like this:</div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default"> <font face="monospace, monospace">      res1                     = True</font></div><div class="gmail_default"><font face="monospace, monospace">        res1@mpDataBaseVersion = &quot;Ncarg4_1&quot;           ; choose more recent database                                   </font></div><div class="gmail_default"><span style="font-family:monospace,monospace">        . . .<br>        res1@mpNationalLineThicknessF    = 3.0</span><br></div><div class="gmail_default"><font face="monospace, monospace">        res1@mpGeophysicalLineThicknes<wbr>sF = 2.0</font></div><div><font face="monospace, monospace">      . . .</font></div></div></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"><br></font></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><font face="monospace, monospace">        res1@tiMainString         = time_var</font></div><div class="gmail_default"><font face="monospace, monospace">        res1@gsnDraw             = False           ; don&#39;t draw                                                </font><span style="font-family:monospace,monospace">                </span><span style="font-family:monospace,monospace">res1@cnLevelSelectionMode = &quot;ExplicitLevels&quot;    ; set explicit contour levels  </span></div><div class="gmail_default"><font face="monospace, monospace">        . . .</font></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">        res1@cnInfoLabelOn = False                  ; turn off contour info label                                             </font><span style="font-family:monospace,monospace">res1@lbAutoManage          = False          ; control label bar                                                       </span><span style="font-family:monospace,monospace">res1@lbOrientation         = &quot;Vertical&quot;</span></div><div class="gmail_default"><span style="font-family:monospace,monospace">        . . .                                                               </span><br></div><div class="gmail_default"><font face="monospace, monospace">        res1@lbTopMarginF = 0.001</font></div><div class="gmail_default"><font face="monospace, monospace">        res2                     = True</font></div><div class="gmail_default"><font face="monospace, monospace">        res2                     = True</font></div><div class="gmail_default"><font face="monospace, monospace">        .  . .</font></div><div class="gmail_default"><font face="monospace, monospace">        res2@mpNationalLineThicknessF    = 3.0</font></div><div class="gmail_default"><font face="monospace, monospace">        res2@mpGeophysicalLineThicknes<wbr>sF = 2.0</font></div><div class="gmail_default"><font face="monospace, monospace">        res2@tiMainString         = time_var</font></div><div class="gmail_default"><font face="monospace, monospace">        res2@gsnDraw             = False           ; don&#39;t draw                                                                   </font></div><div class="gmail_default"><font face="monospace, monospace">        . . .</font></div><div class="gmail_default"><font face="monospace, monospace">        res2@lbOrientation         = &quot;Vertical&quot;</font></div><div class="gmail_default"><font face="monospace, monospace">        res2@pmLabelBarSide        = &quot;Right&quot;</font></div><div class="gmail_default"><font face="monospace, monospace">        res2@lbLabelAutoStride =   True</font></div><div class="gmail_default"><font face="monospace, monospace">        res2@pmLabelBarWidthF      = 0.20</font></div><div class="gmail_default"><font face="monospace, monospace">        res2@pmLabelBarHeightF     = 0.7</font></div><div class="gmail_default"><font face="monospace, monospace">        . . .</font></div></div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">None of this code changes inside the do loops, but yet it is getting set again and again for every iteration of the two do loops. In order to speed things up, move as much code as you can to outside the do loop, and only keep things that actually change inside the do loop.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I recommend creating functions to set the various resource lists: set_res1_list, set_res2_list, etc. This may not necessarily save memory, but it makes your code much cleaner.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><b>[4] Use functions for cleaner code.</b></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You have code that is repeated in multiple locations.  This can cause extra memory usage.  If you turn these repeated code segments into NCL functions, then this can save some memory.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">An example, you have:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  i_loc = 1</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  j_loc = 1</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  GET_IJ::get_ij(lat2d,lon2d,lat<wbr>_beg,lon_beg,i_loc,j_loc,nj,ni<wbr>)</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  x_start = i_loc</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  y_start = j_loc</font></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Granted, this doesn&#39;t use a lot of memory, but every time you copy these 5 lines, it makes your script harder to read, and you will slowly use more memory if you do this kind of thing frequently.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Turn the above five lines into a function:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">function get_ij_ncl(lat2d,lon2d,lat_beg<wbr>,lon_beg)</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">local nj, ni</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">begin<br></font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  i_loc = 1</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  j_loc = 1</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  nj = dimsizes(lat2d(:,0))</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  ni = dimsizes(lat2d(0,:))</font></div><div class="gmail_default"><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">  GET_IJ::get_ij(lat2d,lon2d,lat<wbr>_beg,lon_beg,i_loc,j_loc,nj,ni<wbr>)</font></div><div style="font-size:small"><font face="monospace, monospace"> return([/i_loc,j_loc/])</font></div><div style="font-size:small"><font face="monospace, monospace">end</font></div><div style="font-size:small"><br></div><div style="font-size:small">and then call the function with:</div><div style="font-size:small"><br></div><div style="font-size:small"><font face="monospace, monospace">xy_start = get_ij_ncl(lat2d,lon2d,lat_beg<wbr>,lon_beg)</font></div><div style="font-size:small"><br></div><div style="font-size:small">You will then need to change &quot;x_start&quot; to xy_start(0) and &quot;y_start&quot; to xy_start(1)</div><div style="font-size:small"><br></div><div style="font-size:small"><b>[5] Another place where a function would be helpful:</b></div><div style="font-size:small"><br></div><div><div style="font-size:small"><font face="monospace, monospace">  u_ave_new = u_ave(xy_start(1):xy_end(1),xy<wbr>_start(0):xy_end(0))</font></div><div style="font-size:small"><font face="monospace, monospace">  v_ave_new = v_ave(xy_start(1):xy_end(1),xy<wbr>_start(0):xy_end(0))</font></div><div style="font-size:small"><font face="monospace, monospace">  lat2d_new = lat2d(xy_start(1):xy_end(1),xy<wbr>_start(0):xy_end(0))</font></div><div style="font-size:small"><font face="monospace, monospace">  lon2d_new = lon2d(xy_start(1):xy_end(1),xy<wbr>_start(0):xy_end(0))</font></div><div style="font-size:small"><font face="monospace, monospace">; plotB   = gsn_csm_vector(wks,u_ave_new,v<wbr>_ave_new,vecres)                                                                          </font></div><div style="font-size:small"><font face="monospace, monospace">;;;opy_VarCoords(dumb_ave,u_av<wbr>e_new)                                                                                                </font></div><div style="font-size:small"><font face="monospace, monospace">; copy_VarCoords(dumb_ave,v_ave_<wbr>new)                                                                                                </font></div><div style="font-size:small"><font face="monospace, monospace">   u_ave_new!0 = &quot;lat&quot;</font></div><div style="font-size:small"><font face="monospace, monospace">   u_ave_new!1 = &quot;lon&quot;</font></div><div style="font-size:small"><font face="monospace, monospace">   u_ave_new&amp;lat= lat(xy_start(1):xy_end(1))</font></div><div style="font-size:small"><font face="monospace, monospace">   u_ave_new&amp;lon= lon(xy_start(0):xy_end(0))</font></div><div style="font-size:small"><font face="monospace, monospace">   v_ave_new!0 = &quot;lat&quot;</font></div><div style="font-size:small"><font face="monospace, monospace">   v_ave_new!1 = &quot;lon&quot;</font></div><div style="font-size:small"><font face="monospace, monospace">   v_ave_new&amp;lat= lat(xy_start(1):xy_end(1))</font></div><div style="font-size:small"><font face="monospace, monospace">   v_ave_new&amp;lon= lon(xy_start(0):xy_end(0))</font></div><div style="font-size:small"><br></div><div style="font-size:small">Create a function to do the subsetting and attaching of the metadata:</div><div style="font-size:small"><br></div><div style="font-size:small"><font face="monospace, monospace">function average_subset(x,lat,lon,xy_st<wbr>art,xy_end)</font></div><div style="font-size:small"><font face="monospace, monospace">begin</font></div><div style="font-size:small"><font face="monospace, monospace">  x_ave_new = x(xy_start(1):xy_end(1),xy_sta<wbr>rt(0):xy_end(0))</font></div><div><div><font face="monospace, monospace">  x_ave_new!0 = &quot;lat&quot;</font></div><div><font face="monospace, monospace">  x_ave_new!1 = &quot;lon&quot;</font></div></div><div style="font-size:small"><font face="monospace, monospace"><div>  x_ave_new&amp;lat= lat(xy_start(1):xy_end(1))</div><div>  x_ave_new&amp;lon= lon(xy_start(0):xy_end(0))</div><div>  return(x_ave_new)</div></font></div><div style="font-size:small"><font face="monospace, monospace">end</font></div><div style="font-size:small"><br></div></div><div style="font-size:small">so now you can replace the above code with two lines:</div><div style="font-size:small"><br></div><div style="font-size:small"><font face="monospace, monospace">  u_ave_new = average_subset(u_ave,lat,lon,x<wbr>y_start,xy_end)</font></div><div style="font-size:small"><div><font face="monospace, monospace">  v_ave_new = average_subset(v_ave,lat,lon,x<wbr>y_start,xy_end)</font></div><div><br></div><div><b>[6] You created &quot;lat2d_new&quot; and &quot;lon2d_new&quot; but never use them. Again, this is using up memory for no purpose. Remove those two lines.</b></div><div><br></div></div><div style="font-size:small"><b>[7] If you are propagating a smaller array to a larger array, as is the case here:</b></div><div style="font-size:small"><br></div><div style="font-size:small"><div><font face="monospace, monospace">  lat2d = z</font></div><div><font face="monospace, monospace">  lon2d = z</font></div></div><div><div><font face="monospace, monospace">  do j = 0,nj-1</font></div><div><font face="monospace, monospace">  do i = 0,ni-1</font></div><div><font face="monospace, monospace">   lat2d(j,i)=lat(j)</font></div><div><font face="monospace, monospace">   lon2d(j,i)=lon(i)</font></div><div><font face="monospace, monospace">  end do</font></div><div><font face="monospace, monospace">  end do</font></div></div><div><br></div><div>then use conform_dims instead of a do loop:</div><div><br></div><div><font face="monospace, monospace">  lat2d = conform_dims(dims2d,lat,0)  </font></div><div><font face="monospace, monospace">  lon2d = conform_dims(dims2d,lon,1)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">Note that I no longer need the &quot;lat2d = z&quot; or &quot;lon2d = z&quot; code.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">[8] You have this code, and I&#39;m not sure why:</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><div><font face="monospace, monospace">      a = addfile(filename,&quot;r&quot;)</font></div><div><font face="monospace, monospace">      fin = a</font></div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">This seems like an unnecessary copy of &quot;a&quot;.  Why not simply do:</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div><font face="monospace, monospace">  fin = addfile(filename,&quot;r&quot;)</font></div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif"><b>[9] The &quot;gsn_define_colormap&quot; call should not be inside the do loop. Call this right after you call gsn_open_wks.</b></div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif"><b>[10] There&#39;s some random code I don&#39;t understand. For example:</b></div><div style="font-family:arial,helvetica,sans-serif"><br></div><div><div><font face="monospace, monospace">  copy_VarCoords(z,lat2d)</font></div><div><font face="monospace, monospace">  copy_VarCoords(z,lon2d)</font></div></div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">lat2d and lon2d don&#39;t need to have z&#39;s coordinate arrays attached to them for any reason that I can see, so I think you can remove those two lines.</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif"><b>[11] Every time you have a do loop or an if statement, indent all the code inside *consistently* so you can more easily see what part of the code you&#39;re in.</b></div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif"><b>[12] Don&#39;t make extra copies of variables unless you really need to.</b></div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">For example, you have:</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">







<p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619gmail-s1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619gmail-Apple-converted-space">      </span>filename = all_files(n)</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619gmail-p1">There&#39;s really no need to create &quot;filename&quot; since you can just use &quot;all_files(n)&quot;.</p></div><div style="font-family:arial,helvetica,sans-serif">I&#39;ve tried to clean up your code to show you what I&#39;m talking about. The attached script likely won&#39;t run because I don&#39;t have your data to test it.  But, hopefully you can see what I&#39;m doing and mimic this in your code.</div><span class="m_-5610480789294355575m_-359832157629598785HOEnZb"><font color="#888888"><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">--Mary</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif"><br></div></font></span></div></div></div></div></div></div><div class="m_-5610480789294355575m_-359832157629598785HOEnZb"><div class="m_-5610480789294355575m_-359832157629598785h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 17, 2017 at 11:40 AM, Barry Lynn <span dir="ltr">&lt;<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Rick:<div><br></div><div>Thank you for your suggestion.</div><div><br></div><div>Could you please give me some guidelines on how to delete resources.</div><div><br></div><div>I have included the script.  If you can provide an example, I can take it from there.</div><div><br></div><div>Thank you,</div><div><br></div><div>Barry</div></div><div class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619HOEnZb"><div class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 17, 2017 at 5:22 PM, Rick Brownrigg <span dir="ltr">&lt;<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi Barry,<br><br></div>On Linux, an errno=12 is an &quot;out of memory&quot; error.  I doubt that its related directly to the systemfunc() call, but rather due to memory being consumed by your script in previous iterations of the loop.  You might check if there are variables that can be freed (i.e., deleted()) after each iteration.<br><br></div>HTH...<br></div>Rick<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367h5">On Sun, Jul 16, 2017 at 8:56 PM, Barry Lynn <span dir="ltr">&lt;<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367h5"><div dir="ltr">Hi:<div><br></div><div>I have a program that does multiple loops.</div><div><br></div><div>I had this error:</div><div><br></div><div>







<p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">0)<span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-Apple-tab-span">        </span>i_dir = 6</span></p>
<p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">fatal:systemfunc: cannot create child process:[errno=12]</span></p>
<p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">fatal:[&quot;Execute.c&quot;:8640]:Execu<wbr>te: Error occurred at or near line 84 in file ./plot_loop_700mb.ncl</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1"><br></span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">This occurred when reading the file from the sixth directory of 20.</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1"><br></span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">Here was the read from the 5th directory:</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">(0)<span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-Apple-tab-span">        </span>i_dir = 5</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">(0)<span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-Apple-tab-span">        </span>all_files(n) = /home/cust100021_vol1/barry/cu<wbr>st100021_vol2/GEFS/GEFS_05/gep<wbr>05.t00z.pgrb2b.0p50.f084.grb</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">









</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1">Here is a listing of both files:</p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1">They are both present, but the second attempted allocation/definition of the file fails with the read that follows:</p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><br></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">[barry@cust100021-login1 GEFS]$ ls -ltr /home/cust100021_vol1/barry/cu<wbr>st100021_vol2/GEFS/GEFS_05/gep<wbr>05.t00z.pgrb2b.0p50.f084.grb</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">-rw-r--r-- 1 barry cust100021 78985320 Jul 16 04:58 /home/cust100021_vol1/barry/cu<wbr>st100021_vol2/GEFS/GEFS_05/gep<wbr>05.t00z.pgrb2b.0p50.f084.grb</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">[barry@cust100021-login1 GEFS]$ ls -ltr /home/cust100021_vol1/barry/cu<wbr>st100021_vol2/GEFS/GEFS_06/gep<wbr>06.t00z.pgrb2b.0p50.f084.grb</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1">










</p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">-rw-r--r-- 1 barry cust100021 80466702 Jul 16 04:58 /home/cust100021_vol1/barry/cu<wbr>st100021_vol2/GEFS/GEFS_06/gep<wbr>06.t00z.pgrb2b.0p50.f084.grb</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">Here is the read:</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1"><br></span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-Apple-converted-space">  </span>print(&quot;i_dir = &quot; + i_dir)</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-Apple-converted-space">  </span>diri = dirWRF(i_dir) + &quot;/&quot;</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">; define individual file read</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-Apple-converted-space">   </span>all_files = systemfunc(&quot;ls &quot; + diri + &quot;ge*pgrb2b*grb&quot;)</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-Apple-converted-space">   </span>print(&quot;all_files(n) = &quot; + all_files(n))</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1">












</p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-Apple-converted-space">  </span>filename = all_files(n)</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1"><br></span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">Is the problem that I make this allocation multiple times, each directory, each file? Perhaps I should read all files at once into a two dimensional filename array?</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1"><br></span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1">Thanks</span></p><p class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-p1"><span class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail-s1"><br></span></p><div><br></div>-- <br><div class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367m_-1244925744970829752m_-5735885267463024187gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-5610480789294355575m_-359832157629598785m_5532582317255059619m_-390945913059712367gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div>
</div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-5610480789294355575m_-359832157629598785gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US 914 432 3108<br></div></div></div>
</div>