NCEPLIBS-sp  2.3.3
sptgpt.f
Go to the documentation of this file.
1 C> @file
2 C>
3 C> Transform spectral scalar to station points
4 C> @author IREDELL @date 96-02-29
5 
6 C> This subprogram performs a spherical transform
7 c> from spectral coefficients of scalar quantities
8 c> to specified sets of station points on the globe.
9 C> The wave-space can be either triangular or rhomboidal.
10 C> The wave and point fields may have general indexing,
11 c> but each wave field is in sequential 'ibm order',
12 c> i.e. with zonal wavenumber as the slower index.
13 C> The transforms are all multiprocessed over stations.
14 C> Transform several fields at a time to improve vectorization.
15 C> Subprogram can be called from a multiprocessing environment.
16 C>
17 C> PROGRAM HISTORY LOG:
18 C> - 96-02-29 IREDELL
19 C> - 1998-12-15 IREDELL OPENMP DIRECTIVES INSERTED
20 C> - 2003-06-30 IREDELL USE SPFFTPT
21 C>
22 C> @param IROMB - INTEGER SPECTRAL DOMAIN SHAPE
23 C> (0 FOR TRIANGULAR, 1 FOR RHOMBOIDAL)
24 C> @param MAXWV - INTEGER SPECTRAL TRUNCATION
25 C> @param KMAX - INTEGER NUMBER OF FIELDS TO TRANSFORM.
26 C> @param NMAX - INTEGER NUMBER OF STATION POINTS TO RETURN
27 C> @param KWSKIP - INTEGER SKIP NUMBER BETWEEN WAVE FIELDS
28 C> (DEFAULTS TO (MAXWV+1)*((IROMB+1)*MAXWV+2) IF KWSKIP=0)
29 C> @param KGSKIP - INTEGER SKIP NUMBER BETWEEN STATION POINT SETS
30 C> (DEFAULTS TO NMAX IF KGSKIP=0)
31 C> @param NRSKIP - INTEGER SKIP NUMBER BETWEEN STATION LATS AND LONS
32 C> (DEFAULTS TO 1 IF NRSKIP=0)
33 C> @param NGSKIP - INTEGER SKIP NUMBER BETWEEN STATION POINTS
34 C> (DEFAULTS TO 1 IF NGSKIP=0)
35 C> @param RLAT - REAL (*) STATION LATITUDES IN DEGREES
36 C> @param RLON - REAL (*) STATION LONGITUDES IN DEGREES
37 C> @param WAVE - REAL (*) WAVE FIELDS
38 C> @param GP - REAL (*) STATION POINT SETS
39 C>
40 C> SUBPROGRAMS CALLED:
41 C> - SPWGET() GET WAVE-SPACE CONSTANTS
42 C> - SPLEGEND() COMPUTE LEGENDRE POLYNOMIALS
43 C> - SPSYNTH() SYNTHESIZE FOURIER FROM SPECTRAL
44 C> - SPFFTPT() POINTWISE FOURIER TRANSFORM
45  SUBROUTINE sptgpt(IROMB,MAXWV,KMAX,NMAX,
46  & KWSKIP,KGSKIP,NRSKIP,NGSKIP,
47  & RLAT,RLON,WAVE,GP)
48 
49  REAL RLAT(*),RLON(*),WAVE(*),GP(*)
50  REAL EPS((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),EPSTOP(MAXWV+1)
51  REAL ENN1((MAXWV+1)*((IROMB+1)*MAXWV+2)/2)
52  REAL ELONN1((MAXWV+1)*((IROMB+1)*MAXWV+2)/2)
53  REAL EON((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),EONTOP(MAXWV+1)
54  INTEGER MP(KMAX)
55  REAL WTOP(2*(MAXWV+1),KMAX)
56  REAL PLN((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),PLNTOP(MAXWV+1)
57  REAL F(2*MAXWV+3,2,KMAX)
58  parameter(pi=3.14159265358979)
59 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
60 C CALCULATE PRELIMINARY CONSTANTS
61  CALL spwget(iromb,maxwv,eps,epstop,enn1,elonn1,eon,eontop)
62  mx=(maxwv+1)*((iromb+1)*maxwv+2)/2
63  mxtop=maxwv+1
64  idim=2*maxwv+3
65  kw=kwskip
66  kg=kgskip
67  nr=nrskip
68  ng=ngskip
69  IF(kw.EQ.0) kw=2*mx
70  IF(kg.EQ.0) kg=nmax
71  IF(nr.EQ.0) nr=1
72  IF(ng.EQ.0) ng=1
73  mp=0
74 C$OMP PARALLEL DO
75  DO k=1,kmax
76  wtop(1:2*mxtop,k)=0
77  ENDDO
78 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
79 C CALCULATE STATION FIELDS
80 C$OMP PARALLEL DO PRIVATE(RADLAT,SLAT1,CLAT1)
81 C$OMP& PRIVATE(PLN,PLNTOP,F,NK)
82  DO n=1,nmax
83  radlat=pi/180*rlat((n-1)*nr+1)
84  IF(rlat((n-1)*nr+1).GE.89.9995) THEN
85  slat1=1.
86  clat1=0.
87  ELSEIF(rlat((n-1)*nr+1).LE.-89.9995) THEN
88  slat1=-1.
89  clat1=0.
90  ELSE
91  slat1=sin(radlat)
92  clat1=cos(radlat)
93  ENDIF
94  CALL splegend(iromb,maxwv,slat1,clat1,eps,epstop,
95  & pln,plntop)
96  CALL spsynth(iromb,maxwv,2*maxwv,idim,kw,2*mxtop,kmax,
97  & clat1,pln,plntop,mp,wave,wtop,f)
98  CALL spfftpt(maxwv,1,2*maxwv+3,kg,kmax,rlon((n-1)*nr+1),
99  & f,gp((n-1)*ng+1))
100  ENDDO
101 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
102  END
spwget
subroutine spwget(IROMB, MAXWV, EPS, EPSTOP, ENN1, ELONN1, EON, EONTOP)
This subprogram gets wave-space constants.
Definition: spwget.f:22
splegend
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
spsynth
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:35
spfftpt
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:22
sptgpt
subroutine sptgpt(IROMB, MAXWV, KMAX, NMAX, KWSKIP, KGSKIP, NRSKIP, NGSKIP, RLAT, RLON, WAVE, GP)
This subprogram performs a spherical transform from spectral coefficients of scalar quantities to spe...
Definition: sptgpt.f:48