Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions doc/source/examining/loading_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3171,12 +3171,15 @@ There are three way to make yt detect all the particle fields. For example, if y
particle_metallicity, d
"""

Each line should contain the name of the field and its data type (``d`` for double precision, ``f`` for single precision, ``i`` for integer and ``l`` for long integer). You can also configure the auto detected fields for fluid types by adding a section ``ramses-hydro``, ``ramses-grav`` or ``ramses-rt`` in the config file. For example, if you customized your gravity files so that they contain the potential, the potential in the previous timestep and the x, y and z accelerations, you can use :
Each line should contain the name of the field and its data type (``d`` for double precision, ``f`` for single precision, ``i`` for integer and ``l`` for long integer). You can also configure the auto detected fields for fluid types by adding a section ``ramses-hydro``, ``ramses-grav`` or ``ramses-rt`` in the config file. For example, if you customized your gravity files so that they contain the potential, the potential in the previous timestep and the x, y and z accelerations, all in single-precision, you can use :

.. code-block:: none

[ramses-grav]
fields = [ "Potential", "Potential-old", "x-acceleration", "y-acceleration", "z-acceleration" ]
fields = [ "Potential,f", "Potential-old,f", "x-acceleration,f", "y-acceleration,f", "z-acceleration,f" ]

Importantly, the order of the fields should match the order in which they are written in the RAMSES output files.
yt will also assume that each entry is formed of a field name followed by its type (``f`` for single precision, ``d`` for double precision), separated by a comma. Field names containing commas are not supported, other precisions (e.g. integers) are not supported either. All fields in a given file type (gravity, hydro, ...) need to have the same precision.

3. New RAMSES way. Recent versions of RAMSES automatically write in their output an ``hydro_file_descriptor.txt`` file that gives information about which field is where. If you wish, you can simply create such a file in the folder containing the ``info_xxxxx.txt`` file

Expand All @@ -3197,6 +3200,8 @@ There are three way to make yt detect all the particle fields. For example, if y
11, metallicity, d

It is important to note that this file should not end with an empty line (but in this case with ``11, metallicity, d``).
Note that, for grid fields (hydro, gravity, rt), all the fields need to have the same precision (``f`` or ``d``).
Combinations are not supported.

.. note::

Expand Down
12 changes: 10 additions & 2 deletions yt/frontends/ramses/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ def _fill_no_ghostzones(self, fd, fields, selector, file_handler):
fields,
data,
oct_handler,
file_handler.single_precision,
)
return data

Expand Down Expand Up @@ -507,6 +508,7 @@ def _fill_with_ghostzones(
fields,
tr,
oct_handler,
file_handler.single_precision,
domain_inds=domain_inds,
)
return tr
Expand Down Expand Up @@ -805,7 +807,7 @@ def __init__(
if isinstance(fields, str):
fields = field_aliases[fields]
"""
fields:
fields: list[tuple[str, str]] | list[str] | None
An array of hydro variable fields in order of position in the
hydro_XXXXX.outYYYYY file. If set to None, will try a default set of fields.

Expand All @@ -822,7 +824,13 @@ def __init__(
This affects the fields related to cooling and the mean molecular weight.
"""

self._fields_in_file = fields
self._fields_in_file: list[tuple[str, str]] = []
if fields:
for field in fields:
if isinstance(field, tuple):
self._fields_in_file.append(field)
else:
self._fields_in_file.append((field, "d"))
# By default, extra fields have not triggered a warning
self._warned_extra_fields = defaultdict(lambda: False)
self._extra_particle_fields = extra_particle_fields
Expand Down
Loading
Loading