Use parent unit_registry for YTData and HaloCatalog datasets

#2482 Merged at ec92132
Repository
brittonsmith
Branch
yt
Repository
yt_analysis
Branch
yt
Author
  1. Britton Smith
Reviewers
Description

We now make use of UnitRegistry.to_json to store the unit registry of the parent dataset and UnitRegistry.from_json to restore it for new datasets created via save_as_dataset. This allows new datasets to access code units from the original dataset rather than redefining code units explicitly as CGS.

To cut down on duplicate code for unit registry restoration, I created a new SavedDataset class that is a super class of both YTDataset and HaloCatalogDataset.

This should be fully backward compatible yt datasets and halo catalogs made prior to this change.

  • Commit status
  • 1 open task

Comments (7)

      1. Nathan Goldbaum

        OK, we can close that one now or when we merge this. It would be awesome if you could comment there when that happens.

          1. Nathan Goldbaum

            @brittonsmith now that this has been merged can you comment on PR 2208 and decline it?

            • PR 2208
  1. Nathan Goldbaum

    Very nice, thanks for taking this on. Being able to work in the original units of the dataset will be very useful, I'm sure. Just a few comments but other than that :+1: