NCEPLIBS-w3emc  2.11.0
w3fb11.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Lat/lon to lambert(i,j) for grib.
3 C> @author John Stackpole @date 1988-11-25
4 
5 C> Converts the coordinates of a location on Earth given in
6 C> the natural coordinate system of latitude/longitude to a grid
7 C> coordinate system overlaid on a lambert conformal tangent cone
8 C> projection true at a given n or s latitude. w3fb11() is the reverse
9 C> of w3fb12(). uses grib specification of the location of the grid
10 C>
11 C> Program history log:
12 C> - John Stackpole 1988-11-25
13 C> - Ralph Jones 1990-04-12 Convert to cft77 fortran.
14 C> - Ralph Jones 1994-04-28 Add save statement.
15 C>
16 C> @param[in] ALAT Latitude in degrees (negative in southern hemis).
17 C> @param[in] ELON East longitude in degrees, real*4.
18 C> @param[in] ALAT1 Latitude of lower left point of grid (point (1,1)).
19 C> @param[in] ELON1 Longitude of lower left point of grid (point (1,1))
20 C> all real*4.
21 C> @param[in] DX Mesh length of grid in meters at tangent latitude.
22 C> @param[in] ELONV The orientation of the grid. i.e.,
23 C> the east longitude value of the vertical meridian
24 C> which is parallel to the y-axis (or columns of
25 C> of the grid) along which latitude increases as
26 C> the y-coordinate increases. real*4
27 C> this is also the meridian (on the back side of the
28 C> tangent cone) along which the cut is made to lay
29 C> the cone flat.
30 C> @param[in] ALATAN The latitude at which the lambert cone is tangent to
31 C> (touching) the spherical Earth. Set negative to indicate a
32 C> southern hemisphere projection.
33 C> @param[out] XI I coordinate of the point specified by alat, elon
34 C> @param[out] XJ J coordinate of the point; both real*4
35 C>
36 C> @note Formulae and notation loosely based on hoke, hayes,
37 C> and renninger's "map projections and grid systems...", march 1981
38 C> afgwc/tn-79/003.
39 C>
40 C> @author John Stackpole @date 1988-11-25
41  SUBROUTINE w3fb11(ALAT,ELON,ALAT1,ELON1,DX,ELONV,ALATAN,XI,XJ)
42 C
43  SAVE
44 C
45  DATA rerth /6.3712e+6/, pi/3.14159/
46 C
47 C PRELIMINARY VARIABLES AND REDIFINITIONS
48 C
49 C H = 1 FOR NORTHERN HEMISPHERE; = -1 FOR SOUTHERN
50 C
51  IF (alatan.GT.0) THEN
52  h = 1.
53  ELSE
54  h = -1.
55  ENDIF
56 C
57  radpd = pi / 180.0
58  rebydx = rerth / dx
59  alatn1 = alatan * radpd
60  an = h * sin(alatn1)
61  cosltn = cos(alatn1)
62 C
63 C MAKE SURE THAT INPUT LONGITUDES DO NOT PASS THROUGH
64 C THE CUT ZONE (FORBIDDEN TERRITORY) OF THE FLAT MAP
65 C AS MEASURED FROM THE VERTICAL (REFERENCE) LONGITUDE.
66 C
67  elon1l = elon1
68  IF ((elon1 - elonv).GT.180.)
69  & elon1l = elon1 - 360.
70  IF ((elon1 - elonv).LT.(-180.))
71  & elon1l = elon1 + 360.
72 C
73  elonl = elon
74  IF ((elon - elonv).GT.180.)
75  & elonl = elon - 360.
76  IF ((elon - elonv).LT.(-180.))
77  & elonl = elon + 360.
78 C
79  elonvr = elonv * radpd
80 C
81 C RADIUS TO LOWER LEFT HAND (LL) CORNER
82 C
83  ala1 = alat1 * radpd
84  rmll = rebydx * (((cosltn)**(1.-an))*(1.+an)**an) *
85  & (((cos(ala1))/(1.+h*sin(ala1)))**an)/an
86 C
87 C USE LL POINT INFO TO LOCATE POLE POINT
88 C
89  elo1 = elon1l * radpd
90  arg = an * (elo1-elonvr)
91  polei = 1. - h * rmll * sin(arg)
92  polej = 1. + rmll * cos(arg)
93 C
94 C RADIUS TO DESIRED POINT AND THE I J TOO
95 C
96  ala = alat * radpd
97  rm = rebydx * ((cosltn**(1.-an))*(1.+an)**an) *
98  & (((cos(ala))/(1.+h*sin(ala)))**an)/an
99 C
100  elo = elonl * radpd
101  arg = an*(elo-elonvr)
102  xi = polei + h * rm * sin(arg)
103  xj = polej - rm * cos(arg)
104 C
105 C IF COORDINATE LESS THAN 1
106 C COMPENSATE FOR ORIGIN AT (1,1)
107 C
108  IF (xi.LT.1.) xi = xi - 1.
109  IF (xj.LT.1.) xj = xj - 1.
110 C
111  RETURN
112  END
subroutine w3fb11(ALAT, ELON, ALAT1, ELON1, DX, ELONV, ALATAN, XI, XJ)
Converts the coordinates of a location on Earth given in the natural coordinate system of latitude/lo...
Definition: w3fb11.f:42