NCEPLIBS-ip  5.0.0
budget_interp_mod Module Reference

Budget interpolation routines for scalars and vectors. More...

Data Types

interface  interpolate_budget
 

Functions/Subroutines

subroutine interpolate_budget_scalar (IPOPT, grid_in, grid_out, MI, MO, KM, IBI, LI, GI, NO, RLAT, RLON, IBO, LO, GO, IRET)
 Performs budget interpolation from any grid to any grid (or to random station points) for scalar fields. More...
 
subroutine interpolate_budget_vector (IPOPT, grid_in, grid_out, MI, MO, KM, IBI, LI, UI, VI, NO, RLAT, RLON, CROT, SROT, IBO, LO, UO, VO, IRET)
 This subprogram performs budget interpolation from any grid to any grid (or to random station points) for vector fields. More...
 

Detailed Description

Budget interpolation routines for scalars and vectors.

Author
George Gayno, Mark Iredell, Kyle Gerheiser, Eric Engle
Date
July 2021

Function/Subroutine Documentation

◆ interpolate_budget_scalar()

subroutine budget_interp_mod::interpolate_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(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

Performs budget interpolation from any grid to any grid (or to random station points) for scalar fields.

The algorithm simply computes (weighted) averages of bilinearly interpolated 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).

A special interpolation is done if ipopt(2)=-2. in this case, the boxes stretch nearly all the way to each of the neighboring grid points and the weights are the adjoint of the bilinear interpolation weights. This case gives quasi-second-order budget interpolation.

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

In cases where there is no or insufficient valid input data, the user may choose to search for the nearest valid data. this is invoked by setting ipopt(20) to the width of the search square. The default is 1 (no search). 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.

Parameters
[in]ipoptInterpolation 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_inInput grid
[in]grid_outOutput grid
[in]miSkip number between input grid fields if km>1 or dimension of input grid fields if km=1.
[out]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]ibiInput bitmap flags.
[in]liInput bitmaps (if some ibi(k)=1).
[in]giInput fields to interpolate.
[in,out]noNumber of output points (only if igdtnumo<0).
[in,out]rlatOutput latitudes in degrees (if igdtnumo<0).
[in,out]rlonOutput longitudes in degrees (if igdtnumo<0).
[out]iboOutput bitmap flags.
[out]loOutput bitmaps (always output).
[out]goOutput fields interpolated.
[out]iretReturn code.
  • 0 Successful interpolation.
  • 2 Unrecognized input grid or no grid overlap.
  • 3 Unrecognized output grid.
  • 32 Invalid budget method parameters.
Author
Marke Iredell, George Gayno, Kyle Gerheiser, Eric Engle
Date
July 2021

Definition at line 94 of file budget_interp_mod.F90.

◆ interpolate_budget_vector()

subroutine budget_interp_mod::interpolate_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

This subprogram performs budget interpolation from any grid to any grid (or to random station points) for vector fields.

The algorithm simply computes (weighted) averages of bilinearly interpolated 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).

A special interpolation is done if ipopt(2)=-2. in this case, the boxes stretch nearly all the way to each of the neighboring grid points and the weights are the adjoint of the bilinear interpolation weights. This case gives quasi-second-order budget interpolation.

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

In cases where there is no or insufficient valid input data, the user may choose to search for the nearest valid data. this is invoked by setting ipopt(20) to the width of the search square. The default is 1 (no search). 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.

Parameters
[in]ipoptinterpolation options ipopt(1) Number of radius points (defaults to 2 if ipopt(1)=-1); ipopt(2:2+ipopt(1)) Respective weights (defaults to all 1 if ipopt(1)=-1 or ipopt(2)=-1). ipopt(3+ipopt(1)) Minimum percentage for mask (defaults to 50 if ipopt(3+ipopt(1)=-1)
[in]grid_inInput grid.
[in]grid_outOutput grid.
[in]miskip Number between input grid fields if km>1 or dimension of input grid fields if km=1.
[out]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]ibiInput bitmap flags.
[in]liInput bitmaps (if some ibi(k)=1).
[in]uiInput u-component fields to interpolate.
[in]viInput v-component fields to interpolate.
[in,out]noNumber of output points (only if igdtnumo<0)
[in,out]rlatOutput latitudes in degrees (if igdtnumo<0)
[in,out]rlonOutput longitudes in degrees (if igdtnumo<0)
[in,out]crotVector rotation cosines. If interpolating subgrid ugrid=crot * uearth - srot * vearth.
[in,out]srotVector rotation sines. If interpolating subgrid vgrid = srot * uearth + crot * vearth.
[out]iboOutput bitmap flags.
[out]loOutput bitmaps (always output).
[out]uoOutput u-component fields interpolated.
[out]voOutput v-component fields interpolated.
[out]iretReturn code.
  • 0 Successful interpolation.
  • 2 Unrecognized input grid or no grid overlap.
  • 3 Unrecognized output grid.
  • 32 Invalid budget method parameters.
Author
Marke Iredell, George Gayno, Kyle Gerheiser, Eric Engle
Date
July 2021

Definition at line 423 of file budget_interp_mod.F90.