NCEPLIBS-sp 2.4.0
sptrung.f
Go to the documentation of this file.
1C> @file
2C>
3C> Spectrally interpolate scalars to stations
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 specified sets of
8C> station points on the globe. 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 and point fields may have general indexing. The
12C> transforms are all multiprocessed. Transform several fields at a
13C> time to improve vectorization. Subprogram can be called from a
14C> multiprocessing environment.
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 NMAX - INTEGER NUMBER OF STATION POINTS TO RETURN
27C> @param IPRIME - INTEGER INPUT LONGITUDE INDEX FOR THE PRIME MERIDIAN.
28C> (DEFAULTS TO 1 IF IPRIME=0)
29C> (OUTPUT LONGITUDE INDEX FOR PRIME MERIDIAN ASSUMED 1.)
30C> @param ISKIPI - INTEGER SKIP NUMBER BETWEEN INPUT LONGITUDES
31C> (DEFAULTS TO 1 IF ISKIPI=0)
32C> @param JSKIPI - INTEGER SKIP NUMBER BETWEEN INPUT LATITUDES FROM SOUTH
33C> (DEFAULTS TO -IMAXI IF JSKIPI=0)
34C> @param KSKIPI - INTEGER SKIP NUMBER BETWEEN INPUT GRID FIELDS
35C> (DEFAULTS TO IMAXI*JMAXI IF KSKIPI=0)
36C> @param KGSKIP - INTEGER SKIP NUMBER BETWEEN STATION POINT SETS
37C> (DEFAULTS TO NMAX IF KGSKIP=0)
38C> @param NRSKIP - INTEGER SKIP NUMBER BETWEEN STATION LATS AND LONS
39C> (DEFAULTS TO 1 IF NRSKIP=0)
40C> @param NGSKIP - INTEGER SKIP NUMBER BETWEEN STATION POINTS
41C> (DEFAULTS TO 1 IF NGSKIP=0)
42C> @param RLAT - REAL (*) STATION LATITUDES IN DEGREES
43C> @param RLON - REAL (*) STATION LONGITUDES IN DEGREES
44C> @param JCPU - INTEGER NUMBER OF CPUS OVER WHICH TO MULTIPROCESS
45C> (DEFAULTS TO ENVIRONMENT NCPUS IF JCPU=0)
46C> @param GRIDI - REAL (*) INPUT GRID FIELDS
47C> @param[out] GP - REAL (*) STATION POINT SETS
48C>
49C> SUBPROGRAMS CALLED:
50C> - sptran() Perform a scalar spherical transform
51C> - sptgpt() Transform spectral scalar to station points
52C> - ncpus() Gets environment number of cpus
53C>
54C> Minimum grid dimensions for unaliased transforms to spectral:
55C> DIMENSION |LINEAR |QUADRATIC
56C> ----------------------- |--------- |-------------
57C> IMAX | 2*MAXWV+2 | 3*MAXWV/2*2+2
58C> JMAX (IDRT=4,IROMB=0) | 1*MAXWV+1 | 3*MAXWV/2+1
59C> JMAX (IDRT=4,IROMB=1) | 2*MAXWV+1 | 5*MAXWV/2+1
60C> JMAX (IDRT=0,IROMB=0) | 2*MAXWV+3 | 3*MAXWV/2*2+3
61C> JMAX (IDRT=0,IROMB=1) | 4*MAXWV+3 | 5*MAXWV/2*2+3
62C> JMAX (IDRT=256,IROMB=0) | 2*MAXWV+1 | 3*MAXWV/2*2+1
63C> JMAX (IDRT=256,IROMB=1) | 4*MAXWV+1 | 5*MAXWV/2*2+1
64C>
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)
71C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
72C 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)
85C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
86C TRANSFORM WAVE TO OUTPUT
87 CALL sptgpt(iromb,maxwv,kmax,nmax,mdim,kgskip,nrskip,ngskip,
88 & rlat,rlon,w,gp)
89C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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