# Heliocentric Earth Ecliptic coordinates in sunpy

**URL:** <https://community.openastronomy.org/t/heliocentric-earth-ecliptic-coordinates-in-sunpy/627>\
**Category:** SunPy\
**Tags:** sunpy, question\
**Created:** [March 28, 2023, 3:36pm UTC](https://community.openastronomy.org/t/heliocentric-earth-ecliptic-coordinates-in-sunpy/627 "2023-03-28T15:36:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbethge](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@cbethge](https://community.openastronomy.org/u/cbethge)\
**Post date:** [March 28, 2023, 3:36pm UTC](https://community.openastronomy.org/t/heliocentric-earth-ecliptic-coordinates-in-sunpy/627/1 "2023-03-28T15:36:24Z")

</div>

Hi all,

I am having some trouble with the Heliocentric Earth Ecliptic coordinates in sunpy. All other missions I have found so far, Solar Orbiter and PROBA2/SWAP among them, seem to give these coordinates in the FITS header (HEEX/Y/Z keywords) in meters. When I use the HeliocentricEarthEcliptic class in sunpy, all I can get from it seems to be (lon, lat, distance) in (degrees, degrees, m or AU). Example code would be (with sc\_locx/y/z being ECI coordinates):

```auto
gcrs_coord = GCRS(CartesianRepresentation(x=sc_locx, y=sc_locy, z=sc_locz, unit=u.m), obstime=obstime)
hee_coord = gcrs_coord.transform_to(HeliocentricEarthEcliptic(obstime=obstime))

```

I have tried using `representation_type='cartesian'`, but to no avail. I guess I have two questions:

1. Is there a way to get the results from the above transformation in meters with HeliocentricEarthEcliptic?
2. When I take the HEEX/Y/Z values in meters from a FITS header, from PROBA2/SWAP for example, how do I import these into HeliocentricEarthEcliptic? It only seems to accept (degrees, degrees, m or AU).

Thanks for your help!  
-Chris

---

<div class="post-metadata">

**Author:** ![ayshih](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/ayshih/32/84_2.png) [@ayshih](https://community.openastronomy.org/u/ayshih)\
**Post date:** [March 28, 2023, 4:20pm UTC](https://community.openastronomy.org/t/heliocentric-earth-ecliptic-coordinates-in-sunpy/627/2 "2023-03-28T16:20:39Z")

</div>

First, it is recommended you use `SkyCoord` rather than the frames directly.

Second, for ECI coordinates, use sunpy’s `GeocentricEarthEquatorial` rather than Astropy’s `GCRS`. The latter includes stellar aberration – the apparent shift in distant objects due to observer motion – which is presumably not appropriate for spacecraft coordinates.

> I have tried using `representation_type='cartesian'` , but to no avail.

You can set the representation type after the coordinate is created:

```python
hee_coord.representation_type = 'cartesian'

```

But, if all you need are the components, you don’t need to modify the coordinate’s representation. You can just call (including converting the components from AU to m):

```python
hee_coord.cartesian.xyz.to('m')

```

> When I take the HEEX/Y/Z values in meters from a FITS header, from PROBA2/SWAP for example, how do I import these into HeliocentricEarthEcliptic?

You can instantiate it with a `CartesianRepresentation`, in the same fashion that you did for `gcrs_coord`. If you use `SkyCoord` (again, which is recommended), you can provide Cartesian components as part of the instantiation, e.g.:

```python
SkyCoord(x=hee_x, y=hee_y, z=hee_z, unit=u.m, representation_type='cartesian',
         frame='heliocentricearthecliptic', obstime=obstime)

```

Hope that helps!

---

<div class="post-metadata">

**Author:** ![cbethge](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@cbethge](https://community.openastronomy.org/u/cbethge)\
**Post date:** [March 28, 2023, 4:22pm UTC](https://community.openastronomy.org/t/heliocentric-earth-ecliptic-coordinates-in-sunpy/627/3 "2023-03-28T16:22:39Z")

</div>

Thanks Albert! I will give this a try!
