NCEPLIBS-sp  2.5.0
sptrung.f
Go to the documentation of this file.
1 C> @file
2 C>
3 C> Spectrally interpolate scalars to stations
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 specified sets of
8 C> station points on the globe. 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 and point fields may have general indexing. The
12 C> transforms are all multiprocessed. Transform several fields at a
13 C> time to improve vectorization. Subprogram can be called from a
14 C> multiprocessing environment.
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 NMAX - INTEGER NUMBER OF STATION POINTS TO RETURN
27 C> @param IPRIME - INTEGER INPUT LONGITUDE INDEX FOR THE PRIME MERIDIAN.
28 C> (DEFAULTS TO 1 IF IPRIME=0)
29 C> (OUTPUT LONGITUDE INDEX FOR PRIME MERIDIAN ASSUMED 1.)
30 C> @param ISKIPI - INTEGER SKIP NUMBER BETWEEN INPUT LONGITUDES
31 C> (DEFAULTS TO 1 IF ISKIPI=0)
32 C> @param JSKIPI - INTEGER SKIP NUMBER BETWEEN INPUT LATITUDES FROM SOUTH
33 C> (DEFAULTS TO -IMAXI IF JSKIPI=0)
34 C> @param KSKIPI - INTEGER SKIP NUMBER BETWEEN INPUT GRID FIELDS
35 C> (DEFAULTS TO IMAXI*JMAXI IF KSKIPI=0)
36 C> @param KGSKIP - INTEGER SKIP NUMBER BETWEEN STATION POINT SETS
37 C> (DEFAULTS TO NMAX IF KGSKIP=0)
38 C> @param NRSKIP - INTEGER SKIP NUMBER BETWEEN STATION LATS AND LONS
39 C> (DEFAULTS TO 1 IF NRSKIP=0)
40 C> @param NGSKIP - INTEGER SKIP NUMBER BETWEEN STATION POINTS
41 C> (DEFAULTS TO 1 IF NGSKIP=0)
42 C> @param RLAT - REAL (*) STATION LATITUDES IN DEGREES
43 C> @param RLON - REAL (*) STATION LONGITUDES IN DEGREES
44 C> @param JCPU - INTEGER NUMBER OF CPUS OVER WHICH TO MULTIPROCESS
45 C> (DEFAULTS TO ENVIRONMENT NCPUS IF JCPU=0)
46 C> @param GRIDI - REAL (*) INPUT GRID FIELDS
47 C> @param[out] GP - REAL (*) STATION POINT SETS
48 C>
49 C> SUBPROGRAMS CALLED:
50 C> - sptran() Perform a scalar spherical transform
51 C> - sptgpt() Transform spectral scalar to station points
52 C> - ncpus() Gets environment number of cpus
53 C>
54 C> Minimum grid dimensions for unaliased transforms to spectral:
55 C> DIMENSION |LINEAR |QUADRATIC
56 C> ----------------------- |--------- |-------------
57 C> IMAX | 2*MAXWV+2 | 3*MAXWV/2*2+2
58 C> JMAX (IDRT=4,IROMB=0) | 1*MAXWV+1 | 3*MAXWV/2+1
59 C> JMAX (IDRT=4,IROMB=1) | 2*MAXWV+1 | 5*MAXWV/2+1
60 C> JMAX (IDRT=0,IROMB=0) | 2*MAXWV+3 | 3*MAXWV/2*2+3
61 C> JMAX (IDRT=0,IROMB=1) | 4*MAXWV+3 | 5*MAXWV/2*2+3
62 C> JMAX (IDRT=256,IROMB=0) | 2*MAXWV+1 | 3*MAXWV/2*2+1
63 C> JMAX (IDRT=256,IROMB=1) | 4*MAXWV+1 | 5*MAXWV/2*2+1
64 C>
65  SUBROUTINE sptrung(IROMB,MAXWV,IDRTI,IMAXI,JMAXI,KMAX,NMAX,
66  & IPRIME,ISKIPI,JSKIPI,KSKIPI,KGSKIP,
67  & NRSKIP,NGSKIP,JCPU,RLAT,RLON,GRIDI,GP)
68 
69  REAL RLAT(*),RLON(*),GRIDI(*),GP(*)
70  REAL W((MAXWV+1)*((IROMB+1)*MAXWV+2)/2*2+1,KMAX)
71 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
72 C TRANSFORM INPUT GRID TO WAVE
73  jc=jcpu
74  IF(jc.EQ.0) jc=ncpus()
75  mx=(maxwv+1)*((iromb+1)*maxwv+2)/2
76  mdim=2*mx+1
77  jn=-jskipi
78  IF(jn.EQ.0) jn=imaxi
79  js=-jn
80  inp=(jmaxi-1)*max(0,-jn)+1
81  isp=(jmaxi-1)*max(0,-js)+1
82  CALL sptran(iromb,maxwv,idrti,imaxi,jmaxi,kmax,
83  & iprime,iskipi,jn,js,mdim,kskipi,0,0,jc,
84  & w,gridi(inp),gridi(isp),-1)
85 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
86 C TRANSFORM WAVE TO OUTPUT
87  CALL sptgpt(iromb,maxwv,kmax,nmax,mdim,kgskip,nrskip,ngskip,
88  & rlat,rlon,w,gp)
89 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
90  END
function ncpus()
Set number of CPUs - the number of processors over which to parallelize.
Definition: ncpus.F:24
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:51
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 sptrung(IROMB, MAXWV, IDRTI, IMAXI, JMAXI, KMAX, NMAX, IPRIME, ISKIPI, JSKIPI, KSKIPI, KGSKIP, NRSKIP, NGSKIP, JCPU, RLAT, RLON, GRIDI, GP)
This subprogram spectrally truncates scalar fields on a global cylindrical grid, returning the fields...
Definition: sptrung.f:68