<div><div dir="auto">Hi Dale,</div><div dir="auto"><br></div><div dir="auto">You should be able to make a SlicePlot with a cut_region data object. I’m not sure what’s going wrong exactly based on the information in your e-mail. It’s possible you’ve hit a yt bug.</div><div dir="auto"><br></div><div dir="auto">Check whether you’re using the newest release of yt, version 3.4.0.</div><div dir="auto"><br></div><div dir="auto">If you can send us a self-contained script that reproduces the issue you are having that will make it easier to see what exactly is going wrong.</div><div dir="auto"><br></div><div dir="auto">In your script either load fake data generated in the script or use a data file which you can share with the “yt upload” bash command helper. This will print out a url once the upload is finished that you can include in your reply so others can download the file and reproduce your issue.</div><div dir="auto"><br></div><div dir="auto">Nathan</div><div dir="auto"><br></div><div dir="auto"><br></div><br><div class="gmail_quote"><div>On Sun, Dec 10, 2017 at 3:05 PM Dale Braden <<a href="mailto:genghis17@comcast.net">genghis17@comcast.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I have some density data in an unsupported format which I read into yt<br>
by means of the yt.load_uniform_grid() function.  I want to filter this<br>
data by creating a cut_region and then do a SlicePlot on the filtered<br>
data.  What I find is that no matter how I define the cut_region, the<br>
dynamic range of the resulting plot is said to be 0.0, even though the<br>
cut region has no values in it which are actually 0.0.<br>
<br>
I do not have this problem if I use data in a supported format. For<br>
example, I can follow the yt tutorial which creates a SlicePlot from a<br>
cut_region on the Enzo_64 example dataset.  So I wonder if maybe the<br>
problem I'm having is due to the fact that when one creates a dataset<br>
using load_uniform_grid(), one ends up with a StreamDataset object<br>
instead of an object representing a supported format.<br>
<br>
Here is some relevant output from my session (omitting the code to read<br>
in my data from disk):<br>
<br>
In [8]: data2 = np.array(griddata)<br>
In [9]: arr = data2.reshape((41,56,47))<br>
In [10]: data = dict(density = (arr,"g/cm**3"))<br>
In [11]: bbox = np.array([[-4.0,4.2],[-5.5,5.7],[-4.175872,5.22413]])<br>
In [12]: ds = yt.load_uniform_grid(data, arr.shape, length_unit="cm",<br>
bbox=bbox)<br>
yt : [INFO     ] 2017-12-09 15:41:20,781 Parameters:<br>
current_time              = 0.0<br>
yt : [INFO     ] 2017-12-09 15:41:20,781 Parameters:<br>
domain_dimensions         = [41 56 47]<br>
yt : [INFO     ] 2017-12-09 15:41:20,782 Parameters:<br>
domain_left_edge          = [-4.       -5.5      -4.175872]<br>
yt : [INFO     ] 2017-12-09 15:41:20,782 Parameters:<br>
domain_right_edge         = [ 4.2      5.7      5.22413]<br>
yt : [INFO     ] 2017-12-09 15:41:20,783 Parameters:<br>
cosmological_simulation   = 0.0<br>
In [13]: ds.find_max('density')<br>
yt : [INFO     ] 2017-12-09 15:48:16,640 Max Value is 5.14618e+01 at<br>
0.0999999999999996 -0.0000000000000009 -0.0758711276595738<br>
Out[13]: (51.4618 g/cm**3, YTArray([  1.00000000e-01, -8.88178420e-16, <br>
-7.58711277e-02]) code_length)<br>
<br>
In [14]: ds.find_min('density')<br>
yt : [INFO     ] 2017-12-09 15:48:53,392 Min Value is 8.71255e-12 at<br>
-3.8999999999999999 -5.4000000000000004 -4.0758719787234039<br>
Out[14]: (8.71255e-12 g/cm**3, YTArray([-3.9       , -5.4       ,<br>
-4.07587198]) code_length)<br>
<br>
So you can see from find_min() that all data values are > 0.0.  I should<br>
mention that if I do a SlicePlot on ds.all_data(), it looks fine.  But<br>
if I try a SlicePlot on a cut_region, even one that essentially<br>
duplicates the entire dataset, then there's nothing to plot even though<br>
the cut_region does have valid data in it:<br>
<br>
In [20]: ad = ds.all_data()<br>
In [23]: den = ad.cut_region(['obj["density"] > 0.0'])<br>
In [24]: print den.quantities.extrema([('gas','density')])<br>
[  8.71255000e-12   5.14618000e+01] g/cm**3<br>
In [25]: p2 = yt.SlicePlot(ds, 'x','density', center="m", data_source=den)<br>
yt : [INFO     ] 2017-12-09 15:55:58,155 Max Value is 5.14618e+01 at<br>
0.0999999999999996 -0.0000000000000009 -0.0758711276595738<br>
yt : [INFO     ] 2017-12-09 15:55:58,585 xlim = -5.600000 5.600000<br>
yt : [INFO     ] 2017-12-09 15:55:58,585 ylim = -4.775872 4.624130<br>
yt : [INFO     ] 2017-12-09 15:55:58,586 xlim = -5.600000 5.600000<br>
yt : [INFO     ] 2017-12-09 15:55:58,586 ylim = -4.775872 4.624130<br>
yt : [INFO     ] 2017-12-09 15:55:58,587 Making a fixed resolution<br>
buffer of (('gas', 'density')) 800 by 800<br>
yt : [WARNING  ] 2017-12-09 15:55:58,606 Plot image for field ('gas',<br>
'density') has zero dynamic range. Min = Max = 0.000000.<br>
yt : [WARNING  ] 2017-12-09 15:55:58,606 Switching to linear colorbar<br>
scaling.<br>
<br>
That first warning message is the problem: zero dynamic range. What's<br>
going wrong?<br>
<br>
best wishes,<br>
<br>
Dale<br>
<br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">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/listinfo.cgi/yt-users-spacepope.org</a><br>
</blockquote></div></div>