Skip to content
Merged
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
16 changes: 6 additions & 10 deletions doc/source/Python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ a parcel of gas at constant density or in a free-fall model. Each example
will produce a figure as well as a dataset that can be loaded and analyzed
with `yt <http://yt-project.org/>`__.

Configuring the path to Grackle input data
++++++++++++++++++++++++++++++++++++++++++
Editable Install Requirement
++++++++++++++++++++++++++++

All of the example scripts discussed below use the following line to
make a guess at where the Grackle input files are located.
Expand All @@ -195,19 +195,15 @@ make a guess at where the Grackle input files are located.

from pygrackle.utilities.data_path import grackle_data_dir

This will typically work for any 'editable' Pygrackle installation
This currently **ONLY** works for an 'editable' Pygrackle installation
(i.e., one installed with ``pip install -e .`` as directed
above). In this case, it will be assumed that the data files can be
found in a directory called ``input`` in the top level of the source
repository. However, this will not work with non-editable
installations. In this case you can use the ``GRACKLE_DATA_DIR``
environment variable to set the path to the data. This will be picked
up by the Python code above and the ``grackle_data_dir`` variable will
contain the proper path.
repository.

.. code-block:: shell-session
.. note::

export GRACKLE_DATA_DIR=/path/to/data
`GitHub PR #235 <https://github.com/grackle-project/grackle/pull/235>`__ is a pending pull request that seeks to add functionality to make this work in a regular Pygrackle installation (i.e. a non-'editable' install).

Cooling Rate Figure Example
+++++++++++++++++++++++++++
Expand Down
60 changes: 0 additions & 60 deletions src/clib/c_wrappers/wrap_interpolators_g.c

This file was deleted.

4 changes: 2 additions & 2 deletions src/include/grackle_fortran_interface.def
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ c The following define the fortran interfaces to the C routines
IMPORT
TYPE(grackle_units), INTENT(IN) :: my_units
TYPE(grackle_field_data), INTENT(IN) :: my_fields
REAL(C_DOUBLE), INTENT(IN) :: dt
REAL(C_DOUBLE), VALUE, INTENT(IN) :: dt
END FUNCTION solve_chemistry
END INTERFACE

Expand Down Expand Up @@ -252,4 +252,4 @@ c The following define the fortran interfaces to the C routines
IMPORT
TYPE(grackle_field_data), INTENT(INOUT) :: my_fields
END FUNCTION gr_initialize_field_data
END INTERFACE
END INTERFACE
14 changes: 3 additions & 11 deletions src/python/pygrackle/utilities/data_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,12 @@
from pygrackle.__config__ import _is_editable_installation
from pygrackle.utilities.misc import dirname

grackle_data_dir = os.environ.get("GRACKLE_DATA_DIR")
if (grackle_data_dir is None) and _is_editable_installation():
if _is_editable_installation():
# Note, this only works with an editable install of pygrackle.
_install_dir = dirname(os.path.abspath(__file__), level=5)
grackle_data_dir = os.path.join(_install_dir, "input")
elif (grackle_data_dir is None):
else:
raise RuntimeError(
"in non-editable pygrackle installations, like this one, "
f"grackle_data_dir can only be imported from {__file__} if it is set "
"by the GRACKLE_DATA_DIR environment variable"
f"grackle_data_dir cannot be imported from {__file__}."
)

if not os.path.isdir(grackle_data_dir):
raise RuntimeError(
f"grackle_data_dir not set to a valid directory: {grackle_data_dir}. "
"Use the GRACKLE_DATA_DIR environment variable to set path to "
"Grackle data.")