FMS  2026.01.01-dev
Flexible Modeling System
horiz_interp_spherical_mod

Performs spatial interpolation between grids using inverse-distance-weighted scheme. More...

Data Types

interface  horiz_interp_spherical_new
 Generic interface to compute interpolation weights and mapping indices. Calls horiz_interp_spherical_new_r4 when input and output 2D grid arrays are in 32-bit precision. Calls horiz_interp_spherical_new_r8 when input and output 2D grid arrays are in 64-bit precision. More...
 
interface  horiz_interp_spherical_wght
 Unused interface. More...
 
interface  spherical_distance
 Generic inteface used internally in full_search and radial_search. Calls spherical_distance_r4 when the lon and lat values are in 32-bit precision. Calls spherical_distance_r8 when the lon and lat values are in 64-bit precision. More...
 

Functions/Subroutines

 full_search_r4
 
 full_search_r8
 
subroutine, public horiz_interp_spherical_del (Interp)
 
subroutine, public horiz_interp_spherical_init
 
 horiz_interp_spherical_new_r4
 
 horiz_interp_spherical_new_r8
 
 horiz_interp_spherical_r4
 
 horiz_interp_spherical_r8
 
 horiz_interp_spherical_wght_r4
 
 horiz_interp_spherical_wght_r8
 
 radial_search_r4
 
 radial_search_r8
 
 spherical_distance_r4
 
 spherical_distance_r8
 

Variables

real(r8_kind), parameter epsln =1.e-10_r8_kind
 is a small number
 
real(r8_kind), parameter large =1.e20_r8_kind
 is a large number
 
real(r8_kind), parameter max_dist_default = 0.1_r8_kind
 is the maximum angular distance in radians for input and output grid cells to neighbor.
 
integer, parameter max_neighbors = 400
 is the maximum number of neighboring input grid cells around output grid cell.
 
logical module_is_initialized = .FALSE.
 
integer, parameter num_nbrs_default = 4
 is the minimum number of neighbors to compute for each output grid cell.
 
integer pe
 
integer root_pe
 
character(len=32) search_method = "radial_search"
 is a namelist flag to set the nearest neighbor searching method to either "radial_search" (default) or "full_search". When set to "radial_search", the search may not be as accurate for some cases. Normally the search will be ok if you chose suitable max_dist. When search_method is "full_search", it will be always accurate, but will be slower comparing to "radial_search". Normally these two search algorithm will produce same results other than order of operation. "radial_search" are recommended to use. The purpose to add "full_search" is in case you think you interpolation results is not right, you have other option to verify.
 

Detailed Description

Performs spatial interpolation between grids using inverse-distance-weighted scheme.

Horiz_interp_spherical_mod contains methods called from horiz_interp_mod to interpolate data from rectangular/tripolar grid to rectangular/tripolar grid using the inverse-distance-weighted interpolation. Users are recommended to use the top-level horiz_interp_mod with "interp" set to "spherical" for the inverse-distance-weighted interpolation.

Data Type Documentation

◆ horiz_interp_spherical_mod::full_search

interface horiz_interp_spherical_mod::full_search

Generic interface used internally when search_method = "full_search" to search for nearest neighbors. Calls full_search_r4 when the input and output grids are in 32-bit precision. Calls full_search_r8 when the input and output grids are in 64-bit precision.

Definition at line 71 of file horiz_interp_spherical.F90.

Private Member Functions

 full_search_r4
 
 full_search_r8
 

◆ horiz_interp_spherical_mod::horiz_interp_spherical_new

interface horiz_interp_spherical_mod::horiz_interp_spherical_new

Generic interface to compute interpolation weights and mapping indices. Calls horiz_interp_spherical_new_r4 when input and output 2D grid arrays are in 32-bit precision. Calls horiz_interp_spherical_new_r8 when input and output 2D grid arrays are in 64-bit precision.

Definition at line 53 of file horiz_interp_spherical.F90.

Private Member Functions

 horiz_interp_spherical_new_r4
 
 horiz_interp_spherical_new_r8
 

◆ horiz_interp_spherical_mod::horiz_interp_spherical_wght

interface horiz_interp_spherical_mod::horiz_interp_spherical_wght

Unused interface.

Definition at line 59 of file horiz_interp_spherical.F90.

Private Member Functions

 horiz_interp_spherical_wght_r4
 
 horiz_interp_spherical_wght_r8
 

◆ horiz_interp_spherical_mod::radial_search

interface horiz_interp_spherical_mod::radial_search

Generic interface used internally when search_method = "radial_search" to search for nearest neighbors. Calls radial_search_r4 when the input and output grids are in 32-bit precision. Calls radial_search_r8 when the input and output grids are in 64-bit precision.

Definition at line 80 of file horiz_interp_spherical.F90.

Private Member Functions

 radial_search_r4
 
 radial_search_r8
 

◆ horiz_interp_spherical_mod::spherical_distance

interface horiz_interp_spherical_mod::spherical_distance

Generic inteface used internally in full_search and radial_search. Calls spherical_distance_r4 when the lon and lat values are in 32-bit precision. Calls spherical_distance_r8 when the lon and lat values are in 64-bit precision.

Definition at line 88 of file horiz_interp_spherical.F90.

Private Member Functions

 spherical_distance_r4
 
 spherical_distance_r8
 

Function/Subroutine Documentation

◆ horiz_interp_spherical_del()

subroutine, public horiz_interp_spherical_mod::horiz_interp_spherical_del ( type (horiz_interp_type), intent(inout)  Interp)
Deallocates arrays holding spherical interpolation weights and mapping indices in Interp. Resets is_allocated to .false. Called from horiz_interp_del in horiz_interp_mod.
Parameters
[in,out]interpwill be reset with deallocated memory

Definition at line 145 of file horiz_interp_spherical.F90.

◆ horiz_interp_spherical_init()

subroutine, public horiz_interp_spherical_mod::horiz_interp_spherical_init
Initializes horiz_interp_spherical_mod. Called from horiz_interp_init in horiz_interp_mod

Definition at line 126 of file horiz_interp_spherical.F90.