[yt-users] units_override not working for Flash or Enzo datasets

John ZuHone jzuhone at gmail.com
Thu Jul 16 11:58:23 PDT 2015


Hi Alex,

Actually, it is working for me over here.

I think that the reason why it’s not working for you might have to do with your script. 

Are you testing it by loading the dataset once without units_override, and then loading it again with it? That actually won’t work, because yt will not reload the dataset the second time, and won’t change anything. If I just load with units_override from the beginning, I can verify the units have changed.

Otherwise, we might have another issue.

Best,

John

> On Jul 16, 2015, at 2:35 PM, Alex Hill <ashill at haverford.edu> wrote:
> 
> Hi,
> 
> I’m trying to use the units_override option in loaddata (because I have a data set with metadata labeling itself as cgs but is actually in kpc-Myr-Msun units), following the example in the documentation here: <http://yt-project.org/doc/analyzing/units/comoving_units_and_code_units.html>
> 
> I find that, for data sets created with FLASH 2.5 and FLASH 4.2, units_override does nothing. units_override also does nothing for the sample enzo data sets enzo_tiny_cosmology and IsolatedGalaxy. It *does* work for the sample Athena data set.
> 
> Any suggestions? Is units_override supported for Athena but not for Flash or Enzo?
> 
> Examples here and copied below with the output: <http://paste.yt-project.org/show/5713/>
> 
> units_override={"length_unit":(1.0,"cm"),"time_unit":(1.0,"s"),"mass_unit":(1.0,"g")}
> ds=yt.load('/Users/hil32p/src/yt/doc/source/quickstart/IsolatedGalaxy/galaxy0030/galaxy0030')
> print ds.length_unit
> print ds.mass_unit
> print ds.time_unit
> 
> output:
> 
> 3.086e+24 cm
> 8.11471080586e+43 g
> 2.32946e+18 s
> 
> ds=yt.load('/Users/hil32p/src/yt/doc/source/quickstart/IsolatedGalaxy/galaxy0030/galaxy0030',units_override=units_override)
> print ds.length_unit
> print ds.mass_unit
> print ds.time_unit
> 
> output:
> 
> 3.086e+24 cm
> 8.11471080586e+43 g
> 2.32946e+18 s
> 
> However, it does work for the Athena dataset used in the example:
> 
> ds = yt.load('/Users/hil32p/Downloads/MHDSloshing/virgo_low_res.0054.vtk')
> 1.0 cm
> 1.0 g
> 1.0 s
> 
> units_override={"length_unit":(1.0,"kpc"),"time_unit":(1.0,"Myr"),"mass_unit":(1.0,"Msun")}
> ds = yt.load('/Users/hil32p/Downloads/MHDSloshing/virgo_low_res.0054.vtk', units_override=units_override)
> 1.0 kpc
> 1.0 Msun
> 1.0 Myr
> 
> I am running yt 3.1 with python 2.7, both installed via conda.
> 
> Cheers,
> Alex
> 
> ---------
> Alex Hill
> Senior Postdoctoral Research Associate
> Strawbridge Observatory
> Department of Astronomy, Haverford College
> 370 Lancaster Ave, Haverford, PA 19041 USA
> phone: +1 484 297 2136
> email/iMessage: ashill at haverford.edu
> 
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org




More information about the yt-users mailing list