-
-
Notifications
You must be signed in to change notification settings - Fork 54
Add support for ASDF serialisation and deserialisation #776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Cadair
wants to merge
80
commits into
main
Choose a base branch
from
asdf-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 74 commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
ac36722
initial commit
ViciousEagle03 6be61e7
version alignment
ViciousEagle03 6e619fc
Remove method to remove any delay and
ViciousEagle03 f505703
Update tag and
ViciousEagle03 af2f9c7
enable schema test
ViciousEagle03 adfc6b3
revert small change
ViciousEagle03 78eeb53
Add the converters for ExtraCoords and TimeTableCoordinate class
ViciousEagle03 0804f1d
Add ExtraCoords and TimeTableCoord Schema
ViciousEagle03 0f4a86f
Update manifest and entry_point.py
ViciousEagle03 86bfac9
Add the QuantityTableCoordinate and SkyCoordTableCoordinate converters
ViciousEagle03 da1c14e
Add the schema for QuantityTableCoordinate and SkyCoordTableCoordinate
ViciousEagle03 dc24d40
Update manifest and entry_point.py
ViciousEagle03 ef208ed
Add validation for schema and manifests
ViciousEagle03 c3d2606
pre-commit
Cadair 86c2b6c
Update the tox.ini and CI workflow
ViciousEagle03 3a875ab
Update schemas
ViciousEagle03 ce5a14b
Add the converter and schema for GlobalCoords
ViciousEagle03 9247b46
Update converters
ViciousEagle03 c8a1bc4
Update entry_points,schemas and manifest
ViciousEagle03 c681cb2
minor change
ViciousEagle03 42c590e
lowercase schema URIs and use wildcards
ViciousEagle03 7f3a81b
Add tests and GWCS objects
ViciousEagle03 7622950
apply suggestions from code review
ViciousEagle03 f89e195
Remove mesh as a property validator
ViciousEagle03 8b519ae
Update the dependencies version
ViciousEagle03 37bf563
Style changes and add warnings to NDCube converter
ViciousEagle03 693e63e
env name update
ViciousEagle03 de6944e
Add asdf as an optional dep
ViciousEagle03 22a839e
Remove asdf as an optional dependency
ViciousEagle03 ec863ad
Add support for meta in converter and schema
ViciousEagle03 b2fd5e1
Add mask as a validator property
ViciousEagle03 6d81ee9
Add unit support to asdf
Cadair a6a33be
Add the serialization support for the ResampledLowlevelWCS ReorderedL…
ViciousEagle03 95486b0
Apply suggestions from code review
ViciousEagle03 4fb5288
Use Tabular1D, Tabular2D instead of tabular_model
ViciousEagle03 6cf9602
Add comment and update logic
ViciousEagle03 ddc75be
Apply minor suggestions from code review
DanRyanIrish e7cf14f
More minor tweaks
Cadair 7ee5048
Merge pull request #751 from ViciousEagle03/wcs_wrapper_asdf_support
Cadair 8610805
Add validation for schema and manifests
ViciousEagle03 149944f
revert small change
ViciousEagle03 98e633c
Add asdf as an optional dep
ViciousEagle03 789e841
Remove asdf as an optional dependency
ViciousEagle03 24af793
Add serialization logic for the NDCubeSequence and NDCollection
ViciousEagle03 494e2c5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] db8f22d
Minor tweaks
Cadair 3876924
Merge pull request #756 from ViciousEagle03/asdf_ndcube_sequence_and_…
Cadair 1b9679a
Merge branch 'main' into asdf-support
Cadair 082d8c6
Merge branch 'main' into asdf-support
Cadair 9732fa9
Merge branch 'main' into asdf-support
Cadair 46215b0
Update pytest.ini
Cadair 1b72253
fix pre-commit
Cadair e7c4c04
Fix schema
Cadair 61cc81d
Fix uncertainty, fits wcs etc
Cadair d9b4b80
Allow FITS WCS in more places
Cadair ee48a53
Fix tests while awaiting astropy/asdf-astropy#276
Cadair eea3e40
Merge pull request #842 from Cadair/add_uncertainty
Cadair 675bf1d
Rough start at basic docs
SolarDrew 1cf3b18
Update ndcube/asdf/converters/compoundwcs_converter.py
Cadair e70a736
More details on what's supported
Cadair 1d92daf
Add support for MultipleTableCoordinate
Cadair 50a3cdd
More docs and test fixes
Cadair ce0556d
Add support for MTC and tests
Cadair 45f6d55
Merge pull request #843 from SolarDrew/asdf-support
Cadair 350d7ce
Bump versions of all schemas etc
Cadair f1cec49
Add changelog
Cadair f430969
Bump various deps based on SPEC-0
Cadair 38e2680
American I guess
Cadair da2b74f
Update 776.feature.rst
Cadair 3754a61
Update docs/explaining_ndcube/asdf_serialization.rst
Cadair 5fac69a
More test fixes
Cadair 81677e9
Allow bool for mask
Cadair b90a2ff
Add support for NDMeta
Cadair ad258e5
Allow FITS WCS in ExtraCoords ASDF schema
Cadair e2c24f2
Change NDCollection to save a dict not kv pairs
Cadair 85f93f7
Apply suggestions from code review
Cadair b56c702
Apply suggestions from code review
Cadair 0762b8d
Only add meta, global and extra to ndcube if populated
Cadair eb0c6f3
More lax schemas
Cadair 2559057
no property order
Cadair File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The minimum supported version of some dependencies has increased: | ||
|
||
* astropy >= 5.3 | ||
* gwcs >= 0.20 | ||
* numpy >= 1.25 | ||
* scipy >= 1.11 | ||
* matplotlib >= 3.8 | ||
* mpl_animators >= 1.1 | ||
* reproject >= 0.11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add support for serialization of most `ndcube` objects to ASDF files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
.. _asdf_serialization: | ||
|
||
************************* | ||
Saving ND objects to ASDF | ||
************************* | ||
|
||
:ref:`asdf` is an extensible format for validating and saving complex scientific data along with its metadata. | ||
`ndcube` provides schemas and converters for all the ND objects (`~ndcube.NDCube`, `~ndcube.NDCubeSequence` and `~ndcube.NDCollection`) as well as for various WCS and table objects required by them. | ||
To make use of these, simply save an ND object to an ASDF file and it will be correctly serialized. | ||
ASDF files save a "tree" which is a `dict`. | ||
You can save any number of cubes in your ASDF by adding them to the dictionary. | ||
|
||
.. expanding-code-block:: python | ||
:summary: Click to reveal/hide instantiation of the NDCube. | ||
|
||
>>> import numpy as np | ||
>>> import asdf | ||
>>> import astropy.wcs | ||
>>> from ndcube import NDCube | ||
|
||
>>> # Define data array. | ||
>>> data = np.random.rand(4, 4, 5) | ||
|
||
>>> # Define WCS transformations in an astropy WCS object. | ||
>>> wcs = astropy.wcs.WCS(naxis=3) | ||
>>> wcs.wcs.ctype = 'WAVE', 'HPLT-TAN', 'HPLN-TAN' | ||
>>> wcs.wcs.cunit = 'Angstrom', 'deg', 'deg' | ||
>>> wcs.wcs.cdelt = 0.2, 0.5, 0.4 | ||
>>> wcs.wcs.crpix = 0, 2, 2 | ||
>>> wcs.wcs.crval = 10, 0.5, 1 | ||
>>> wcs.wcs.cname = 'wavelength', 'HPC lat', 'HPC lon' | ||
|
||
>>> # Now instantiate the NDCube | ||
>>> my_cube = NDCube(data, wcs=wcs) | ||
|
||
|
||
.. code-block:: python | ||
|
||
>>> my_tree = {"mycube": my_cube} | ||
>>> with asdf.AsdfFile(tree=my_tree) as f: # doctest: +SKIP | ||
... f.write_to("somefile.asdf") # doctest: +SKIP | ||
|
||
|
||
What's Supported and What Isn't | ||
=============================== | ||
|
||
We aim to support all features of `ndcube` when saving and loading to ASDF. | ||
However, because it is possible to create `ndcube` objects with many different components (for example dask arrays) which aren't part of the `ndcube` package these may not be supported. | ||
Many common components of `ndcube` classes are supported in the `asdf_astropy <https://asdf-astropy.readthedocs.io/en/stable/>`__ package, such as `astropy.wcs.WCS`, `astropy.wcs.wcsapi.SlicedLowLevelWCS` and uncertainty objects. | ||
|
||
The only component of the `ndcube.NDCube` class which is never saved is the ``.psf`` attribute. | ||
|
||
`ndcube` implements converters and schemas for the following objects: | ||
|
||
* `~ndcube.NDCube` | ||
* `~ndcube.NDCubeSequence` | ||
* `~ndcube.NDCollection` | ||
* `~ndcube.NDMeta` | ||
* `~ndcube.GlobalCoords` | ||
* `~ndcube.ExtraCoords` | ||
* `~ndcube.extra_coords.TimeTableCoordinate` | ||
* `~ndcube.extra_coords.QuantityTableCoordinate` | ||
* `~ndcube.extra_coords.SkyCoordTableCoordinate` | ||
* `~ndcube.extra_coords.MultipleTableCoordinate` | ||
* `~ndcube.wcs.wrappers.ReorderedLowLevelWCS` | ||
* `~ndcube.wcs.wrappers.ResampledLowLevelWCS` | ||
* `~ndcube.wcs.wrappers.CompoundLowLevelWCS` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ Explaining ``ndcube`` | |
tabular_coordinates | ||
reproject | ||
visualization | ||
asdf_serialization |
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from asdf.extension import Converter | ||
|
||
|
||
class CompoundConverter(Converter): | ||
tags = ["tag:sunpy.org:ndcube/compoundwcs-*"] | ||
types = ["ndcube.wcs.wrappers.compound_wcs.CompoundLowLevelWCS"] | ||
|
||
def from_yaml_tree(self, node, tag, ctx): | ||
from ndcube.wcs.wrappers import CompoundLowLevelWCS | ||
|
||
return CompoundLowLevelWCS(*node["wcs"], mapping=node.get("mapping"), pixel_atol=node.get("atol")) | ||
|
||
def to_yaml_tree(self, compoundwcs, tag, ctx): | ||
node = {} | ||
node["wcs"] = compoundwcs._wcs | ||
node["mapping"] = compoundwcs.mapping.mapping | ||
node["atol"] = compoundwcs.atol | ||
return node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from asdf.extension import Converter | ||
|
||
|
||
class ExtraCoordsConverter(Converter): | ||
tags = ["tag:sunpy.org:ndcube/extra_coords/extra_coords/extracoords-*"] | ||
types = ["ndcube.extra_coords.extra_coords.ExtraCoords"] | ||
|
||
def from_yaml_tree(self, node, tag, ctx): | ||
from ndcube.extra_coords.extra_coords import ExtraCoords | ||
extra_coords = ExtraCoords() | ||
extra_coords._wcs = node.get("wcs") | ||
extra_coords._mapping = node.get("mapping") | ||
extra_coords._lookup_tables = node.get("lookup_tables", []) | ||
extra_coords._dropped_tables = node.get("dropped_tables") | ||
extra_coords._ndcube = node.get("ndcube") | ||
return extra_coords | ||
|
||
def to_yaml_tree(self, extracoords, tag, ctx): | ||
node = {} | ||
if extracoords._wcs is not None: | ||
node["wcs"] = extracoords._wcs | ||
if extracoords._mapping is not None: | ||
node["mapping"] = extracoords._mapping | ||
if extracoords._lookup_tables: | ||
node["lookup_tables"] = extracoords._lookup_tables | ||
node["dropped_tables"] = extracoords._dropped_tables | ||
node["ndcube"] = extracoords._ndcube | ||
return node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from asdf.extension import Converter | ||
|
||
|
||
class GlobalCoordsConverter(Converter): | ||
tags = ["tag:sunpy.org:ndcube/global_coords/globalcoords-*"] | ||
types = ["ndcube.global_coords.GlobalCoords"] | ||
|
||
def from_yaml_tree(self, node, tag, ctx): | ||
from ndcube.global_coords import GlobalCoords | ||
|
||
globalcoords = GlobalCoords() | ||
if "internal_coords" in node: | ||
globalcoords._internal_coords = node["internal_coords"] | ||
globalcoords._ndcube = node["ndcube"] | ||
|
||
return globalcoords | ||
|
||
def to_yaml_tree(self, globalcoords, tag, ctx): | ||
node = {} | ||
node["ndcube"] = globalcoords._ndcube | ||
if globalcoords._internal_coords: | ||
node["internal_coords"] = globalcoords._internal_coords | ||
|
||
return node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from asdf.extension import Converter | ||
|
||
|
||
class NDCollectionConverter(Converter): | ||
tags = ["tag:sunpy.org:ndcube/ndcube/ndcollection-*"] | ||
types = ["ndcube.ndcollection.NDCollection"] | ||
|
||
def from_yaml_tree(self, node, tag, ctx): | ||
from ndcube.ndcollection import NDCollection | ||
|
||
key_value_pairs = list(zip(node["keys"], node["value"])) | ||
aligned_axes = list(node.get("aligned_axes").values()) | ||
aligned_axes = tuple(tuple(lst) for lst in aligned_axes) | ||
return NDCollection(key_value_pairs, meta=node.get("meta"), aligned_axes=aligned_axes) | ||
|
||
def to_yaml_tree(self, ndcollection, tag, ctx): | ||
node = {} | ||
node["keys"] = tuple(ndcollection.keys()) | ||
node["value"] = tuple(ndcollection.values()) | ||
Cadair marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if ndcollection.meta is not None: | ||
node["meta"] = ndcollection.meta | ||
if ndcollection._aligned_axes is not None: | ||
node["aligned_axes"] = ndcollection._aligned_axes | ||
|
||
return node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import warnings | ||
|
||
from asdf.extension import Converter | ||
|
||
|
||
class NDCubeConverter(Converter): | ||
tags = ["tag:sunpy.org:ndcube/ndcube/ndcube-*"] | ||
types = ["ndcube.ndcube.NDCube"] | ||
|
||
def from_yaml_tree(self, node, tag, ctx): | ||
from ndcube.ndcube import NDCube | ||
|
||
ndcube = NDCube( | ||
node["data"], | ||
node["wcs"], | ||
meta=node.get("meta"), | ||
mask=node.get("mask"), | ||
unit=node.get("unit"), | ||
uncertainty=node.get("uncertainty"), | ||
) | ||
if "extra_coords" in node: | ||
ndcube._extra_coords = node["extra_coords"] | ||
if "global_coords" in node: | ||
ndcube._global_coords = node["global_coords"] | ||
|
||
return ndcube | ||
|
||
def to_yaml_tree(self, ndcube, tag, ctx): | ||
""" | ||
Notes | ||
----- | ||
This methods serializes the primary components of the NDCube object, | ||
including the `data`, `wcs`, `extra_coords`, and `global_coords` attributes. | ||
Issues a warning if unsupported attributes are present. | ||
|
||
Warnings | ||
-------- | ||
UserWarning | ||
Warns if the NDCube object has a 'psf' attribute that will not be | ||
saved in the ASDF serialization. | ||
This ensures that users are aware of potentially important information | ||
that is not included in the serialized output. | ||
""" | ||
from astropy.wcs.wcsapi import BaseHighLevelWCS | ||
|
||
node = {} | ||
node["data"] = ndcube.data | ||
if isinstance(ndcube.wcs, BaseHighLevelWCS): | ||
node["wcs"] = ndcube.wcs.low_level_wcs | ||
else: | ||
node["wcs"] = ndcube.wcs | ||
node["extra_coords"] = ndcube.extra_coords | ||
node["global_coords"] = ndcube.global_coords | ||
node["meta"] = ndcube.meta | ||
Cadair marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if ndcube.mask is not None: | ||
node["mask"] = ndcube.mask | ||
if ndcube.unit is not None: | ||
node["unit"] = ndcube.unit | ||
if ndcube.uncertainty is not None: | ||
node["uncertainty"] = ndcube.uncertainty | ||
|
||
if getattr(ndcube, 'psf') is not None: | ||
warnings.warn("Attribute 'psf' is present but not being saved in ASDF serialization.", UserWarning) | ||
|
||
return node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from asdf.extension import Converter | ||
|
||
|
||
class NDCubeSequenceConverter(Converter): | ||
tags = ["tag:sunpy.org:ndcube/ndcube/ndcube_sequence-*"] | ||
types = ["ndcube.ndcube_sequence.NDCubeSequence"] | ||
|
||
def from_yaml_tree(self, node, tag, ctx): | ||
from ndcube.ndcube_sequence import NDCubeSequence | ||
|
||
return NDCubeSequence(node["data"], | ||
meta=node.get("meta"), | ||
common_axis=node.get("common_axis")) | ||
|
||
def to_yaml_tree(self, ndcseq, tag, ctx): | ||
node = {} | ||
node["data"] = ndcseq.data | ||
if ndcseq.meta is not None: | ||
node["meta"] = ndcseq.meta | ||
if ndcseq._common_axis is not None: | ||
node["common_axis"] = ndcseq._common_axis | ||
|
||
return node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import numpy as np | ||
|
||
from asdf.extension import Converter | ||
|
||
|
||
class NDMetaConverter(Converter): | ||
tags = ["tag:sunpy.org:ndcube/meta/ndmeta-*"] | ||
types = ["ndcube.meta.NDMeta"] | ||
|
||
def from_yaml_tree(self, node, tag, ctx): | ||
from ndcube.meta import NDMeta | ||
axes = {k: np.array(v) for k, v in node["axes"].items()} | ||
meta = NDMeta(node["meta"], node["key_comments"], axes, node["data_shape"]) | ||
meta._original_meta = node["original_meta"] | ||
return meta | ||
|
||
def to_yaml_tree(self, meta, tag, ctx): | ||
node = {} | ||
node["meta"] = dict(meta) | ||
node["key_comments"] = meta.key_comments | ||
node["axes"] = meta.axes | ||
node["data_shape"] = meta.data_shape | ||
node["original_meta"] = meta._original_meta # not the MappingProxy object | ||
return node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from asdf.extension import Converter | ||
|
||
|
||
class ReorderedConverter(Converter): | ||
tags = ["tag:sunpy.org:ndcube/reorderedwcs-*"] | ||
types = ["ndcube.wcs.wrappers.reordered_wcs.ReorderedLowLevelWCS"] | ||
|
||
def from_yaml_tree(self, node, tag, ctx): | ||
from ndcube.wcs.wrappers import ReorderedLowLevelWCS | ||
|
||
return ReorderedLowLevelWCS( | ||
wcs=node["wcs"], | ||
pixel_order=node.get("pixel_order"), | ||
world_order=node.get("world_order"), | ||
) | ||
|
||
def to_yaml_tree(self, reorderedwcs, tag, ctx): | ||
node = {} | ||
node["wcs"] = reorderedwcs._wcs | ||
node["pixel_order"] = reorderedwcs._pixel_order | ||
node["world_order"] = reorderedwcs._world_order | ||
return node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from asdf.extension import Converter | ||
|
||
|
||
class ResampledConverter(Converter): | ||
tags = ["tag:sunpy.org:ndcube/resampledwcs-*"] | ||
types = ["ndcube.wcs.wrappers.resampled_wcs.ResampledLowLevelWCS"] | ||
|
||
def from_yaml_tree(self, node, tag, ctx): | ||
from ndcube.wcs.wrappers import ResampledLowLevelWCS | ||
|
||
return ResampledLowLevelWCS( | ||
wcs=node["wcs"], | ||
offset=node.get("offset"), | ||
factor=node.get("factor"), | ||
) | ||
|
||
def to_yaml_tree(self, resampledwcs, tag, ctx): | ||
node = {} | ||
node["wcs"] = resampledwcs._wcs | ||
node["factor"] = resampledwcs._factor | ||
node["offset"] = resampledwcs._offset | ||
|
||
return node |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that every future metadata object needs its own schema to be saved and read?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well yes and no, anything custom will need one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also goes for unsaveable values in meta. i.e. if you put a dask array in your meta dict it will break.