## 5 Appendix: Coordinate Transformation

In this Appendix we describe the coordinate transformation that allows us to solve the 180°-ambiguity in the azimuth of the magnetic field vector (see Section 1.3.2). To that end let us define three different reference frames: , , and . The first frame is a Cartesian frame centered at the Sun’s center. The second frame is a curvilinear frame located at the point of observation P, where is the unit vector that is perpendicular to the plane tangential to the solar surface at this point. This plane contains the unit vectors and . This is the so-called local reference frame. The third reference frame is the observer’s reference frame. It is centered at the point of observation P, with the unit vector referring to the line-of-sight. As mentioned in Section 1.3 the inversion of the radiative transfer equation (1) yields the magnetic field vector in the observer’s reference frame:

The key point to solve the 180°-ambiguity is to find the coordinates of the magnetic field vector into the local reference frame, where we will apply the condition that the magnetic field vector in a sunspot must spread radially outwards. In order to do so, we will obtain the coordinates of and into the reference frame at the Sun’s center: .

1. Let us focus first on : the unit vectors defining a coordinate system at the Sun’s center. The unit vector connects the Earth with the Sun’s center, while corresponds to the proyection of the Sun’s rotation axis on the plane perpendicular to (see Figure 42). In this coordinate system, the vector connecting the observer’s and the Sun’s center is (E means Earth):
where is the Astronomical Unit. Let us now suppose that we observe a point P on the solar surface. The coordinates of this point are usually given in the reference frame of the observer with the values and (usually in arcsec). These two values refer to the angular distances of the point P measured from the center of the solar disk as seen from the Earth (see Figure 42). From this figure we can extract two triangles: and (see Figure 42) that can be employed to obtain the values of and given and . From the latter triangle we obtain:

where is the Sun’s radius. Once has been obtained, we can employ the cosine theorem in the triangle to determine as:

Note that the obtained values for and will have to be modified depending upon the signs of and (which determine the quadrant on the solar disk). Equation (30) shows that there are two possible values for , however, one of them always corresponds to an angle and, therefore, can be neglected. It is also important to bear in mind that in Figure 42 the points labeled as and are the projections of the observed point on the solar surface, , onto the planes and respectively. In fact, once that and are known, the coordinates of in the reference frame of (the vector ) can be written as:
Another vector that will be useful later is the unit vector from the Earth to the observation point P. This can be written as follows:
2. The next step is to realize that (Equation (34)) is parallel to the radial vector in the solar surface and, therefore, it is perpendicular to the tangential plane on the solar surface at the point of observation. This means that the vector (see Figure 42) belonging to the local frame can be obtained as:
With this data we can now define the local reference frame as . This coordinate system is defined on the plane that is tangential to the solar surface at the point P, with being perpendicular to this plane, and and being contained in this plane. and are the tangential vectors to the cons and cons curves, respectively. The relation between the local reference frame and the one located at the Sun’s center can be easily derived from Figure 42:
3. The third reference frame we have mentioned is the observer’s reference frame: . Note that the first of the unit vectors can be directly obtained (see Figure 42 and Equation (35)) as:

The heliocentric angle is defined as the angle between the normal vector to the solar surface at the point of observation P (aka ) and the line-of-sight (aka ). Therefore, the scalar product between these two already known vectors (Equations (35) and (36)) yields the heliocentric angle :

The other two vectors of this coordinate system, i.e., and must be perpendicular to the line-of-sight. The first one, , can be obtained from Equations (35), (36), and (38) as:

Finally, the vector can be obtained employing the following conditions:
This represents a system of three equations with three unknowns: . These represent the proyections of the unit vector on the base located at the Sun’s center: . Solving the previous system of equations yields the following solutions:
All the three components of – Equations (42), (43), and (44) – can be obtained through Equations (38) and (40). We are, therefore, able to construct the matrix , which transforms the observer’s reference frame into the reference frame at the Sun’s center:
An important point to consider is that the local reference frame, , and the observer’s reference frame, , vary with the observed point P on the solar surface. This means that each of these coordinates systems must be recalculated for each point of an observed 2-dimensional map.
4. We can now express the magnetic field vector in Equation (27), in the local reference frame:
Note that because of the 180°-ambiguity in the determination of , the two possible solutions in the magnetic field vector also exist (in an intricate manner) in the local reference frame : and (Equation (46)). In order to distinguish which one of the two is the correct one, we will consider that the magnetic field in a sunspot is mostly radial from the center of the sunspot. This means that we will take the solution that minimizes Equation (9). To evaluate that equation we already know the coordinates of the magnetic field vector in the local reference frame. However, we must still find the coordinates, in this same reference frame, of the vector which, as already mentioned in Section 1.3.2, is the vector that connects the center of the umbra (denoted by U) with the point P of observation:
where we have distinguished between (,) and (,) to differentiate the coordinates of the point of observation P and the umbral center U, respectively. For convenience, we re-write Equation (47) as follows:
Note that Equations (47) and (48) refer to the reference frame at the Sun’s center. However, in order to calculate its scalar product with the magnetic field vector (Equation (9)) we need to express it in the local reference frame at the point of observation P:
where the inverse matrix (Equation (37)) must be obtained employing and (coordinates on the solar surface for the observed point P). Once and are known in the local reference frame (Equations (46) and (49), respectively), it is now possible to evaluate Equation (9). This allows us to determine which solution for the azimuth of the magnetic field, or , yields a magnetic field vector which is closer to be radially aligned.