From 42aca8bfaccfb8aa0d8f7a5612f460288142e6d5 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Tue, 23 May 2023 13:52:23 -0400 Subject: [PATCH 1/4] Add Geodetic representation support --- resources/manifests/coordinates-1.1.0.yaml | 80 +++++++ resources/schemas/representation-1.1.0 .yaml | 209 +++++++++++++++++++ 2 files changed, 289 insertions(+) create mode 100644 resources/manifests/coordinates-1.1.0.yaml create mode 100644 resources/schemas/representation-1.1.0 .yaml diff --git a/resources/manifests/coordinates-1.1.0.yaml b/resources/manifests/coordinates-1.1.0.yaml new file mode 100644 index 0000000..8a3cd87 --- /dev/null +++ b/resources/manifests/coordinates-1.1.0.yaml @@ -0,0 +1,80 @@ +id: asdf://asdf-format.org/astronomy/coordinates/manifests/coordinates-1.0.0 +extension_uri: asdf://asdf-format.org/astronomy/coordinates/extensions/coordinates-1.0.0 +title: Coordinates extension 1.0.0 +description: |- + A set of tags for serializing coordinates. +tags: +- tag_uri: tag:astropy.org:astropy/coordinates/angle-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/angle-1.0.0 + title: Represents an Angle. + description: |- + This object represents a subtype of Quantity which has units equivalent to radians or degrees. +- tag_uri: tag:astropy.org:astropy/coordinates/earthlocation-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/earthlocation-1.0.0 + title: Represents EarthLocation objects from astropy. + description: |- + Location on the Earth. +- tag_uri: tag:astropy.org:astropy/coordinates/frames/baseframe-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/frames/baseframe-1.0.0 + title: Represents a coordinate frame object from astropy + description: |- + This schema is designed to be extended by other schemas to restrict the + allowable frame_attributes. +- tag_uri: tag:astropy.org:astropy/coordinates/frames/cirs-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/frames/cirs-1.0.0 + title: Represents a CIRS coordinate object from astropy +- tag_uri: tag:astropy.org:astropy/coordinates/frames/fk4-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/frames/fk4-1.0.0 + title: Represents a FK4 coordinate object from astropy +- tag_uri: tag:astropy.org:astropy/coordinates/frames/fk4noeterms-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/frames/fk4noeterms-1.0.0 + title: Represents a FK4NoETerms coordinate object from astropy +- tag_uri: tag:astropy.org:astropy/coordinates/frames/fk5-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/frames/fk5-1.0.0 + title: Represents a FK5 coordinate object from astropy +- tag_uri: tag:astropy.org:astropy/coordinates/frames/galactic-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/frames/galactic-1.0.0 + title: Represents an Galactic coordinate object from astropy. +- tag_uri: tag:astropy.org:astropy/coordinates/frames/galactocentric-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/frames/galactocentric-1.0.0 + title: Represents an galactocentric coordinate object from astropy +- tag_uri: tag:astropy.org:astropy/coordinates/frames/gcrs-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/frames/gcrs-1.0.0 + title: Represents a GCRS coordinate object from astropy +- tag_uri: tag:astropy.org:astropy/coordinates/frames/icrs-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/frames/icrs-1.0.0 + title: Represents an ICRS coordinate object from astropy + description: |- + This object represents the right ascension (RA) and declination of an ICRS + coordinate or frame. The ICRS class contains additional fields that may be + useful to add here in the future. +- tag_uri: tag:astropy.org:astropy/coordinates/frames/icrs-1.1.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/frames/icrs-1.1.0 + title: Represents an ICRS coordinate object from astropy. +- tag_uri: tag:astropy.org:astropy/coordinates/frames/itrs-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/frames/itrs-1.0.0 + title: Represents a ITRS coordinate object from astropy +- tag_uri: tag:astropy.org:astropy/coordinates/frames/precessedgeocentric-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/frames/precessedgeocentric-1.0.0 + title: Represents a PrecessedGeocentric coordinate object from astropy +- tag_uri: tag:astropy.org:astropy/coordinates/latitude-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/latitude-1.0.0 + title: Represents latitude-like angles. + description: |- + Represents latitude-like angle(s) which must be in the range -90 to +90 deg. +- tag_uri: tag:astropy.org:astropy/coordinates/longitude-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/longitude-1.0.0 + title: Represents longitude-like angles. + description: |- + Longitude-like angle(s) which are wrapped within a contiguous 360 degree range. +- tag_uri: tag:astropy.org:astropy/coordinates/representation-1.1.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/representation-1.1.0 + title: Representation of points or differentials in two or three dimensional space. + description: |- + Representation of points or differentials in two or three dimensional space. +- tag_uri: tag:astropy.org:astropy/coordinates/skycoord-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/skycoord-1.0.0 + title: Represents a SkyCoord object from astropy +- tag_uri: tag:astropy.org:astropy/coordinates/spectralcoord-1.0.0 + schema_uri: http://astropy.org/schemas/astropy/coordinates/spectralcoord-1.0.0 + title: Represents a SpectralCoord object from astropy diff --git a/resources/schemas/representation-1.1.0 .yaml b/resources/schemas/representation-1.1.0 .yaml new file mode 100644 index 0000000..caeb5b2 --- /dev/null +++ b/resources/schemas/representation-1.1.0 .yaml @@ -0,0 +1,209 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" +id: "http://astropy.org/schemas/astropy/coordinates/representation-1.0.0" + +title: | + Representation of points or differentials in two or three dimensional space. + +description: | + Representation of points or differentials in two or three dimensional space. + +examples: + - + - A SphericalRepresentation + - | + ! + components: + distance: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 AU, value: 1.0} + lat: ! {unit: !unit/unit-1.0.0 deg, + value: 10.0} + lon: ! + unit: !unit/unit-1.0.0 deg + value: 10.0 + wrap_angle: ! {unit: !unit/unit-1.0.0 deg, + value: 360.0} + type: SphericalRepresentation + - + - A CartesianDifferential + - | + ! + components: + d_x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 100.0} + d_y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 200.0} + d_z: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 3141.0} + type: CartesianDifferential + +type: object +properties: + type: + type: string + enum: + - CartesianRepresentation + - SphericalRepresentation + - UnitSphericalRepresentation + - RadialRepresentation + - PhysicsSphericalRepresentation + - CylindricalRepresentation + - CartesianDifferential + - SphericalDifferential + - UnitSphericalCosLatDifferential + - UnitSphericalDifferential + - SphericalCosLatDifferential + - RadialDifferential + - PhysicsSphericalDifferential + - CylindricalDifferential + - WGS84GeodeticRepresentation + - WGS72GeodeticRepresentation + - GRS80GeodeticRepresentation + + components: + anyOf: + # CartesianRepresentation + - type: object + properties: + x: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + y: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + z: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # SphericalRepresentation + - type: object + properties: + lat: + $ref: "latitude-1.0.0" + lon: + $ref: "longitude-1.0.0" + distance: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # UnitSphericalRepresentation + - type: object + properties: + lat: + $ref: "latitude-1.0.0" + lon: + $ref: "longitude-1.0.0" + + # RadialRepresentation + - type: object + properties: + distance: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # PhysicsSphericalRepresentation + - type: object + properties: + phi: + $ref: "angle-1.0.0" + theta: + $ref: "angle-1.0.0" + r: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # CylindricalRepresentation + - type: object + properties: + rho: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + phi: + $ref: "angle-1.0.0" + z: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # CartesianDifferential + - type: object + properties: + d_x: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_y: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_z: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # SphericalDifferential + - type: object + properties: + d_lon: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_lat: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_distance: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # UnitSphericalCosLatDifferential + - type: object + properties: + d_lon_coslat: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_lat: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # UnitSphericalDifferential + - type: object + properties: + d_lon: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_lat: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # SphericalCosLatDifferential + - type: object + properties: + d_lon_coslat: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_lat: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_distance: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # SphericalDifferential + - type: object + properties: + d_lon: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_lat: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_distance: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # RadialDifferential + - type: object + properties: + d_phi: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_theta: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_r: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # PhysicsSphericalDifferential + - type: object + properties: + d_phi: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_theta: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_r: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # RadialDifferential + - type: object + properties: + d_distance: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + + # CylindricalDifferential + - type: object + properties: + d_rho: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_phi: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + d_z: + $ref: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.0" + +required: [type, components] +... From 0e75948ab7bfbd0f0086e2bfcac2e732dfbbe92c Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Tue, 23 May 2023 13:54:51 -0400 Subject: [PATCH 2/4] Update changes --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index 0912739..856e284 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,7 @@ ------------------ - Add ``asdf-astropy`` as a test dependency. [#34] +- Add ``Geodetic`` coordinate representation support. [#40] 0.2.0 (2023-03-21) ------------------ From b422cf4ef6722d245ab379a526c9d222ea235258 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Tue, 23 May 2023 14:02:29 -0400 Subject: [PATCH 3/4] Fix uris --- resources/manifests/coordinates-1.1.0.yaml | 6 +++--- ...representation-1.1.0 .yaml => representation-1.1.0.yaml} | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename resources/schemas/{representation-1.1.0 .yaml => representation-1.1.0.yaml} (97%) diff --git a/resources/manifests/coordinates-1.1.0.yaml b/resources/manifests/coordinates-1.1.0.yaml index 8a3cd87..7eabaf8 100644 --- a/resources/manifests/coordinates-1.1.0.yaml +++ b/resources/manifests/coordinates-1.1.0.yaml @@ -1,6 +1,6 @@ -id: asdf://asdf-format.org/astronomy/coordinates/manifests/coordinates-1.0.0 -extension_uri: asdf://asdf-format.org/astronomy/coordinates/extensions/coordinates-1.0.0 -title: Coordinates extension 1.0.0 +id: asdf://asdf-format.org/astronomy/coordinates/manifests/coordinates-1.1.0 +extension_uri: asdf://asdf-format.org/astronomy/coordinates/extensions/coordinates-1.1.0 +title: Coordinates extension 1.1.0 description: |- A set of tags for serializing coordinates. tags: diff --git a/resources/schemas/representation-1.1.0 .yaml b/resources/schemas/representation-1.1.0.yaml similarity index 97% rename from resources/schemas/representation-1.1.0 .yaml rename to resources/schemas/representation-1.1.0.yaml index caeb5b2..6137b6d 100644 --- a/resources/schemas/representation-1.1.0 .yaml +++ b/resources/schemas/representation-1.1.0.yaml @@ -1,7 +1,7 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/yaml-schema/draft-01" -id: "http://astropy.org/schemas/astropy/coordinates/representation-1.0.0" +id: "http://astropy.org/schemas/astropy/coordinates/representation-1.1.0" title: | Representation of points or differentials in two or three dimensional space. @@ -13,7 +13,7 @@ examples: - - A SphericalRepresentation - | - ! + ! components: distance: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 AU, value: 1.0} lat: ! {unit: !unit/unit-1.0.0 deg, @@ -27,7 +27,7 @@ examples: - - A CartesianDifferential - | - ! + ! components: d_x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 100.0} d_y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 200.0} From 872a66dd4e8dbd49d5b77a2dbe09ee0572624421 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Tue, 23 May 2023 14:37:13 -0400 Subject: [PATCH 4/4] Temp add matching asdf-astropy changes --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9c15d67..a90b0fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,8 @@ docs = [ ] test = [ 'pytest', - 'asdf-astropy >= 0.2.0' + 'asdf-astropy @ git+https://github.com/braingram/asdf-astropy.git@upstream_class_reorg' + # 'asdf-astropy >= 0.2.0' ] [project.urls]