da_get_reglats.inc

References to this file elsewhere.
1 subroutine da_get_reglats( nj, lat, sinlat, coslat, int_wgts)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
6 
7    implicit none
8 
9    integer, intent(in)    :: nj             ! Number of latitudes
10    real,    intent(out)   :: lat(1:nj)      ! Latitude(radians, from south).
11    real,    intent(out)   :: sinlat(1:nj)   ! sin(Latitude).
12    real,    intent(out)   :: coslat(1:nj)   ! cos(Latitude).
13    real,    intent(out)   :: int_wgts(1:nj) ! Legendre Integration weights. 
14 
15    integer                :: j              ! Loop counter.
16    real                   :: delta_phi      ! Regular latitude interval.
17 
18    delta_phi = pi / real(nj-1) 
19 
20    do j = 1, nj / 2
21       lat(j) = -0.5 * pi + delta_phi * real(j - 1)
22       sinlat(j) = sin(lat(j))
23       coslat(j) = cos(lat(j))
24       int_wgts(j) = coslat(j) * delta_phi
25 
26       ! use symmetry for northern hemisphere:
27       lat(nj+1-j) = -lat(j)
28       sinlat(nj+1-j) = -sinlat(j)
29       coslat(nj+1-j) = coslat(j)
30       int_wgts(nj+1-j) = int_wgts(j)
31    end do
32 
33    if ((nj+1) / 2 == nj/2 + 1) then  ! Odd, then equator point:
34       lat(nj/2+1) = 0.0
35       sinlat(nj/2+1) = 0.0
36       coslat(nj/2+1) = 1.0
37       int_wgts(nj/2+1) = delta_phi
38    end if
39 
40 end subroutine da_get_reglats
41 
42