NCEPLIBS-sp 2.4.0
sptrunm.f
Go to the documentation of this file.
1C> @file
2C>
3C> Spectrally interpolate scalars to Mercator
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 a Mercator grid. The
8C> wave-space can be either triangular or rhomboidal. The grid-space
9C> can be either an equally-spaced grid (with or without pole
10C> points) or a Gaussian grid. The grid fields may have general
11C> indexing. The transforms are all multiprocessed. Transform
12C> several fields at a time to improve vectorization. Subprogram can
13C> be called from a multiprocessing environment.
14C>
15C>
16C> @param IROMB - INTEGER SPECTRAL DOMAIN SHAPE
17C> (0 FOR TRIANGULAR, 1 FOR RHOMBOIDAL)
18C> @param MAXWV - INTEGER SPECTRAL TRUNCATION
19C> @param IDRTI - INTEGER INPUT GRID IDENTIFIER
20C> (IDRTI=4 FOR GAUSSIAN GRID,
21C> IDRTI=0 FOR EQUALLY-SPACED GRID INCLUDING POLES,
22C> IDRTI=256 FOR EQUALLY-SPACED GRID EXCLUDING POLES)
23C> @param IMAXI - INTEGER EVEN NUMBER OF INPUT LONGITUDES.
24C> @param JMAXI - INTEGER NUMBER OF INPUT LATITUDES.
25C> @param KMAX - INTEGER NUMBER OF FIELDS TO TRANSFORM.
26C> @param MI - INTEGER NUMBER OF POINTS IN THE FASTER ZONAL DIRECTION
27C> @param MJ - INTEGER NUMBER OF POINTS IN THE SLOWER MERID DIRECTION
28C> @param IPRIME - INTEGER INPUT LONGITUDE INDEX FOR THE PRIME MERIDIAN.
29C> (DEFAULTS TO 1 IF IPRIME=0)
30C> (OUTPUT LONGITUDE INDEX FOR PRIME MERIDIAN ASSUMED 1.)
31C> @param ISKIPI - INTEGER SKIP NUMBER BETWEEN INPUT LONGITUDES
32C> (DEFAULTS TO 1 IF ISKIPI=0)
33C> @param JSKIPI - INTEGER SKIP NUMBER BETWEEN INPUT LATITUDES FROM SOUTH
34C> (DEFAULTS TO -IMAXI IF JSKIPI=0)
35C> @param KSKIPI - INTEGER SKIP NUMBER BETWEEN INPUT GRID FIELDS
36C> (DEFAULTS TO IMAXI*JMAXI IF KSKIPI=0)
37C> @param KGSKIP - INTEGER SKIP NUMBER BETWEEN GRID FIELDS
38C> (DEFAULTS TO NPS*NPS IF KGSKIP=0)
39C> @param NISKIP - INTEGER SKIP NUMBER BETWEEN GRID I-POINTS
40C> (DEFAULTS TO 1 IF NISKIP=0)
41C> @param NJSKIP - INTEGER SKIP NUMBER BETWEEN GRID J-POINTS
42C> (DEFAULTS TO NPS IF NJSKIP=0)
43C> @param JCPU - INTEGER NUMBER OF CPUS OVER WHICH TO MULTIPROCESS
44C> (DEFAULTS TO ENVIRONMENT NCPUS IF JCPU=0)
45C> @param RLAT1 - REAL LATITUDE OF THE FIRST GRID POINT IN DEGREES
46C> @param RLON1 - REAL LONGITUDE OF THE FIRST GRID POINT IN DEGREES
47C> @param DLAT - REAL LATITUDE INCREMENT IN DEGREES SUCH THAT
48C> D(PHI)/D(J)=DLAT*COS(PHI) WHERE J IS MERIDIONAL INDEX.
49C> DLAT IS NEGATIVE FOR GRIDS INDEXED SOUTHWARD.
50C> (IN TERMS OF GRID INCREMENT DY VALID AT LATITUDE RLATI,
51C> THE LATITUDE INCREMENT DLAT IS DETERMINED AS
52C> DLAT=DPR*DY/(RERTH*COS(RLATI/DPR))
53C> WHERE DPR=180/PI AND RERTH IS EARTH'S RADIUS)
54C> @param DLON - REAL LONGITUDE INCREMENT IN DEGREES SUCH THAT
55C> D(LAMBDA)/D(I)=DLON WHERE I IS ZONAL INDEX.
56C> DLON IS NEGATIVE FOR GRIDS INDEXED WESTWARD.
57C> @param GRIDI - REAL (*) INPUT GRID FIELDS
58C> @param GM - REAL (*) MERCATOR FIELDS
59C>
60C> SUBPROGRAMS CALLED:
61C> - sptran() Perform a scalar spherical transform
62C> - sptgpm() Transform spectral scalar to Mercator
63C> - ncpus() Gets environment number of cpus
64C>
65C> MINIMUM GRID DIMENSIONS FOR UNALIASED TRANSFORMS TO SPECTRAL:
66C> DIMENSION |LINEAR |QUADRATIC
67C> ----------------------- |--------- |-------------
68C> IMAX | 2*MAXWV+2 | 3*MAXWV/2*2+2
69C> JMAX (IDRT=4,IROMB=0) | 1*MAXWV+1 | 3*MAXWV/2+1
70C> JMAX (IDRT=4,IROMB=1) | 2*MAXWV+1 | 5*MAXWV/2+1
71C> JMAX (IDRT=0,IROMB=0) | 2*MAXWV+3 | 3*MAXWV/2*2+3
72C> JMAX (IDRT=0,IROMB=1) | 4*MAXWV+3 | 5*MAXWV/2*2+3
73C> JMAX (IDRT=256,IROMB=0) | 2*MAXWV+1 | 3*MAXWV/2*2+1
74C> JMAX (IDRT=256,IROMB=1) | 4*MAXWV+1 | 5*MAXWV/2*2+1
75C>
76 SUBROUTINE sptrunm(IROMB,MAXWV,IDRTI,IMAXI,JMAXI,KMAX,MI,MJ,
77 & IPRIME,ISKIPI,JSKIPI,KSKIPI,KGSKIP,
78 & NISKIP,NJSKIP,JCPU,RLAT1,RLON1,DLAT,DLON,
79 & GRIDI,GM)
80 REAL GRIDI(*),GM(*)
81 REAL W((MAXWV+1)*((IROMB+1)*MAXWV+2)/2*2+1,KMAX)
82C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
83C TRANSFORM INPUT GRID TO WAVE
84 jc=jcpu
85 IF(jc.EQ.0) jc=ncpus()
86 mx=(maxwv+1)*((iromb+1)*maxwv+2)/2
87 mdim=2*mx+1
88 jn=-jskipi
89 IF(jn.EQ.0) jn=imaxi
90 js=-jn
91 inp=(jmaxi-1)*max(0,-jn)+1
92 isp=(jmaxi-1)*max(0,-js)+1
93 CALL sptran(iromb,maxwv,idrti,imaxi,jmaxi,kmax,
94 & iprime,iskipi,jn,js,mdim,kskipi,0,0,jc,
95 & w,gridi(inp),gridi(isp),-1)
96C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
97C TRANSFORM WAVE TO OUTPUT
98 CALL sptgpm(iromb,maxwv,kmax,mi,mj,mdim,kgskip,niskip,njskip,
99 & rlat1,rlon1,dlat,dlon,w,gm)
100C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
101 END
function ncpus()
Set number of CPUs - the number of processors over which to parallelize.
Definition: ncpus.F:24
subroutine sptgpm(IROMB, MAXWV, KMAX, MI, MJ, KWSKIP, KGSKIP, NISKIP, NJSKIP, RLAT1, RLON1, DLAT, DLON, WAVE, GM)
This subprogram performs a spherical transform from spectral coefficients of scalar quantities to sca...
Definition: sptgpm.f:56
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 sptrunm(IROMB, MAXWV, IDRTI, IMAXI, JMAXI, KMAX, MI, MJ, IPRIME, ISKIPI, JSKIPI, KSKIPI, KGSKIP, NISKIP, NJSKIP, JCPU, RLAT1, RLON1, DLAT, DLON, GRIDI, GM)
This subprogram spectrally truncates scalar fields on a global cylindrical grid, returning the fields...
Definition: sptrunm.f:80