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