NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3fb07.f
Go to the documentation of this file.
1C> @file
2C> @brief Grid coords to lat/lon for grib.
3C> @author John Stackpole @date 1988-01-01
4
5C> Converts the coordinates of a location on earth given in a
6C> grid coordinate system overlaid on a polar stereographic map pro-
7C> jection true at 60 degrees n or s latitude to the
8C> natural coordinate system of latitude/longitude
9C> w3fb07() is the reverse of w3fb06().
10C> uses grib specification of the location of the grid
11C>
12C> Program history log:
13C> - John Stackpole 1988-01-01
14C> - Ralph Jones 1990-04-12 Convert to cray cft77 fortran.
15C>
16C> @param[in] XI I coordinate of the point real*4.
17C> @param[in] XJ J coordinate of the point real*4.
18C> @param[in] ALAT1 Latitude of lower left point of grid (point 1,1)
19C> latitude <0 for southern hemisphere; real*4.
20C> @param[in] ALON1 Longitude of lower left point of grid (point 1,1)
21C> east longitude used throughout; real*4.
22C> @param[in] DX Mesh length of grid in meters at 60 deg lat
23C> must be set negative if using
24C> southern hemisphere projection; real*4
25C> 190500.0 lfm grid,
26C> 381000.0 nh pe grid, -381000.0 sh pe grid, etc.
27C> @param[in] ALONV The orientation of the grid. i.e.,
28C> the east longitude value of the vertical meridian
29C> which is parallel to the y-axis (or columns of
30C> the grid) along which latitude increases as
31C> the y-coordinate increases. real*4
32C> for example:
33C> 255.0 for lfm grid,
34C> 280.0 nh pe grid, 100.0 sh pe grid, etc.
35C> @param[out] ALAT Latitude in degrees (negative in southern hemi.).
36C> @param[out] ALON East longitude in degrees, real*4.
37C>
38C> @note Formulae and notation loosely based on hoke, hayes,
39C> and renninger's "map projections and grid systems...", march 1981
40C> afgwc/tn-79/003
41C>
42C> @author John Stackpole @date 1988-01-01
43 SUBROUTINE w3fb07(XI,XJ,ALAT1,ALON1,DX,ALONV,ALAT,ALON)
44C
45 DATA rerth /6.3712e+6/,pi/3.1416/
46 DATA ss60 /1.86603/
47C
48C PRELIMINARY VARIABLES AND REDIFINITIONS
49C
50C H = 1 FOR NORTHERN HEMISPHERE; = -1 FOR SOUTHERN
51C
52C REFLON IS LONGITUDE UPON WHICH THE POSITIVE X-COORDINATE
53C DRAWN THROUGH THE POLE AND TO THE RIGHT LIES
54C ROTATED AROUND FROM ORIENTATION (Y-COORDINATE) LONGITUDE
55C DIFFERENTLY IN EACH HEMISPHERE
56C
57 IF (dx.LT.0) THEN
58 h = -1.0
59 dxl = -dx
60 reflon = alonv - 90.0
61 ELSE
62 h = 1.0
63 dxl = dx
64 reflon = alonv - 270.0
65 ENDIF
66C
67 radpd = pi / 180.0
68 degprd = 180.0 / pi
69 rebydx = rerth / dxl
70C
71C RADIUS TO LOWER LEFT HAND (LL) CORNER
72C
73 ala1 = alat1 * radpd
74 rmll = rebydx * cos(ala1) * ss60/(1. + h * sin(ala1))
75C
76C USE LL POINT INFO TO LOCATE POLE POINT
77C
78 alo1 = (alon1 - reflon) * radpd
79 polei = 1. - rmll * cos(alo1)
80 polej = 1. - h * rmll * sin(alo1)
81C
82C RADIUS TO THE I,J POINT (IN GRID UNITS)
83C
84 xx = xi - polei
85 yy = (xj - polej) * h
86 r2 = xx**2 + yy**2
87C
88C NOW THE MAGIC FORMULAE
89C
90 IF (r2.EQ.0) THEN
91 alat = h * 90.
92 alon = reflon
93 ELSE
94 gi2 = (rebydx * ss60)**2
95 alat = degprd * h * asin((gi2 - r2)/(gi2 + r2))
96 arccos = acos(xx/sqrt(r2))
97 IF (yy.GT.0) THEN
98 alon = reflon + degprd * arccos
99 ELSE
100 alon = reflon - degprd * arccos
101 ENDIF
102 ENDIF
103 IF (alon.LT.0) alon = alon + 360.
104C
105 RETURN
106 END
subroutine w3fb07(xi, xj, alat1, alon1, dx, alonv, alat, alon)
Converts the coordinates of a location on earth given in a grid coordinate system overlaid on a polar...
Definition w3fb07.f:44