NCEPLIBS-sp  2.3.3
sptruns.f
Go to the documentation of this file.
1 C> @file
2 C>
3 C> Spectrally interpolate scalars to polar stereo
4 C> @author IREDELL @date 96-02-29
5 
6 C> This subprogram spectrally truncates scalar fields on a global
7 C> cylindrical grid, returning the fields to specific pairs of polar
8 C> stereographic scalar fields. The wave-space can be either
9 C> triangular or rhomboidal. The grid-space can be either an
10 C> equally-spaced grid (with or without pole points) or a gaussian
11 C> grid. The grid fields may have general indexing. The transforms
12 C> are all multiprocessed. Transform several fields at a time to
13 C> improve vectorization. Subprogram can be called from a
14 C> multiprocessing environment.
15 C>
16 C> PROGRAM HISTORY LOG:
17 C> 96-02-29 IREDELL
18 C>
19 C> @param IROMB - INTEGER SPECTRAL DOMAIN SHAPE
20 C> (0 FOR TRIANGULAR, 1 FOR RHOMBOIDAL)
21 C> @param MAXWV - INTEGER SPECTRAL TRUNCATION
22 C> @param IDRTI - INTEGER INPUT GRID IDENTIFIER
23 C> (IDRTI=4 FOR GAUSSIAN GRID,
24 C> IDRTI=0 FOR EQUALLY-SPACED GRID INCLUDING POLES,
25 C> IDRTI=256 FOR EQUALLY-SPACED GRID EXCLUDING POLES)
26 C> @param IMAXI - INTEGER EVEN NUMBER OF INPUT LONGITUDES.
27 C> @param JMAXI - INTEGER NUMBER OF INPUT LATITUDES.
28 C> @param KMAX - INTEGER NUMBER OF FIELDS TO TRANSFORM.
29 C> @param NPS - INTEGER ODD ORDER OF THE POLAR STEREOGRAPHIC GRIDS
30 C> @param IPRIME - INTEGER INPUT LONGITUDE INDEX FOR THE PRIME MERIDIAN.
31 C> (DEFAULTS TO 1 IF IPRIME=0)
32 C> (OUTPUT LONGITUDE INDEX FOR PRIME MERIDIAN ASSUMED 1.)
33 C> @param ISKIPI - INTEGER SKIP NUMBER BETWEEN INPUT LONGITUDES
34 C> (DEFAULTS TO 1 IF ISKIPI=0)
35 C> @param JSKIPI - INTEGER SKIP NUMBER BETWEEN INPUT LATITUDES FROM SOUTH
36 C> (DEFAULTS TO -IMAXI IF JSKIPI=0)
37 C> @param KSKIPI - INTEGER SKIP NUMBER BETWEEN INPUT GRID FIELDS
38 C> (DEFAULTS TO IMAXI*JMAXI IF KSKIPI=0)
39 C> @param KGSKIP - INTEGER SKIP NUMBER BETWEEN GRID FIELDS
40 C> (DEFAULTS TO NPS*NPS IF KGSKIP=0)
41 C> @param NISKIP - INTEGER SKIP NUMBER BETWEEN GRID I-POINTS
42 C> (DEFAULTS TO 1 IF NISKIP=0)
43 C> @param NJSKIP - INTEGER SKIP NUMBER BETWEEN GRID J-POINTS
44 C> (DEFAULTS TO NPS IF NJSKIP=0)
45 C> @param JCPU - INTEGER NUMBER OF CPUS OVER WHICH TO MULTIPROCESS
46 C> (DEFAULTS TO ENVIRONMENT NCPUS IF JCPU=0)
47 C> @param TRUE - REAL LATITUDE AT WHICH PS GRID IS TRUE (USUALLY 60.)
48 C> @param XMESH - REAL GRID LENGTH AT TRUE LATITUDE (M)
49 C> @param ORIENT - REAL LONGITUDE AT BOTTOM OF NORTHERN PS GRID
50 C> (SOUTHERN PS GRID WILL HAVE OPPOSITE ORIENTATION.)
51 C> @param GRIDI - REAL (*) INPUT GRID FIELDS
52 C> @param GN - REAL (*) NORTHERN POLAR STEREOGRAPHIC FIELDS
53 C> @param GS - REAL (*) SOUTHERN POLAR STEREOGRAPHIC FIELDS
54 C>
55 C> SUBPROGRAMS CALLED:
56 C> - sptran() Perform a scalar spherical transform
57 C> - sptgps() Transform spectral scalar to polar stereo.
58 C> - ncpus() Gets environment number of cpus
59 C>
60 C> Minimum grid dimensions for unaliased transforms to spectral:
61 C> DIMENSION | LINEAR | QUADRATIC
62 C> ----------------------- | --------- | -------------
63 C> IMAX | 2*MAXWV+2 | 3*MAXWV/2*2+2
64 C> JMAX (IDRT=4,IROMB=0) | 1*MAXWV+1 | 3*MAXWV/2+1
65 C> JMAX (IDRT=4,IROMB=1) | 2*MAXWV+1 | 5*MAXWV/2+1
66 C> JMAX (IDRT=0,IROMB=0) | 2*MAXWV+3 | 3*MAXWV/2*2+3
67 C> JMAX (IDRT=0,IROMB=1) | 4*MAXWV+3 | 5*MAXWV/2*2+3
68 C> JMAX (IDRT=256,IROMB=0) | 2*MAXWV+1 | 3*MAXWV/2*2+1
69 C> JMAX (IDRT=256,IROMB=1) | 4*MAXWV+1 | 5*MAXWV/2*2+1
70 C>
71  SUBROUTINE sptruns(IROMB,MAXWV,IDRTI,IMAXI,JMAXI,KMAX,NPS,
72  & IPRIME,ISKIPI,JSKIPI,KSKIPI,KGSKIP,
73  & NISKIP,NJSKIP,JCPU,TRUE,XMESH,ORIENT,
74  & GRIDI,GN,GS)
75  REAL GRIDI(*),GN(*),GS(*)
76  REAL W((MAXWV+1)*((IROMB+1)*MAXWV+2)/2*2+1,KMAX)
77 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
78 C TRANSFORM INPUT GRID TO WAVE
79  jc=jcpu
80  IF(jc.EQ.0) jc=ncpus()
81  mx=(maxwv+1)*((iromb+1)*maxwv+2)/2
82  mdim=2*mx+1
83  jn=-jskipi
84  IF(jn.EQ.0) jn=imaxi
85  js=-jn
86  inp=(jmaxi-1)*max(0,-jn)+1
87  isp=(jmaxi-1)*max(0,-js)+1
88  CALL sptran(iromb,maxwv,idrti,imaxi,jmaxi,kmax,
89  & iprime,iskipi,jn,js,mdim,kskipi,0,0,jc,
90  & w,gridi(inp),gridi(isp),-1)
91 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
92 C TRANSFORM WAVE TO OUTPUT
93  CALL sptgps(iromb,maxwv,kmax,nps,mdim,kgskip,niskip,njskip,
94  & true,xmesh,orient,w,gn,gs)
95 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
96  END
sptran
subroutine sptran(IROMB, MAXWV, IDRT, IMAX, JMAX, KMAX, IPRIME, ISKIP, JNSKIP, JSSKIP, KWSKIP, KGSKIP, JBEG, JEND, JCPU, WAVE, GRIDN, GRIDS, IDIR)
This subprogram performs a spherical transform between spectral coefficients of scalar quantities and...
Definition: sptran.f:80
sptgps
subroutine sptgps(IROMB, MAXWV, KMAX, NPS, KWSKIP, KGSKIP, NISKIP, NJSKIP, TRUE, XMESH, ORIENT, WAVE, GN, GS)
This subprogram performs a spherical transform from spectral coefficients of scalar quantities to sca...
Definition: sptgps.f:75
ncpus
function ncpus()
Set number of cpus.
Definition: ncpus.F:21
sptruns
subroutine sptruns(IROMB, MAXWV, IDRTI, IMAXI, JMAXI, KMAX, NPS, IPRIME, ISKIPI, JSKIPI, KSKIPI, KGSKIP, NISKIP, NJSKIP, JCPU, TRUE, XMESH, ORIENT, GRIDI, GN, GS)
This subprogram spectrally truncates scalar fields on a global cylindrical grid, returning the fields...
Definition: sptruns.f:75