[yt-svn] commit/yt: ngoldbaum: Fix loading athena data in python3 with provided parameters

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Oct 21 18:41:01 PDT 2015


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/d77e881944f8/
Changeset:   d77e881944f8
Branch:      yt
User:        ngoldbaum
Date:        2015-10-21 18:17:14+00:00
Summary:     Fix loading athena data in python3 with provided parameters
Affected #:  2 files

diff -r 35741b799d57ac96134c4f869cfa92e8c4f9e2be -r d77e881944f88d7d4fce3c90b4fec115cf0180ce yt/frontends/athena/data_structures.py
--- a/yt/frontends/athena/data_structures.py
+++ b/yt/frontends/athena/data_structures.py
@@ -457,7 +457,7 @@
             units_override = {}
         # This is for backwards-compatibility
         already_warned = False
-        for k,v in self.specified_parameters.items():
+        for k, v in list(self.specified_parameters.items()):
             if k.endswith("_unit") and k not in units_override:
                 if not already_warned:
                     mylog.warning("Supplying unit conversions from the parameters dict is deprecated, "+

diff -r 35741b799d57ac96134c4f869cfa92e8c4f9e2be -r d77e881944f88d7d4fce3c90b4fec115cf0180ce yt/frontends/athena/tests/test_outputs.py
--- a/yt/frontends/athena/tests/test_outputs.py
+++ b/yt/frontends/athena/tests/test_outputs.py
@@ -25,6 +25,8 @@
 from yt.config import ytcfg
 from yt.convenience import load
 
+import yt.units as u
+
 _fields_cloud = ("scalar[0]", "density", "total_energy")
 
 cloud = "ShockCloud/id0/Cloud.0050.vtk"
@@ -64,9 +66,9 @@
 
 sloshing = "MHDSloshing/virgo_low_res.0054.vtk"
 
-uo_sloshing = {"length_unit":(1.0,"Mpc"),
-               "time_unit":(1.0,"Myr"),
-               "mass_unit":(1.0e14,"Msun")}
+uo_sloshing = {"length_unit": (1.0,"Mpc"),
+               "time_unit": (1.0,"Myr"),
+               "mass_unit": (1.0e14,"Msun")}
 
 @requires_file(sloshing)
 def test_nprocs():
@@ -79,6 +81,11 @@
     sp2 = ds2.sphere("c", (100.,"kpc"))
     prj2 = ds1.proj("density",0)
 
+    ds3 = load(sloshing, parameters=uo_sloshing)
+    assert_equal(ds3.length_unit, u.Mpc)
+    assert_equal(ds3.time_unit, u.Myr)
+    assert_equal(ds3.mass_unit, 1e14*u.Msun)
+
     yield assert_equal, sp1.quantities.extrema("pressure"), sp2.quantities.extrema("pressure")
     yield assert_allclose_units, sp1.quantities.total_quantity("pressure"), sp2.quantities.total_quantity("pressure")
     for ax in "xyz":

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