FMS  2024.03
Flexible Modeling System
horiz_interp_bilinear_mod

Performs spatial interpolation between grids using bilinear interpolation. More...

Data Types

interface  horiz_interp_bilinear_new
 Creates a horiz_interp_type for bilinear interpolation. More...
 
interface  horiz_interp_read_weights_bilinear
 Subroutines for reading in weight files and using that to fill in the horiz_interp type instead calculating it. More...
 
interface  intersect
 

Functions/Subroutines

subroutine find_neighbor_ (Interp, lon_in, lat_in, lon_out, lat_out, src_modulo)
 this routine will search the source grid to fine the grid box that encloses each destination grid.
 
subroutine find_neighbor_new_ (Interp, lon_in, lat_in, lon_out, lat_out, src_modulo, no_crash)
 this routine will search the source grid to fine the grid box that encloses each destination grid.
 
subroutine horiz_interp_bilinear_ (Interp, data_in, data_out, verbose, mask_in, mask_out, missing_value, missing_permit, new_handle_missing)
 Subroutine for performing the horizontal interpolation between two grids. More...
 
subroutine, public horiz_interp_bilinear_del (Interp)
 Deallocates memory used by "horiz_interp_type" variables. More...
 
subroutine, public horiz_interp_bilinear_init
 Initialize this module and writes version number to logfile.
 
subroutine horiz_interp_bilinear_new_1d_ (Interp, lon_in, lat_in, lon_out, lat_out, verbose, src_modulo)
 
subroutine horiz_interp_bilinear_new_2d_ (Interp, lon_in, lat_in, lon_out, lat_out, verbose, src_modulo, new_search, no_crash_when_not_found)
 Initialization routine. More...
 
subroutine horiz_interp_read_weights_bilinear_ (Interp, weight_filename, lon_out, lat_out, lon_in, lat_in, weight_file_source, interp_method, isw, iew, jsw, jew, nglon, nglat)
 Subroutine for reading a weight file and use it to fill in the horiz interp type for the bilinear interpolation method. More...
 
logical function inside_polygon_ (polyx, polyy, x, y)
 The function will return true if the point x,y is inside a polygon, or false if it is not. If the point is exactly on the edge of a polygon, the function will return .true. More...
 
real(fms_hi_kind_) function intersect_ (x1, y1, x2, y2, x)
 
 intersect_r4
 
 intersect_r8
 

Variables

integer, parameter dummy = -999
 
real(r8_kind), parameter epsln =1.e-10_r8_kind
 
logical module_is_initialized = .FALSE.
 

Detailed Description

Performs spatial interpolation between grids using bilinear interpolation.

Author
Zhi Liang Zhi.L.nosp@m.iang.nosp@m.@noaa.nosp@m..gov This module can interpolate data from regular rectangular grid to rectangular/tripolar grid. The interpolation scheme is bilinear interpolation. There is an optional mask field for missing input data. An optional output mask field may be used in conjunction with the input mask to show where output data exists.

Data Type Documentation

◆ horiz_interp_bilinear_mod::horiz_interp_bilinear_new

interface horiz_interp_bilinear_mod::horiz_interp_bilinear_new

Creates a horiz_interp_type for bilinear interpolation.

Definition at line 50 of file horiz_interp_bilinear.F90.

Private Member Functions

 horiz_interp_bilinear_new_1d_r4
 
 horiz_interp_bilinear_new_1d_r8
 
 horiz_interp_bilinear_new_2d_r4
 
 horiz_interp_bilinear_new_2d_r8
 

◆ horiz_interp_bilinear_mod::horiz_interp_read_weights_bilinear

interface horiz_interp_bilinear_mod::horiz_interp_read_weights_bilinear

Subroutines for reading in weight files and using that to fill in the horiz_interp type instead calculating it.

Definition at line 60 of file horiz_interp_bilinear.F90.

Private Member Functions

 horiz_interp_read_weights_bilinear_r4
 
 horiz_interp_read_weights_bilinear_r8
 

◆ horiz_interp_bilinear_mod::intersect

interface horiz_interp_bilinear_mod::intersect

Definition at line 77 of file horiz_interp_bilinear.F90.

Private Member Functions

 intersect_r4
 
 intersect_r8
 

Function/Subroutine Documentation

◆ horiz_interp_bilinear_()

subroutine horiz_interp_bilinear_ ( type (horiz_interp_type), intent(in)  Interp,
real(fms_hi_kind_), dimension(:,:), intent(in)  data_in,
real(fms_hi_kind_), dimension(:,:), intent(out)  data_out,
integer, intent(in), optional  verbose,
real(fms_hi_kind_), dimension(:,:), intent(in), optional  mask_in,
real(fms_hi_kind_), dimension(:,:), intent(out), optional  mask_out,
real(fms_hi_kind_), intent(in), optional  missing_value,
integer, intent(in), optional  missing_permit,
logical, intent(in), optional  new_handle_missing 
)

Subroutine for performing the horizontal interpolation between two grids.

horiz_interp_bilinear_new must be called before calling this routine.

Parameters
[in]interpDerived type variable containing interpolation indices and weights. Returned by a previous call to horiz_interp_bilinear_new
[in]data_ininput data on source grid
[out]data_outoutput data on source grid
[in]verbose0 = no output; 1 = min,max,means; 2 = all output
[in]mask_inInput mask, must be the same size as the input data. The real(FMS_HI_KIND_) value of mask_in must be in the range (0.,1.). Set mask_in=0.0 for data points that should not be used or have missing data
[out]mask_outoutput mask that specifies whether data was computed

Definition at line 903 of file horiz_interp_bilinear.inc.

◆ horiz_interp_bilinear_del()

subroutine, public horiz_interp_bilinear_mod::horiz_interp_bilinear_del ( type (horiz_interp_type), intent(inout)  Interp)

Deallocates memory used by "horiz_interp_type" variables.

Must be called before reinitializing with horiz_interp_bilinear_new.

Parameters
[in,out]interpA derived-type variable returned by previous call to horiz_interp_bilinear_new. The input variable must have allocated arrays. The returned variable will contain deallocated arrays

Definition at line 101 of file horiz_interp_bilinear.F90.

◆ horiz_interp_bilinear_new_2d_()

subroutine horiz_interp_bilinear_new_2d_ ( type(horiz_interp_type), intent(inout)  Interp,
real(fms_hi_kind_), dimension(:,:), intent(in)  lon_in,
real(fms_hi_kind_), dimension(:,:), intent(in)  lat_in,
real(fms_hi_kind_), dimension(:,:), intent(in)  lon_out,
real(fms_hi_kind_), dimension(:,:), intent(in)  lat_out,
integer, intent(in), optional  verbose,
logical, intent(in), optional  src_modulo,
logical, intent(in), optional  new_search,
logical, intent(in), optional  no_crash_when_not_found 
)

Initialization routine.

Allocates space and initializes a derived-type variable that contains pre-computed interpolation indices and weights.

Parameters
[in,out]interpA derived type variable containing indices and weights for subsequent interpolations. To reinitialize for different grid-to-grid interpolation horiz_interp_del must be used first.
[in]lon_inLatitude (radians) for source data grid
[in]lat_inLongitude (radians) for source data grid
[in]lon_outLongitude (radians) for output data grid
[in]lat_outLatitude (radians) for output data grid
[in]verboseflag for amount of print output
[in]src_moduloindicates if the boundary condition along zonal boundary is cyclic or not. Cyclic when true

Definition at line 207 of file horiz_interp_bilinear.inc.

◆ horiz_interp_read_weights_bilinear_()

subroutine horiz_interp_read_weights_bilinear_ ( type(horiz_interp_type), intent(inout)  Interp,
character(len=*), intent(in)  weight_filename,
real(fms_hi_kind_), dimension(:,:), intent(in), target  lon_out,
real(fms_hi_kind_), dimension(:,:), intent(in), target  lat_out,
real(fms_hi_kind_), dimension(:), intent(in)  lon_in,
real(fms_hi_kind_), dimension(:), intent(in)  lat_in,
character(len=*), intent(in)  weight_file_source,
character(len=*), intent(in)  interp_method,
integer, intent(in)  isw,
integer, intent(in)  iew,
integer, intent(in)  jsw,
integer, intent(in)  jew,
integer, intent(in)  nglon,
integer, intent(in)  nglat 
)

Subroutine for reading a weight file and use it to fill in the horiz interp type for the bilinear interpolation method.

Parameters
[in,out]interpHoriz interp time to fill
[in]weight_filenameName of the weight file
[in]lat_outOutput (model) latitude
[in]lon_outOutput (model) longitude
[in]lat_inInput (data) latitude
[in]lon_inInput (data) longitude
[in]weight_file_sourceSource of the weight file
[in]interp_methodThe interp method to use
[in]jewStarting and ending indices of the compute domain
[in]nglonNumber of longitudes in the global domain
[in]nglatNumber of latitudes in the globl domain

Definition at line 1215 of file horiz_interp_bilinear.inc.

◆ inside_polygon_()

logical function inside_polygon_ ( real(fms_hi_kind_), dimension(:), intent(in)  polyx,
real(fms_hi_kind_), dimension(:), intent(in)  polyy,
real(fms_hi_kind_), intent(in)  x,
real(fms_hi_kind_), intent(in)  y 
)

The function will return true if the point x,y is inside a polygon, or false if it is not. If the point is exactly on the edge of a polygon, the function will return .true.

Parameters
[in]polyxlongitude coordinates of corners
[in]polyylatitude coordinates of corners
[in]xx coordinate of point to be tested
[in]yy coordinate of point to be tested

Definition at line 654 of file horiz_interp_bilinear.inc.