NCEPLIBS-ip  5.0.0
neighbor_interp_mod Module Reference

Interpolate scalar fields (neighbor). More...

Data Types

interface  interpolate_neighbor
 

Functions/Subroutines

subroutine interpolate_neighbor_scalar (IPOPT, grid_in, grid_out, MI, MO, KM, IBI, LI, GI, NO, RLAT, RLON, IBO, LO, GO, IRET)
 Interpolate scalar fields (neighbor). More...
 
subroutine interpolate_neighbor_vector (IPOPT, grid_in, grid_out, MI, MO, KM, IBI, LI, UI, VI, NO, RLAT, RLON, CROT, SROT, IBO, LO, UO, VO, IRET)
 Interpolate vector fields (neighbor). More...
 

Detailed Description

Interpolate scalar fields (neighbor).

Program History Log

Date Programmer Comments
96-04-10 Iredell initial
1999-04-08 Iredell split ijkgds into two pieces
2001-06-18 Iredell include spiral search option
2006-01-04 Gayno minor bug fix
2007-10-30 Iredell save weights and thread for performance
2012-06-26 Gayno fix out-of-bounds error. see nceplibs ticket #9.
2015-01-27 Gayno replace calls to gdswiz() with new merged version of gdswzd().
2015-07-13 Gayno replace grib 1 kgds arrays with grib 2 grid definition template arrays.
Author
Mark Iredell
Date
96-04-10

Function/Subroutine Documentation

◆ interpolate_neighbor_scalar()

subroutine neighbor_interp_mod::interpolate_neighbor_scalar ( integer, dimension(20), intent(in)  IPOPT,
class(ip_grid), intent(in)  grid_in,
class(ip_grid), intent(in)  grid_out,
integer, intent(in)  MI,
integer, intent(in)  MO,
integer, intent(in)  KM,
integer, dimension(km), intent(in)  IBI,
logical*1, dimension(mi,km), intent(in)  LI,
real, dimension(mi,km), intent(in)  GI,
integer, intent(inout)  NO,
real, dimension(mo), intent(inout)  RLAT,
real, dimension(mo), intent(inout)  RLON,
integer, dimension(km), intent(out)  IBO,
logical*1, dimension(mo,km), intent(out)  LO,
real, dimension(mo,km), intent(out)  GO,
integer, intent(out)  IRET 
)
private

Interpolate scalar fields (neighbor).

This subprogram performs neighbor interpolation from any grid to any grid for scalar fields.

Options allow choosing the width of the grid square (ipopt(1)) to search for valid data, which defaults to 1 (if ipopt(1)=-1). Odd width squares are centered on the nearest input grid point; even width squares are centered on the nearest four input grid points. Squares are searched for valid data in a spiral pattern starting from the center. No searching is done where the output grid is outside the input grid. Only horizontal interpolation is performed.

The code recognizes the following projections, where "igdtnumi/o" is the grib 2 grid defintion template number for the input and output grids, respectively:

  • (igdtnumi/o=00) equidistant cylindrical
  • (igdtnumi/o=01) rotated equidistant cylindrical. "e" and non-"e" staggered
  • (igdtnumi/o=10) mercator cylindrical
  • (igdtnumi/o=20) polar stereographic azimuthal
  • (igdtnumi/o=30) lambert conformal conical
  • (igdtnumi/o=40) gaussian cylindrical

As an added bonus the number of output grid points and their latitudes and longitudes are also returned. On the other hand, the output can be a set of station points if igdtnumo<0, in which case the number of points and their latitudes and longitudes must be input.

Input bitmaps will be interpolated to output bitmaps.

Output bitmaps will also be created when the output grid extends outside of the domain of the input grid. The output field is set to 0 where the output bitmap is off.

Parameters
[in]ipopt(20) interpolation options ipopt(1) is width of square to examine in spiral search (defaults to 1 if ipopt(1)=-1)
[in]grid_inThe input grid.
[in]grid_outThe output grid.
[in]miskip number between input grid fields if km>1 or dimension of input grid fields if km=1.
[in]moskip number between output grid fields if km>1 or dimension of output grid fields if km=1
[in]kmnumber of fields to interpolate
[in]ibi(km) input bitmap flags
[in]li(mi,km) input bitmaps (if some ibi(k)=1)
[in]gi(mi,km) input fields to interpolate
[in,out]nonumber of output points (only if igdtnumo<0)
[in,out]rlat(no) output latitudes in degrees (if igdtnumo<0)
[in,out]rlon(no) output longitudes in degrees (if igdtnumo<0)
[out]ibo(km) output bitmap flags
[out]lo(mo,km) output bitmaps (always output)
[out]go(mo,km) output fields interpolated
[out]iretreturn code
  • 0 successful interpolation
  • 2 unrecognized input grid or no grid overlap
  • 3 unrecognized output grid
Author
Mark Iredell
Date
96-04-10
Author
Eric Engle
Date
23-05-04

Definition at line 100 of file neighbor_interp_mod.F90.

◆ interpolate_neighbor_vector()

subroutine neighbor_interp_mod::interpolate_neighbor_vector ( integer, dimension(20), intent(in)  IPOPT,
class(ip_grid), intent(in)  grid_in,
class(ip_grid), intent(in)  grid_out,
integer, intent(in)  MI,
integer, intent(in)  MO,
integer, intent(in)  KM,
integer, dimension(km), intent(in)  IBI,
logical*1, dimension(mi,km), intent(in)  LI,
real, dimension(mi,km), intent(in)  UI,
real, dimension(mi,km), intent(in)  VI,
integer, intent(inout)  NO,
real, dimension(mo), intent(inout)  RLAT,
real, dimension(mo), intent(inout)  RLON,
real, dimension(mo), intent(inout)  CROT,
real, dimension(mo), intent(inout)  SROT,
integer, dimension(km), intent(out)  IBO,
logical*1, dimension(mo,km), intent(out)  LO,
real, dimension(mo,km), intent(out)  UO,
real, dimension(mo,km), intent(out)  VO,
integer, intent(out)  IRET 
)
private

Interpolate vector fields (neighbor).

This subprogram performs neighbor interpolation from any grid to any grid for vector fields.

Options allow choosing the width of the grid square (ipopt(1)) to search for valid data, which defaults to 1 (IF IPOPT(1)=-1). Odd width squares are centered on the nearest input grid point; even width squares are centered on the nearest four input grid points.

Squares are searched for valid data in a spiral pattern starting from the center. no searching is done where the output grid is outside the input grid. Only horizontal interpolation is performed.

The input and output grids are defined by their grib 2 grid definition template as decoded by the ncep g2 library.

The code recognizes the following projections, where "igdtnumi/o" is the grib 2 grid defintion template number for the input and output grids, respectively:

  • (igdtnumi/o=00) equidistant cylindrical
  • (igdtnumi/o=01) rotated equidistant cylindrical. "e" and non-"e" staggered
  • (igdtnumi/o=10) mercator cylindrical
  • (igdtnumi/o=20) polar stereographic azimuthal
  • (igdtnumi/o=30) lambert conformal conical
  • (igdtnumi/o=40) gaussian cylindrical

The input and output vectors are rotated so that they are either resolved relative to the defined grid in the direction of increasing x and y coordinates or resolved relative to easterly and northerly directions, as designated by their respective grid definition sections.

As an added bonus the number of output grid points and their latitudes and longitudes are also returned along with their vector rotation parameters. On the other hand, the output can be a set of station points if igdtnumo<0, in which case the number of points and their latitudes and longitudes must be input along with their vector rotation parameters.

Input bitmaps will be interpolated to output bitmaps. output bitmaps will also be created when the output grid extends outside of the domain of the input grid. The output field is set to 0 where the output bitmap is off.

Parameters
[in]ipopt(20) interpolation options ipopt(1) is width of square to examine in spiral search (defaults to 1 if ipopt(1)=-1)
[in]grid_inThe input grid.
[in]grid_outThe output grid.
[in]miskip number between input grid fields if km>1 or dimension of input grid fields if km=1
[in]moskip number between output grid fields if km>1 or dimension of output grid fields if km=1
[in]kmnumber of fields to interpolate
[in]ibi(km) input bitmap flags
[in]li(mi,km) input bitmaps (if some ibi(k)=1)
[in]ui(mi,km) input u-component fields to interpolate
[in]vi(mi,km) input v-component fields to interpolate
[in,out]nonumber of output points (only if igdtnumo>=0)
[in,out]rlat(mo) output latitudes in degrees (if igdtnumo<0)
[in,out]rlon(mo) output longitudes in degrees (if igdtnumo<0)
[in,out]crot(mo) vector rotation cosines (if igdtnumo<0)
[in,out]srot(mo) vector rotation sines (if igdtnumo<0) (ugrid=crot*uearth-srot*vearth; vgrid=srot*uearth+crot*vearth)
[out]ibo(km) output bitmap flags
[out]lo(mo,km) output bitmaps (always output)
[out]uo(mo,km) output u-component fields interpolated
[out]vo(mo,km) output v-component fields interpolated
[out]iretreturn code
  • 0 successful interpolation
  • 2 unrecognized input grid or no grid overlap
  • 3 unrecognized output grid
Author
Mark Iredell
Date
96-04-10
Author
Eric Engle
Date
23-05-04

Definition at line 352 of file neighbor_interp_mod.F90.