<div dir="ltr">Sorry, I didn't realize that I didn't reply to NCL talk....<div><br></div><div>See below a much simplified version of the code. By using top, VIRT and RES increase substantially through each iteration of the day loop. If I comment out the addfiles line and subsequent delete calls, there is no problem memory-wise. Why is there iteratively more memory consumption upon the addfiles call?</div><div><br></div><div>Thanks,</div><div>-Stefan</div><div><br></div><div>





<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">begin</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">domain<span class="gmail-Apple-converted-space">  </span>= "d01"</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">dir<span class="gmail-Apple-converted-space">  </span>= "/glade/scratch/srahimi/ucla/downscale/test/WRF-4.1.3/test/"</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">ndays = 365</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">iyear = 2019</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>dir_x =<span class="gmail-Apple-converted-space">  </span>dir + "MPI_r8_" + iyear + "/" + domain + "/"</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>print (dir_x+"")</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>file_str = "wrfout*"</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>filei = systemfunc("cd " + dir_x + " ; ls " + file_str)</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>day_count = 1</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>do iday = 0, ndays - 1</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">  </span>files = filei(4*(day_count-1):4*day_count-1)</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">  </span>ff = addfiles(dir_x+files,"r")</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">  </span>delete(ff)</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>end do <span class="gmail-Apple-converted-space">        </span>;end day loop</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:25px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Andale Mono";color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">end</span></p></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 8, 2020 at 11:56 AM Dennis Shea <<a href="mailto:shea@ucar.edu">shea@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello,</div><div><br></div><div>It is always best to respond the ncl-talk. I am sure there are people who know more than me about these types of issues.</div><div>---</div><div>FYI: to my knowledge,</div><div><br></div><div><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">ff = addfiles(dir_x+files,"r")</span></div><div><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">The 'ff' is a variable of type 'list' Each element of 'ff' is a pointer [one 'location'] to each variable. So, it is not consuming memory. <br></span></div><div><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">I am not aware of any memory leaks associated with netCDF files.</span></div><div><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">Again, I will look this evening.</span></div><div><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">Cheers</span></div><div><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">D<br></span></div><div><br></div><div><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"></span></span><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"></span></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 8, 2020 at 11:27 AM STEFAN RAHIMI-ESFARJANI <<a href="mailto:s.rahimi@ucla.edu" target="_blank">s.rahimi@ucla.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Dennis,<div><br></div><div>As you can see in this much simplified version of the code, the problem just described persists....</div><div><br></div><div>/glade/scratch/srahimi/test.ncl</div><div><br></div><div>Thanks so much,</div><div>-Stefan</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 8, 2020 at 11:23 AM STEFAN RAHIMI-ESFARJANI <<a href="mailto:s.rahimi@ucla.edu" target="_blank">s.rahimi@ucla.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks for the reply,<div><br></div><div>The program is trying to write the created <a href="http://etrans_sfc.daily.mpi-esm1-2-lr_ssp370_r8i1p1f1_d01_1980.nc/" target="_blank">etrans_sfc</a>...nc to the /files directory. Since this directory isn't in your work directory, that is where the explicit issue is happening that you see.</div><div><br></div><div>My issue is that, if you run the code for 365 days for a given year, top -u shea, you will see that there is a steady increase in VIRT and RES memory associated with the line ff = addfiles(stuff). Even when ff is deleted, the increase persists. This problem is independent of the .nc write follwoing the completion of the day loop, and the problem persists even if all var_wrf variables are removed from the code... </div><div><br></div><div>I have seen references to this type of leak before with GRB2 files (<a href="https://mailman.ucar.edu/pipermail/ncl-talk/2017-June/009365.html" target="_blank">https://mailman.ucar.edu/pipermail/ncl-talk/2017-June/009365.html</a>), but it seems that iterations of NCL versions solved this issue with addfile....</div><div><br></div><div>Is there a different way to release memory for ff?</div><div><br></div><div>Thanks,</div><div>-Stefan</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 8, 2020 at 11:02 AM Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I copied your script and ran it with a few print statements added:<br></div><div><br></div><div>/glade/work/shea/test.mem_leak.ncl</div><div><br></div><div>%> ncl test.mem_leak.ncl</div><div><br></div><div>==================</div><div>/glade/work/shea>ncl test.mem_leak.ncl<br> Copyright (C) 1995-2019 - All Rights Reserved<br> University Corporation for Atmospheric Research<br> NCAR Command Language Version 6.6.2<br> The use of this software is governed by a License Agreement.<br> See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more details.<br>(0)  /glade/scratch/srahimi/interp/meta2/wrfinput_d01<br><br>Variable: var_wrf<br>Type: float<br>Total Size: 16550560 bytes<br>            4137640 values<br>Number of Dimensions: 3<br>Dimensions and sizes:        [365] x [104] x [109]<br>Coordinates: <br>Number Of Attributes: 1<br>  _FillValue :  9.96921e+36<br>(0)        ------------------<br>(0) /glade/scratch/srahimi/ucla/downscale/test/WRF-4.1.3/test/MPI_r8_1980/d01/<br>(0) iyear=1980: iday=0<br>(0) iyear=1980: iday=1<br>(0) iyear=1980: iday=2</div><div>[SNIP]</div><div>0)        iyear=1980: iday=362<br>(0)       iyear=1980: iday=363<br>(0)       iyear=1980: iday=364<br>(0)       ====================<br>(0)       ===EXIT IDAY LOOP===<br>(0)       ====================<br><br>Variable: var_wrf<br>Type: float<br>Total Size: 16550560 bytes<br>            4137640 values<br>Number of Dimensions: 3<br>Dimensions and sizes:    [day | 365] x [lat2d | 104] x [lon2d | 109]<br>Coordinates: <br>            day: [19800901..19810831]<br>Number Of Attributes: 2<br>  units :    mm/d<br>  _FillValue :   9.96921e+36<br>(0)         <br>(0)  min=0   max=4.89127<br>(0)       ====================</div><div><br></div><div>/bin/rm: cannot remove 'files/<a href="http://etrans_sfc.daily.mpi-esm1-2-lr_ssp370_r8i1p1f1_d01_1980.nc" target="_blank">etrans_sfc.daily.mpi-esm1-2-lr_ssp370_r8i1p1f1_d01_1980.nc</a>': No such file or directory<br>fatal:Could not create (files/<a href="http://etrans_sfc.daily.mpi-esm1-2-lr_ssp370_r8i1p1f1_d01_1980.nc" target="_blank">etrans_sfc.daily.mpi-esm1-2-lr_ssp370_r8i1p1f1_d01_1980.nc</a>)<br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 113 in file test.mem_leak.ncl</div><div><br></div><div>+++++++++++++++++++++++++++++</div><div>The 'iday'  loop has <br></div><div><br></div><div> 63  do iday = 0, ndays - 1<br> 64 <br> 65   files = filei(4*(day_count-1):4*day_count-1)<br> 66 ;;print (files) ;each is a string</div><div><br></div><div>The following is after the loop. 'files' is a 1D array of strings. If so,  the following looks incorrect.<br></div><div><br></div><div>/bin/rm: cannot remove 'files/<a href="http://etrans_sfc.daily.mpi-esm1-2-lr_ssp370_r8i1p1f1_d01_1980.nc" target="_blank">etrans_sfc.daily.mpi-esm1-2-lr_ssp370_r8i1p1f1_d01_1980.nc</a>': No such file or directory</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 8, 2020 at 9:24 AM STEFAN RAHIMI-ESFARJANI via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">Greetings,</span><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">I spent a lot of time developing post-processing software for my research, which are written in NCL. The code here creates single-year files of daily evapotranspiration values on a lat/lon grid f(time,lat,lon). I am experiencing a memory leak that is affecting my ability to run these jobs using Cheyenne compute nodes.</span><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">In short, I have traced the memory leak to the following line (70) in /glade/scratch/srahimi/interp/</span><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">mpi_r8/test.ncl on Cheyenne or see below:</span><div><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">ff = addfiles(dir_x+files,"r")</span><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">The files are wrfout .nc files. Variable "ff" should be deleted 2 lines later, and that space should be re-used throughout each iteration of the loop. What seems to be happening however is that new memory is being allocated for ff in each iteration of the loop, eventually overpowering the core and the node.</span><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">I know ways around this in python, but I really do not want to rewrite these scripts at present. Any suggestions?</span><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">Thanks,</span><br style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">-Stefan Rahimi, UCLA</span><br></div><div><span style="color:rgb(23,43,77);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px"><br></span></div><div><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">;Created by S. Rahimi on 15 Jan. 2020</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">;to interpolate WRF fields toa common</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">;0.03 rectilinear grid</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">;Daily averages from 6-h data</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">;For a 2-D variable</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">;f = f(year,day,ny,nx)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">begin</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">var = "etrans_sfc"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">model  = "mpi-esm1-2-lr"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">variant  = "r8i1p1f1"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">ssp  = "ssp370"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">freq = "daily"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">domain  = "d01"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">startyear  = 1980</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">endyear  = 1989</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">year0 = 1980</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">dir  = "/glade/scratch/srahimi/ucla/downscale/test/WRF-4.1.3/test/"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">dir_inp  = "/glade/scratch/srahimi/interp/meta2/"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">file_wrfinput  = "/glade/scratch/srahimi/interp/meta2/wrfinput_d01"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">s2d = 86400.</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">ndays = 365</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">nyears = endyear - startyear + 1</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">nx  = 109</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">ny  = 104</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">;lat/lon from wrfinput</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">print (file_wrfinput+"")</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">f = addfile(file_wrfinput,"r")</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">lat_wrf = f->XLAT(0,:,:)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">lon_wrf = f->XLONG(0,:,:)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">delete(f)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">years = ispan(startyear,endyear,1)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">days = new((/ndays/),"integer")</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">var_wrf = new((/ndays,ny,nx/),"float")</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">do iyear = startyear, endyear</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">if (iyear .eq. 2014 ) then</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">        continue</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">end if</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> dir_x =  dir + "MPI_r8_" + iyear + "/" + domain + "/"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> print (dir_x+"")</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> file_str = "wrfout*"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> filei = systemfunc("cd " + dir_x + " ; ls " + file_str)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> day_count = 1</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> do iday = 0, ndays - 1</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  files = filei(4*(day_count-1):4*day_count-1)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  print (files) ;each is a string</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  date_str = stringtochar(files(0))</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  date = tostring(date_str(11:14)) + tostring(date_str(16:17)) + tostring(date_str(19:20))</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  days(iday) = stringtointeger(date)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  ff = addfiles(dir_x+files,"r")</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  var_wrf(iday,:,:) =  dim_avg_n_Wrap(ff[0:dimsizes(files)-1]->ETRAN,0) * s2d</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  delete(ff)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  var_wrf(iday,:,:) = where(abs(var_wrf(iday,:,:)).gt.1e20,0., var_wrf(iday,:,:))</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  day_count = day_count + 1</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  delete(files)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> end do         ;end day loop</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> var_wrf!0 = "day"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> var_wrf!1 = "lat2d"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> var_wrf!2 = "lon2d"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> var_wrf&day = days</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> var_wrf@units = "mm/d"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> ;Write to .nc files</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> dirout = "files/"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> fil_out = var + "." + freq + "." + \</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  model + "_" + ssp + "_" + variant + "_" + \</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">  domain + "_" + iyear + ".nc"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> outfile = dirout+fil_out</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> system("/bin/rm " +outfile)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> ncdf = addfile(outfile ,"c")  ; open output netCDF file</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> ;setfileoption(outfile,"DefineMode",True)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> fAtt               = True            ; assign file attributes</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> fAtt@title         = var+ " for  "+iyear</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> fAtt@Conventions   = "None"</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> fAtt@creation_date = systemfunc("date")</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> ;fileattdef(ncdf,f[0])            ; copy file attributes</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> filedimdef(ncdf,"region",-1,True)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> ncdf->$var$ = var_wrf</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures"> delete(ncdf)</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">end do          ;end year loop</span></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9);min-height:6px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:5px;line-height:normal;font-family:"Andale Mono";margin:0px;color:rgb(47,255,18);background-color:rgba(0,0,0,0.9)"><span style="font-variant-ligatures:no-common-ligatures">end</span></p><br></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>