NCEPLIBS-sp 2.4.0
sptgptsd.f
Go to the documentation of this file.
1C> @file
2C> @brief Transform spectral scalar to station points.
3C> @author Iredell @date 96-02-29
4C>
5C> ### Program History Log
6C> Date | Programmer | Comments
7C> -----|------------|---------
8C> 96-02-29 | Iredell | Initial.
9C> 1998-12-15 | Iredell | Openmp directives inserted.
10C> 1999-08-18 | Iredell | Openmp directive typo fixed.
11C>
12C> @author Iredell @date 96-02-29
13
14C> This subprogram performs a spherical transform
15C> from spectral coefficients of scalar quantities
16C> to specified sets of station point values
17C> and their gradients on the globe.
18C>
19C> The wave-space can be either triangular or rhomboidal.
20C>
21C> The wave and point fields may have general indexing,
22C> but each wave field is in sequential 'IBM order',
23C> i.e. with zonal wavenumber as the slower index.
24C>
25C> The transforms are all multiprocessed over stations.
26C>
27C> Transform several fields at a time to improve vectorization.
28C>
29C> Subprogram can be called from a multiprocessing environment.
30C>
31C> @param IROMB spectral domain shape
32C> (0 for triangular, 1 for rhomboidal)
33C> @param MAXWV spectral truncation
34C> @param KMAX number of fields to transform.
35C> @param NMAX number of station points to return
36C> @param KWSKIP skip number between wave fields
37C> (defaults to (MAXWV+1)*((IROMB+1)*MAXWV+2) if KWSKIP=0)
38C> @param KGSKIP skip number between station point sets
39C> (defaults to NMAX if KGSKIP=0)
40C> @param NRSKIP skip number between station lats and lons
41C> (defaults to 1 if NRSKIP=0)
42C> @param NGSKIP skip number between station points
43C> (defaults to 1 if NGSKIP=0)
44C> @param RLAT station latitudes in degrees
45C> @param RLON station longitudes in degrees
46C> @param WAVE wave fields
47C> @param GP station point sets
48C> @param XP station point x-gradient sets
49C> @param YP station point y-gradient sets
50C>
51C> @author Iredell @date 96-02-29
52 SUBROUTINE sptgptsd(IROMB,MAXWV,KMAX,NMAX,
53 & KWSKIP,KGSKIP,NRSKIP,NGSKIP,
54 & RLAT,RLON,WAVE,GP,XP,YP)
55
56 REAL RLAT(*),RLON(*),WAVE(*)
57 REAL GP(*),XP(*),YP(*)
58 REAL EPS((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),EPSTOP(MAXWV+1)
59 REAL ENN1((MAXWV+1)*((IROMB+1)*MAXWV+2)/2)
60 REAL ELONN1((MAXWV+1)*((IROMB+1)*MAXWV+2)/2)
61 REAL EON((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),EONTOP(MAXWV+1)
62 INTEGER MP(2*KMAX)
63 REAL W((MAXWV+1)*((IROMB+1)*MAXWV+2)/2*2,2*KMAX)
64 REAL WTOP(2*(MAXWV+1),2*KMAX)
65 REAL PLN((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),PLNTOP(MAXWV+1)
66 REAL F(2*MAXWV+2,2,3*KMAX),G(3*KMAX)
67 parameter(pi=3.14159265358979)
68C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
69C CALCULATE PRELIMINARY CONSTANTS
70 CALL spwget(iromb,maxwv,eps,epstop,enn1,elonn1,eon,eontop)
71 mx=(maxwv+1)*((iromb+1)*maxwv+2)/2
72 mxtop=maxwv+1
73 mdim=2*mx
74 idim=2*maxwv+2
75 kw=kwskip
76 kg=kgskip
77 nr=nrskip
78 ng=ngskip
79 IF(kw.EQ.0) kw=2*mx
80 IF(kg.EQ.0) kg=nmax
81 IF(nr.EQ.0) nr=1
82 IF(ng.EQ.0) ng=1
83 mp(1:kmax)=10
84 mp(kmax+1:2*kmax)=1
85C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
86C CALCULATE SPECTRAL WINDS
87C$OMP PARALLEL DO PRIVATE(KWS,KS,KY)
88 DO k=1,kmax
89 kws=(k-1)*kw
90 ks=0*kmax+k
91 ky=1*kmax+k
92 DO i=1,2*mx
93 w(i,ks)=wave(kws+i)
94 ENDDO
95 DO i=1,2*mxtop
96 wtop(i,ks)=0
97 ENDDO
98 CALL spgrady(iromb,maxwv,enn1,eon,eontop,
99 & wave(kws+1),w(1,ky),wtop(1,ky))
100 ENDDO
101C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
102C CALCULATE STATION FIELDS
103C$OMP PARALLEL DO PRIVATE(KS,KY,KX,SLAT1,CLAT1)
104C$OMP& PRIVATE(PLN,PLNTOP,F,G,NK)
105 DO n=1,nmax
106 IF(abs(rlat((n-1)*nr+1)).GE.89.9995) THEN
107 slat1=sign(1.,rlat((n-1)*nr+1))
108 clat1=0.
109 ELSE
110 slat1=sin(pi/180*rlat((n-1)*nr+1))
111 clat1=cos(pi/180*rlat((n-1)*nr+1))
112 ENDIF
113 CALL splegend(iromb,maxwv,slat1,clat1,eps,epstop,
114 & pln,plntop)
115 CALL spsynth(iromb,maxwv,2*maxwv,idim,mdim,2*mxtop,2*kmax,
116 & clat1,pln,plntop,mp,w,wtop,f)
117 CALL spgradx(maxwv,idim,kmax,mp,clat1,f(1,1,1),f(1,1,2*kmax+1))
118 CALL spfftpt(maxwv,1,idim,1,3*kmax,rlon((n-1)*nr+1),f,g)
119 DO k=1,kmax
120 ks=0*kmax+k
121 ky=1*kmax+k
122 kx=2*kmax+k
123 nk=(n-1)*ng+(k-1)*kg+1
124 gp(nk)=g(ks)
125 xp(nk)=g(kx)
126 yp(nk)=g(ky)
127 ENDDO
128 ENDDO
129C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
130 END
subroutine spfftpt(M, N, INCW, INCG, KMAX, RLON, W, G)
This subprogram computes a slow Fourier transform from Fourier space to a set of gridpoints.
Definition: spfftpt.f:23
subroutine spgradx(M, INCW, KMAX, MP, CLAT, W, WX)
This subprogram computes the x-gradient of fields in complex Fourier space.
Definition: spgradx.f:38
subroutine spgrady(I, M, ENN1, EON, EONTOP, Q, QDY, QDYTOP)
Computes the horizontal vector y-gradient of a scalar field in spectral space.
Definition: spgrady.f:32
subroutine splegend(I, M, SLAT, CLAT, EPS, EPSTOP, PLN, PLNTOP)
Evaluates the orthonormal associated Legendre polynomials in the spectral domain at a given latitude.
Definition: splegend.f:45
subroutine spsynth(I, M, IM, IX, NC, NCTOP, KM, CLAT, PLN, PLNTOP, MP, SPC, SPCTOP, F)
Synthesizes Fourier coefficients from spectral coefficients for a latitude pair (Northern and Souther...
Definition: spsynth.f:39
subroutine sptgptsd(IROMB, MAXWV, KMAX, NMAX, KWSKIP, KGSKIP, NRSKIP, NGSKIP, RLAT, RLON, WAVE, GP, XP, YP)
This subprogram performs a spherical transform from spectral coefficients of scalar quantities to spe...
Definition: sptgptsd.f:55
subroutine spwget(IROMB, MAXWV, EPS, EPSTOP, ENN1, ELONN1, EON, EONTOP)
This subprogram gets wave-space constants.
Definition: spwget.f:18