FMS
2024.03
Flexible Modeling System
|
Perform I/O and time interpolation of external fields (contained in a file), using fms2_io. More...
Data Types | |
type | ext_fieldtype |
Represents external fields. More... | |
type | filetype |
Holds filename and file object. More... | |
interface | time_interp_external |
Provide data from external file interpolated to current model time. Data may be local to current processor or global, depending on "init_external_field" flags. Uses FMS2 IO for I/O. More... | |
Functions/Subroutines | |
integer function, private | find_buf_index (indx, buf) |
simple linear search for given value in given list TODO should use better search if this list is bigger | |
real(r8_kind) function, public | get_external_field_missing (index) |
return missing value More... | |
integer function, dimension(4), public | get_external_field_size (index) |
Returns size of field after call to init_external_field. Ordering is X/Y/Z/T. This call only makes sense for non-distributed reads. More... | |
logical function, public | get_external_fileobj (filename, fileobj) |
subroutine, public | get_time_axis (index, time) |
integer function, public | init_external_field (file, fieldname, domain, desired_units, verbose, axis_names, axis_sizes, override, correct_leap_year_inconsistency, permit_calendar_conversion, use_comp_domain, ierr, nwindows, ignore_axis_atts, ongrid) |
Initialize an external field. Buffer "num_io_buffers" (default=2) in memory to reduce memory allocations. distributed reads are supported using the optional "domain" flag. Units conversion via the optional "desired_units" flag using udunits_mod. More... | |
subroutine | load_record (field, rec, interp, is_in, ie_in, js_in, je_in, window_id_in) |
load specified record from file Always loads in r8, casts down for horiz_interp if interp argument is already allocated for r4's. | |
subroutine | load_record_0d (field, rec) |
Given a initialized ext_fieldtype and record number, loads the given index into fieldsrc_data. | |
subroutine | realloc_fields (n) |
reallocates array of fields,increasing its size | |
subroutine | realloc_files (n) |
reallocates array of fields, increasing its size | |
subroutine, public | reset_src_data_region (index, is, ie, js, je) |
Reallocates src_data for field from module level loaded_fields array. | |
subroutine, public | set_override_region (index, region_type, is_region, ie_region, js_region, je_region) |
subroutine, private | set_time_modulo (Time) |
subroutine | time_interp_external_0d_ (index, time, time_data, verbose) |
Scalar interpolation for time_interp_external. | |
subroutine | time_interp_external_2d_ (index, time, data_in, interp, verbose, horz_interp, mask_out, is_in, ie_in, js_in, je_in, window_id) |
2D interpolation for time_interp_external More... | |
subroutine | time_interp_external_3d_ (index, time, time_data, interp, verbose, horz_interp, mask_out, is_in, ie_in, js_in, je_in, window_id) |
3D interpolation for time_interp_external Provide data from external file interpolated to current model time. Data may be local to current processor or global, depending on "init_external_field" flags. More... | |
subroutine | time_interp_external_bridge_0d_ (index1, index2, time, time_data, verbose) |
subroutine | time_interp_external_bridge_2d_ (index1, index2, time, data_in, interp, verbose, horz_interp, mask_out, is_in, ie_in, js_in, je_in, window_id) |
2D interpolation for time_interp_external_bridge More... | |
subroutine | time_interp_external_bridge_3d_ (index1, index2, time, time_data, interp, verbose, horz_interp, mask_out, is_in, ie_in, js_in, je_in, window_id) |
3D interpolation for time_interp_external Provide data from external file interpolated to current model time. Data may be local to current processor or global, depending on "init_external_field" flags. More... | |
subroutine, public | time_interp_external_exit () |
exit time_interp_external_mod. Close all open files and release storage | |
subroutine, public | time_interp_external_init () |
Initialize the time_interp_external_mod module. | |
Variables | |
logical, private | debug_this_module = .false. |
real(r8_kind), parameter, private | default_missing_value = -1e20_r8_kind |
integer, parameter, public | err_field_not_found = 1 |
integer, parameter, public | inside_region =1 |
integer, parameter, private | linear_time_interp = 1 |
type(ext_fieldtype), dimension(:), pointer, save, private | loaded_fields => NULL() |
integer, private | max_fields = 100 |
integer, private | max_files = 40 |
logical, private | module_initialized = .false. |
integer, parameter, private | modulo_year = 0001 |
integer, private | num_fields = 0 |
integer, private | num_files =0 |
integer, private | num_io_buffers = 2 |
type(filetype), dimension(:), pointer, save, private | opened_files => NULL() |
integer, parameter, public | outside_region =2 |
integer | outunit |
integer, parameter, public | success = 0 |
real(r8_kind), parameter, private | time_interp_missing =-1e99_r8_kind |
Perform I/O and time interpolation of external fields (contained in a file), using fms2_io.
Perform I/O and time interpolation for external fields. Uses udunits library to calculate calendar dates and convert units. Allows for reading data decomposed across model horizontal grid using optional domain2d argument
data are defined over data domain for domain2d data (halo values are NOT updated by this module)
type time_interp_external2_mod::ext_fieldtype |
Represents external fields.
Definition at line 96 of file time_interp_external2.F90.
Private Attributes | |
character(len=32), dimension(4) | axisname |
logical | correct_leap_year_inconsistency |
type(domain2d) | domain |
real(r8_kind), dimension(:,:,:,:), pointer | domain_data =>NULL() |
defined over data domain or global domain | |
logical | domain_present |
type(time_type), dimension(:), pointer | end_time =>NULL() |
type(fmsnetcdffile_t), pointer | fileobj =>NULL() |
keep unit open when not reading all records | |
logical | have_modulo_times |
integer, dimension(:), pointer | ibuf =>NULL() |
record numbers associated with buffers | |
integer | ie_region |
integer | ie_src |
integer | iec |
real(r8_kind) | intercept |
integer | is_region |
integer | is_src |
integer | isc |
integer | je_region |
integer | je_src |
integer | jec |
integer | js_region |
integer | js_src |
integer | jsc |
logical, dimension(:,:,:,:), pointer | mask =>NULL() |
defined over data domain or global domain | |
real(r8_kind) | missing |
logical | modulo_time |
denote climatological time axis | |
type(time_type) | modulo_time_beg |
type(time_type) | modulo_time_end |
character(len=128) | name |
integer | nbuf |
integer | ndim |
logical, dimension(:,:), pointer | need_compute =>NULL() |
integer | numwindows |
type(time_type), dimension(:), pointer | period =>NULL() |
integer | region_type |
integer, dimension(4) | siz |
real(r8_kind) | slope |
real(r8_kind), dimension(:,:,:,:), pointer | src_data =>NULL() |
input data buffer | |
type(time_type), dimension(:), pointer | start_time =>NULL() |
integer | tdim |
type(time_type), dimension(:), pointer | time =>NULL() |
midpoint of time interval | |
character(len=128) | units |
type(valid_t) | valid |
type time_interp_external2_mod::filetype |
Holds filename and file object.
Definition at line 128 of file time_interp_external2.F90.
Private Attributes | |
character(len=fms_file_len) | filename = '' |
type(fmsnetcdffile_t), pointer | fileobj => NULL() |
interface time_interp_external2_mod::time_interp_external |
Provide data from external file interpolated to current model time. Data may be local to current processor or global, depending on "init_external_field" flags. Uses FMS2 IO for I/O.
index | index of external field from previous call to init_external_field | |
time | target time for data | |
[in,out] | data | global or local data array |
interp | time_interp_external defined interpolation method (optional). Currently this module only supports LINEAR_TIME_INTERP. | |
verbose | verbose flag for debugging (optional). |
Definition at line 145 of file time_interp_external2.F90.
Private Member Functions | |
time_interp_external_0d_r4 | |
time_interp_external_0d_r8 | |
time_interp_external_2d_r4 | |
time_interp_external_2d_r8 | |
time_interp_external_3d_r4 | |
time_interp_external_3d_r8 | |
real(r8_kind) function, public time_interp_external2_mod::get_external_field_missing | ( | integer | index | ) |
return missing value
index | returned from previous call to init_external_field. |
Definition at line 1078 of file time_interp_external2.F90.
integer function, dimension(4), public time_interp_external2_mod::get_external_field_size | ( | integer | index | ) |
Returns size of field after call to init_external_field. Ordering is X/Y/Z/T. This call only makes sense for non-distributed reads.
index | returned from previous call to init_external_field. |
Definition at line 1061 of file time_interp_external2.F90.
subroutine, public time_interp_external2_mod::get_time_axis | ( | integer, intent(in) | index, |
type(time_type), dimension(:), intent(out) | time | ||
) |
[in] | index | field id |
[out] | time | array of time values to be filled |
Definition at line 1091 of file time_interp_external2.F90.
integer function, public time_interp_external2_mod::init_external_field | ( | character(len=*), intent(in) | file, |
character(len=*), intent(in) | fieldname, | ||
type(domain2d), intent(in), optional | domain, | ||
character(len=*), intent(in), optional | desired_units, | ||
logical, intent(in), optional | verbose, | ||
character(len=*), dimension(4), intent(out), optional | axis_names, | ||
integer, dimension(4), intent(inout), optional | axis_sizes, | ||
logical, intent(in), optional | override, | ||
logical, intent(in), optional | correct_leap_year_inconsistency, | ||
logical, intent(in), optional | permit_calendar_conversion, | ||
logical, intent(in), optional | use_comp_domain, | ||
integer, intent(out), optional | ierr, | ||
integer, intent(in), optional | nwindows, | ||
logical, optional | ignore_axis_atts, | ||
logical, optional | ongrid | ||
) |
Initialize an external field. Buffer "num_io_buffers" (default=2) in memory to reduce memory allocations. distributed reads are supported using the optional "domain" flag. Units conversion via the optional "desired_units" flag using udunits_mod.
file | filename | |
fieldname | fieldname (in file) | |
format | mpp_io flag for format of file(optional). Currently only "MPP_NETCDF" supported | |
threading | mpp_io flag for threading (optional). "MPP_SINGLE" means root pe reads global field and distributes to other PEs. "MPP_MULTI" means all PEs read data | |
domain | domain flag (optional) | |
desired_units | Target units for data (optional), e.g. convert from deg_K to deg_C. Failure to convert using udunits will result in failure of this module. | |
verbose | verbose flag for debugging (optional). | |
[out] | axis_names | List of axis names (optional). |
[in,out] | axis_sizes | array of axis lengths ordered X-Y-Z-T (optional). |
ongrid | Optional flag indicating if the data is ongrid |
If this is an ongrid case, set is[e]js[e]data to be equal to the compute domain. This is what it is used to allocate space for the data!
Definition at line 270 of file time_interp_external2.F90.
subroutine time_interp_external_2d_ | ( | integer, intent(in) | index, |
type(time_type), intent(in) | time, | ||
real(fms_ti_kind_), dimension(:,:), intent(inout) | data_in, | ||
integer, intent(in), optional | interp, | ||
logical, intent(in), optional | verbose, | ||
type(horiz_interp_type), intent(in), optional | horz_interp, | ||
logical, dimension(:,:), intent(out), optional | mask_out, | ||
integer, intent(in), optional | is_in, | ||
integer, intent(in), optional | ie_in, | ||
integer, intent(in), optional | js_in, | ||
integer, intent(in), optional | je_in, | ||
integer, intent(in), optional | window_id | ||
) |
2D interpolation for time_interp_external
[out] | mask_out | set to true where output data is valid |
Definition at line 24 of file time_interp_external2.inc.
subroutine time_interp_external_3d_ | ( | integer, intent(in) | index, |
type(time_type), intent(in) | time, | ||
real(fms_ti_kind_), dimension(:,:,:), intent(inout) | time_data, | ||
integer, intent(in), optional | interp, | ||
logical, intent(in), optional | verbose, | ||
type(horiz_interp_type), intent(in), optional | horz_interp, | ||
logical, dimension(:,:,:), intent(out), optional | mask_out, | ||
integer, intent(in), optional | is_in, | ||
integer, intent(in), optional | ie_in, | ||
integer, intent(in), optional | js_in, | ||
integer, intent(in), optional | je_in, | ||
integer, intent(in), optional | window_id | ||
) |
3D interpolation for time_interp_external Provide data from external file interpolated to current model time. Data may be local to current processor or global, depending on "init_external_field" flags.
[in] | index | index of external field from previous call to init_external_field |
[in] | time | target time for data |
[in,out] | time_data | global or local data array |
[in] | verbose | flag for debugging |
[out] | mask_out | set to true where output data is valid |
Definition at line 55 of file time_interp_external2.inc.
subroutine time_interp_external_bridge_0d_ | ( | integer, intent(in) | index1, |
integer, intent(in) | index2, | ||
type(time_type), intent(in) | time, | ||
real(fms_ti_kind_), intent(inout) | time_data, | ||
logical, intent(in), optional | verbose | ||
) |
[in] | index1 | index of first external field |
[in] | index2 | index of second external field |
[in] | time | target time for data |
[in,out] | time_data | global or local data array |
[in] | verbose | flag for debugging |
Definition at line 230 of file time_interp_external2_bridge.inc.
subroutine time_interp_external_bridge_2d_ | ( | integer, intent(in) | index1, |
integer, intent(in) | index2, | ||
type(time_type), intent(in) | time, | ||
real(fms_ti_kind_), dimension(:,:), intent(inout) | data_in, | ||
integer, intent(in), optional | interp, | ||
logical, intent(in), optional | verbose, | ||
type(horiz_interp_type), intent(in), optional | horz_interp, | ||
logical, dimension(:,:), intent(out), optional | mask_out, | ||
integer, intent(in), optional | is_in, | ||
integer, intent(in), optional | ie_in, | ||
integer, intent(in), optional | js_in, | ||
integer, intent(in), optional | je_in, | ||
integer, intent(in), optional | window_id | ||
) |
2D interpolation for time_interp_external_bridge
[in] | index1 | index of first external field |
[in] | index2 | index of second external field |
[in] | time | target time for data |
[in,out] | data_in | global or local data array |
[in] | interp | hardcoded to linear |
[in] | verbose | flag for debugging |
[in] | horz_interp | horizontal interpolation type |
[out] | mask_out | set to true where output data is valid |
[in] | je_in | horizontal indices for load_record |
[in] | window_id | harcoded to 1 in load_record |
Definition at line 24 of file time_interp_external2_bridge.inc.
subroutine time_interp_external_bridge_3d_ | ( | integer, intent(in) | index1, |
integer, intent(in) | index2, | ||
type(time_type), intent(in) | time, | ||
real(fms_ti_kind_), dimension(:,:,:), intent(inout) | time_data, | ||
integer, intent(in), optional | interp, | ||
logical, intent(in), optional | verbose, | ||
type(horiz_interp_type), intent(in), optional | horz_interp, | ||
logical, dimension(:,:,:), intent(out), optional | mask_out, | ||
integer, intent(in), optional | is_in, | ||
integer, intent(in), optional | ie_in, | ||
integer, intent(in), optional | js_in, | ||
integer, intent(in), optional | je_in, | ||
integer, intent(in), optional | window_id | ||
) |
3D interpolation for time_interp_external Provide data from external file interpolated to current model time. Data may be local to current processor or global, depending on "init_external_field" flags.
[in] | index1 | index of first external field |
[in] | index2 | index of second external field |
[in] | time | target time for data |
[in,out] | time_data | global or local data array |
[in] | interp | hardcoded to linear |
[in] | verbose | flag for debugging |
[in] | horz_interp | horizontal interpolation type |
[out] | mask_out | set to true where output data is valid |
[in] | ie_in | x horizontal indices for load_record |
[in] | je_in | y horizontal indices for load_record |
[in] | window_id | harcoded to 1 in load_record |
Definition at line 54 of file time_interp_external2_bridge.inc.