Hi Ricardo, This is a tricky question. If you want this to be done on a cell-by-cell basis, and the AMR structure of the two datasets is not precisely identical, you'll need to put the two datasets onto a regular grid by doing something like: ds.r[::128j,::128j,::128j] . But if they have identical grid structures, you might be able to get around this by using a ValidateSpatial() validator and then using ID lookup on data.id. I think the former is morel likely to work than the latter, though. Can you try that? On Thu, Apr 23, 2020 at 4:17 AM Ricardo Y <richardlol1024@gmail.com> wrote:
Hi all,
I want a slice plot of pressure(x, y, z = 0, t) - pressure(x, y, z = 0, t = 0). I tried using a derived field as follows:
---- # Load the initial dataset ds0 = yt.load('my t=0 dataset') p0 = initialPressure = ds0.all_data()['pressure']
# Define the derived field def _perturbationPressure(field, data): return data['pressure'] - initialPressure
# Add the derived field yt.add_field(('gas', 'perturbationPressure'), function=_perturbationPressure, units = "auto", dimensions = yt.units.dimensions.pressure)
# Load the dataset of interest ds = yt.load('my dataset') yt.SlicePlot(ds, 'z', 'perturbationPressure') ----
The error:
ValueError: operands could not be broadcast together with shapes (16,16,16) (134217728,)
I noticed the "data" in the definition of the derived field is a FieldDetector, so I'm not sure how I should define the derived field to plot the pressure difference (if using a derived field is the right approach at all!). The dataset I'm trying to plot is from FLASH, and I'm running yt 3.6.0. Thanks! _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org