NCEPLIBS-sp  2.5.0
sptgptsd.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Transform spectral scalar to station points.
3 C> @author Iredell @date 96-02-29
4 C>
5 C> ### Program History Log
6 C> Date | Programmer | Comments
7 C> -----|------------|---------
8 C> 96-02-29 | Iredell | Initial.
9 C> 1998-12-15 | Iredell | Openmp directives inserted.
10 C> 1999-08-18 | Iredell | Openmp directive typo fixed.
11 C>
12 C> @author Iredell @date 96-02-29
13 
14 C> This subprogram performs a spherical transform
15 C> from spectral coefficients of scalar quantities
16 C> to specified sets of station point values
17 C> and their gradients on the globe.
18 C>
19 C> The wave-space can be either triangular or rhomboidal.
20 C>
21 C> The wave and point fields may have general indexing,
22 C> but each wave field is in sequential 'IBM order',
23 C> i.e. with zonal wavenumber as the slower index.
24 C>
25 C> The transforms are all multiprocessed over stations.
26 C>
27 C> Transform several fields at a time to improve vectorization.
28 C>
29 C> Subprogram can be called from a multiprocessing environment.
30 C>
31 C> @param IROMB spectral domain shape
32 C> (0 for triangular, 1 for rhomboidal)
33 C> @param MAXWV spectral truncation
34 C> @param KMAX number of fields to transform.
35 C> @param NMAX number of station points to return
36 C> @param KWSKIP skip number between wave fields
37 C> (defaults to (MAXWV+1)*((IROMB+1)*MAXWV+2) if KWSKIP=0)
38 C> @param KGSKIP skip number between station point sets
39 C> (defaults to NMAX if KGSKIP=0)
40 C> @param NRSKIP skip number between station lats and lons
41 C> (defaults to 1 if NRSKIP=0)
42 C> @param NGSKIP skip number between station points
43 C> (defaults to 1 if NGSKIP=0)
44 C> @param RLAT station latitudes in degrees
45 C> @param RLON station longitudes in degrees
46 C> @param WAVE wave fields
47 C> @param GP station point sets
48 C> @param XP station point x-gradient sets
49 C> @param YP station point y-gradient sets
50 C>
51 C> @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)
68 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
69 C 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
85 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
86 C CALCULATE SPECTRAL WINDS
87 C$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
101 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
102 C CALCULATE STATION FIELDS
103 C$OMP PARALLEL DO PRIVATE(KS,KY,KX,SLAT1,CLAT1)
104 C$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
129 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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