FMS  2024.03
Flexible Modeling System
interpolator_mod

A module to interpolate climatology data to model the grid. More...

Data Types

interface  assignment(=)
 Private assignment override interface for interpolate type. More...
 
interface  interp_weighted_scalar
 Private interface for weighted scalar interpolation. More...
 
interface  interpolator
 Interpolates a field to a model grid. More...
 

Functions/Subroutines

integer function check_climo_units (units)
 check_climo_units checks the units that the climatology data is using. This is needed to allow for conversion of datasets to mixing ratios which is what the vertical interpolation scheme requires. The default is to assume no conversion is needed. If the units are those of a column burden (kg/m2) then conversion to mixing ratio is flagged. More...
 
character(len=64) function chomp (string)
 chomp receives a string from NetCDF files and removes CHAR(0) from the end of this string. More...
 
subroutine, public init_clim_diag (clim_type, mod_axes, init_time)
 init_clim_diag is a routine to register diagnostic fields for the climatology file. This routine calculates the domain decompostion of the climatology fields for later export through send_data. The ids created here are for column burdens that will diagnose the vertical interpolation routine. More...
 
subroutine, public interpolate_type_eq (Out, In)
 Assignment overload routine for interpolate_type, to be used through the assignment interface.
 
subroutine, public interpolator_end (clim_type)
 interpolator_end receives interpolate data as input and deallocates its memory. More...
 
subroutine, public obtain_interpolator_time_slices (clim_type, Time)
 obtain_interpolator_time_slices makes sure that the appropriate time slices are available for interpolation on this time step. More...
 
subroutine, public query_interpolator (clim_type, nfields, field_names)
 query_interpolator receives an interpolate type as input and returns the number of fields and field names. More...
 
subroutine, public unset_interpolator_time_flag (clim_type)
 unset_interpolator_time_flag sets a flag in clim_type to false. More...
 

Variables

integer, parameter bilinear = 3
 
logical clim_diag_initialized = .false.
 
integer, dimension(max_diag_fields) climo_diag_id
 
character(len=64), dimension(max_diag_fields) climo_diag_name
 No description.
 
logical conservative_interp = .true.
 No description.
 
integer, parameter, public constant = 1
 
real(r8_kind), parameter dtr = TPI/360._r8_kind
 
integer, parameter f_p = r8_kind
 64-bit precision (kind=8)
 
integer, dimension(max_diag_fields) hinterp_id
 No description.
 
integer, parameter increasing_downward = 1
 
integer, parameter increasing_upward = -1
 Flags to indicate direction of vertical axis in data file.
 
integer, parameter, public interp_linear_p = 20
 
integer, parameter, public interp_log_p = 30
 Flags to indicate the type of vertical interpolation.
 
integer, parameter, public interp_weighted_p = 10
 
integer, parameter kg_m2 = 2
 Flags to indicate whether the climatology units are mixing ratio (kg/kg) or column integral (kg/m2). Vertical interpolation scheme requires mixing ratio at this time.
 
integer len
 
integer, parameter linear = 1
 
integer, parameter max_diag_fields = 30
 No description.
 
real(r8_kind) missing_value = -1.e10_r8_kind
 No description.
 
logical module_is_initialized = .false.
 
integer ndim
 No description.
 
integer nlat
 No description.
 
integer nlatb
 No description.
 
integer nlev
 No description.
 
integer nlevh
 No description.
 
integer nlon
 No description.
 
integer nlonb
 No description.
 
integer, parameter no_conv = 1
 
integer, parameter notime = 4
 Flags to indicate whether the time interpolation should be linear or some other scheme for seasonal data. NOTIME indicates that data file has no time axis.
 
integer ntime
 No description.
 
integer ntime_in
 
integer num_clim_diag = 0
 No description.
 
integer num_fields
 No description.
 
integer nvar
 No description.
 
integer, parameter pressure = 1
 
logical read_all_on_init = .false.
 No description.
 
logical retain_cm3_bug = .false.
 No description.
 
integer, parameter seasonal = 2
 
integer sense
 No description.
 
integer, parameter sigma = 2
 Flags to indicate where climatology pressure levels are pressure or sigma levels.
 
real(r8_kind), parameter tpi = (2.0_r8_kind*PI)
 
character(len=64) units
 No description.
 
logical use_mpp_io = .false.
 Set to true to use mpp_io, otherwise fms2io is used.
 
integer verbose = 0
 No description.
 
integer, parameter, public zero = 2
 Flags to indicate what to do when the model surface pressure exceeds the climatology surface pressure level.
 

Detailed Description

A module to interpolate climatology data to model the grid.

Author
William Cooke Willi.nosp@m.am.C.nosp@m.ooke@.nosp@m.noaa.nosp@m..gov

Data Type Documentation

◆ interpolator_mod::assignment(=)

interface interpolator_mod::assignment(=)

Private assignment override interface for interpolate type.

Definition at line 166 of file interpolator.F90.

Private Member Functions

subroutine interpolate_type_eq (Out, In)
 Assignment overload routine for interpolate_type, to be used through the assignment interface.
 

◆ interpolator_mod::interp_weighted_scalar

interface interpolator_mod::interp_weighted_scalar

Private interface for weighted scalar interpolation.

Example usage:

call interp_weighted_scalar (pclim, phalf(ilon,j,:),hinterp_data(ilon,j,:,:),interp_data(ilon,j,:,:))
call interp_weighted_scalar (pclim, phalf(ilon,j,:),hinterp_data(ilon,j,:),interp_data(ilon,j,:))
Parameters
[in]<grdin>Input grid
[in]<grdout>Output grid
[in]<datin>Input data
[out]<datout>Output data

Definition at line 238 of file interpolator.F90.

Private Member Functions

 interp_weighted_scalar_1d_r4
 
 interp_weighted_scalar_1d_r8
 
 interp_weighted_scalar_2d_r4
 
 interp_weighted_scalar_2d_r8
 

◆ interpolator_mod::interpolator

interface interpolator_mod::interpolator

Interpolates a field to a model grid.

Example usage:

call interpolator (sulfate, model_time, p_half, model_data, name, is, js, clim_units)
call interpolator (o3, model_time, p_half, model_data, "ozone", is, js)

The first option is used to generate sulfate models.

The sulfate data is set by

type(interpolate_type), intent(inout) :: sulfate

The name of the model is set by

character(len=*), intent(in) :: name

The units used in this model are outputted to

character(len=*), intent(out), optional :: clim_units

The second option is generate ozone models.

The ozone data is set by

type(interpolate_type), intent(inout) :: o3

Both of these options use the following variables in the model.

The time used in the model is set by

type(time_type), intent(in) :: model_time

The model pressure field is set by

real, intent(in), dimension(:,:,:) :: p_half
Parameters
[in,out]<clim_type>The interpolate type previously defined by a call to interpolator_init
[in]<field_name>The name of a field that you wish to interpolate
[in]<Time>The model time that you wish to interpolate to
[in]<phalf>The half level model pressure field
[in]<is>Index for the physics window
[in]<js>Index for the physics window
[out]<interp_data>The model fields with the interpolated climatology data
[out]<clim_units>The units of field_name

Definition at line 155 of file interpolator.F90.

Private Member Functions

 interpolator_2d_no_time_axis_r4
 
 interpolator_2d_no_time_axis_r8
 
 interpolator_2d_r4
 
 interpolator_2d_r8
 
 interpolator_3d_no_time_axis_r4
 
 interpolator_3d_no_time_axis_r8
 
 interpolator_3d_r4
 
 interpolator_3d_r8
 
 interpolator_4d_no_time_axis_r4
 
 interpolator_4d_no_time_axis_r8
 
 interpolator_4d_r4
 
 interpolator_4d_r8
 

Function/Subroutine Documentation

◆ check_climo_units()

integer function interpolator_mod::check_climo_units ( character(len=*), intent(in)  units)
private

check_climo_units checks the units that the climatology data is using. This is needed to allow for conversion of datasets to mixing ratios which is what the vertical interpolation scheme requires. The default is to assume no conversion is needed. If the units are those of a column burden (kg/m2) then conversion to mixing ratio is flagged.

Parameters
[in]<units>The units which you will be checking

Definition at line 507 of file interpolator.F90.

◆ chomp()

character(len=64) function interpolator_mod::chomp ( character(len=*), intent(in)  string)
private

chomp receives a string from NetCDF files and removes CHAR(0) from the end of this string.

Parameters
[in]<string>The string from the NetCDF file

Definition at line 762 of file interpolator.F90.

◆ init_clim_diag()

subroutine, public interpolator_mod::init_clim_diag ( type(interpolate_type), intent(inout)  clim_type,
integer, dimension(:), intent(in)  mod_axes,
type(time_type), intent(in)  init_time 
)

init_clim_diag is a routine to register diagnostic fields for the climatology file. This routine calculates the domain decompostion of the climatology fields for later export through send_data. The ids created here are for column burdens that will diagnose the vertical interpolation routine.

Parameters
[in,out]<clim_type>The interpolate type containing the names of the fields in the climatology file
[in]<mod_axes>The axes of the model
[in]<init_time>The model initialization time
Exceptions
FATAL,init_clim_diag : You must call interpolator_init before calling init_clim_diag
FATAL,init_clim_diag : Trying to set up too many diagnostic fields for the climatology data

Definition at line 547 of file interpolator.F90.

◆ interpolator_end()

subroutine, public interpolator_mod::interpolator_end ( type(interpolate_type), intent(inout)  clim_type)

interpolator_end receives interpolate data as input and deallocates its memory.

Parameters
[in,out]<clim_type>The interpolate type whose components will be deallocated

Definition at line 653 of file interpolator.F90.

◆ obtain_interpolator_time_slices()

subroutine, public interpolator_mod::obtain_interpolator_time_slices ( type(interpolate_type), intent(inout)  clim_type,
type(time_type), intent(in)  Time 
)

obtain_interpolator_time_slices makes sure that the appropriate time slices are available for interpolation on this time step.

Parameters
[in,out]<clim_type>The interpolate type previously defined by a call to interpolator_init
[in]<Time>The model time that you wish to interpolate to
Exceptions
FATAL"interpolator_timeslice 1: file="
FATAL"interpolator_timeslice 2: file="
FATAL"interpolator_timeslice 3: file="
FATAL"interpolator_timeslice 4: file="
FATAL"interpolator_timeslice 5: file="
FATAL"interpolator_timeslice : No data from the previous climatology time but we have the next time. How did this happen?"

Definition at line 596 of file interpolator.F90.

◆ query_interpolator()

subroutine, public interpolator_mod::query_interpolator ( type(interpolate_type), intent(in)  clim_type,
integer, intent(out), optional  nfields,
character(len=*), dimension(:), intent(out), optional  field_names 
)

query_interpolator receives an interpolate type as input and returns the number of fields and field names.

Parameters
[in]<clim_type>The interpolate type which contains the data
[out]<nfields>OPTIONAL: No description
[out]<field_names>OPTIONAL: No description

Definition at line 741 of file interpolator.F90.

◆ unset_interpolator_time_flag()

subroutine, public interpolator_mod::unset_interpolator_time_flag ( type(interpolate_type), intent(inout)  clim_type)

unset_interpolator_time_flag sets a flag in clim_type to false.

Parameters
[in,out]<clim_type>The interpolate type containing the names of the fields in the climatology file

Definition at line 635 of file interpolator.F90.