Converting wind data from rotated lat-lon grid Carsten Hansen, Farvandsvæsenet Copenhagen, 16 march 2001 1 Figure 1: A Hirlam Grid Hirlam output data are in a rotated lat-lon grid The Hirlam grid is typically defined on a rotated latitude-longitude coordinate system. In the present note I will explain what this means, and write down the algebra to convert from geographical coordinates (also called regular lat-lon coordinates) to rotated coordinates. I will also show how to rotate a horizontal vector such as the wind. However, it is not the aim of this note to discuss handling of the Hirlam forcing fields in general. Normally the equator of the rotated system is plased somewhere along the middle of grid. When the people at the meteorological institutes give us the data they tell us that "Origo of the Hirlam grid is at longitude α R0 and latitude φ RO. Longitude increment is dx and latitude increment is dy. There are nx grid points in longitude direction and ny grid points 1 The correctness of all formulas, especially Eqs. SA r to CB r has not been verified yet
in latitudes. The sequence of binary data are written to the file in this and this order along the grid points." This information defines the grid points within the rotated system, and some of the information is written to inventory sections of the data files (except for the counting order of data in the files - you must find this information elsewhere). So, if we know the coordinates of a point in the rotated system (e.g. point P α R φ R of Fig. 1), we can identify near-by grid points by their coordinates and find their field values in the data file. However, we usually only know the point P as a geographic position λ φ. In order to calculate the coordinates of P in the rotated system, we must know orientation of the rotated reference system. The data file inventory provides this information expressed as the position of the south pole of the rotated system λ S φ S. We also want to rotate horizontal vectors such as the wind. For this we need to calculate the meridional convergence at our position P. The convergence is defined as the local angle β from the regular meridian through the point P to the rotated meridian at P. The spherical geometry is illustrated in Fig. 2. By convension longitudes α R of the rotated system has origo at the common meridian that intersects the south poles of both the rotated and the regular system. If we apply the same convension to the regular lat-lon system, the algebra becomes simpler. In our detailed threatment of the spherical trigonometry we will shift origo to λ S, and use a longitude parameter α λ λ S. Figure 2: Regular and rotated spherical coordinate systems. The Equator is EQ, South Pole SP and North Pole NP. Parameters of the rotated system have index R. 2
The conversion formulas Here we provide an overview of the formulas 2 for conversion between the regular and the rotated lat-lon coordinate systems. Formulas are given for a) Locate point P in the rotated coordinate system, b) Find regular orientation of a vector known in the rotated coordinate system (such as wind direction), c) Convert a position known in rotated coordinates to regular coordinates. a) Locate a point P in the rotated coordinate system Our position P has geographic longitude,latitude coordinates λ φ. To derive the rotated longitude coordinate λ R we first calculate the right-hand sides of the equations sinλ R cosφ R sin λ λ S cosφ SA cosλ R cosφ R cosφ S sinφ sinφ S cosφ cos λ λ S CA There is no need to calculate φ R in order to get λ R. For positive CA it is simply the principal value of the arc tangent of SA CA, and for negative CA it is the arc tangent shifted plus/minus π. Strictly, Arctan SA CA for the case CA 0 λ R Arctan SA CA π for CA 0 and SA 0 Arctan SA CA π for CA 0 and SA 0 π 2 for CA 0 and SA 0 π 2 for CA 0 and SA 0 In standard programming languages this is expressed shortly by using the function atan2: λ R atan2 SA CA ; (1) To derive the rotated latitude coordinate φ R we calculate the right-hand side of and then get φ R as the arc sinus sinφ R sinφ S sinφ cosφ S cosφ cos λ λ S SL φ R Arcsin SL (2) There is no need of multiple cases here since φ R belongs to the interval π 2 π 2. b) Map a vector from rotated to regular coordinate system The direction of a vector (such as wind direction) at P must be shifted by the angle β between the rotated meridian and the regular meridian through P (Fig. 2). Note that there is always an 2 It should be noted that there are other ways to do the rotation. For example you may transform to a Cartesian system and rotate that system. 3
ambiguity in how individual persons interprete the sign of such angles. All I can say is that the sign of β used here is positive in the direction shown in Fig. 2. β is derived from the formulas sinβ cosφ R sin λ λ S cosφ S SB cosβ cosφ R sinφ S cosφ cosφ S sinφ cos λ λ S CB Expressed in the programming language function atan2 we have β atan2 SB CB (3) c) Map a position from rotated to regular coordinates The transformations above may be reversed, using virtually the same equations. However, interchanging the symbols for rotated and regular coordinates is not quite straightforeward. The regular south pole has the coordinates (180,φ S ) relative to the rotated system. This means that on the left hand sides of the equations SA and CA λ R is exchanged with λ λ S 180. On the right hand sides of all equations SA to CB λ λ S is exchanged with λ R 180. The reverse equations corresponding to Eqs. SA to CB are then (with index r meaning reverse - from rotated to regular ) sin λ λ S cosφ sinλ R cosφ R SA r cos λ λ S cosφ cosφ S sinφ R sinφ S cosφ R cosλ R CA r sinφ sinφ S sinφ R cosφ S cosφ R cosλ R SL r sinβ cosφ sinλ R cosφ S SB r cosβ cosφ sinφ S cosφ R cosφ S sinφ R cosλ R CB r Trigonometry on spherical triangles We will derive Eqs. SA to CB from spherical trigonometry. Figure 3 a) shows a spherical triangle wich has corners at the two south poles and at the point of interest P. The angles at the corners are α, β as defined above. The third angle is The arc angles of the sides are foun with the aid of Fig. 2: γ 180 α R (4) a φ R 90 b φ S 90 c φ 90 (5) Figure 3 b) shows two triangles. They have one common side connecting P and the origo of the rotated system, and their third corner is respectively the regular South Pole, and the rightangled projection of P on the rotated Equator. Two new side lengths are introduced, a 2 is to be eliminated between trigonometric relations of the two triangles b 2 φ S 180 (6) 4
Figure 3 a): Spherical triangles Figure 3 b) In terms of the parameters of Fig. 3 a) we have, from the Law of Sines: and from the Law of Cosines: For Fig. 3 b) we have from the Law of Cosines: for the two triangles respectively. sinβ sina sinbsinα (7) sinγ sina sincsinα (8) cosa cosb cosc sinb sinc cosα (9) cosβ cosα cosγ sinα sinγ cosb (10) cosa 2 cosb 2 cosc sinb 2 sinc cosα (11) cosa 2 cosα R cosφ R (12) Equation (10) is multiplied by sina, and the factor sinγ sina is then eliminated by use of Eq. (8). We then have cosβ sina cosα cosγ sina sin 2 α sinc cosb (13) 5
Now rewrite the equations in terms of the lat-lon coordinates of Eqs. (4) to (6). We find that Eq. SL corresponds to Eq. (9), Eq. SA corresponds to Eq. (8), and Eq. SB corresponds to Eq. (7). Eq. CA is the equality between right sides of Eqs. (11) and (12). To obtain Eq. CB we will do a little algebra. Substitution of Eqs. (4) to (6) in Eq. (13) yields cosβ cosφ R cosα cosα R cosφ R sin 2 α cosφ sinφ S By substitution of Eq. CA we see that this is equal to which reduces to Eq. CB. cosβ cosφ R cosα cosφ S sinφ sinφ S cosφ sin 2 α cos 2 α 6