Repository: yt-project/yt

Issue:
[BUG] (RAMSES ?) OffAxisProjection
### Bug report

**Bug summary**

When doing OffAxisProjections with a weight field for multiple fields at the same time, the resulting images are maps of the first field only, but with the wrong unit (see images).

**Code for reproduction**
```python
import yt
import numpy

ds = yt.load('ramses_rt_00088/output_00088/info_00088.txt')
p = yt.OffAxisProjectionPlot(ds, [1, 0, 0], ['density', 'temperature'], weight_field='cell_volume')
p.save('/tmp/')
```

**Actual outcome**

![info_00088_offaxisprojection_density_cell_volume](https://user-images.githubusercontent.com/5411875/42216803-536df46e-7ec3-11e8-8b98-1a74a5c3f852.png)
![info_00088_offaxisprojection_temperature_cell_volume](https://user-images.githubusercontent.com/5411875/42216802-53343c06-7ec3-11e8-8d07-c96aacb9411f.png)

**Expected outcome**
Here is the expected outcome for the regular projection plot on the same axis.

![info_00088_projection_x_temperature_cell_volume](https://user-images.githubusercontent.com/5411875/42216848-7f66aa2a-7ec3-11e8-96f3-5f83fb7356cc.png)
![info_00088_projection_x_density_cell_volume](https://user-images.githubusercontent.com/5411875/42216849-7f989864-7ec3-11e8-9d50-00f47ec832b5.png)

**Version Information**
<!--Please specify your platform and versions of the relevant libraries you are
using:-->
  * Operating System: Linux
  * Python Version: 3.6.5
  * yt version: 3.5_dev, from git (master branch, ef4be5d5497b1771af453fe47a5795f510cb860c).

<!--Please tell us how you installed yt and python e.g., from source,
pip, conda. If you installed from conda, please specify which channel you used
if not the default-->

EDIT:

This script runs a lot more quickly:

```
import yt

ds = yt.testing.fake_octree_ds()
p = yt.OffAxisProjectionPlot(ds, [1, 0, 0], ['density', 'velocity_x'],
                             weight_field='cell_volume')
p.save()
```


Discussion:
This is a followup: 
- the bug does not occur using `fake_amr_ds`.
- the bug occurs with another RAMSES dataset (http://yt-project.org/data/ramses_extra_fields.tar.gz).
- the displayed field is always the first one (so if I plot `['temperature', 'density']`, I get a map of the temperature with a label saying density).
My guess is that this may be related to the octree slicer thing we use.  I'll try to repro.
A few more observations, since I just ran into a similar issue:
The same thing happens when creating more than one plot from the same data object. If the object is recreated inbetween, it works fine. 

```
sp=ds.sphere([0.5,0.5,0.5],ds.quan(10,'pc'))
p = yt.OffAxisProjectionPlot(ds, [1, 0, 0], ['density'], weight_field='cell_volume',data_source=sp)
p = yt.OffAxisProjectionPlot(ds, [1, 0, 0], ['temperature'], weight_field='cell_volume',data_source=sp)
```
produces two 'density' plots, as Corentin showed above.

```
sp=ds.sphere([0.5,0.5,0.5],ds.quan(10,'pc'))
p = yt.OffAxisProjectionPlot(ds, [1, 0, 0], ['density'], weight_field='cell_volume',data_source=sp)
sp=ds.sphere([0.5,0.5,0.5],ds.quan(10,'pc'))
p = yt.OffAxisProjectionPlot(ds, [1, 0, 0], ['temperature'], weight_field='cell_volume',data_source=sp)
```
works fine for me. 

Resolving patch:
diff --git a/yt/data_objects/data_containers.py b/yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -1513,6 +1513,11 @@ def _ds_hold(self, new_ds):
     def _chunked_read(self, chunk):
         # There are several items that need to be swapped out
         # field_data, size, shape
+        obj_field_data = []
+        if hasattr(chunk, 'objs'):
+            for obj in chunk.objs:
+                obj_field_data.append(obj.field_data)
+                obj.field_data = YTFieldData()
         old_field_data, self.field_data = self.field_data, YTFieldData()
         old_chunk, self._current_chunk = self._current_chunk, chunk
         old_locked, self._locked = self._locked, False
@@ -1520,6 +1525,9 @@ def _chunked_read(self, chunk):
         self.field_data = old_field_data
         self._current_chunk = old_chunk
         self._locked = old_locked
+        if hasattr(chunk, 'objs'):
+            for obj in chunk.objs:
+                obj.field_data = obj_field_data.pop(0)
 
     @contextmanager
     def _activate_cache(self):


Test patch: