NCEPLIBS-ip  5.0.0
neighbor_budget_interp_mod Module Reference

Interpolate scalar fields (neighbor). More...

Data Types

interface  interpolate_neighbor_budget
 

Functions/Subroutines

subroutine interpolate_neighbor_budget_scalar (IPOPT, grid_in, grid_out, MI, MO, KM, IBI, LI, GI, NO, RLAT, RLON, IBO, LO, GO, IRET)
 Interpolate scalar fields (budget). More...
 
subroutine interpolate_neighbor_budget_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 (budget). More...
 

Detailed Description

Interpolate scalar fields (neighbor).

Author
Mark Iredell
Date
96-04-10

Function/Subroutine Documentation

◆ interpolate_neighbor_budget_scalar()

subroutine neighbor_budget_interp_mod::interpolate_neighbor_budget_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(out)  NO,
real, dimension(mo), intent(out)  RLAT,
real, dimension(mo), intent(out)  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 (budget).

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

The algorithm simply computes (weighted) averages of neighbor points arranged in a square box centered around each output grid point and stretching nearly halfway to each of the neighboring grid points.

Options allow choices of number of points in each radius from the center point (ipopt(1)) which defaults to 2 (if ipopt(1)=-1) meaning that 25 points will be averaged; further options are the respective weights for the radius points starting at the center point (ipopt(2:2+ipopt(1)) which defaults to all 1 (if ipopt(1)=-1 or ipopt(2)=-1).

Another option is the minimum percentage for mask, i.e. percent valid input data required to make output data, (ipopt(3+ipopt(1)) which defaults to 50 (if -1).

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. 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.

Program History Log

Date Programmer Comments
96-04-10 Iredell Initial
96-10-04 Iredell neighbor points not bilinear interpolation
1999-04-08 Iredell split ijkgds into two pieces
2001-06-18 Iredell include minimum mask percentage option
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.
2023-05-04 Engle allow calls to GDSWZD for station points
Parameters
[in]ipopt(20) interpolation options ipopt(1) is number of radius points (defaults to 2 if ipopt(1)=-1); ipopt(2:2+ipopt(1)) are respective weights (defaults to all 1 if ipopt(1)=-1 or ipopt(2)=-1). ipopt(3+ipopt(1)) is minimum percentage for mask (defaults to 50 if ipopt(3+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
[out]nonumber of output points
[out]rlat(mo) output latitudes in degrees
[out]rlon(mo) output longitudes in degrees
[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
  • 31 invalid undefined output grid
  • 32 invalid budget method parameters
Author
Mark Iredell
Date
96-04-10

Definition at line 107 of file neighbor_budget_interp_mod.F90.

◆ interpolate_neighbor_budget_vector()

subroutine neighbor_budget_interp_mod::interpolate_neighbor_budget_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(out)  NO,
real, dimension(mo), intent(inout)  RLAT,
real, dimension(mo), intent(inout)  RLON,
real, dimension(mo), intent(out)  CROT,
real, dimension(mo), intent(out)  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 (budget).

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

The algorithm simply computes (weighted) averages of neighbor points arranged in a square box centered around each output grid point and stretching nearly halfway to each of the neighboring grid points.

Options allow choices of number of points in each radius from the center point (ipopt(1)) which defaults to 2 (if ipopt(1)=-1) meaning that 25 points will be averaged; further options are the respective weights for the radius points starting at the center point (ipopt(2:2+ipopt(1)) which defaults to all 1 (if ipopt(1)=-1 or ipopt(2)=-1).

Another option is the minimum percentage for mask, i.e. percent valid input data required to make output data, (ipopt(3+ipopt(1)) which defaults to 50 (if -1).

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 description 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. 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.

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 minimum mask percentage option
2002-01-17 Iredell save data from last call for optimization
2015-01-27 Gayno replace calls to gdswiz with new merged routine gdswzd.
2015-07-13 Gayno replace grib 1 kgds arrays with grib 2 grid definition template arrays.
2023-05-04 Engle allow calls to GDSWZD for station points
Parameters
[in]ipopt(20) interpolation options ipopt(1) is number of radius points (defaults to 2 if ipopt(1)=-1); ipopt(2:2+ipopt(1)) are respective weights (defaults to all 1 if ipopt(1)=-1 or ipopt(2)=-1). ipopt(3+ipopt(1)) is minimum percentage for mask (defaults to 50 if ipopt(3+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
[out]nonumber of output points
[out]rlat(mo) output latitudes in degrees
[out]rlon(mo) output longitudes in degrees
[out]crot(mo) vector rotation cosines
[out]srot(mo) vector rotation sines (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
  • 31 invalid undefined output grid
  • 32 invalid budget method parameters
Author
Mark Iredell
Date
96-04-10

Definition at line 351 of file neighbor_budget_interp_mod.F90.