[yt-svn] commit/yt: ngoldbaum: TimeSeriesData.from_filenames() reads from the test data dir if the glob fails.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Oct 28 07:02:09 PDT 2013


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/7d4f39cdfb79/
Changeset:   7d4f39cdfb79
Branch:      yt
User:        ngoldbaum
Date:        2013-10-28 07:29:21
Summary:     TimeSeriesData.from_filenames() reads from the test data dir if the glob fails.
Affected #:  1 file

diff -r e4575d3f2e046376d422b8ae73f8050477536a1d -r 7d4f39cdfb791a92a1d1dc7d6d4b5e26d8c32394 yt/data_objects/time_series.py
--- a/yt/data_objects/time_series.py
+++ b/yt/data_objects/time_series.py
@@ -13,10 +13,11 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import inspect, functools, weakref, glob, types
+import inspect, functools, weakref, glob, types, os
 
 from yt.funcs import *
 from yt.convenience import load
+from yt.config import ytcfg
 from .data_containers import data_object_registry
 from .analyzer_objects import create_quantity_proxy, \
     analysis_task_registry, AnalysisTask
@@ -250,10 +251,17 @@
         """
         
         if isinstance(filenames, types.StringTypes):
-            filenames = glob.glob(filenames)
+            if len(glob.glob(filenames)) == 0:
+                data_dir = ytcfg.get("yt", "test_data_dir")
+                pattern = os.path.join(data_dir, filenames)
+                td_filenames = glob.glob(pattern)
+                if len(td_filenames) > 0:
+                    filenames = td_filenames
+                else:
+                    raise YTOutputNotIdentified(filenames, {})
+            else:
+                filenames = glob.glob(filenames)
             filenames.sort()
-        if len(filenames) == 0:
-            raise YTOutputNotIdentified(filenames, {})
         obj = cls(filenames[:], parallel = parallel, **kwargs)
         return obj

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list