NCEPLIBS-w3emc  2.11.0
w3fb04.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Latitude, longitude to grid coordinates.
3 C> @author James McDonell @date 1986-07-17
4 
5 C> Converts the coordinates of a location on earth from the
6 C> natural coordinate system of latitude/longitude to the grid (i,j)
7 C> coordinate system overlaid on a polar stereographic map pro-
8 C> jection true at 60 degrees n or s latitude. w3fb04() is the reverse
9 C> of w3fb05().
10 C>
11 C> Program history log:
12 C> - James McDonell 1986-07-17
13 C> - Ralph Jones 1988-06-07 Clean up code, take out goto, use then, else.
14 C> - Ralph Jones 1989-11-02 Change to cray cft77 fortran.
15 C>
16 C> @param[in] ALAT Latitude in degrees (<0 if sh).
17 C> @param[in] ALONG West longitude in degrees.
18 C> @param[in] XMESHL Mesh length of grid in km at 60 deg lat(<0 if sh)
19 C> (190.5 lfm grid, 381.0 nh pe grid,-381.0 sh pe grid).
20 C> @param[in] ORIENT Orientation west longitude of the grid
21 C> (105.0 lfm grid, 80.0 nh pe grid, 260.0 sh pe grid).
22 C> @param[out] XI I of the point relative to north or south pole.
23 C> @param[out] XJ J of the point relative to north or south pole.
24 C>
25 C> @note All parameters in the calling statement must be
26 c> real. the range of allowable latitudes is from a pole to
27 c> 30 degrees into the opposite hemisphere.
28 c> The grid used in this subroutine has its origin (i=0,j=0)
29 c> at the pole in either hemisphere, so if the user's grid has its
30 c> origin at a point other than the pole, a translation is needed
31 c> to get i and j. The gridlines of i=constant are parallel to a
32 c> longitude designated by the user. the earth's radius is taken
33 c> to be 6371.2 km.
34 C>
35 C> @note This code is not vectorized. To vectorize take it and the
36 C> subroutine it calls and put them in line.
37 C>
38 C> @author James McDonell @date 1986-07-17
39  SUBROUTINE w3fb04(ALAT,ALONG,XMESHL,ORIENT,XI,XJ)
40 C
41  DATA radpd /.01745329/
42  DATA earthr/6371.2/
43 C
44  re = (earthr * 1.86603) / xmeshl
45  xlat = alat * radpd
46 C
47  IF (xmeshl.GE.0.) THEN
48  wlong = (along + 180.0 - orient) * radpd
49  r = (re * cos(xlat)) / (1.0 + sin(xlat))
50  xi = r * sin(wlong)
51  xj = r * cos(wlong)
52  ELSE
53  re = -re
54  xlat = -xlat
55  wlong = (along - orient) * radpd
56  r = (re * cos(xlat)) / (1.0 + sin(xlat))
57  xi = r * sin(wlong)
58  xj = -r * cos(wlong)
59  ENDIF
60 C
61  RETURN
62  END
subroutine w3fb04(ALAT, ALONG, XMESHL, ORIENT, XI, XJ)
Converts the coordinates of a location on earth from the natural coordinate system of latitude/longit...
Definition: w3fb04.f:40