FMS 2025.01-dev
Flexible Modeling System
Loading...
Searching...
No Matches
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.
 
character(len=64) function chomp (string)
 chomp receives a string from NetCDF files and removes CHAR(0) from the end of this string.
 
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.
 
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.
 
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.
 
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.
 
subroutine, public unset_interpolator_time_flag (clim_type)
 unset_interpolator_time_flag sets a flag in clim_type to false.
 

Variables

integer, parameter bilinear = 3
 
logical clim_diag_initialized = .false.
 
integer, dimension(max_diag_fieldsclimo_diag_id
 
character(len=64), dimension(max_diag_fieldsclimo_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_fieldshinterp_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.

Public Member Functions

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

Member Function/Subroutine Documentation

◆ interpolate_type_eq()

subroutine interpolate_type_eq ( type(interpolate_type), intent(inout)  out,
type(interpolate_type), intent(in)  in 
)

Assignment overload routine for interpolate_type, to be used through the assignment interface.

Definition at line 418 of file interpolator.F90.

◆ 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.

Public 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.

Public 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 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 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 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.

◆ interpolate_type_eq()

subroutine, public interpolate_type_eq ( type(interpolate_type), intent(inout)  out,
type(interpolate_type), intent(in)  in 
)

Assignment overload routine for interpolate_type, to be used through the assignment interface.

Definition at line 418 of file interpolator.F90.

◆ interpolator_end()

subroutine, public 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 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 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 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.

Variable Documentation

◆ bilinear

integer, parameter bilinear = 3
private

Definition at line 360 of file interpolator.F90.

◆ clim_diag_initialized

logical clim_diag_initialized = .false.
private

Definition at line 333 of file interpolator.F90.

◆ climo_diag_id

integer, dimension(max_diag_fields) climo_diag_id
private

Definition at line 393 of file interpolator.F90.

◆ climo_diag_name

character(len=64), dimension(max_diag_fields) climo_diag_name
private

No description.

Definition at line 392 of file interpolator.F90.

◆ conservative_interp

logical conservative_interp = .true.
private

No description.

Definition at line 407 of file interpolator.F90.

◆ constant

integer, parameter, public constant = 1

Definition at line 378 of file interpolator.F90.

◆ dtr

real(r8_kind), parameter dtr = TPI/360._r8_kind
private

Definition at line 387 of file interpolator.F90.

◆ f_p

integer, parameter f_p = r8_kind
private

64-bit precision (kind=8)

Definition at line 402 of file interpolator.F90.

◆ hinterp_id

integer, dimension(max_diag_fields) hinterp_id
private

No description.

Definition at line 393 of file interpolator.F90.

◆ increasing_downward

integer, parameter increasing_downward = 1
private

Definition at line 355 of file interpolator.F90.

◆ increasing_upward

integer, parameter increasing_upward = -1
private

Flags to indicate direction of vertical axis in data file.

Definition at line 355 of file interpolator.F90.

◆ interp_linear_p

integer, parameter, public interp_linear_p = 20

Definition at line 382 of file interpolator.F90.

◆ interp_log_p

integer, parameter, public interp_log_p = 30

Flags to indicate the type of vertical interpolation.

Definition at line 382 of file interpolator.F90.

◆ interp_weighted_p

integer, parameter, public interp_weighted_p = 10

Definition at line 382 of file interpolator.F90.

◆ kg_m2

integer, parameter kg_m2 = 2
private

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.

Definition at line 372 of file interpolator.F90.

◆ len

integer len
private

Definition at line 344 of file interpolator.F90.

◆ linear

integer, parameter linear = 1
private

Definition at line 360 of file interpolator.F90.

◆ max_diag_fields

integer, parameter max_diag_fields = 30
private

No description.

Definition at line 352 of file interpolator.F90.

◆ missing_value

real(r8_kind) missing_value = -1.e10_r8_kind
private

No description.

Definition at line 394 of file interpolator.F90.

◆ module_is_initialized

logical module_is_initialized = .false.
private

Definition at line 332 of file interpolator.F90.

◆ ndim

integer ndim
private

No description.

Definition at line 335 of file interpolator.F90.

◆ nlat

integer nlat
private

No description.

Definition at line 338 of file interpolator.F90.

◆ nlatb

integer nlatb
private

No description.

Definition at line 339 of file interpolator.F90.

◆ nlev

integer nlev
private

No description.

Definition at line 342 of file interpolator.F90.

◆ nlevh

integer nlevh
private

No description.

Definition at line 343 of file interpolator.F90.

◆ nlon

integer nlon
private

No description.

Definition at line 340 of file interpolator.F90.

◆ nlonb

integer nlonb
private

No description.

Definition at line 341 of file interpolator.F90.

◆ no_conv

integer, parameter no_conv = 1
private

Definition at line 372 of file interpolator.F90.

◆ notime

integer, parameter notime = 4
private

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.

Definition at line 360 of file interpolator.F90.

◆ ntime

integer ntime
private

No description.

Definition at line 337 of file interpolator.F90.

◆ ntime_in

integer ntime_in
private

Definition at line 344 of file interpolator.F90.

◆ num_clim_diag

integer num_clim_diag = 0
private

No description.

Definition at line 391 of file interpolator.F90.

◆ num_fields

integer num_fields
private

No description.

Definition at line 344 of file interpolator.F90.

◆ nvar

integer nvar
private

No description.

Definition at line 336 of file interpolator.F90.

◆ pressure

integer, parameter pressure = 1
private

Definition at line 367 of file interpolator.F90.

◆ read_all_on_init

logical read_all_on_init = .false.
private

No description.

Definition at line 405 of file interpolator.F90.

◆ retain_cm3_bug

logical retain_cm3_bug = .false.
private

No description.

Definition at line 408 of file interpolator.F90.

◆ seasonal

integer, parameter seasonal = 2
private

Definition at line 360 of file interpolator.F90.

◆ sense

integer sense
private

No description.

Definition at line 350 of file interpolator.F90.

◆ sigma

integer, parameter sigma = 2
private

Flags to indicate where climatology pressure levels are pressure or sigma levels.

Definition at line 367 of file interpolator.F90.

◆ tpi

real(r8_kind), parameter tpi = (2.0_r8_kind*PI)
private

Definition at line 386 of file interpolator.F90.

◆ units

character(len=64) units
private

No description.

Definition at line 349 of file interpolator.F90.

◆ use_mpp_io

logical use_mpp_io = .false.
private

Set to true to use mpp_io, otherwise fms2io is used.

Definition at line 409 of file interpolator.F90.

◆ verbose

integer verbose = 0
private

No description.

Definition at line 406 of file interpolator.F90.

◆ zero

integer, parameter, public zero = 2

Flags to indicate what to do when the model surface pressure exceeds the climatology surface pressure level.

Definition at line 378 of file interpolator.F90.