LMDZ
principal_cshift_m.F90
Go to the documentation of this file.
2 
3  implicit none
4 
5 contains
6 
7  subroutine principal_cshift(is2, xlon, xprimm)
8 
9  ! Add or subtract 2 pi so that xlon is near [-pi, pi], then cshift
10  ! so that xlon is in ascending order. Make the same cshift on
11  ! xprimm.
12 
13  use nrtype, only: twopi
14 
15  include "dimensions.h"
16  ! for iim
17 
18  include "serre.h"
19  ! for clon
20 
21  integer, intent(in):: is2
22  real, intent(inout):: xlon(:), xprimm(:) ! (iim + 1)
23 
24  !-----------------------------------------------------
25 
26  if (is2 /= 0) then
27  IF (clon <= 0.) THEN
28  IF (is2 /= 1) THEN
29  xlon(:is2 - 1) = xlon(:is2 - 1) + twopi
30  xlon(:iim) = cshift(xlon(:iim), shift = is2 - 1)
31  xprimm(:iim) = cshift(xprimm(:iim), shift = is2 - 1)
32  END IF
33  else
34  xlon(is2 + 1:iim) = xlon(is2 + 1:iim) - twopi
35  xlon(:iim) = cshift(xlon(:iim), shift = is2)
36  xprimm(:iim) = cshift(xprimm(:iim), shift = is2)
37  end IF
38  end if
39 
40  xlon(iim + 1) = xlon(1) + twopi
41  xprimm(iim + 1) = xprimm(1)
42 
43  end subroutine principal_cshift
44 
45 end module principal_cshift_m
!$Header!c!c!c include serre h!c REAL clon
Definition: serre.h:8
Definition: nrtype.F90:1
real, parameter twopi
Definition: nrtype.F90:11
c c zjulian c cym CALL iim cym klev iim
Definition: ini_bilKP_ave.h:24
subroutine principal_cshift(is2, xlon, xprimm)