FMS  2026.01.01-dev
Flexible Modeling System
horiz_interp_type_mod

Data Types

interface  assignment(=)
 Interface to override the "=" operator to a horiz_interp_eq that will copy the Interp instance of horiz_interp_type with Interp2 = Interp1. More...
 
type  horiz_interp_type
 Datatype holding interpolation weights, mapping indices, and metadata for horizontal interpolation. All real members are stored in horizInterpReals8_type if the grid and data are represented in 64-bit floating point precision or horizInterpReals4_type if the grid and data are represented in 32-bit floating point precision. Only one type, horizInterpReals4_type or horizInterpReals8_type, is allocated and used for interpolation. More...
 
type  horizinterpreals4_type
 Nested derived type in horiz_interp_type that holds 32-bit interpolation weights, and metadata. If 32-bit grid and data arrays are provided to horiz_interp, InterphorizInterpReals4_type will be initialized and populated with mapping weights. More...
 
type  horizinterpreals8_type
 Nested derived type in horiz_interp_type that holds 64-bit interpolation weights, and metadata. If 64-bit grid and data arrays are provided to horiz_interp, InterphorizInterpReals8_type will be initialized and populated with mapping weights. More...
 
interface  stats
 Generic interfaces to compute statistics for bilinear and spherical interpolation Calls stats_r4 when the output data is in 32-bit precision. Calls stats_r8 when the output data is in 64-bit precision. More...
 

Functions/Subroutines

subroutine horiz_interp_type_eq (horiz_interp_out, horiz_interp_in)
 
subroutine horiz_interp_type_eq (horiz_interp_out, horiz_interp_in)
 
 stats_r4
 
 stats_r8
 

Variables

real(kind=r8_kind), dimension(:,:), allocatable area_dst
 holds destination grid area.
 
real(kind=r4_kind), dimension(:,:), allocatable area_dst
 holds destination grid area.
 
real(kind=r8_kind), dimension(:), allocatable area_frac_dst
 holds interpolation weights for conservative interpolation, version2
 
real(kind=r4_kind), dimension(:), allocatable area_frac_dst
 holds interpolation weights for conservative interpolation, version2
 
real(kind=r8_kind), dimension(:,:), allocatable area_src
 holds source grid area
 
real(kind=r4_kind), dimension(:,:), allocatable area_src
 holds source grid area.
 
integer, parameter, public bicubic = 4
 is an internally used parameter to mark bicubic interpolation
 
integer, parameter, public bilinear = 2
 is an internally used parameter to mark bilinear interpolation
 
real(kind=r8_kind), dimension(:,:), allocatable faci
 holds weights for conservative interpolation version 1
 
real(kind=r4_kind), dimension(:,:), allocatable faci
 holds weights for conservative interpolation version 1
 
real(kind=r8_kind), dimension(:,:), allocatable facj
 holds weights for conservative interpolation version 1
 
real(kind=r4_kind), dimension(:,:), allocatable facj
 holds weights for conservative interpolation version 1
 
logical, dimension(:,:), allocatable found_neighbors
 is not used
 
type(horizinterpreals4_typehorizinterpreals4_type
 holds more 32-bit floating point data required for interpolation.
 
type(horizinterpreals8_typehorizinterpreals8_type
 holds more 64-bit floating point data required for interpolation.
 
logical i_am_initialized =.false.
 is set to .true. in horiz_interp_new. Horiz_interp_base will fail if I_am_initialized = .false.
 
integer, dimension(:), allocatable i_dst
 are the destination grid mapping indices in the x-direction for conservative interpolation, version 2.
 
integer, dimension(:,:,:), allocatable i_lon
 contains the source grid mapping indices in x-direction for bicubic and bilinear interpolation
 
integer, dimension(:), allocatable i_src
 are the source grid mapping indices in the x-direction for conservative interpolation, version 2.
 
integer, dimension(:,:), allocatable ilon
 contains the source grid mapping index in x-direction for conservative interpolation, version 1
 
integer interp_method
 is the interpolation method set to 1 for conservative; 2 for bilinear; 3 for spherical; 4 for bicubic.
 
logical is_allocated = .false.
 is .true. if Interp is populated
 
logical is_allocated = .false.
 is .true. if Interp is populated
 
integer, dimension(:), allocatable j_dst
 are the destination grid mapping indices in the y-direction for conservative interpolation, version 2.
 
integer, dimension(:,:,:), allocatable j_lat
 contains the source grid cell indices in y-direction for bicubic and bilinear interpolation
 
integer, dimension(:), allocatable j_src
 are the source grid mapping indices in the y-direction for conservative interpolation, version 2.
 
integer, dimension(:,:), allocatable jlat
 contains the source grid mapping indices in y-direction for conservative interpolation, version 1
 
real(kind=r8_kind), dimension(:), allocatable lat_in
 holds the latitude coordinates on the source grid
 
real(kind=r4_kind), dimension(:), allocatable lat_in
 holds the latitude coordinates on the source grid
 
real(kind=r8_kind), dimension(:), allocatable lon_in
 holds the longitude coordinates on the source grid
 
real(kind=r4_kind), dimension(:), allocatable lon_in
 holds the longitude coordinates on the source grid
 
real(kind=r8_kind), dimension(:,:), allocatable mask_in
 masks the input grid to skip input cells when interpolation
 
real(kind=r4_kind), dimension(:,:), allocatable mask_in
 masks the input grid to skip input cells when interpolation
 
real(kind=r8_kind) max_src_dist
 sets to max_dist in spherical interpolation
 
real(kind=r4_kind) max_src_dist
 sets to max_dist in spherical interpolation
 
integer nlat_dst
 is the size of destination grid in the y direction
 
integer nlat_src
 is the size of source grid in the y direction
 
integer nlon_dst
 is the size of destination grid in the x direction
 
integer nlon_src
 is the size of source grid in the x direction
 
integer, dimension(:,:), allocatable num_found
 stores the number of neighbors found in spherical interpolation
 
integer nxgrid
 is the number of exchange grid cells for conservative interpolation, version 2.
 
real(kind=r8_kind), dimension(:,:), allocatable rat_x
 holds (x_dest -x_src_r)/(x_src_l -x_src_r) for bicubic interpolation
 
real(kind=r4_kind), dimension(:,:), allocatable rat_x
 holds (x_dest -x_src_r)/(x_src_l -x_src_r) for bicubic interpolation
 
real(kind=r8_kind), dimension(:,:), allocatable rat_y
 holds (y_src_l -y_src_r)/(y_src_l -y_src_r) for bicubic interpolation
 
real(kind=r4_kind), dimension(:,:), allocatable rat_y
 holds (y_src_l -y_src_r)/(y_src_l -y_src_r) for bicubic interpolation
 
integer, parameter, public spherical = 3
 is an internally used parameter to mark spherical interpolation
 
real(kind=r8_kind), dimension(:,:,:), allocatable src_dist
 holds distance between destination grid and neighbor source grid in spherical interpolation.
 
real(kind=r4_kind), dimension(:,:,:), allocatable src_dist
 holds distance between destination grid and neighbor source grid in spherical interpolation.
 
integer version
 is set to 1 in horiz_interp_conserve_1dx1d_r4/8. Else set to 2; only used for conservative interpolation.
 
real(kind=r8_kind), dimension(:,:,:), allocatable wti
 holds interpolation weights for bilinear interpolation; x-derivatives for bicubic interpolation.
 
real(kind=r4_kind), dimension(:,:,:), allocatable wti
 holds interpolation weights for bilinear interpolation; x-derivatives for bicubic interpolation.
 
real(kind=r8_kind), dimension(:,:,:), allocatable wtj
 holds interpolation weights for bilinear interpolation; y-derivatives for bicubic interpolation.
 
real(kind=r4_kind), dimension(:,:,:), allocatable wtj
 holds interpolation weights for bilinear interpolation; y-derivatives for bicubic interpolation.
 

Detailed Description

Author
Zhi Liang
Defines horiz_interp_type

Data Type Documentation

◆ horiz_interp_type_mod::assignment(=)

interface horiz_interp_type_mod::assignment(=)

Interface to override the "=" operator to a horiz_interp_eq that will copy the Interp instance of horiz_interp_type with Interp2 = Interp1.

Definition at line 49 of file horiz_interp_type.F90.

Private Member Functions

subroutine horiz_interp_type_eq (horiz_interp_out, horiz_interp_in)
 

◆ horiz_interp_type_mod::horiz_interp_type

type horiz_interp_type_mod::horiz_interp_type

Datatype holding interpolation weights, mapping indices, and metadata for horizontal interpolation. All real members are stored in horizInterpReals8_type if the grid and data are represented in 64-bit floating point precision or horizInterpReals4_type if the grid and data are represented in 32-bit floating point precision. Only one type, horizInterpReals4_type or horizInterpReals8_type, is allocated and used for interpolation.

Definition at line 141 of file horiz_interp_type.F90.

Collaboration diagram for horiz_interp_type:
[legend]

Private Attributes

logical, dimension(:,:), allocatable found_neighbors
 is not used
 
type(horizinterpreals4_typehorizinterpreals4_type
 holds more 32-bit floating point data required for interpolation.
 
type(horizinterpreals8_typehorizinterpreals8_type
 holds more 64-bit floating point data required for interpolation.
 
logical i_am_initialized =.false.
 is set to .true. in horiz_interp_new. Horiz_interp_base will fail if I_am_initialized = .false.
 
integer, dimension(:), allocatable i_dst
 are the destination grid mapping indices in the x-direction for conservative interpolation, version 2.
 
integer, dimension(:,:,:), allocatable i_lon
 contains the source grid mapping indices in x-direction for bicubic and bilinear interpolation
 
integer, dimension(:), allocatable i_src
 are the source grid mapping indices in the x-direction for conservative interpolation, version 2.
 
integer, dimension(:,:), allocatable ilon
 contains the source grid mapping index in x-direction for conservative interpolation, version 1
 
integer interp_method
 is the interpolation method set to 1 for conservative; 2 for bilinear; 3 for spherical; 4 for bicubic.
 
integer, dimension(:), allocatable j_dst
 are the destination grid mapping indices in the y-direction for conservative interpolation, version 2.
 
integer, dimension(:,:,:), allocatable j_lat
 contains the source grid cell indices in y-direction for bicubic and bilinear interpolation
 
integer, dimension(:), allocatable j_src
 are the source grid mapping indices in the y-direction for conservative interpolation, version 2.
 
integer, dimension(:,:), allocatable jlat
 contains the source grid mapping indices in y-direction for conservative interpolation, version 1
 
integer nlat_dst
 is the size of destination grid in the y direction
 
integer nlat_src
 is the size of source grid in the y direction
 
integer nlon_dst
 is the size of destination grid in the x direction
 
integer nlon_src
 is the size of source grid in the x direction
 
integer, dimension(:,:), allocatable num_found
 stores the number of neighbors found in spherical interpolation
 
integer nxgrid
 is the number of exchange grid cells for conservative interpolation, version 2.
 
integer version
 is set to 1 in horiz_interp_conserve_1dx1d_r4/8. Else set to 2; only used for conservative interpolation.
 

◆ horiz_interp_type_mod::horizinterpreals4_type

type horiz_interp_type_mod::horizinterpreals4_type

Nested derived type in horiz_interp_type that holds 32-bit interpolation weights, and metadata. If 32-bit grid and data arrays are provided to horiz_interp, InterphorizInterpReals4_type will be initialized and populated with mapping weights.

Definition at line 102 of file horiz_interp_type.F90.

Collaboration diagram for horizinterpreals4_type:
[legend]

Private Attributes

real(kind=r4_kind), dimension(:,:), allocatable area_dst
 holds destination grid area.
 
real(kind=r4_kind), dimension(:), allocatable area_frac_dst
 holds interpolation weights for conservative interpolation, version2
 
real(kind=r4_kind), dimension(:,:), allocatable area_src
 holds source grid area.
 
real(kind=r4_kind), dimension(:,:), allocatable faci
 holds weights for conservative interpolation version 1
 
real(kind=r4_kind), dimension(:,:), allocatable facj
 holds weights for conservative interpolation version 1
 
logical is_allocated = .false.
 is .true. if Interp is populated
 
real(kind=r4_kind), dimension(:), allocatable lat_in
 holds the latitude coordinates on the source grid
 
real(kind=r4_kind), dimension(:), allocatable lon_in
 holds the longitude coordinates on the source grid
 
real(kind=r4_kind), dimension(:,:), allocatable mask_in
 masks the input grid to skip input cells when interpolation
 
real(kind=r4_kind) max_src_dist
 sets to max_dist in spherical interpolation
 
real(kind=r4_kind), dimension(:,:), allocatable rat_x
 holds (x_dest -x_src_r)/(x_src_l -x_src_r) for bicubic interpolation
 
real(kind=r4_kind), dimension(:,:), allocatable rat_y
 holds (y_src_l -y_src_r)/(y_src_l -y_src_r) for bicubic interpolation
 
real(kind=r4_kind), dimension(:,:,:), allocatable src_dist
 holds distance between destination grid and neighbor source grid in spherical interpolation.
 
real(kind=r4_kind), dimension(:,:,:), allocatable wti
 holds interpolation weights for bilinear interpolation; x-derivatives for bicubic interpolation.
 
real(kind=r4_kind), dimension(:,:,:), allocatable wtj
 holds interpolation weights for bilinear interpolation; y-derivatives for bicubic interpolation.
 

◆ horiz_interp_type_mod::horizinterpreals8_type

type horiz_interp_type_mod::horizinterpreals8_type

Nested derived type in horiz_interp_type that holds 64-bit interpolation weights, and metadata. If 64-bit grid and data arrays are provided to horiz_interp, InterphorizInterpReals8_type will be initialized and populated with mapping weights.

Definition at line 65 of file horiz_interp_type.F90.

Collaboration diagram for horizinterpreals8_type:
[legend]

Private Attributes

real(kind=r8_kind), dimension(:,:), allocatable area_dst
 holds destination grid area.
 
real(kind=r8_kind), dimension(:), allocatable area_frac_dst
 holds interpolation weights for conservative interpolation, version2
 
real(kind=r8_kind), dimension(:,:), allocatable area_src
 holds source grid area
 
real(kind=r8_kind), dimension(:,:), allocatable faci
 holds weights for conservative interpolation version 1
 
real(kind=r8_kind), dimension(:,:), allocatable facj
 holds weights for conservative interpolation version 1
 
logical is_allocated = .false.
 is .true. if Interp is populated
 
real(kind=r8_kind), dimension(:), allocatable lat_in
 holds the latitude coordinates on the source grid
 
real(kind=r8_kind), dimension(:), allocatable lon_in
 holds the longitude coordinates on the source grid
 
real(kind=r8_kind), dimension(:,:), allocatable mask_in
 masks the input grid to skip input cells when interpolation
 
real(kind=r8_kind) max_src_dist
 sets to max_dist in spherical interpolation
 
real(kind=r8_kind), dimension(:,:), allocatable rat_x
 holds (x_dest -x_src_r)/(x_src_l -x_src_r) for bicubic interpolation
 
real(kind=r8_kind), dimension(:,:), allocatable rat_y
 holds (y_src_l -y_src_r)/(y_src_l -y_src_r) for bicubic interpolation
 
real(kind=r8_kind), dimension(:,:,:), allocatable src_dist
 holds distance between destination grid and neighbor source grid in spherical interpolation.
 
real(kind=r8_kind), dimension(:,:,:), allocatable wti
 holds interpolation weights for bilinear interpolation; x-derivatives for bicubic interpolation.
 
real(kind=r8_kind), dimension(:,:,:), allocatable wtj
 holds interpolation weights for bilinear interpolation; y-derivatives for bicubic interpolation.
 

◆ horiz_interp_type_mod::stats

interface horiz_interp_type_mod::stats

Generic interfaces to compute statistics for bilinear and spherical interpolation Calls stats_r4 when the output data is in 32-bit precision. Calls stats_r8 when the output data is in 64-bit precision.

Definition at line 56 of file horiz_interp_type.F90.

Private Member Functions

 stats_r4
 
 stats_r8
 

Function/Subroutine Documentation

◆ horiz_interp_type_eq() [1/2]

subroutine horiz_interp_type_eq ( type(horiz_interp_type), intent(inout)  horiz_interp_out,
type(horiz_interp_type), intent(in)  horiz_interp_in 
)
private
Subroutine invoked when calling the "=" operator to copy all members of input horiz_interp_type into another instance of horiz_interp_type. Do not call subroutine directly. Instead, for copying, use the "=" operator: Interp2 = Interp1.
Parameters
[in,out]horiz_interp_outwill contain the copied horiz_interp_type
[in]horiz_interp_inis the horiz_interp_type to copy

Definition at line 192 of file horiz_interp_type.F90.

◆ horiz_interp_type_eq() [2/2]

subroutine horiz_interp_type_mod::horiz_interp_type_eq ( type(horiz_interp_type), intent(inout)  horiz_interp_out,
type(horiz_interp_type), intent(in)  horiz_interp_in 
)
private
Subroutine invoked when calling the "=" operator to copy all members of input horiz_interp_type into another instance of horiz_interp_type. Do not call subroutine directly. Instead, for copying, use the "=" operator: Interp2 = Interp1.
Parameters
[in,out]horiz_interp_outwill contain the copied horiz_interp_type
[in]horiz_interp_inis the horiz_interp_type to copy

Definition at line 192 of file horiz_interp_type.F90.