<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 7, 2017 at 1:42 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>></span> wrote:<br><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"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-">On Tue, Feb 7, 2017 at 1:13 PM, Yingchao Lu <span dir="ltr"><<a href="mailto:yingchao.lu@rice.edu" target="_blank">yingchao.lu@rice.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_-8726686279885370604m_3565231475041202178WordSection1"><p class="MsoNormal"><span style="font-size:11pt">Hi All,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt">I want to do a time query over multiply hdf5 files as following:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt">import yt<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt">from glob import glob<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt">fns = glob(‘flash_hdf5_plf_*’)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt">data = []<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt">for fn in fns:<u></u><u></u></span></p><p class="MsoNormal" style="text-indent:10.15pt"><span style="font-size:11pt">ds = yt.load(fn)<u></u><u></u></span></p><p class="MsoNormal" style="text-indent:10.15pt"><span style="font-size:11pt">pt = ds.point([0,0,0])<u></u><u></u></span></p><p class="MsoNormal" style="text-indent:10.15pt"><span style="font-size:11pt">data.append([ds.parameters[‘ti<wbr>me’], pt.mean(‘tele’)])<u></u><u></u></span></p><p class="MsoNormal" style="text-indent:10.15pt"><span style="font-size:11pt">ds.close()<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt">print data<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt">At the beginning, it takes about 1s to process each file. But later, it becomes slower and slower. Finally, 100 files cost 10 minutes, much large than 1s*100. I guess maybe the database is not fully closed. </span></p></div></div></blockquote><div><br></div></span><div>Doing "del ds" should completely close and free the dataset object (although python's garbage collector should be doing that each iteration of your for loop).</div><div><br></div><div>There are some operations in your script (in particular "pt.mean('tele')") that might be slower later in the time series, especially if the number of cells in the simulation increases with time.</div><div> </div></div></div></div></blockquote><div><br></div><div>To make this a bit more concrete, I went ahead and made a test script that uses some of the public data on <a href="http://yt-project.org/data">yt-project.org/data</a>. You can find it here:</div><div><br></div><div><a href="http://paste.yt-project.org/show/7018/">http://paste.yt-project.org/show/7018/</a><br></div><div><br></div><div>This particular time series has 70 outputs, so not as many as yours.</div><div><br></div><div>The output I get from running this script is here:</div><div><br></div><div><a href="http://paste.yt-project.org/show/7019/">http://paste.yt-project.org/show/7019/</a><br></div><div><br></div><div>Each loop iteration takes about a second and I don't see any appreciable increase as we get later in the time series.</div><div><br></div><div>When you run that script on your time series (replacing pt['temp'] with pt['tele']), do you get different answers? If so can you share them on the yt pastebin? Can you also share which yt version you're using?</div><div><br></div><div>If you can also share the dataset that's triggering this behavior, that would also be helpful. If it's ok to publicly post it, you can share your dataset using the yt curldrop:</div><div><br></div><div><a href="https://docs.hub.yt/services.html#curldrop">https://docs.hub.yt/services.html#curldrop</a><br></div><div> </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 class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-"><div lang="EN-US"><div class="gmail-m_-8726686279885370604m_3565231475041202178WordSection1"><p class="MsoNormal"><span style="font-size:11pt">When I try ds.field_info() after ds.close(), it still displays the field information. Does anyone have the same problem?<span class="gmail-m_-8726686279885370604HOEnZb"><font color="#888888"><u></u><u></u></font></span></span></p><span class="gmail-m_-8726686279885370604HOEnZb"><font color="#888888"><p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt">Yingchao<u></u><u></u></span></p></font></span></div></div><br></span>______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.<wbr>org</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div></div>