[yt-users] Loading dataset with no particles using a script with particle fields

Nathan Goldbaum nathan12343 at gmail.com
Thu Jul 7 12:41:49 PDT 2016


Any chance you can elaborate on the failures you're seeing? Maybe a
pastebin of a traceback?

What I've done in the past in a similar situation is wrap data access in a
try/except block and catch the YTFieldNotFound error if a field doesn't
exist in a dataset.

You can also check the particle counts in the dataset by looking at
ds.particle_type_counts and then conditionally process particle fields if
there are nonzero particle counts. I added ds.particle_type_counts
recently, so it's only in the development version of yt and will be in yt
3.3.

On Thu, Jul 7, 2016 at 1:12 PM, José Utreras <jutreras at das.uchile.cl> wrote:

> Hi yt users,
>
> I'm using a script to calculate things for cells and particles when
> needed. But I'm having the following problem:
>
> - Each time I try to work with datasets that do not contain particles the
> particle fields  are loaded which results in an error. In my simulations
> some datasets have particles at the beginning and other at later times.
> Then it is not desirable to have different scripts for datasets with and
> without particles.
>
> Is there a way to tell yt to not load field particles when particles are
> not present?
>
> Best regards
>
> Jose
>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160707/76a5cc26/attachment.html>


More information about the yt-users mailing list