[yt-dev] Issue #1295: [GDF] writing and loading dataset yields different result (yt_analysis/yt)

Kacper Kowalik issues-reply at bitbucket.org
Fri Nov 4 10:56:51 PDT 2016


New issue 1295: [GDF] writing and loading dataset yields different result
https://bitbucket.org/yt_analysis/yt/issues/1295/gdf-writing-and-loading-dataset-yields

Kacper Kowalik:

As reported by Andrea Negri on the [yt-user ml](http://lists.spacepope.org/pipermail/yt-users-spacepope.org/2016-November/008301.html) following script:

```
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import yt

def main():
    dims = np.array([2, 2, 2])

    grid_data = [
        dict(left_edge = [0.0, 0.0, 0.0],
             right_edge = [1.0, 1.0, 1.0],
             level = 0,
             dimensions = dims), 
        dict(left_edge = [0.25, 0.25, 0.25],
             right_edge = [0.75, 0.75, 0.75],
             level = 1,
             dimensions = dims),
       ]
    bbox = np.array([[0, 1], [0, 1], [0, 1]])
    ds = yt.load_amr_grids(grid_data, dims, bbox=bbox, periodicity=(0,0,0), \
            length_unit=1., refine_by=2)

    #make a nice slice
    slc = yt.SlicePlot(ds, "z", "grid_level")
    slc.set_log("grid_level", False)
    slc.save('original_slice.png')

    yt.utilities.grid_data_format.writer.write_to_gdf(ds, 'test.h5',
            clobber=True)

    da = yt.load('test.h5')
    slc = yt.SlicePlot(da, "z", "grid_level")
    slc.set_log("grid_level", False)
    slc.save('test.png')

if __name__ == '__main__':
    main()
```

yields different results ![original_slice.png] (https://bitbucket.org/repo/BXbAb/images/355574044-original_slice.png)

![test.png](https://bitbucket.org/repo/BXbAb/images/3456721044-test.png)

for the same dataset that was exported and read as a GDF file.

Responsible: xarthisius


More information about the yt-dev mailing list