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