NCEPLIBS-sp  2.3.3
spanaly.f
Go to the documentation of this file.
1 C> @file
2 C> Analyze spectral from fourier
3 C> @author IREDELL @date 92-10-31
4 
5 C> @name SPANALY Analyzes spectral coefficients from fourier coefficients
6 C> for a latitude pair (northern and southern hemispheres).
7 C> Vector components are multiplied by cosine of latitude.
8 C>
9 C> PROGRAM HISTORY LOG:
10 C> - 91-10-31 MARK IREDELL
11 C> - 94-08-01 MARK IREDELL MOVED ZONAL WAVENUMBER LOOP INSIDE
12 C> - 1998-12-15 IREDELL OPENMP DIRECTIVES INSERTED
13 C>
14 C> @param I - INTEGER SPECTRAL DOMAIN SHAPE
15 C> (0 FOR TRIANGULAR, 1 FOR RHOMBOIDAL)
16 C> @param M - INTEGER SPECTRAL TRUNCATION
17 C> @param IM - INTEGER EVEN NUMBER OF FOURIER COEFFICIENTS
18 C> @param IX - INTEGER DIMENSION OF FOURIER COEFFICIENTS (IX>=IM+2)
19 C> @param NC - INTEGER DIMENSION OF SPECTRAL COEFFICIENTS
20 C> (NC>=(M+1)*((I+1)*M+2))
21 C> @param NCTOP - INTEGER DIMENSION OF SPECTRAL COEFFICIENTS OVER TOP
22 C> (NCTOP>=2*(M+1))
23 C> @param KM - INTEGER NUMBER OF FIELDS
24 C> @param WGT - REAL GAUSSIAN WEIGHT
25 C> @param CLAT - REAL COSINE OF LATITUDE
26 C> @param PLN - REAL ((M+1)*((I+1)*M+2)/2) LEGENDRE POLYNOMIALS
27 C> @param PLNTOP - REAL (M+1) LEGENDRE POLYNOMIAL OVER TOP
28 C> @param MP - INTEGER (KM) IDENTIFIERS (0 FOR SCALAR, 1 FOR VECTOR)
29 C> @param F - REAL (IX,2,KM) FOURIER COEFFICIENTS COMBINED
30 C> @param SPC - REAL (NC,KM) SPECTRAL COEFFICIENTS
31 C> @param SPCTOP - REAL (NCTOP,KM) SPECTRAL COEFFICIENTS OVER TOP
32 
33  SUBROUTINE spanaly(I,M,IM,IX,NC,NCTOP,KM,WGT,CLAT,PLN,PLNTOP,MP,
34  & F,SPC,SPCTOP)
35  INTEGER MP(KM)
36  REAL PLN((M+1)*((I+1)*M+2)/2),PLNTOP(M+1)
37  REAL F(IX,2,KM)
38  REAL SPC(NC,KM),SPCTOP(NCTOP,KM)
39  REAL FW(2,2)
40 C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
41 C FOR EACH ZONAL WAVENUMBER, ANALYZE TERMS OVER TOTAL WAVENUMBER.
42 C ANALYZE EVEN AND ODD POLYNOMIALS SEPARATELY.
43  lx=min(m,im/2)
44 !C$OMP PARALLEL DO PRIVATE(L,NT,KS,KP,FW)
45  DO k=1,km
46  DO l=0,lx
47  nt=mod(m+1+(i-1)*l,2)+1
48  ks=l*(2*m+(i-1)*(l-1))
49  kp=ks/2+1
50  IF(mp(k).EQ.0) THEN
51  fw(1,1)=wgt*(f(2*l+1,1,k)+f(2*l+1,2,k))
52  fw(2,1)=wgt*(f(2*l+2,1,k)+f(2*l+2,2,k))
53  fw(1,2)=wgt*(f(2*l+1,1,k)-f(2*l+1,2,k))
54  fw(2,2)=wgt*(f(2*l+2,1,k)-f(2*l+2,2,k))
55  ELSE
56  fw(1,1)=wgt*clat*(f(2*l+1,1,k)+f(2*l+1,2,k))
57  fw(2,1)=wgt*clat*(f(2*l+2,1,k)+f(2*l+2,2,k))
58  fw(1,2)=wgt*clat*(f(2*l+1,1,k)-f(2*l+1,2,k))
59  fw(2,2)=wgt*clat*(f(2*l+2,1,k)-f(2*l+2,2,k))
60  spctop(2*l+1,k)=spctop(2*l+1,k)+plntop(l+1)*fw(1,nt)
61  spctop(2*l+2,k)=spctop(2*l+2,k)+plntop(l+1)*fw(2,nt)
62  ENDIF
63  DO n=l,i*l+m,2
64  spc(ks+2*n+1,k)=spc(ks+2*n+1,k)+pln(kp+n)*fw(1,1)
65  spc(ks+2*n+2,k)=spc(ks+2*n+2,k)+pln(kp+n)*fw(2,1)
66  ENDDO
67  DO n=l+1,i*l+m,2
68  spc(ks+2*n+1,k)=spc(ks+2*n+1,k)+pln(kp+n)*fw(1,2)
69  spc(ks+2*n+2,k)=spc(ks+2*n+2,k)+pln(kp+n)*fw(2,2)
70  ENDDO
71  ENDDO
72  ENDDO
73 C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
74  RETURN
75  END