cds-astro / mocpy

Python library to easily create and manipulate MOCs (Multi-Order Coverage maps)
https://cds-astro.github.io/mocpy/
BSD 3-Clause "New" or "Revised" License
60 stars 33 forks source link

Make deprecated write call save #114

Closed ManonMarchand closed 1 year ago

ManonMarchand commented 1 year ago

The deprecated write method does not sort the MOC while the new save does. This causes compatibility issues with aladin desktop. Let's fix it for now before removing the deprecated function (likely in v1)

fxpineau commented 1 year ago

Fwiw, in general you cannot expect attributes to be ordered in a JSON document, see e.g.: https://stackoverflow.com/questions/16870416/does-the-sequence-of-the-values-matter-in-a-json-object

From my point-of-view the problem here comes from the fact that the Java MOC implementation requires depth attributes to be sorted. I warn in vain since the very beginning against the possible troubles it would inevitably cause. And here we are...

(That said, I agree to call save from write)