[yt-svn] commit/yt: jzuhone: 1) Removing caching of facevars variable names since they are of a different shape than cell-centered variables and we wouldn't be reading them in right anyway. My bad.

Bitbucket commits-noreply at bitbucket.org
Thu Mar 29 11:18:42 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/48de2f60f2a2/
changeset:   48de2f60f2a2
branch:      yt
user:        jzuhone
date:        2012-03-28 21:58:04
summary:     1) Removing caching of facevars variable names since they are of a different shape than cell-centered variables and we wouldn't be reading them in right anyway. My bad.
2) String runtime parameters/scalars need to have their values stripped of trailing spaces before including them in the parameters dict. This was causing a problem with correctly identifying "pf.parameters['pc_unitsbase']" as "CGS"
affected #:  1 file

diff -r 6b1e902e3e254030b8c41061c222c2b1a152cb9a -r 48de2f60f2a2ddfe01a85b904934c82cc886d9de yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -79,13 +79,6 @@
     def _detect_fields(self):
         ncomp = self._handle["/unknown names"].shape[0]
         self.field_list = [s for s in self._handle["/unknown names"][:].flat]
-        facevars = [s for s in self._handle
-                    if s.startswith(("fcx","fcy","fcz")) and s[-1].isdigit()]
-        nfacevars = len(facevars)
-        if (nfacevars > 0) :
-            ncomp += nfacevars
-            for facevar in facevars :
-                self.field_list.append(facevar)
         if ("/particle names" in self._handle) :
             self.field_list += ["particle_" + s[0].strip() for s
                                 in self._handle["/particle names"][:]]
@@ -232,7 +225,7 @@
             self._setup_comoving_units()
         if "pc_unitsbase" in self.parameters:
             if self.parameters["pc_unitsbase"] == "CGS":
-                self.setup_cgs_units()
+                self._setup_cgs_units()
         else:
             self._setup_nounits_units()
         self.time_units['1'] = 1
@@ -337,11 +330,16 @@
         for hn in hns:
             if hn not in self._handle:
                 continue
-            for varname, val in self._handle[hn]:
+            for varname, val in zip(self._handle[hn][:,'name'],
+                                    self._handle[hn][:,'value']):
                 vn = varname.strip()
-                if vn in self.parameters and self.parameters[vn] != val:
+                if hn.startswith("string") :
+                    pval = val.strip()
+                else :
+                    pval = val
+                if vn in self.parameters and self.parameters[vn] != pval:
                     mylog.warning("{0} {1} overwrites a simulation scalar of the same name".format(hn[:-1],vn)) 
-                self.parameters[vn] = val
+                self.parameters[vn] = pval
         self.domain_left_edge = na.array(
             [self.parameters["%smin" % ax] for ax in 'xyz']).astype("float64")
         self.domain_right_edge = na.array(

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