NCEPLIBS-ip  5.0.0
ipolates_mod Module Reference

Top-level driver for scalar interpolation interpolation routine ipolates(). More...

Data Types

interface  ipolates
 

Functions/Subroutines

subroutine, public ipolates_grib1 (ip, ipopt, kgdsi, kgdso, mi, mo, km, ibi, li, gi, no, rlat, rlon, ibo, lo, go, iret)
 This subprogram interpolates scalar field from any grid to any grid given a grib1 Grid Descriptor Section. More...
 
subroutine, public ipolates_grib1_single_field (ip, ipopt, kgdsi, kgdso, mi, mo, km, ibi, li, gi, no, rlat, rlon, ibo, lo, go, iret)
 Special case of ipolates_grib1 when interpolating a single field. More...
 
subroutine, public ipolates_grib2 (IP, IPOPT, IGDTNUMI, IGDTMPLI, IGDTLENI, IGDTNUMO, IGDTMPLO, IGDTLENO, MI, MO, KM, IBI, LI, GI, NO, RLAT, RLON, IBO, LO, GO, IRET)
 This subprogram interpolates scalar field from any grid to any grid given a grib2 descriptor. More...
 
subroutine, public ipolates_grib2_single_field (IP, IPOPT, IGDTNUMI, IGDTMPLI, IGDTLENI, IGDTNUMO, IGDTMPLO, IGDTLENO, MI, MO, KM, IBI, LI, GI, NO, RLAT, RLON, IBO, LO, GO, IRET)
 Special case of ipolates_grib2 when interpolating a single field. More...
 
subroutine ipolates_grid (ip, ipopt, grid_in, grid_out, mi, mo, km, ibi, li, gi, no, rlat, rlon, ibo, lo, go, iret)
 Interpolates scalar fields between grids given ip_grid objects. More...
 

Detailed Description

Top-level driver for scalar interpolation interpolation routine ipolates().

ipolates() is overloaded with interfaces for GRIB1 and GRIB2 descriptors.

Author
George Gayno, Mark Iredell, Kyle Gerheiser

Function/Subroutine Documentation

◆ ipolates_grib1()

subroutine, public ipolates_mod::ipolates_grib1 ( integer(c_int), intent(in)  ip,
integer(c_int), dimension(20), intent(in)  ipopt,
integer(c_int), dimension(200), intent(in)  kgdsi,
integer(c_int), dimension(200), intent(in)  kgdso,
integer(c_int), intent(in)  mi,
integer(c_int), intent(in)  mo,
integer(c_int), intent(in)  km,
integer(c_int), dimension(km), intent(in)  ibi,
logical(c_bool), dimension(mi,km), intent(in)  li,
real(c_double), dimension(mi,km), intent(in)  gi,
integer(c_int), intent(inout)  no,
real(c_double), dimension(mo), intent(inout)  rlat,
real(c_double), dimension(mo), intent(inout)  rlon,
integer(c_int), dimension(km), intent(out)  ibo,
logical(c_bool), dimension(mo,km), intent(out)  lo,
real(c_double), dimension(mo,km), intent(out)  go,
integer(c_int), intent(out)  iret 
)

This subprogram interpolates scalar field from any grid to any grid given a grib1 Grid Descriptor Section.

Only horizontal interpolation is performed. The following interpolation methods are possible:

  • (ip=0) bilinear
  • (ip=1) bicubic
  • (ip=2) neighbor
  • (ip=3) budget
  • (ip=4) spectral
  • (ip=6) neighbor-budget

Some of these methods have interpolation options and/or restrictions on the input or output grids, both of which are documented more fully in their respective subprograms.

The grids are defined by their grid description sections (passed in integer form as decoded by subprogram w3fi63).

The current code recognizes the following projections:

  • (kgds(1)=000) equidistant cylindrical
  • (kgds(1)=001) mercator cylindrical
  • (kgds(1)=003) lambert conformal conical
  • (kgds(1)=004) gaussian cylindrical
  • (kgds(1)=005) polar stereographic azimuthal
  • (kgds(1)=203) rotated equidistant cylindrical - e-stagger
  • (kgds(1)=205) rotated equidistant cylindrical - b-stagger

Where kgds could be either input kgdsi or output kgdso.

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 kgdso(1)<0, in which case the number of points and their latitudes and longitudes must be input. for the budget approach, a subsection of the grid may be output by subtracting kgdso(1) from 255 and passing in the latitudes and longitudes of the points. 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
ipInterpolation method
  • ip = BILINEAR_INTERP_ID = 0 for bilinear
  • ip = BICUBIC_INTERP_ID = 1 for bicubic
  • ip = NEIGHBOR_INTERP_ID = 2 for neighbor;
  • ip = BUDGET_INTERP_ID = 3 for budget;
  • ip = SPECTRAL_INTERP_ID = 4 for spectral;
  • ip = NEIGHBOR_BUDGET_INTERP_ID = 6 for neighbor-budget
ipoptInterpolation options
  • ip=0 (bilinear): (No options)
  • ip=1 Cbicubic): constraint option
  • ip=2 (neighbor): (No options)
  • ip=3 (budget): Number in radius, radius weights, search radius
  • ip=4 (spectral): Spectral shape, spectral truncation
  • ip=6 (neighbor-budget): Number in radius, radius weights ...)
[in]kgdsiInput gds parameters as decoded by w3fi63.
[in]kgdsoOutput gds parameters.
[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]ibiInput bitmap flags.
[in]liInput bitmaps (if respective ibi(k)=1).
[in]giInput fields to interpolate.
[out]noNumber of output points (only if kgdso(1)<0).
[out]rlatOutput latitudes in degrees (if kgdso(1)<0).
[out]rlonOutput longitudes in degrees (if kgdso(1)<0).
[out]iboOutput bitmap flags.
[out]loOutput bitmaps (always output).
[out]goOutput fields interpolated.
[out]iretReturn code.
  • 0 Successful interpolation.
  • 1 Unrecognized interpolation method.
  • 2 Unrecognized input grid or no grid overlap.
  • 3 Unrecognized output grid.
  • 1x Invalid bicubic method parameters.
  • 3x Invalid budget method parameters.
  • 4x Invalid spectral method parameters.
Author
Mark Iredell, Kyle Gerheiser

Definition at line 293 of file ipolates.F90.

◆ ipolates_grib1_single_field()

subroutine, public ipolates_mod::ipolates_grib1_single_field ( integer(c_int), intent(in)  ip,
integer(c_int), dimension(20), intent(in)  ipopt,
integer(c_int), dimension(200), intent(in)  kgdsi,
integer(c_int), dimension(200), intent(in)  kgdso,
integer(c_int), intent(in)  mi,
integer(c_int), intent(in)  mo,
integer(c_int), intent(in)  km,
integer(c_int), intent(in)  ibi,
logical(c_bool), dimension(mi), intent(in)  li,
real(c_double), dimension(mi), intent(in)  gi,
integer(c_int), intent(inout)  no,
real(c_double), dimension(mo), intent(inout)  rlat,
real(c_double), dimension(mo), intent(inout)  rlon,
integer(c_int), intent(out)  ibo,
logical(c_bool), dimension(mo), intent(out)  lo,
real(c_double), dimension(mo), intent(out)  go,
integer(c_int), intent(out)  iret 
)

Special case of ipolates_grib1 when interpolating a single field.

Removes the km dimension of input arrays so scalars can be passed to ibi/ibo.

Parameters
ipInterpolation method
  • ip = BILINEAR_INTERP_ID = 0 for bilinear
  • ip = BICUBIC_INTERP_ID = 1 for bicubic
  • ip = NEIGHBOR_INTERP_ID = 2 for neighbor;
  • ip = BUDGET_INTERP_ID = 3 for budget;
  • ip = SPECTRAL_INTERP_ID = 4 for spectral;
  • ip = NEIGHBOR_BUDGET_INTERP_ID = 6 for neighbor-budget
ipoptInterpolation options
  • ip=0 (bilinear): (No options)
  • ip=1 Cbicubic): constraint option
  • ip=2 (neighbor): (No options)
  • ip=3 (budget): Number in radius, radius weights, search radius
  • ip=4 (spectral): Spectral shape, spectral truncation
  • ip=6 (neighbor-budget): Number in radius, radius weights ...)
[in]kgdsiInput gds parameters as decoded by w3fi63.
[in]kgdsoOutput gds parameters.
[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]ibiInput bitmap flags.
[in]liInput bitmaps (if respective ibi(k)=1).
[in]giInput fields to interpolate.
[out]noNumber of output points (only if kgdso(1)<0).
[out]rlatOutput latitudes in degrees (if kgdso(1)<0).
[out]rlonOutput longitudes in degrees (if kgdso(1)<0).
[out]iboOutput bitmap flags.
[out]loOutput bitmaps (always output).
[out]goOutput fields interpolated.
[out]iretReturn code.
  • 0 Successful interpolation.
  • 1 Unrecognized interpolation method.
  • 2 Unrecognized input grid or no grid overlap.
  • 3 Unrecognized output grid.
  • 1x Invalid bicubic method parameters.
  • 3x Invalid budget method parameters.
  • 4x Invalid spectral method parameters.
Date
Jan 2022
Author
Kyle Gerheiser

Definition at line 158 of file ipolates.F90.

◆ ipolates_grib2()

subroutine, public ipolates_mod::ipolates_grib2 ( integer(c_int), intent(in)  IP,
integer(c_int), dimension(20), intent(in)  IPOPT,
integer(c_int), intent(in)  IGDTNUMI,
integer(c_int), dimension(igdtleni), intent(in)  IGDTMPLI,
integer(c_int), intent(in)  IGDTLENI,
integer(c_int), intent(in)  IGDTNUMO,
integer(c_int), dimension(igdtleno), intent(in)  IGDTMPLO,
integer(c_int), intent(in)  IGDTLENO,
integer(c_int), intent(in)  MI,
integer(c_int), intent(in)  MO,
integer(c_int), intent(in)  KM,
integer(c_int), dimension(km), intent(in)  IBI,
logical(c_bool), dimension(mi,km), intent(in)  LI,
real(c_double), dimension(mi,km), intent(in)  GI,
integer(c_int), intent(out)  NO,
real(c_double), dimension(mo), intent(inout)  RLAT,
real(c_double), dimension(mo), intent(inout)  RLON,
integer(c_int), dimension(km), intent(out)  IBO,
logical(c_bool), dimension(mo,km), intent(out)  LO,
real(c_double), dimension(mo,km), intent(out)  GO,
integer(c_int), intent(out)  IRET 
)

This subprogram interpolates scalar field from any grid to any grid given a grib2 descriptor.

Wrapper for ipolates_grid which converts a grib1 descriptor into an ip_grid_descriptor, which is used to create an ip_grid. Only horizontal interpolation is performed.

The following interpolation methods are possible:

  • (ip=0) bilinear
  • (ip=1) bicubic
  • (ip=2) neighbor
  • (ip=3) budget
  • (ip=4) spectral
  • (ip=6) neighbor-budget

Some of these methods have interpolation options and/or restrictions on the input or output grids, both of which are documented more fully in their respective subprograms.

Input and output grids are defined by their grib 2 grid definition template as decoded by the ncep g2 library. The current 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, data may be interpolated to a set of station points if "igdtnumo"<0 (or subtracted from 255 for the budget option), 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]ipInterpolation method
  • ip=0 for bilinear
  • ip=1 for bicubic
  • ip=2 for neighbor;
  • ip=3 for budget;
  • ip=4 for spectral;
  • ip=6 for neighbor-budget
[in]ipoptInterpolation options
  • ip=0: (No options)
  • ip=1: Constraint option
  • ip=2: (No options)
  • ip=3: Number in radius, radius weights, search radius
  • ip=4: Spectral shape, spectral truncation
  • ip=6: Number in radius, radius weights ...)
[in]igdtnumiGrid definition template number for the input grid. Corresponds to the gfldigdtnum component of the ncep g2 library gridmod data structure:
  • 00 - EQUIDISTANT CYLINDRICAL
  • 01 - Rotated equidistant cylindrical. "e" and non-"e" staggered
  • 10 - MERCATOR CYCLINDRICAL
  • 20 - POLAR STEREOGRAPHIC AZIMUTHAL
  • 30 - LAMBERT CONFORMAL CONICAL
  • 40 - GAUSSIAN EQUIDISTANT CYCLINDRICAL
[in]igdtmpliGrid definition template array input grid. Corresponds to the gfldigdtmpl component of the NCEPLIBS-g2 gridmod data structure

Section 3 Info:

All map projections:

  • (1): SHAPE OF EARTH, OCTET 15
  • (2): SCALE FACTOR OF SPHERICAL EARTH RADIUS, OCTET 16
  • (3): SCALED VALUE OF RADIUS OF SPHERICAL EARTH, OCTETS 17-20
  • (4): SCALE FACTOR OF MAJOR AXIS OF ELLIPTICAL EARTH, OCTET 21
  • (5): SCALED VALUE OF MAJOR AXIS OF ELLIPTICAL EARTH, OCTETS 22-25
  • (6): SCALE FACTOR OF MINOR AXIS OF ELLIPTICAL EARTH, OCTET 26
  • (7): SCALED VALUE OF MINOR AXIS OF ELLIPTICAL EARTH, OCTETS 27-30

Equidistant Cyclindrical:

  • (8): NUMBER OF POINTS ALONG A PARALLEL, OCTS 31-34
  • (9): NUMBER OF POINTS ALONG A MERIDIAN, OCTS 35-38
  • (10): BASIC ANGLE OF INITIAL PRODUCTION DOMAIN, OCTETS 39-42.
  • (11): SUBDIVISIONS OF BASIC ANGLE, OCTETS 43-46
  • (12): LATITUDE OF FIRST GRID POINT, OCTETS 47-50
  • (13): LONGITUDE OF FIRST GRID POINT, OCTETS 51-54
  • (14): RESOLUTION AND COMPONENT FLAGS, OCTET 55
  • (15): LATITUDE OF LAST GRID POINT, OCTETS 56-59
  • (16): LONGITUDE OF LAST GRID POINT, OCTETS 60-63
  • (17): I-DIRECTION INCREMENT, OCTETS 64-67
  • (18): J-DIRECTION INCREMENT, OCTETS 68-71
  • (19): SCANNING MODE, OCTET 72

Mercator Cyclindrical:

  • (8): NUMBER OF POINTS ALONG A PARALLEL, OCTS 31-34
  • (9): NUMBER OF POINTS ALONG A MERIDIAN, OCTS 35-38
  • (10): LATITUDE OF FIRST POINT, OCTETS 39-42
  • (11): LONGITUDE OF FIRST POINT, OCTETS 43-46
  • (12): RESOLUTION AND COMPONENT FLAGS, OCTET 47
  • (13): TANGENT LATITUDE, OCTETS 48-51
  • (14): LATITUDE OF LAST POINT, OCTETS 52-55
  • (15): LONGITUDE OF LAST POINT, OCTETS 56-59
  • (16): SCANNING MODE FLAGS, OCTET 60
  • (17): ORIENTATION OF GRID, OCTETS 61-64
  • (18): LONGITUDINAL GRID LENGTH, OCTETS 65-68
  • (19): LATITUDINAL GRID LENGTH, OCTETS 69-72

Lambert Conformal Conical:

  • (8): NUMBER OF POINTS ALONG X-AXIS, OCTS 31-34
  • (9): NUMBER OF POINTS ALONG Y-AXIS, OCTS 35-38
  • (10): LATITUDE OF FIRST POINT, OCTETS 39-42
  • (11): LONGITUDE OF FIRST POINT, OCTETS 43-46
  • (12): RESOLUTION OF COMPONENT FLAG, OCTET 47
  • (13): LATITUDE WHERE GRID LENGTHS SPECIFIED,OCTETS 48-51
  • (14): LONGITUDE OF MERIDIAN THAT IS PARALLEL TO Y-AXIS, OCTETS 52-55
  • (15): X-DIRECTION GRID LENGTH, OCTETS 56-59
  • (16): Y-DIRECTION GRID LENGTH, OCTETS 60-63
  • (17): PROJECTION CENTER FLAG, OCTET 64
  • (18): SCANNING MODE, OCTET 65
  • (19): FIRST TANGENT LATITUDE FROM POLE, OCTETS 66-69
  • (20): SECOND TANGENT LATITUDE FROM POLE, OCTETS 70-73
  • (21): LATITUDE OF SOUTH POLE OF PROJECTION, OCTETS 74-77
  • (22): LONGITUDE OF SOUTH POLE OF PROJECTION, OCTETS 78-81

Gaussian Cylindrical:

  • (8): NUMBER OF POINTS ALONG A PARALLEL, OCTS 31-34
  • (9): NUMBER OF POINTS ALONG A MERIDIAN, OCTS 35-38
  • (10): BASIC ANGLE OF INITIAL PRODUCTION DOMAIN, OCTETS 39-42
  • (11): SUBDIVISIONS OF BASIC ANGLE, OCTETS 43-46
  • (12): LATITUDE OF FIRST GRID POINT, OCTETS 47-50
  • (13): LONGITUDE OF FIRST GRID POINT, OCTETS 51-54
  • (14): RESOLUTION AND COMPONENT FLAGS, OCTET 55
  • (15): LATITUDE OF LAST GRID POINT, OCTETS 56-59
  • (16): LONGITUDE OF LAST GRID POINT, OCTETS 60-63
  • (17): I-DIRECTION INCREMENT, OCTETS 64-67
  • (18): NUMBER OF PARALLELS BETWEEN POLE AND EQUATOR, OCTETS 68-71
  • (19): SCANNING MODE, OCTET 72

Polar Stereographic Azimuthal:

  • (8): NUMBER OF POINTS ALONG X-AXIS, OCTETS 31-34
  • (9): NUMBER OF POINTS ALONG Y-AXIS, OCTETS 35-38
  • (10): LATITUDE OF FIRST GRID POINT, OCTETS 39-42
  • (11): LONGITUDE OF FIRST GRID POINT, OCTETS 43-46
  • (12): RESOLUTION AND COMPONENT FLAGS, OCTET 47
  • (13): TRUE LATITUDE, OCTETS 48-51
  • (14): ORIENTATION LONGITUDE, OCTETS 52-55
  • (15): X-DIRECTION GRID LENGTH, OCTETS 56-59
  • (16): Y-DIRECTION GRID LENGTH, OCTETS 60-63
  • (17): PROJECTION CENTER FLAG, OCTET 64
  • (18): SCANNING MODE FLAGS, OCTET 65

Rotated Equidistant Cyclindrical:

  • (8): NUMBER OF POINTS ALONG A PARALLEL, OCTS 31-34
  • (9): NUMBER OF POINTS ALONG A MERIDIAN, OCTS 35-38
  • (10): BASIC ANGLE OF INITIAL PRODUCTION DOMAIN, OCTETS 39-42
  • (11): SUBDIVISIONS OF BASIC ANGLE, OCTETS 43-46
  • (12): LATITUDE OF FIRST GRID POINT, OCTETS 47-50
  • (13): LONGITUDE OF FIRST GRID POINT, OCTETS 51-54
  • (14): RESOLUTION AND COMPONENT FLAGS, OCTET 55
  • (15): LATITUDE OF LAST GRID POINT, OCTETS 56-59
  • (16): LONGITUDE OF LAST GRID POINT, OCTETS 60-63
  • (17): I-DIRECTION INCREMENT, OCTETS 64-67
  • (18): J-DIRECTION INCREMENT, OCTETS 68-71
  • (19): SCANNING MODE, OCTET 72
  • (20): LATITUDE OF SOUTHERN POLE OF PROJECTION, OCTETS 73-76
  • (21): LONGITUDE OF SOUTHERN POLE OF PROJECTION, OCTETS 77-80
  • (22): ANGLE OF ROTATION OF PROJECTION, OCTS 81-84
Parameters
[in]igdtleniNumber of elements of the grid definition template array for the input grid. Corresponds to the gfldigdtlen component of the ncep g2 library gridmod data structure.
[in]igdtnumoGrid definition template number for the output grid. Corresponds to the gfldigdtnum component of the ncep g2 library gridmod data structure. See "igdtnumi" for specific template definitions. Note: igdtnumo<0 means interpolate to random station points.
[in]igdtmploGrid definition template array for the output grid. Corresponds to the gfldigdtmpl component of the ncep g2 library gridmod data structure. See "igdtmpli" for definition of array elements.
[in]igdtlenoNumber of elements of the grid definition template array for the output grid. c Corresponds to the gfldigdtlen component of the ncep g2 library gridmod data structure.
[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]ibiInput bitmap flags.
[in]liInput bitmaps (if respective ibi(k)=1).
[in]giInput fields to interpolate.
[out]noNumber of output points (only if kgdso(1)<0).
[out]rlatOutput latitudes in degrees (if kgdso(1)<0).
[out]rlonOutput longitudes in degrees (if kgdso(1)<0).
[out]iboOutput bitmap flags.
[out]loOutput bitmaps (always output).
[out]goOutput fields interpolated.
[out]iretReturn code.
  • 0 Successful interpolation.
  • 1 Unrecognized interpolation method.
  • 2 Unrecognized input grid or no grid overlap.
  • 3 Unrecognized output grid.
  • 1x Invalid bicubic method parameters.
  • 3x Invalid budget method parameters.
  • 4x Invalid spectral method parameters.
Note
Examples demonstrating relative cpu costs. This example is interpolating 12 levels of temperatures from the 360 x 181 global grid (ncep grid 3) to the 93 x 68 hawaiian mercator grid (ncep grid 204).

The example times are for the c90. As a reference, the cp time for unpacking the global 12 temperature fields is 0.04 seconds.

METHOD IP IPOPT CP SECONDS
BILINEAR 0 0.03
BICUBIC 1 0 0.07
BICUBIC 1 1 0.07
NEIGHBOR 2 0.01
BUDGET 3 -1,-1 0.48
SPECTRAL 4 0,40 0.22
SPECTRAL 4 1,40 0.24
SPECTRAL 4 0,-1 0.42
N-BUDGET 6 -1,-1 0.15

The spectral interpolation is fast for the mercator grid. However, for some grids the spectral interpolation is slow.

The following example is interpolating 12 levels of temperatures from the 360 x 181 global grid (ncep grid 3) to the 93 x 65 conus lambert conformal grid (ncep grid 211).

METHOD IP IPOPT CP SECONDS
BILINEAR 0 0.03
BICUBIC 1 0 0.07
BICUBIC 1 1 0.07
NEIGHBOR 2 0.01
BUDGET 3 -1,-1 0.51
SPECTRAL 4 0,40 3.94
SPECTRAL 4 1,40 5.02
SPECTRAL 4 0,-1 11.36
N-BUDGET 6 -1,-1 0.18
Author
Mark Iredell, Kyle Gerheiser

Definition at line 587 of file ipolates.F90.

◆ ipolates_grib2_single_field()

subroutine, public ipolates_mod::ipolates_grib2_single_field ( integer(c_int), intent(in)  IP,
integer(c_int), dimension(20), intent(in)  IPOPT,
integer(c_int), intent(in)  IGDTNUMI,
integer(c_int), dimension(igdtleni), intent(in)  IGDTMPLI,
integer(c_int), intent(in)  IGDTLENI,
integer(c_int), intent(in)  IGDTNUMO,
integer(c_int), dimension(igdtleno), intent(in)  IGDTMPLO,
integer(c_int), intent(in)  IGDTLENO,
integer(c_int), intent(in)  MI,
integer(c_int), intent(in)  MO,
integer(c_int), intent(in)  KM,
integer(c_int), intent(in)  IBI,
logical(c_bool), dimension(mi), intent(in)  LI,
real(c_double), dimension(mi), intent(in)  GI,
integer(c_int), intent(out)  NO,
real(c_double), dimension(mo), intent(inout)  RLAT,
real(c_double), dimension(mo), intent(inout)  RLON,
integer(c_int), intent(out)  IBO,
logical(c_bool), dimension(mo), intent(out)  LO,
real(c_double), dimension(mo), intent(out)  GO,
integer(c_int), intent(out)  IRET 
)

Special case of ipolates_grib2 when interpolating a single field.

Removes the km dimension of input arrays so scalars can be passed to ibi/ibo.

Parameters
[in]ipInterpolation method
  • ip=0 for bilinear
  • ip=1 for bicubic
  • ip=2 for neighbor;
  • ip=3 for budget;
  • ip=4 for spectral;
  • ip=6 for neighbor-budget
[in]ipoptInterpolation options
  • ip=0: (No options)
  • ip=1: Constraint option
  • ip=2: (No options)
  • ip=3: Number in radius, radius weights, search radius
  • ip=4: Spectral shape, spectral truncation
  • ip=6: Number in radius, radius weights ...)
[in]igdtnumiGrid definition template number for the input grid. Corresponds to the gfldigdtnum component of the ncep g2 library gridmod data structure:
  • 00 - EQUIDISTANT CYLINDRICAL
  • 01 - Rotated equidistant cylindrical. "e" and non-"e" staggered
  • 10 - MERCATOR CYCLINDRICAL
  • 20 - POLAR STEREOGRAPHIC AZIMUTHAL
  • 30 - LAMBERT CONFORMAL CONICAL
  • 40 - GAUSSIAN EQUIDISTANT CYCLINDRICAL
[in]igdtmpliGrid definition template array input grid. Corresponds to the gfldigdtmpl component of the NCEPLIBS-g2 gridmod data structure

Section 3 Info:

All map projections:

  • (1): SHAPE OF EARTH, OCTET 15
  • (2): SCALE FACTOR OF SPHERICAL EARTH RADIUS, OCTET 16
  • (3): SCALED VALUE OF RADIUS OF SPHERICAL EARTH, OCTETS 17-20
  • (4): SCALE FACTOR OF MAJOR AXIS OF ELLIPTICAL EARTH, OCTET 21
  • (5): SCALED VALUE OF MAJOR AXIS OF ELLIPTICAL EARTH, OCTETS 22-25
  • (6): SCALE FACTOR OF MINOR AXIS OF ELLIPTICAL EARTH, OCTET 26
  • (7): SCALED VALUE OF MINOR AXIS OF ELLIPTICAL EARTH, OCTETS 27-30

Equidistant Cyclindrical:

  • (8): NUMBER OF POINTS ALONG A PARALLEL, OCTS 31-34
  • (9): NUMBER OF POINTS ALONG A MERIDIAN, OCTS 35-38
  • (10): BASIC ANGLE OF INITIAL PRODUCTION DOMAIN, OCTETS 39-42.
  • (11): SUBDIVISIONS OF BASIC ANGLE, OCTETS 43-46
  • (12): LATITUDE OF FIRST GRID POINT, OCTETS 47-50
  • (13): LONGITUDE OF FIRST GRID POINT, OCTETS 51-54
  • (14): RESOLUTION AND COMPONENT FLAGS, OCTET 55
  • (15): LATITUDE OF LAST GRID POINT, OCTETS 56-59
  • (16): LONGITUDE OF LAST GRID POINT, OCTETS 60-63
  • (17): I-DIRECTION INCREMENT, OCTETS 64-67
  • (18): J-DIRECTION INCREMENT, OCTETS 68-71
  • (19): SCANNING MODE, OCTET 72

Mercator Cyclindrical:

  • (8): NUMBER OF POINTS ALONG A PARALLEL, OCTS 31-34
  • (9): NUMBER OF POINTS ALONG A MERIDIAN, OCTS 35-38
  • (10): LATITUDE OF FIRST POINT, OCTETS 39-42
  • (11): LONGITUDE OF FIRST POINT, OCTETS 43-46
  • (12): RESOLUTION AND COMPONENT FLAGS, OCTET 47
  • (13): TANGENT LATITUDE, OCTETS 48-51
  • (14): LATITUDE OF LAST POINT, OCTETS 52-55
  • (15): LONGITUDE OF LAST POINT, OCTETS 56-59
  • (16): SCANNING MODE FLAGS, OCTET 60
  • (17): ORIENTATION OF GRID, OCTETS 61-64
  • (18): LONGITUDINAL GRID LENGTH, OCTETS 65-68
  • (19): LATITUDINAL GRID LENGTH, OCTETS 69-72

Lambert Conformal Conical:

  • (8): NUMBER OF POINTS ALONG X-AXIS, OCTS 31-34
  • (9): NUMBER OF POINTS ALONG Y-AXIS, OCTS 35-38
  • (10): LATITUDE OF FIRST POINT, OCTETS 39-42
  • (11): LONGITUDE OF FIRST POINT, OCTETS 43-46
  • (12): RESOLUTION OF COMPONENT FLAG, OCTET 47
  • (13): LATITUDE WHERE GRID LENGTHS SPECIFIED,OCTETS 48-51
  • (14): LONGITUDE OF MERIDIAN THAT IS PARALLEL TO Y-AXIS, OCTETS 52-55
  • (15): X-DIRECTION GRID LENGTH, OCTETS 56-59
  • (16): Y-DIRECTION GRID LENGTH, OCTETS 60-63
  • (17): PROJECTION CENTER FLAG, OCTET 64
  • (18): SCANNING MODE, OCTET 65
  • (19): FIRST TANGENT LATITUDE FROM POLE, OCTETS 66-69
  • (20): SECOND TANGENT LATITUDE FROM POLE, OCTETS 70-73
  • (21): LATITUDE OF SOUTH POLE OF PROJECTION, OCTETS 74-77
  • (22): LONGITUDE OF SOUTH POLE OF PROJECTION, OCTETS 78-81

Gaussian Cylindrical:

  • (8): NUMBER OF POINTS ALONG A PARALLEL, OCTS 31-34
  • (9): NUMBER OF POINTS ALONG A MERIDIAN, OCTS 35-38
  • (10): BASIC ANGLE OF INITIAL PRODUCTION DOMAIN, OCTETS 39-42
  • (11): SUBDIVISIONS OF BASIC ANGLE, OCTETS 43-46
  • (12): LATITUDE OF FIRST GRID POINT, OCTETS 47-50
  • (13): LONGITUDE OF FIRST GRID POINT, OCTETS 51-54
  • (14): RESOLUTION AND COMPONENT FLAGS, OCTET 55
  • (15): LATITUDE OF LAST GRID POINT, OCTETS 56-59
  • (16): LONGITUDE OF LAST GRID POINT, OCTETS 60-63
  • (17): I-DIRECTION INCREMENT, OCTETS 64-67
  • (18): NUMBER OF PARALLELS BETWEEN POLE AND EQUATOR, OCTETS 68-71
  • (19): SCANNING MODE, OCTET 72

Polar Stereographic Azimuthal:

  • (8): NUMBER OF POINTS ALONG X-AXIS, OCTETS 31-34
  • (9): NUMBER OF POINTS ALONG Y-AXIS, OCTETS 35-38
  • (10): LATITUDE OF FIRST GRID POINT, OCTETS 39-42
  • (11): LONGITUDE OF FIRST GRID POINT, OCTETS 43-46
  • (12): RESOLUTION AND COMPONENT FLAGS, OCTET 47
  • (13): TRUE LATITUDE, OCTETS 48-51
  • (14): ORIENTATION LONGITUDE, OCTETS 52-55
  • (15): X-DIRECTION GRID LENGTH, OCTETS 56-59
  • (16): Y-DIRECTION GRID LENGTH, OCTETS 60-63
  • (17): PROJECTION CENTER FLAG, OCTET 64
  • (18): SCANNING MODE FLAGS, OCTET 65

Rotated Equidistant Cyclindrical:

  • (8): NUMBER OF POINTS ALONG A PARALLEL, OCTS 31-34
  • (9): NUMBER OF POINTS ALONG A MERIDIAN, OCTS 35-38
  • (10): BASIC ANGLE OF INITIAL PRODUCTION DOMAIN, OCTETS 39-42
  • (11): SUBDIVISIONS OF BASIC ANGLE, OCTETS 43-46
  • (12): LATITUDE OF FIRST GRID POINT, OCTETS 47-50
  • (13): LONGITUDE OF FIRST GRID POINT, OCTETS 51-54
  • (14): RESOLUTION AND COMPONENT FLAGS, OCTET 55
  • (15): LATITUDE OF LAST GRID POINT, OCTETS 56-59
  • (16): LONGITUDE OF LAST GRID POINT, OCTETS 60-63
  • (17): I-DIRECTION INCREMENT, OCTETS 64-67
  • (18): J-DIRECTION INCREMENT, OCTETS 68-71
  • (19): SCANNING MODE, OCTET 72
  • (20): LATITUDE OF SOUTHERN POLE OF PROJECTION, OCTETS 73-76
  • (21): LONGITUDE OF SOUTHERN POLE OF PROJECTION, OCTETS 77-80
  • (22): ANGLE OF ROTATION OF PROJECTION, OCTS 81-84
Parameters
[in]igdtleniNumber of elements of the grid definition template array for the input grid. Corresponds to the gfldigdtlen component of the ncep g2 library gridmod data structure.
[in]igdtnumoGrid definition template number for the output grid. Corresponds to the gfldigdtnum component of the ncep g2 library gridmod data structure. See "igdtnumi" for specific template definitions. Note: igdtnumo<0 means interpolate to random station points.
[in]igdtmploGrid definition template array for the output grid. Corresponds to the gfldigdtmpl component of the ncep g2 library gridmod data structure. See "igdtmpli" for definition of array elements.
[in]igdtlenoNumber of elements of the grid definition template array for the output grid. c Corresponds to the gfldigdtlen component of the ncep g2 library gridmod data structure.
[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]ibiInput bitmap flags.
[in]liInput bitmaps (if respective ibi(k)=1).
[in]giInput fields to interpolate.
[out]noNumber of output points (only if kgdso(1)<0).
[out]rlatOutput latitudes in degrees (if kgdso(1)<0).
[out]rlonOutput longitudes in degrees (if kgdso(1)<0).
[out]iboOutput bitmap flags.
[out]loOutput bitmaps (always output).
[out]goOutput fields interpolated.
[out]iretReturn code.
  • 0 Successful interpolation.
  • 1 Unrecognized interpolation method.
  • 2 Unrecognized input grid or no grid overlap.
  • 3 Unrecognized output grid.
  • 1x Invalid bicubic method parameters.
  • 3x Invalid budget method parameters.
  • 4x Invalid spectral method parameters.
Author
Eric Engle
Date
November 2022

Definition at line 808 of file ipolates.F90.

◆ ipolates_grid()

subroutine ipolates_mod::ipolates_grid ( integer, intent(in)  ip,
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

Interpolates scalar fields between grids given ip_grid objects.

Calls the specific interpolation routines on the generic ip_grids created from a grib1/grib2 descriptor.

Parameters
[in]ipInterpolation method.
[in]ipoptInterpolation options.
[in]grid_inInput grid.
[in]grid_outOutput grid object created.
[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]ibiInput bitmap flags.
[in]liInput bitmaps (if respective ibi(k)=1).
[in]giInput fields to interpolate.
[out]noNumber of output points (only if kgdso(1)<0).
[out]rlatOutput latitudes in degrees (if kgdso(1)<0).
[out]rlonOutput longitudes in degrees (if kgdso(1)<0).
[out]iboOutput bitmap flags.
[out]loOutput bitmaps (always output).
[out]goOutput fields interpolated.
[out]iretReturn code.
  • 0 Successful interpolation.
  • 1 Unrecognized interpolation method.
  • 2 Unrecognized input grid or no grid overlap.
  • 3 Unrecognized output grid.
  • 1x Invalid bicubic method parameters.
  • 3x Invalid budget method parameters.
  • 4x Invalid spectral method parameters.
Author
Mark Iredell, Kyle Gerheiser

Definition at line 63 of file ipolates.F90.

References ip_interpolators_mod::bicubic_interp_id, ip_interpolators_mod::bilinear_interp_id, ip_interpolators_mod::budget_interp_id, ip_interpolators_mod::neighbor_budget_interp_id, ip_interpolators_mod::neighbor_interp_id, and ip_interpolators_mod::spectral_interp_id.

Referenced by ipolates_mod::ipolates::ipolates_grib1(), ipolates_mod::ipolates::ipolates_grib1_single_field(), ipolates_mod::ipolates::ipolates_grib2(), and ipolates_mod::ipolates::ipolates_grib2_single_field().