<div dir="ltr">Hi Andrea,<div><br></div><div>I am not an expert on the GDF format, but the problem seems to be that your fields are not getting the appropriate units defined for them.  For example, you can see this by doing:</div><div>ds=yt.load('GDFhdfaa.0000073.hdf5')<br></div><div>print (ds.r[("gas", "density")])</div><div><br></div><div>You'll notice that they come up as dimensionless.  I believe you can correct this by adding an attribute called "field_units" to each dataset with a string that indicates the units of the data.  For example, with density, you would have "g/cm**3".</div><div><br></div><div>Britton</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 20, 2016 at 4:19 AM, Andrea Negri <span dir="ltr"><<a href="mailto:negri.andre@gmail.com" target="_blank">negri.andre@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I'm using yt to analize ZEUS simulations. I have been able to remap<br>
all the native fields on a custom AMR grid that I created, and I load<br>
the data in the GDF format.<br>
<br>
I'm very happy with this, but when I try to calculate the Xray<br>
emissivity using this little script here:<br>
<br>
import yt<br>
from yt.analysis_modules.spectral_<wbr>integrator.api import \<br>
     add_xray_emissivity_field<br>
<br>
ds=yt.load('GDFhdfaa.0000073.<wbr>hdf5')<br>
xray_fields = add_xray_emissivity_field(ds, 0.2, 8.0,<br>
with_metals=False, constant_metallicity=0.5)<br>
plot = yt.ProjectionPlot(ds, 'x', 'xray_luminosity_0.2_8.0_keV')<br>
<br>
I get the error:<br>
<br>
Traceback (most recent call last):<br>
  File "./xray.py", line 11, in <module><br>
    plot = yt.ProjectionPlot(ds, 'x', 'xray_luminosity_0.2_8.0_keV')<br>
  File "/home/andrea/.yt-dev/yt-<wbr>conda/src/yt-hg/yt/<wbr>visualization/plot_window.py",<br>
line 1495, in __init__<br>
    max_level=max_level)<br>
  File "/home/andrea/.yt-dev/yt-<wbr>conda/src/yt-hg/yt/data_<wbr>objects/construction_data_<wbr>containers.py",<br>
line 263, in __init__<br>
    self.get_data(field)<br>
  File "/home/andrea/.yt-dev/yt-<wbr>conda/src/yt-hg/yt/data_<wbr>objects/construction_data_<wbr>containers.py",<br>
line 337, in get_data<br>
    self._handle_chunk(chunk, fields, tree)<br>
  File "/home/andrea/.yt-dev/yt-<wbr>conda/src/yt-hg/yt/data_<wbr>objects/construction_data_<wbr>containers.py",<br>
line 437, in _handle_chunk<br>
    d = chunk[field] * dl<br>
  File "/home/andrea/.yt-dev/yt-<wbr>conda/src/yt-hg/yt/data_<wbr>objects/data_containers.py",<br>
line 281, in __getitem__<br>
    self.get_data(f)<br>
  File "/home/andrea/.yt-dev/yt-<wbr>conda/src/yt-hg/yt/data_<wbr>objects/data_containers.py",<br>
line 1295, in get_data<br>
    self._generate_fields(fields_<wbr>to_generate)<br>
  File "/home/andrea/.yt-dev/yt-<wbr>conda/src/yt-hg/yt/data_<wbr>objects/data_containers.py",<br>
line 1346, in _generate_fields<br>
    raise YTFieldUnitError(fi, fd.units)<br>
yt.utilities.exceptions.<wbr>YTFieldUnitError: The field function<br>
associated with the field '('gas', 'H_number_density')' returned data<br>
with units 'dimensionless/g' but was defined with units 'cm**-3'.<br>
<br>
<br>
<br>
I tried to check the GDF frontend, but I'm able to understand if the<br>
error is there or somewhere else... You can find a very light dataset<br>
in the GDF format in attachment, if you want ot reproduce the error.<br>
You need to download both files, since in the GDF file there are some<br>
hard links to the amr2 file (still an hdf5 file).<br>
I tried both the stable and the developer version of yt, and the error<br>
is the same.<br>
<br>
Any ideas? I really think that my GDF file is correct, since I'm able<br>
to slice and project all the native fields (density, temperature,<br>
velocities...).<br>
<br>
<br>
Thanks,<br>
Andrea<br>
<br>______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">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/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
<br></blockquote></div><br></div>