MOM_io_infra module reference
This module contains a thin inteface to mpp and fms I/O code
Data Types
Type for holding a handle to an open file and related information |
|
This type is a container for information about a variable in a file. |
|
This type is a container for information about an axis in a file. |
Generic Interfaces
Indicate whether a file exists, perhaps with domain decomposition |
|
Read a data field from a file |
|
Write a registered field to an output file |
|
Read a pair of data fields representing the two components of a vector from a file |
|
Write metadata about a variable or axis to a file and store it for later reuse |
|
Close a file (or fileset). If the file handle does not point to an open file, close_file simply returns without doing anything. |
Functions/Subroutines
Reads the checksum value for a field that was recorded in a file, along with a flag indicating whether the file contained a valid checksum for this field. |
|
Returns true if the named file or its domain-decomposed variant exists. |
|
Returns true if the named file or its domain-decomposed variant exists. |
|
indicates whether an I/O handle is attached to an open file |
|
closes a file (or fileset). If the file handle does not point to an open file, close_file_type simply returns without doing anything. |
|
closes a file. If the unit does not point to an open file, close_file_unit simply returns without doing anything. |
|
Ensure that the output stream associated with a file handle is fully sent to disk. |
|
Initialize the underlying I/O infrastructure |
|
Gracefully close out and terminate the underlying I/O infrastructure |
|
Open a single namelist file that is potentially readable by all PEs. |
|
Checks the iostat argument that is returned after reading a namelist variable and writes a message if there is an error. |
|
Write a file version number to the log file or other output file |
|
open_file opens a file for parallel or single-file I/O. |
|
open_file opens an ascii file for parallel or single-file I/O using Fortran read and write calls. |
|
Provide a string to append to filenames, to differentiate ensemble members, for example. |
|
Get information about the number of dimensions, variables and time levels in the file associated with an open file unit |
|
Get the times of records from a file |
|
Set up the field information (e.g., names and metadata) for all of the variables in a file. The argument fields must be allocated with a size that matches the number of variables in a file. |
|
Extract information from a field type, as stored or as found in a file |
|
Field_exists returns true if the field indicated by field_name is present in the file file_name. If file_name does not exist, it returns false. |
|
Given filename and fieldname, this subroutine returns the size of the field in the file |
|
Return the index of the first True element of a logical array. |
|
Get the axis size from an axistype |
|
Extracts and returns the axis data stored in an axistype. |
|
Return a new axistype based on axis specs |
|
This routine uses the fms_io subroutine read_data to read a scalar named "fieldname" from a single or domain-decomposed file "filename". |
|
This routine uses the fms_io subroutine read_data to read a 1-D data field named "fieldname" from a single or domain-decomposed file "filename". |
|
This routine uses the fms_io subroutine read_data to read a distributed 2-D data field named "fieldname" from file "filename". Valid values for "position" include CORNER, CENTER, EAST_FACE and NORTH_FACE. |
|
This routine uses the fms_io subroutine read_data to read a region from a distributed or global 2-D data field named "fieldname" from file "filename". |
|
This routine uses the fms_io subroutine read_data to read a distributed 3-D data field named "fieldname" from file "filename". Valid values for "position" include CORNER, CENTER, EAST_FACE and NORTH_FACE. |
|
This routine uses the fms_io subroutine read_data to read a region from a distributed or global 3-D data field named "fieldname" from file "filename". |
|
This routine uses the fms_io subroutine read_data to read a distributed 4-D data field named "fieldname" from file "filename". Valid values for "position" include CORNER, CENTER, EAST_FACE and NORTH_FACE. |
|
This routine uses the fms_io subroutine read_data to read a scalar integer data field named "fieldname" from file "filename". |
|
This routine uses the fms_io subroutine read_data to read a 1-D integer data field named "fieldname" from file "filename". |
|
This routine uses the fms_io subroutine read_data to read a pair of distributed 2-D data fields with names given by "[uv]_fieldname" from file "filename". Valid values for "stagger" include CGRID_NE, BGRID_NE, and AGRID. |
|
This routine uses the fms_io subroutine read_data to read a pair of distributed 3-D data fields with names given by "[uv]_fieldname" from file "filename". Valid values for "stagger" include CGRID_NE, BGRID_NE, and AGRID. |
|
Find the case-sensitive name of the variable in a netCDF file with a case-insensitive name match. Optionally also determine whether this variable has an unlimited time dimension. |
|
Find the case-insensitive name match with a variable in an open domain-decomposed file-set, prepare FMS2 to read this variable, and return some information needed to call fms2_read_data correctly for this variable and file. |
|
register axes associated with a variable from a domain-decomposed netCDF file |
|
Determine whether a variable's axes are associated with x-, y- or time-dimensions. Other unlimited dimensions are also labeled as time axes for these purposes. |
|
Determine whether an axis is associated with the x- or y-directions based on a comparison of its units with CF-compliant variants of latitude or longitude units. |
|
Tries to determine whether the axis name is commonly associated with an x- or y- axis. This approach is fragile and unreliable, but it a backup to reading a CARTESIAN file attribute. |
|
Write a 4d field to an output file. |
|
Write a 3d field to an output file. |
|
Write a 2d field to an output file. |
|
Write a 1d field to an output file. |
|
Write a 0d field to an output file. |
|
Returns the integer time index for a write in this file, also writing the time variable to the file if this time is later than what is already in the file. |
|
Write the data for an axis |
|
Store information about an axis in a previously defined axistype and write this information to the file indicated by unit. |
|
Store information about an output variable in a previously defined fieldtype and write this information to the file indicated by unit. |
|
Write a global text attribute to a file. |
|
Return unlimited dimension name in file, or empty string if none exists. |
|
Return a string in which all uppercase letters have been replaced by their lowercase counterparts. |
Type Documentation
- type :: file_type
Type for holding a handle to an open file and related information
- Parameters
unit
The framework identfier or netCDF unit number of an output file
fileobj
A domain-decomposed file object that is open for writing
filename
The path to this file, if it is open
open_to_read
If true, this file or fileset can be read
open_to_write
If true, this file or fileset can be written to
num_times
The number of time levels in this file
file_time
The time of the latest entry in the file.
- type :: fieldtype
This type is a container for information about a variable in a file.
- Parameters
name
The name of this field in the files.
longname
The long name for this field
units
The units for this field
chksum_read
A checksum that has been read from a file
valid_chksum
If true, this field has a valid checksum value.
- type :: axistype
This type is a container for information about an axis in a file.
- Parameters
name
The name of this axis in the files.
ax_data
The values of the data on the axis.
domain_decomposed
True if axis is domain-decomposed
Generic Interface Documentation
- interface file_exists
Indicate whether a file exists, perhaps with domain decomposition
Callers call graph
Text view
dome_tracer::initialize_dome_tracer → mom_io_infra::interface::file_exists
dyed_obc_tracer::initialize_dyed_obc_tracer → mom_io_infra::interface::file_exists
ideal_age_example::initialize_ideal_age_tracer → mom_io_infra::interface::file_exists
isomip_initialization::isomip_initialize_sponges → mom_io_infra::interface::file_exists
isomip_tracer::initialize_isomip_tracer → mom_io_infra::interface::file_exists
mom_cfc_cap::init_tracer_cfc → mom_io_infra::interface::file_exists
mom_coord_initialization::set_coord_from_file → mom_io_infra::interface::file_exists
mom_coord_initialization::set_coord_from_ts_profile → mom_io_infra::interface::file_exists
mom_domains::gen_auto_mask_table → mom_io_infra::interface::file_exists
mom_domains::mom_domains_init → mom_io_infra::interface::file_exists
mom_get_input::get_mom_input → mom_io_infra::interface::file_exists
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_io_infra::interface::file_exists
mom_hybgen_regrid::init_hybgen_regrid → mom_io_infra::interface::file_exists
mom_ice_shelf::initialize_ice_smb → mom_io_infra::interface::file_exists
mom_ice_shelf::initialize_shelf_mass → mom_io_infra::interface::file_exists
mom_ice_shelf_dynamics::initialize_ice_shelf_dyn → mom_io_infra::interface::file_exists
mom_ice_shelf_initialize::initialize_ice_aglen → mom_io_infra::interface::file_exists
mom_ice_shelf_initialize::initialize_ice_c_basal_friction → mom_io_infra::interface::file_exists
mom_ice_shelf_initialize::initialize_ice_flow_from_file → mom_io_infra::interface::file_exists
mom_ice_shelf_initialize::initialize_ice_shelf_boundary_from_file → mom_io_infra::interface::file_exists
mom_ice_shelf_initialize::initialize_ice_thickness_from_file → mom_io_infra::interface::file_exists
mom_internal_tides::internal_tides_init → mom_io_infra::interface::file_exists
mom_io_infra::field_exists → mom_io_infra::interface::file_exists
mom_io_infra::get_field_size → mom_io_infra::interface::file_exists
mom_io_infra::mom_namelist_file → mom_io_infra::interface::file_exists
mom_io_infra::open_file → mom_io_infra::interface::file_exists
mom_ocmip2_cfc::init_tracer_cfc → mom_io_infra::interface::file_exists
mom_open_boundary::allocate_segment_field_data → mom_io_infra::interface::file_exists
mom_regridding::initialize_regridding → mom_io_infra::interface::file_exists
mom_restart::open_restart_units → mom_io_infra::interface::file_exists
mom_shared_initialization::apply_topography_edits_from_file → mom_io_infra::interface::file_exists
mom_shared_initialization::initialize_topography_from_file → mom_io_infra::interface::file_exists
mom_shared_initialization::reset_face_lengths_file → mom_io_infra::interface::file_exists
mom_shared_initialization::reset_face_lengths_list → mom_io_infra::interface::file_exists
mom_shared_initialization::set_meansl_from_file → mom_io_infra::interface::file_exists
mom_shared_initialization::set_subgrid_topo_at_vel_from_file → mom_io_infra::interface::file_exists
mom_state_initialization::initialize_oda_incupd_file → mom_io_infra::interface::file_exists
mom_state_initialization::initialize_sponges_file → mom_io_infra::interface::file_exists
mom_state_initialization::initialize_temp_salt_from_file → mom_io_infra::interface::file_exists
mom_state_initialization::initialize_temp_salt_from_profile → mom_io_infra::interface::file_exists
mom_state_initialization::initialize_thickness_from_file → mom_io_infra::interface::file_exists
mom_state_initialization::initialize_velocity_from_file → mom_io_infra::interface::file_exists
mom_sum_output::depth_list_setup → mom_io_infra::interface::file_exists
mom_tidal_forcing::find_in_files → mom_io_infra::interface::file_exists
mom_wave_interface::surface_bands_by_data_override → mom_io_infra::interface::file_exists
oil_tracer::initialize_oil_tracer → mom_io_infra::interface::file_exists
rgc_initialization::rgc_initialize_sponges → mom_io_infra::interface::file_exists
rgc_tracer::initialize_rgc_tracer → mom_io_infra::interface::file_exists
user_tracer_example::user_initialize_tracer → mom_io_infra::interface::file_exists
- interface read_field
Read a data field from a file
Callers call graph
Text view
mom_domains::gen_auto_mask_table → mom_io_infra::interface::read_field
mom_io::mom_read_data_0d → mom_io_infra::interface::read_field
mom_io::mom_read_data_0d_int → mom_io_infra::interface::read_field
mom_io::mom_read_data_1d → mom_io_infra::interface::read_field
mom_io::mom_read_data_1d_int → mom_io_infra::interface::read_field
mom_io::mom_read_data_2d → mom_io_infra::interface::read_field
mom_io::mom_read_data_2d_region → mom_io_infra::interface::read_field
mom_io::mom_read_data_3d → mom_io_infra::interface::read_field
mom_io::mom_read_data_3d_region → mom_io_infra::interface::read_field
mom_io::mom_read_data_4d → mom_io_infra::interface::read_field
- interface write_field
Write a registered field to an output file
Callers call graph
Text view
mom_io::mom_write_field_legacy_0d → mom_io_infra::interface::write_field
mom_io::mom_write_field_legacy_1d → mom_io_infra::interface::write_field
mom_io::mom_write_field_legacy_2d → mom_io_infra::interface::write_field
mom_io::mom_write_field_legacy_3d → mom_io_infra::interface::write_field
mom_io::mom_write_field_legacy_4d → mom_io_infra::interface::write_field
mom_io_file::write_field_0d_infra → mom_io_infra::interface::write_field
mom_io_file::write_field_1d_infra → mom_io_infra::interface::write_field
mom_io_file::write_field_2d_infra → mom_io_infra::interface::write_field
mom_io_file::write_field_3d_infra → mom_io_infra::interface::write_field
mom_io_file::write_field_4d_infra → mom_io_infra::interface::write_field
mom_io_file::write_field_axis_infra → mom_io_infra::interface::write_field
- interface read_vector
Read a pair of data fields representing the two components of a vector from a file
Callers call graph
- interface write_metadata
Write metadata about a variable or axis to a file and store it for later reuse
- interface close_file
Close a file (or fileset). If the file handle does not point to an open file, close_file simply returns without doing anything.
Callers call graph
Text view
External::mom6::write_ocean_solo_res → mom_io_infra::interface::close_file
External::mom6::write_time_stamp_file → mom_io_infra::interface::close_file
mom_domains::write_auto_mask_file → mom_io_infra::interface::close_file
mom_get_input::get_mom_input → mom_io_infra::interface::close_file
mom_ice_shelf_dynamics::ice_shelf_dyn_end → mom_io_infra::interface::close_file
mom_io_file::close_file_infra → mom_io_infra::interface::close_file
mom_sum_output::mom_sum_output_end → mom_io_infra::interface::close_file
mom_write_cputime::mom_write_cputime_end → mom_io_infra::interface::close_file
Functions/Subroutine Documentation
- subroutine read_field_chksum(field, chksum, valid_chksum)
Reads the checksum value for a field that was recorded in a file, along with a flag indicating whether the file contained a valid checksum for this field.
- Parameters
field [in]
The field whose checksum attribute is to be read.
chksum [out]
The checksum for the field.
valid_chksum [out]
If true, chksum has been successfully read.
- logical function MOM_file_exists(filename, MOM_Domain)
Returns true if the named file or its domain-decomposed variant exists.
- Parameters
filename [in]
The name of the file being inquired about
MOM_Domain [in]
The MOM_Domain that describes the decomposition
External calls
- fms2_io_mod
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
- logical function FMS_file_exists(filename)
Returns true if the named file or its domain-decomposed variant exists.
- Parameters
filename [in]
The name of the file being inquired about
External calls
- fms_io_utils_mod
fms2_file_exist (fms_io_utils_mod::file_exists)
- logical function file_is_open(IO_handle)
indicates whether an I/O handle is attached to an open file
- Parameters
IO_handle [in]
Handle to a file to inquire about
- subroutine close_file_type(IO_handle)
closes a file (or fileset). If the file handle does not point to an open file, close_file_type simply returns without doing anything.
- Parameters
IO_handle [inout]
The I/O handle for the file to be closed
External calls
- fms2_io_mod
fms2_close_file (fms2_io_mod::close_file)
- subroutine close_file_unit(iounit)
closes a file. If the unit does not point to an open file, close_file_unit simply returns without doing anything.
- Parameters
iounit [inout]
The I/O unit for the file to be closed
- subroutine flush_file(IO_handle)
Ensure that the output stream associated with a file handle is fully sent to disk.
- Parameters
IO_handle [in]
The I/O handle for the file to flush
External calls
- fms2_io_mod
fms2_flush_file (fms2_io_mod::flush_file)
- subroutine io_infra_init(maxunits)
Initialize the underlying I/O infrastructure
- Parameters
maxunits [in]
An optional maximum number of file unit numbers that can be used.
- subroutine io_infra_end()
Gracefully close out and terminate the underlying I/O infrastructure
- function MOM_namelist_file(filepath) result(iounit)
Open a single namelist file that is potentially readable by all PEs.
- Parameters
filepath [in]
The file to open, by default "input.nml".
iounit
The opened unit number of the namelist file
Callees call graph
External calls
- mpp_mod
mpp_get_current_pelist_name (mpp_mod::mpp_get_current_pelist_name)
- subroutine check_namelist_error(IOstat, nml_name)
Checks the iostat argument that is returned after reading a namelist variable and writes a message if there is an error.
- Parameters
IOstat [in]
An I/O status field from a namelist read call
nml_name [in]
The name of the namelist
External calls
- fms_mod
check_nml_error (fms_mod::check_nml_error)
- subroutine write_version(version, tag, unit)
Write a file version number to the log file or other output file
- Parameters
version [in]
A string that contains the routine name and version
tag [in]
A tag name to add to the message
unit [in]
An alternate unit number for output
External calls
- fms_mod
write_version_number (fms_mod::write_version_number)
- subroutine open_file(IO_handle, filename, action, MOM_domain, threading, fileset)
open_file opens a file for parallel or single-file I/O.
- Parameters
IO_handle [inout]
The handle for the opened file
filename [in]
The path name of the file being opened
action [in]
A flag indicating whether the file can be read or written to and how to handle existing files. The default is WRITE_ONLY.
MOM_Domain [in]
A MOM_Domain that describes the decomposition
threading [in]
A flag indicating whether one (SINGLE_FILE) or multiple PEs (MULTIPLE) participate in I/O. With the default, the root PE does I/O.
fileset [in]
A flag indicating whether multiple PEs doing I/O due to threading=MULTIPLE write to the same file (SINGLE_FILE) or to one file per PE (MULTIPLE, the default).
Callees call graph
External calls
- fms2_io_mod
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
fms2_read_data (fms2_io_mod::read_data)
get_dimension_size (fms2_io_mod::get_dimension_size)
- subroutine open_ASCII_file(unit, file, action, threading, fileset)
open_file opens an ascii file for parallel or single-file I/O using Fortran read and write calls.
- Parameters
unit [out]
The I/O unit for the opened file
file [in]
The name of the file being opened
action [in]
A flag indicating whether the file can be read or written to and how to handle existing files.
threading [in]
A flag indicating whether one (SINGLE_FILE) or multiple PEs (MULTIPLE) participate in I/O. With the default, the root PE does I/O.
fileset [in]
A flag indicating whether multiple PEs doing I/O due to threading=MULTIPLE write to the same file (SINGLE_FILE) or to one file per PE (MULTIPLE, the default).
Callers call graph
Text view
External::mom6::write_ocean_solo_res → mom_io_infra::open_ascii_file
External::mom6::write_time_stamp_file → mom_io_infra::open_ascii_file
mom_domains::write_auto_mask_file → mom_io_infra::open_ascii_file
mom_ice_shelf_dynamics::write_ice_shelf_energy → mom_io_infra::open_ascii_file
mom_io_infra::mom_namelist_file → mom_io_infra::open_ascii_file
mom_pointaccel::write_u_accel → mom_io_infra::open_ascii_file
mom_pointaccel::write_v_accel → mom_io_infra::open_ascii_file
mom_sum_output::write_energy → mom_io_infra::open_ascii_file
mom_write_cputime::write_cputime → mom_io_infra::open_ascii_file
External calls
- mpp_mod
mpp_npes (mpp_mod::mpp_npes)
mpp_pe (mpp_mod::mpp_pe)
mpp_root_pe (mpp_mod::mpp_root_pe)
- subroutine get_filename_suffix(suffix)
Provide a string to append to filenames, to differentiate ensemble members, for example.
- Parameters
suffix [out]
A string to append to filenames
External calls
- fms_io_utils_mod
get_filename_appendix (fms_io_utils_mod::get_filename_appendix)
- subroutine get_file_info(IO_handle, ndim, nvar, ntime)
Get information about the number of dimensions, variables and time levels in the file associated with an open file unit
- Parameters
IO_handle [in]
Handle for a file that is open for I/O
ndim [out]
The number of dimensions in the file
nvar [out]
The number of variables in the file
ntime [out]
The number of time levels in the file
Callees call graph
Callers call graph
External calls
- fms2_io_mod
get_dimension_size (fms2_io_mod::get_dimension_size)
get_num_dimensions (fms2_io_mod::get_num_dimensions)
get_num_variables (fms2_io_mod::get_num_variables)
- subroutine get_file_times(IO_handle, time_values, ntime)
Get the times of records from a file
- Parameters
IO_handle [in]
Handle for a file that is open for I/O
time_values [inout]
The real times for the records in file.
ntime [out]
The number of time levels in the file
Callees call graph
External calls
- fms2_io_mod
fms2_read_data (fms2_io_mod::read_data)
- subroutine get_file_fields(IO_handle, fields)
Set up the field information (e.g., names and metadata) for all of the variables in a file. The argument fields must be allocated with a size that matches the number of variables in a file.
- Parameters
IO_handle [in]
Handle for a file that is open for I/O
fields [inout]
Field-type descriptions of all of the variables in a file.
Callers call graph
External calls
- fms2_io_mod
get_variable_attribute (fms2_io_mod::get_variable_attribute)
get_variable_names (fms2_io_mod::get_variable_names)
variable_att_exists (fms2_io_mod::variable_att_exists)
- subroutine get_field_atts(field, name, units, longname, checksum)
Extract information from a field type, as stored or as found in a file
- Parameters
field [in]
The field to extract information from
name [out]
The variable name
units [out]
The units of the variable
longname [out]
The long name of the variable
checksum [out]
The checksums of the variable in a file
Callers call graph
- function field_exists(filename, field_name, domain, no_domain, MOM_domain)
Field_exists returns true if the field indicated by field_name is present in the file file_name. If file_name does not exist, it returns false.
- Parameters
filename [in]
The name of the file being inquired about
field_name [in]
The name of the field being sought
domain [in]
A domain2d type that describes the decomposition
no_domain [in]
This file does not use domain decomposition
MOM_Domain [in]
A MOM_Domain that describes the decomposition
field_exists
True if filename exists and field_name is in filename
Callees call graph
Callers call graph
External calls
- fms2_io_mod
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
variable_exists (fms2_io_mod::variable_exists)
- subroutine get_field_size(filename, fieldname, sizes, field_found, no_domain)
Given filename and fieldname, this subroutine returns the size of the field in the file
- Parameters
filename [in]
The name of the file to read
fieldname [in]
The name of the variable whose sizes are returned
sizes [inout]
The sizes of the variable in each dimension
field_found [out]
This indicates whether the field was found in the input file. Without this argument, there is a fatal error if the field is not found.
no_domain [in]
If present and true, do not check for file names with an appended tile number
Callees call graph
External calls
- fms2_io_mod
fms2_open_file (fms2_io_mod::open_file)
get_variable_dimension_names (fms2_io_mod::get_variable_dimension_names)
get_variable_num_dimensions (fms2_io_mod::get_variable_num_dimensions)
get_variable_size (fms2_io_mod::get_variable_size)
variable_exists (fms2_io_mod::variable_exists)
- function find_index(vec) result(loc)
Return the index of the first True element of a logical array.
If all elements are false, return zero.
- function get_axis_size(axis) result(axis_size)
Get the axis size from an axistype
- Parameters
axis [in]
Infra axis
axis_size
Axis size
- subroutine get_axis_data(axis, axis_name, axis_data)
Extracts and returns the axis data stored in an axistype.
- Parameters
axis [in]
Infra axis
axis_name [out]
Axis name
axis_data [out]
Axis points
- subroutine set_axis_data(axis, axis_name, axis_data)
Return a new axistype based on axis specs
- Parameters
axis [inout]
Target axis
axis_name [in]
Target axis name
axis_data [in]
Target axis values
- subroutine read_field_0d(filename, fieldname, data, timelevel, scale, MOM_Domain, global_file, file_may_be_4d)
This routine uses the fms_io subroutine read_data to read a scalar named "fieldname" from a single or domain-decomposed file "filename".
- Parameters
filename [in]
The name of the file to read
fieldname [in]
The variable name of the data in the file
data [inout]
The 1-dimensional array into which the data
timelevel [in]
The time level in the file to read
scale [in]
A scaling factor that the field is multiplied by before it is returned.
MOM_Domain [in]
The MOM_Domain that describes the decomposition
global_file [in]
If true, read from a single global file
file_may_be_4d [in]
If true, this file may have 4-d arrays, but with the FMS2 I/O interfaces this does not matter.
Callees call graph
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
fms2_read_data (fms2_io_mod::read_data)
- subroutine read_field_1d(filename, fieldname, data, timelevel, scale, MOM_Domain, global_file, file_may_be_4d)
This routine uses the fms_io subroutine read_data to read a 1-D data field named "fieldname" from a single or domain-decomposed file "filename".
- Parameters
filename [in]
The name of the file to read
fieldname [in]
The variable name of the data in the file
data [inout]
The 1-dimensional array into which the data
timelevel [in]
The time level in the file to read
scale [in]
A scaling factor that the field is multiplied by before they are returned.
MOM_Domain [in]
The MOM_Domain that describes the decomposition
global_file [in]
If true, read from a single global file
file_may_be_4d [in]
If true, this file may have 4-d arrays, but with the FMS2 I/O interfaces this does not matter.
Callees call graph
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
fms2_read_data (fms2_io_mod::read_data)
- subroutine read_field_2d(filename, fieldname, data, MOM_Domain, timelevel, position, scale, global_file, file_may_be_4d)
This routine uses the fms_io subroutine read_data to read a distributed 2-D data field named "fieldname" from file "filename". Valid values for "position" include CORNER, CENTER, EAST_FACE and NORTH_FACE.
- Parameters
filename [in]
The name of the file to read
fieldname [in]
The variable name of the data in the file
data [inout]
The 2-dimensional array into which the data should be read
MOM_Domain [in]
The MOM_Domain that describes the decomposition
timelevel [in]
The time level in the file to read
position [in]
A flag indicating where this data is located
scale [in]
A scaling factor that the field is multiplied by before it is returned.
global_file [in]
If true, read from a single global file
file_may_be_4d [in]
If true, this file may have 4-d arrays, but with the FMS2 I/O interfaces this does not matter.
Callees call graph
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
fms2_read_data (fms2_io_mod::read_data)
- subroutine read_field_2d_region(filename, fieldname, data, start, nread, MOM_domain, no_domain, scale)
This routine uses the fms_io subroutine read_data to read a region from a distributed or global 2-D data field named "fieldname" from file "filename".
- Parameters
filename [in]
The name of the file to read
fieldname [in]
The variable name of the data in the file
data [inout]
The 2-dimensional array into which the data should be read
start [in]
The starting index to read in each of 4 dimensions. For this 2-d read, the 3rd and 4th values are always 1.
nread [in]
The number of points to read in each of 4 dimensions. For this 2-d read, the 3rd and 4th values are always 1.
MOM_Domain [in]
The MOM_Domain that describes the decomposition
no_domain [in]
If present and true, this variable does not use domain decomposion.
scale [in]
A scaling factor that the field is multiplied by before it is returned.
Callees call graph
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
fms2_read_data (fms2_io_mod::read_data)
- subroutine read_field_3d(filename, fieldname, data, MOM_Domain, timelevel, position, scale, global_file, file_may_be_4d)
This routine uses the fms_io subroutine read_data to read a distributed 3-D data field named "fieldname" from file "filename". Valid values for "position" include CORNER, CENTER, EAST_FACE and NORTH_FACE.
- Parameters
filename [in]
The name of the file to read
fieldname [in]
The variable name of the data in the file
data [inout]
The 3-dimensional array into which the data should be read
MOM_Domain [in]
The MOM_Domain that describes the decomposition
timelevel [in]
The time level in the file to read
position [in]
A flag indicating where this data is located
scale [in]
A scaling factor that the field is multiplied by before it is returned.
global_file [in]
If true, read from a single global file
file_may_be_4d [in]
If true, this file may have 4-d arrays, but with the FMS2 I/O interfaces this does not matter.
Callees call graph
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
fms2_read_data (fms2_io_mod::read_data)
- subroutine read_field_3d_region(filename, fieldname, data, start, nread, MOM_domain, no_domain, scale)
This routine uses the fms_io subroutine read_data to read a region from a distributed or global 3-D data field named "fieldname" from file "filename".
- Parameters
filename [in]
The name of the file to read
fieldname [in]
The variable name of the data in the file
data [inout]
The 3-dimensional array into which the data should be read
start [in]
The starting index to read in each of 3 dimensions. For this 3-d read, the 4th value is always 1.
nread [in]
The number of points to read in each of 4 dimensions. For this 3-d read, the 4th values are always 1.
MOM_Domain [in]
The MOM_Domain that describes the decomposition
no_domain [in]
If present and true, this variable does not use domain decomposion.
scale [in]
A scaling factor that the field is multiplied by before it is returned.
Callees call graph
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
fms2_read_data (fms2_io_mod::read_data)
- subroutine read_field_4d(filename, fieldname, data, MOM_Domain, timelevel, position, scale, global_file)
This routine uses the fms_io subroutine read_data to read a distributed 4-D data field named "fieldname" from file "filename". Valid values for "position" include CORNER, CENTER, EAST_FACE and NORTH_FACE.
- Parameters
filename [in]
The name of the file to read
fieldname [in]
The variable name of the data in the file
data [inout]
The 4-dimensional array into which the data should be read
MOM_Domain [in]
The MOM_Domain that describes the decomposition
timelevel [in]
The time level in the file to read
position [in]
A flag indicating where this data is located
scale [in]
A scaling factor that the field is multiplied by before it is returned.
global_file [in]
If true, read from a single global file
Callees call graph
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
fms2_read_data (fms2_io_mod::read_data)
- subroutine read_field_0d_int(filename, fieldname, data, timelevel)
This routine uses the fms_io subroutine read_data to read a scalar integer data field named "fieldname" from file "filename".
- Parameters
filename [in]
The name of the file to read
fieldname [in]
The variable name of the data in the file
data [inout]
The 1-dimensional array into which the data
timelevel [in]
The time level in the file to read
Callees call graph
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
fms2_read_data (fms2_io_mod::read_data)
- subroutine read_field_1d_int(filename, fieldname, data, timelevel)
This routine uses the fms_io subroutine read_data to read a 1-D integer data field named "fieldname" from file "filename".
- Parameters
filename [in]
The name of the file to read
fieldname [in]
The variable name of the data in the file
data [inout]
The 1-dimensional array into which the data
timelevel [in]
The time level in the file to read
Callees call graph
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
fms2_read_data (fms2_io_mod::read_data)
- subroutine read_vector_2d(filename, u_fieldname, v_fieldname, u_data, v_data, MOM_Domain, timelevel, stagger, scalar_pair, scale)
This routine uses the fms_io subroutine read_data to read a pair of distributed 2-D data fields with names given by "[uv]_fieldname" from file "filename". Valid values for "stagger" include CGRID_NE, BGRID_NE, and AGRID.
- Parameters
filename [in]
The name of the file to read
u_fieldname [in]
The variable name of the u data in the file
v_fieldname [in]
The variable name of the v data in the file
u_data [inout]
The 2 dimensional array into which the u-component of the data should be read
v_data [inout]
The 2 dimensional array into which the v-component of the data should be read
MOM_Domain [in]
The MOM_Domain that describes the decomposition
timelevel [in]
The time level in the file to read
stagger [in]
A flag indicating where this vector is discretized
scalar_pair [in]
If true, a pair of scalars are to be read
scale [in]
A scaling factor that the fields are multiplied by before they are returned.
Callees call graph
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
fms2_read_data (fms2_io_mod::read_data)
- subroutine read_vector_3d(filename, u_fieldname, v_fieldname, u_data, v_data, MOM_Domain, timelevel, stagger, scalar_pair, scale)
This routine uses the fms_io subroutine read_data to read a pair of distributed 3-D data fields with names given by "[uv]_fieldname" from file "filename". Valid values for "stagger" include CGRID_NE, BGRID_NE, and AGRID.
- Parameters
filename [in]
The name of the file to read
u_fieldname [in]
The variable name of the u data in the file
v_fieldname [in]
The variable name of the v data in the file
u_data [inout]
The 3 dimensional array into which the u-component of the data should be read
v_data [inout]
The 3 dimensional array into which the v-component of the data should be read
MOM_Domain [in]
The MOM_Domain that describes the decomposition
timelevel [in]
The time level in the file to read
stagger [in]
A flag indicating where this vector is discretized
scalar_pair [in]
If true, a pair of scalars are to be read.
scale [in]
A scaling factor that the fields are multiplied by before they are returned.
Callees call graph
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
fms2_close_file (fms2_io_mod::close_file)
fms2_open_file (fms2_io_mod::open_file)
fms2_read_data (fms2_io_mod::read_data)
- subroutine find_varname_in_file(fileobj, fieldname, err_header, filename, var_to_read, has_time_dim, timelevel)
Find the case-sensitive name of the variable in a netCDF file with a case-insensitive name match. Optionally also determine whether this variable has an unlimited time dimension.
- Parameters
fileobj [inout]
An FMS2 handle to an open NetCDF file
fieldname [in]
The variable name to seek in the file
err_header [in]
A descriptive prefix for error messages
filename [in]
The name of the file to read
var_to_read [out]
The variable name to read from the file
has_time_dim [out]
Indicates whether fieldname has a time dimension
timelevel [in]
A time level to read
Callees call graph
Callers call graph
Text view
mom_io_infra::read_field_0d → mom_io_infra::find_varname_in_file
mom_io_infra::read_field_0d_int → mom_io_infra::find_varname_in_file
mom_io_infra::read_field_1d → mom_io_infra::find_varname_in_file
mom_io_infra::read_field_1d_int → mom_io_infra::find_varname_in_file
mom_io_infra::read_field_2d_region → mom_io_infra::find_varname_in_file
mom_io_infra::read_field_3d_region → mom_io_infra::find_varname_in_file
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
get_dimension_size (fms2_io_mod::get_dimension_size)
get_num_variables (fms2_io_mod::get_num_variables)
get_variable_dimension_names (fms2_io_mod::get_variable_dimension_names)
get_variable_names (fms2_io_mod::get_variable_names)
get_variable_num_dimensions (fms2_io_mod::get_variable_num_dimensions)
is_dimension_unlimited (fms2_io_mod::is_dimension_unlimited)
variable_exists (fms2_io_mod::variable_exists)
- subroutine prepare_to_read_var(fileobj, fieldname, err_header, filename, var_to_read, has_time_dim, timelevel, position)
Find the case-insensitive name match with a variable in an open domain-decomposed file-set, prepare FMS2 to read this variable, and return some information needed to call fms2_read_data correctly for this variable and file.
- Parameters
fileobj [inout]
An FMS2 handle to an open domain-decomposed file
fieldname [in]
The variable name to seek in the file
err_header [in]
A descriptive prefix for error messages
filename [in]
The name of the file to read
var_to_read [out]
The variable name to read from the file
has_time_dim [out]
Indicates whether fieldname has a time dimension
timelevel [in]
A time level to read
position [in]
A flag indicating where this variable is discretized
Callees call graph
Callers call graph
Text view
mom_io_infra::read_field_0d → mom_io_infra::prepare_to_read_var
mom_io_infra::read_field_1d → mom_io_infra::prepare_to_read_var
mom_io_infra::read_field_2d → mom_io_infra::prepare_to_read_var
mom_io_infra::read_field_2d_region → mom_io_infra::prepare_to_read_var
mom_io_infra::read_field_3d → mom_io_infra::prepare_to_read_var
mom_io_infra::read_field_3d_region → mom_io_infra::prepare_to_read_var
mom_io_infra::read_field_4d → mom_io_infra::prepare_to_read_var
mom_io_infra::read_vector_2d → mom_io_infra::prepare_to_read_var
mom_io_infra::read_vector_3d → mom_io_infra::prepare_to_read_var
External calls
- fms2_io_mod
check_if_open (fms2_io_mod::check_if_open)
get_dimension_size (fms2_io_mod::get_dimension_size)
get_num_variables (fms2_io_mod::get_num_variables)
get_variable_dimension_names (fms2_io_mod::get_variable_dimension_names)
get_variable_names (fms2_io_mod::get_variable_names)
get_variable_num_dimensions (fms2_io_mod::get_variable_num_dimensions)
is_dimension_unlimited (fms2_io_mod::is_dimension_unlimited)
variable_exists (fms2_io_mod::variable_exists)
- subroutine MOM_register_variable_axes(fileObj, variableName, filename, position)
register axes associated with a variable from a domain-decomposed netCDF file
- Parameters
fileObj [inout]
Handle to an open FMS2 netCDF file object
variableName [in]
name of the variable
filename [in]
The name of the file to read
position [in]
A flag indicating where this data is discretized
Callees call graph
Callers call graph
External calls
- fms2_io_mod
get_variable_dimension_names (fms2_io_mod::get_variable_dimension_names)
get_variable_num_dimensions (fms2_io_mod::get_variable_num_dimensions)
get_variable_size (fms2_io_mod::get_variable_size)
is_dimension_registered (fms2_io_mod::is_dimension_registered)
register_axis (fms2_io_mod::register_axis)
- subroutine categorize_axes(fileObj, filename, ndims, dim_names, is_x, is_y, is_t)
Determine whether a variable's axes are associated with x-, y- or time-dimensions. Other unlimited dimensions are also labeled as time axes for these purposes.
- Parameters
fileObj [in]
Handle to an open FMS2 netCDF file object
filename [in]
The name of the file to read
ndims [in]
The number of dimensions associated with a variable
dim_names [in]
Names of the dimensions associated with a variable
is_x [out]
Indicates if each dimension a (likely decomposed) x-axis
is_y [out]
Indicates if each dimension a (likely decomposed) y-axis
is_t [out]
Indicates if each dimension unlimited (usually time) axis
Callees call graph
Callers call graph
External calls
- fms2_io_mod
get_variable_attribute (fms2_io_mod::get_variable_attribute)
get_variable_units (fms2_io_mod::get_variable_units)
is_dimension_unlimited (fms2_io_mod::is_dimension_unlimited)
variable_att_exists (fms2_io_mod::variable_att_exists)
variable_exists (fms2_io_mod::variable_exists)
- subroutine categorize_axis_from_units(unit_string, is_x, is_y)
Determine whether an axis is associated with the x- or y-directions based on a comparison of its units with CF-compliant variants of latitude or longitude units.
- Parameters
unit_string [in]
string of units
is_x [out]
Indicates if the axis units are associated with an x-direction axis
is_y [out]
Indicates if the axis units are associated with an y-direction axis
Callers call graph
- subroutine categorize_axis_from_name(dimname, is_x, is_y)
Tries to determine whether the axis name is commonly associated with an x- or y- axis. This approach is fragile and unreliable, but it a backup to reading a CARTESIAN file attribute.
- Parameters
dimname [in]
A dimension name
is_x [out]
Indicates if the axis name is associated with an x-direction axis
is_y [out]
Indicates if the axis name is associated with an y-direction axis
Callers call graph
- subroutine write_field_4d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, fill_value)
Write a 4d field to an output file.
- Parameters
IO_handle [inout]
Handle for a file that is open for writing
field_md [in]
Field type with metadata
MOM_domain [in]
The MOM_Domain that describes the decomposition
field [inout]
Field to write
tstamp [in]
Model time of this field
tile_count [in]
PEs per tile (default: 1)
fill_value [in]
Missing data fill value
External calls
- fms2_io_mod
write_data (fms2_io_mod::write_data)
- subroutine write_field_3d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, fill_value)
Write a 3d field to an output file.
- Parameters
IO_handle [inout]
Handle for a file that is open for writing
field_md [in]
Field type with metadata
MOM_domain [in]
The MOM_Domain that describes the decomposition
field [inout]
Field to write
tstamp [in]
Model time of this field
tile_count [in]
PEs per tile (default: 1)
fill_value [in]
Missing data fill value
External calls
- fms2_io_mod
write_data (fms2_io_mod::write_data)
- subroutine write_field_2d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, fill_value)
Write a 2d field to an output file.
- Parameters
IO_handle [inout]
Handle for a file that is open for writing
field_md [in]
Field type with metadata
MOM_domain [in]
The MOM_Domain that describes the decomposition
field [inout]
Field to write
tstamp [in]
Model time of this field
tile_count [in]
PEs per tile (default: 1)
fill_value [in]
Missing data fill value
External calls
- fms2_io_mod
write_data (fms2_io_mod::write_data)
- subroutine write_field_1d(IO_handle, field_md, field, tstamp)
Write a 1d field to an output file.
- Parameters
IO_handle [inout]
Handle for a file that is open for writing
field_md [in]
Field type with metadata
field [in]
Field to write
tstamp [in]
Model time of this field
External calls
- fms2_io_mod
write_data (fms2_io_mod::write_data)
- subroutine write_field_0d(IO_handle, field_md, field, tstamp)
Write a 0d field to an output file.
- Parameters
IO_handle [inout]
Handle for a file that is open for writing
field_md [in]
Field type with metadata
field [in]
Field to write
tstamp [in]
Model time of this field
External calls
- fms2_io_mod
write_data (fms2_io_mod::write_data)
- integer function write_time_if_later(IO_handle, field_time)
Returns the integer time index for a write in this file, also writing the time variable to the file if this time is later than what is already in the file.
- Parameters
IO_handle [inout]
Handle for a file that is open for writing
field_time [in]
Model time of this field
Callees call graph
Callers call graph
Text view
mom_io_infra::write_field_0d → mom_io_infra::write_time_if_later
mom_io_infra::write_field_1d → mom_io_infra::write_time_if_later
mom_io_infra::write_field_2d → mom_io_infra::write_time_if_later
mom_io_infra::write_field_3d → mom_io_infra::write_time_if_later
mom_io_infra::write_field_4d → mom_io_infra::write_time_if_later
External calls
- fms2_io_mod
write_data (fms2_io_mod::write_data)
- subroutine MOM_write_axis(IO_handle, axis)
Write the data for an axis
- Parameters
IO_handle [in]
Handle for a file that is open for writing
axis [in]
An axis type variable with information to write
External calls
- fms2_io_mod
get_global_io_domain_indices (fms2_io_mod::get_global_io_domain_indices)
write_data (fms2_io_mod::write_data)
- subroutine write_metadata_axis(IO_handle, axis, name, units, longname, cartesian, sense, domain, data, edge_axis, calendar)
Store information about an axis in a previously defined axistype and write this information to the file indicated by unit.
- Parameters
IO_handle [in]
Handle for a file that is open for writing
axis [inout]
The axistype where this information is stored.
name [in]
The name in the file of this axis
units [in]
The units of this axis
longname [in]
The long description of this axis
cartesian [in]
A variable indicating which direction this axis corresponds with. Valid values include 'X', 'Y', 'Z', 'T', and 'N' for none.
sense [in]
This is 1 for axes whose values increase upward, or -1 if they increase downward.
domain [in]
The domain decomposion for this axis
data [in]
The coordinate values of the points on this axis
edge_axis [in]
If true, this axis marks an edge of the tracer cells
calendar [in]
The name of the calendar used with a time axis
External calls
- fms2_io_mod
is_dimension_registered (fms2_io_mod::is_dimension_registered)
register_axis (fms2_io_mod::register_axis)
register_field (fms2_io_mod::register_field)
register_variable_attribute (fms2_io_mod::register_variable_attribute)
- subroutine write_metadata_field(IO_handle, field, axes, name, units, longname, pack, standard_name, checksum)
Store information about an output variable in a previously defined fieldtype and write this information to the file indicated by unit.
- Parameters
IO_handle [in]
Handle for a file that is open for writing
field [inout]
The fieldtype where this information is stored
axes [in]
Handles for the axis used for this variable
name [in]
The name in the file of this variable
units [in]
The units of this variable
longname [in]
The long description of this variable
pack [in]
A precision reduction factor with which the variable. The default, 1, has no reduction, but 2 is not uncommon.
standard_name [in]
The standard (e.g., CMOR) name for this variable
checksum [in]
Checksum values that can be used to verify reads.
External calls
- fms2_io_mod
register_field (fms2_io_mod::register_field)
register_variable_attribute (fms2_io_mod::register_variable_attribute)
- subroutine write_metadata_global(IO_handle, name, attribute)
Write a global text attribute to a file.
- Parameters
IO_handle [in]
Handle for a file that is open for writing
name [in]
The name in the file of this global attribute
attribute [in]
The value of this attribute
External calls
- fms2_io_mod
register_global_attribute (fms2_io_mod::register_global_attribute)
- function find_unlimited_dimension_name(fileobj) result(label)
Return unlimited dimension name in file, or empty string if none exists.
- Parameters
fileobj [in]
File handle
label
Unlimited dimension name, or empty string if none exists
ndims
Number of dimensions
dim_names
File handle dimension names
i
Loop index
Callers call graph
Text view
External calls
- fms2_io_mod
get_dimension_names (fms2_io_mod::get_dimension_names)
get_num_dimensions (fms2_io_mod::get_num_dimensions)
is_dimension_unlimited (fms2_io_mod::is_dimension_unlimited)
- function lowercase(input_string)
Return a string in which all uppercase letters have been replaced by their lowercase counterparts.
- Parameters
input_string [in]
The string to modify
lowercase
The modified output string