f2fsh, f2gsh, g2fsh, g2gsh, fo2fsh, f2fosh

Grid-to-grid functions for scalar quantities using Spherepack routines.


Synopsis

    function f2fsh(
        grid       : float,
        outdims[2] : integer
    )

    function g2fsh(
        grid       : float,
        outdims[2] : integer
    )

    function f2gsh(
        grid       : float,
        outdims[2] : integer,
        twave[1]   : integer
    )

    function g2gsh(
        grid       : float,
        outdims[2] : integer,
        twave[1]   : integer
    )

    function fo2fsh(
        grid : float
    )

    function f2fosh(
        grid : float
    )


Arguments

grid
input float array of 2 or more dimensions (last two dimensions must be nlata x nlona, values must be in ascending latitude order)
outdims
indicates dimensions of rightmost two dimensions of output grid (outdims[0] = nlatb, outdims[1] = nlonb)
twave
scalar integer indicating the optional wave truncation:

Description

Fixed or regular grids have grid points that align with the Grenwich meridian and the equator. Eg: a 2.5 x 2.5 degree grid will have values at the equator:
               (-90  ,0), (-90,  2.5),..., (-90,  357.5)
               (-87.5,0), (-87.5,2.5),..., (-87.5,357.5)
                        .
               (0,0), (0,2.5), (0,5.0),..., (0,357.5)
               (2.5,0),(2.5,2.5),..., (2.5,357.5)
For a 2.5 degree fixed/regular grid there are 73 latitude points and 144 longitude points. Both pole points are present.

Fixed offset grids are grids 'offset' from Grenwich meridian and equator. For example, a 2.5 x 2.5 degree fixed-offset grid has values at:

               (-88.75,1.25), (-88.75,3.75),..., (-88.75,357.5)
.
(1.25,1.25), (1.25,3.75),...,(1.25,358.75)
(3,75,1.25), (3.75,3.75),...,(3.75,358.75)
For a 2.5 degree fixed-offset grid there are 72 latitude points and 144 longitude points. There are no pole points.

g2gsh interpolates a scalar quantity from one Gaussian grid to another (optional truncation) using spherical harmonics (values will be in ascending latitude order). The output array's dimensions are the same as grid's dimensions, except nlata and nlona are replaced by nlatb and nlonb.

g2fsh interpolates a scalar quantity on a Gaussian grid to a fixed grid using spherical harmonics (values will be in ascending latitude order). The output array's dimensions are the same as grid's dimensions, except nlata and nlona are replaced by nlatb and nlonb.

f2gsh interpolates a scalar quantity on a fixed grid to a Gaussian (optional truncation) grid using spherical harmonics (values will be in ascending latitude order). The output array's dimensions are the same as grid's dimensions, except nlata and nlona are replaced by nlatb and nlonb.

f2fsh interpolates a scalar quantity from one fixed grid to another using spherical harmonics (values will be in ascending latitude order). The output array's dimensions are the same as grid's dimensions, except nlata and nlona are replaced by nlatb and nlonb.

fo2fsh interpolates a scalar quantity on a fixed-offset grid to a fixed grid using spherical harmonics (values will be in ascending latitude order). The output array dimensions are the same as grid's dimensions, except the latitude dimension (nlata) is increased by one. For example, a 5 degree fixed-offset grid would have dimensions nlata=36, nlona=72 and the return fixed grid would have dimensions nlatb=37, nlonb=72.

f2fosh interpolates a scalar quantity on a fixed grid (including pole points) to a fixed-offset grid using spherical harmonics (values will be in ascending latitude order). The output array dimensions are the same as grid's dimensions, except the latitude dimension (nlata) is decreased by one. For example, a 5 degree fixed grid would have dimensions nlata=37, nlona=72, and the return fixed-offset grid would have dimensions nlatb=36, nlonb=72.

Arrays which have dimensions [...] x nlat x nlon should not include the cyclic (wraparound) points when invoking the procedures and functions which use spherical harmonics (Spherepack).

For example, if an array x has dimensions nlat = 64 and nlon = 129, where the "129" represents the cyclic points, then the user should pass the data to the procedure/function via:

    z = sample ( x([...] :,0:nlon-2) )  ; does not include cyclic points

Example

begin

  jlat  =  94                      ; NCEP grid
  ilon  = 192
  nga   =   3                      ; there will be "nga" (192,94) grids
  grida = new( (/nga,jlat,ilon/), float)

  nlat  = 40
  mlon  = 48              
  ngb   =  3                       ; there will be "ngb" (48,40) grids
  gridb = new( (/ngb,nlat,mlon/), float)

;
; Read in the source grid.		
; This is the NCEP grid created as a direct access fortran file
;
  grida(0,:,:) = cbinread ("T2m_T62.7901" ,(/jlat,ilon/), "float" )
;
; Put the North pole at the top of the plot.
;
  grida(0,:,:) = grida(0,::-1,:)

  print ("grida mid point:")
  print (grida(0,jlat/2,ilon/2))
;
; Create grids with different resolutions.
; Gaussian =>fixed equally spaced
;
  llat  = 180                        ; 1.0 
  klon  = 360                        ; 1.0 
  grid1 = g2fsh (grida(0,:,:), (/llat,klon/) ) 
;
; Gaussian =>fixed unequally spaced
;
  gridb(0,:,:) = g2fsh (grida(0,:,:), (/nlat,mlon/) )
;
; Fixed (equal) to fixed (unequal)
;
  gridb(1,:,:) = f2fsh (grid1, (/nlat,mlon/) )
;
; Fixed => Gaussian (T62)
;
  grida(1,:,:) = f2gsh (grid1, (/jlat,ilon/), 62 )
;
; Difference fields
;
  grida(2,:,:) = grida(1,:,:) - grida(0,:,:)       
  gridb(2,:,:) = gridb(1,:,:) - gridb(0,:,:)       
end

Error messages

ier is equal to:
4 or 10 if nlona is less than 4
5 or 10 if nlata is less than 3
8 if nlonb is less than 4
9 if nlatb is less than 3

Reference Manual Control Panel

NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?


$Revision: 1.15 $ $Date: 1999/02/23 15:59:23 $