MOM_io module reference
This module contains I/O framework code
Data Types
Type that stores information that can be used to create a non-decomposed axis. |
|
Type for describing a 3-d variable for output |
|
Type that stores for a global file attribute |
Generic Interfaces
Read a field from file using the infrastructure I/O. |
|
Read a vector from file using the infrastructure I/O. |
|
Read a field using native netCDF I/O |
|
Write a registered field to an output file, potentially with rotation |
|
Read an entire named variable from a named netCDF file using netCDF calls directly, rather than any infrastructure routines and broadcast it from the root PE to the other PEs. |
|
Read a global or variable attribute from a named netCDF file using netCDF calls directly, in some cases reading from the root PE before broadcasting to the other PEs. |
Functions/Subroutines
create_MOM_file wrapper for the legacy file handle, file_type. NOTE: This function may be removed in a future release. |
|
Create a new netCDF file and register the MOM_fields to be written. |
|
reopen_MOM_file wrapper for the legacy file handle, file_type. NOTE: This function may be removed in a future release. |
|
This routine opens an existing NetCDF file for output. If it does not find the file, a new file is created. It also sets up structures that describe this file and the variables that will later be written to this file. |
|
Return the index of sdtout if called from the root PE, or 0 for other PEs. |
|
This function determines how many time levels a variable has in a file. |
|
get_var_sizes returns the number and size of dimensions associate with a variable in a file. Usually only the root PE does the read, and then the information is broadcast |
|
read_var_sizes returns the number and size of dimensions associated with a variable in a file. If the variable is not in the file the returned sizes are all 0 and ndims is -1. Every processor for which this is called does the reading. |
|
Read a real scalar variable from a netCDF file with the root PE, and broadcast the results to all the other PEs. |
|
Read a 1-d real variable from a netCDF file with the root PE, and broadcast the results to all the other PEs. |
|
Read a integer scalar variable from a netCDF file with the root PE, and broadcast the results to all the other PEs. |
|
Read a 1-d integer variable from a netCDF file with the root PE, and broadcast the results to all the other PEs. |
|
Read a 2d array from a netCDF input file and save to a variable. |
|
Read a character-string global or variable attribute |
|
Read a 32-bit integer global or variable attribute |
|
Read a 64-bit integer global or variable attribute |
|
Read a real global or variable attribute |
|
Open a netcdf file for reading, with error handling |
|
Close a netcdf file that had been opened for reading, with error handling |
|
get_varid finds the netcdf handle for the potentially case-insensitive variable name in a file |
|
Verify that a file contains a named variable with the expected units. |
|
Returns a vardesc type whose elements have been filled with the provided fields. The argument name is required, while the others are optional and have default values that are empty strings or are appropriate for a 3-d tracer field at the tracer cell centers. |
|
This routine modifies the named elements of a vardesc type. All arguments are optional, except the vardesc type to be modified. |
|
Store information that can be used to create an axis in a subsequent call to create_file. |
|
Delete the information in an array of axis_info types and deallocate memory in them. |
|
Retrieve the information from an axis_info type. |
|
Store information that can be used to create an attribute in a subsequent call to create_file. |
|
Delete the information in an array of attribute_info types and deallocate memory in them. |
|
This function returns the CMOR standard name given a CMOR longname, based on the standard pattern of character conversions. |
|
This routine queries vardesc |
|
Read a scalar from file using infrastructure I/O. |
|
Read a scalar integer from file using infrastructure I/O. |
|
Read a 1d array from file using infrastructure I/O. |
|
Read a 1d integer array from file using infrastructure I/O. |
|
Read a 2d array from file using infrastructure I/O. |
|
Read a 2d array (which might have halos) from a file using native netCDF I/O. |
|
Read a 2d region array from file using infrastructure I/O. |
|
Read a 3d array from file using infrastructure I/O. |
|
Read a 3d region array from file using infrastructure I/O. |
|
Read a 4d array from file using infrastructure I/O. |
|
Read a 2d vector tuple from file using infrastructure I/O. |
|
Read a 3d vector tuple from file using infrastructure I/O. |
|
Write a 4d field to an output file, potentially with rotation |
|
Write a 3d field to an output file, potentially with rotation |
|
Write a 2d field to an output file, potentially with rotation |
|
Write a 1d field to an output file |
|
Write a 0d field to an output file |
|
Write a 4d field to an output file, potentially with rotation |
|
Write a 3d field to an output file, potentially with rotation |
|
Write a 2d field to an output file, potentially with rotation |
|
Write a 1d field to an output file |
|
Write a 0d field to an output file |
|
Insert the ensemble appendix into a filename. If provided, the appendix is inserted after the last occurrence of the insert_after substring in the filename. |
|
Given filename and fieldname, this subroutine returns the size of the field in the file |
|
Copies a string |
|
Returns a name with "%#E" or "%E" replaced with the ensemble member number. |
|
Provide a string to append to filenames, to differentiate ensemble members, for example. |
|
Write a file version number to the log file or other output file |
|
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. |
|
Initialize the MOM_io module |
|
Returns the dimension variable information for a netCDF variable |
Detailed Description
This file contains a number of subroutines that manipulate NetCDF files and handle input and output of fields. These subroutines, along with their purpose, are:
create_file: create a new file and set up structures that are needed for subsequent output and write out the coordinates.
reopen_file: reopen an existing file for writing and set up structures that are needed for subsequent output.
open_input_file: open the indicated file for reading only.
close_file: close an open file.
synch_file: flush the buffers, completing all pending output.
write_field: write a field to an open file.
write_time: write a value of the time axis to an open file.
read_data: read a variable from an open file.
read_time: read a time from an open file.
name_output_file: provide a name for an output file based on a name root and the time of the output.
find_input_file: find a file that has been previously written by MOM and named by name_output_file and open it for reading.
handle_error: write an error code and quit.
Type Documentation
- type :: axis_info
Type that stores information that can be used to create a non-decomposed axis.
- Parameters
name
The name of this axis for use in files
longname
A longer name describing this axis
units
The units of the axis labels
cartesian
A variable indicating which direction this axis corresponds with. Valid values include 'X', 'Y', 'Z', 'T', and 'N' for none.
sense
This is 1 for axes whose values increase upward, or -1 if they increase downward. The default, 0, is ignored.
ax_size
The number of elements in this axis
ax_data
The values of the data on the axis [arbitrary]
- type, public :: vardesc
Type for describing a 3-d variable for output
- Parameters
name
Variable name in a NetCDF file
units
Physical dimensions of the variable
longname
Long name of the variable
hor_grid
Horizontal grid: u, v, h, q, Cu, Cv, T, Bu, or 1
z_grid
Vertical grid: L, i, or 1
t_grid
Time description: s, p, or 1
cmor_field_name
CMOR name
cmor_units
CMOR physical dimensions of the variable
cmor_longname
CMOR long name of the variable
conversion
for unit conversions, such as needed to convert from intensive to extensive [various] or [a A-1 ~> 1] to undo internal dimensional rescaling
dim_names
The names in the file of the axes for this variable
position
An integer encoding the horizontal position, it may CENTER, CORNER, EAST_FACE, NORTH_FACE, or 0.
extra_axes
dimensions other than space-time
- type :: attribute_info
Type that stores for a global file attribute
- Parameters
name
The name of this attribute
att_val
The values of this attribute
Generic Interface Documentation
- interface MOM_read_data
Read a field from file using the infrastructure I/O.
Callers call graph
Text view
dome_tracer::initialize_dome_tracer → mom_io::interface::mom_read_data
dyed_obc_tracer::initialize_dyed_obc_tracer → mom_io::interface::mom_read_data
ideal_age_example::initialize_ideal_age_tracer → mom_io::interface::mom_read_data
isomip_initialization::isomip_initialize_sponges → mom_io::interface::mom_read_data
isomip_tracer::initialize_isomip_tracer → mom_io::interface::mom_read_data
marbl_tracers::initialize_marbl_tracers → mom_io::interface::mom_read_data
meso_surface_forcing::meso_buoyancy_forcing → mom_io::interface::mom_read_data
mom_barotropic::barotropic_init → mom_io::interface::mom_read_data
mom_cfc_cap::init_tracer_cfc → mom_io::interface::mom_read_data
mom_coord_initialization::set_coord_from_file → mom_io::interface::mom_read_data
mom_coord_initialization::set_coord_from_ts_profile → mom_io::interface::mom_read_data
mom_geothermal::geothermal_init → mom_io::interface::mom_read_data
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_io::interface::mom_read_data
mom_hor_visc::hor_visc_init → mom_io::interface::mom_read_data
mom_horizontal_regridding::horiz_interp_and_extrap_tracer_record → mom_io::interface::mom_read_data
mom_hybgen_regrid::init_hybgen_regrid → mom_io::interface::mom_read_data
mom_ice_shelf::initialize_ice_shelf → mom_io::interface::mom_read_data
mom_ice_shelf::initialize_ice_smb → mom_io::interface::mom_read_data
mom_ice_shelf_dynamics::initialize_ice_shelf_dyn → mom_io::interface::mom_read_data
mom_ice_shelf_initialize::initialize_ice_aglen → mom_io::interface::mom_read_data
mom_ice_shelf_initialize::initialize_ice_c_basal_friction → mom_io::interface::mom_read_data
mom_ice_shelf_initialize::initialize_ice_flow_from_file → mom_io::interface::mom_read_data
mom_ice_shelf_initialize::initialize_ice_shelf_boundary_from_file → mom_io::interface::mom_read_data
mom_ice_shelf_initialize::initialize_ice_thickness_from_file → mom_io::interface::mom_read_data
mom_int_tide_input::int_tide_input_init → mom_io::interface::mom_read_data
mom_internal_tides::internal_tides_init → mom_io::interface::mom_read_data
mom_mixed_layer_restrat::mixedlayer_restrat_init → mom_io::interface::mom_read_data
mom_ocmip2_cfc::init_tracer_cfc → mom_io::interface::mom_read_data
mom_oda_driver_mod::init_oda → mom_io::interface::mom_read_data
mom_offline_aux::update_offline_from_files → mom_io::interface::mom_read_data
mom_offline_main::read_all_input → mom_io::interface::mom_read_data
mom_regridding::initialize_regridding → mom_io::interface::mom_read_data
mom_restart::only_read_restart_field_2d → mom_io::interface::mom_read_data
mom_restart::only_read_restart_field_3d → mom_io::interface::mom_read_data
mom_restart::only_read_restart_field_4d → mom_io::interface::mom_read_data
mom_restart::only_read_restart_pair_3d → mom_io::interface::mom_read_data
mom_restart::restore_state → mom_io::interface::mom_read_data
mom_self_attr_load::sal_init → mom_io::interface::mom_read_data
mom_set_visc::set_visc_init → mom_io::interface::mom_read_data
mom_shared_initialization::initialize_topography_from_file → mom_io::interface::mom_read_data
mom_shared_initialization::set_meansl_from_file → mom_io::interface::mom_read_data
mom_state_initialization::depress_surface → mom_io::interface::mom_read_data
mom_state_initialization::initialize_oda_incupd_file → mom_io::interface::mom_read_data
mom_state_initialization::initialize_sponges_file → mom_io::interface::mom_read_data
mom_state_initialization::initialize_temp_salt_from_file → mom_io::interface::mom_read_data
mom_state_initialization::initialize_temp_salt_from_profile → mom_io::interface::mom_read_data
mom_state_initialization::initialize_thickness_from_file → mom_io::interface::mom_read_data
mom_state_initialization::initialize_thickness_list → mom_io::interface::mom_read_data
mom_state_initialization::trim_for_ice → mom_io::interface::mom_read_data
mom_surface_forcing::buoyancy_forcing_from_files → mom_io::interface::mom_read_data
mom_surface_forcing::wind_forcing_from_file → mom_io::interface::mom_read_data
mom_thickness_diffuse::thickness_diffuse_init → mom_io::interface::mom_read_data
mom_tidal_forcing::find_in_files → mom_io::interface::mom_read_data
mom_tidal_mixing::read_tidal_constituents → mom_io::interface::mom_read_data
mom_tidal_mixing::read_tidal_energy → mom_io::interface::mom_read_data
mom_tidal_mixing::tidal_mixing_init → mom_io::interface::mom_read_data
mom_tracer_z_init::tracer_z_init → mom_io::interface::mom_read_data
mom_vert_friction::vertvisc_init → mom_io::interface::mom_read_data
mom_wave_drag::wave_drag_init → mom_io::interface::mom_read_data
oil_tracer::initialize_oil_tracer → mom_io::interface::mom_read_data
rgc_initialization::rgc_initialize_sponges → mom_io::interface::mom_read_data
rgc_tracer::initialize_rgc_tracer → mom_io::interface::mom_read_data
user_tracer_example::user_initialize_tracer → mom_io::interface::mom_read_data
- interface MOM_read_vector
Read a vector from file using the infrastructure I/O.
Callers call graph
Text view
mom_offline_aux::update_offline_from_files → mom_io::interface::mom_read_vector
mom_offline_main::read_all_input → mom_io::interface::mom_read_vector
mom_shared_initialization::reset_face_lengths_file → mom_io::interface::mom_read_vector
mom_shared_initialization::set_subgrid_topo_at_vel_from_file → mom_io::interface::mom_read_vector
mom_state_initialization::initialize_oda_incupd_file → mom_io::interface::mom_read_vector
mom_state_initialization::initialize_sponges_file → mom_io::interface::mom_read_vector
mom_state_initialization::initialize_velocity_from_file → mom_io::interface::mom_read_vector
mom_surface_forcing::wind_forcing_from_file → mom_io::interface::mom_read_vector
- interface read_netCDF_data
Read a field using native netCDF I/O
This function is primarily used for unstructured data which may contain content that cannot be parsed by infrastructure I/O.
- interface MOM_write_field
Write a registered field to an output file, potentially with rotation
Callers call graph
Text view
mom_coord_initialization::write_vertgrid_file → mom_io::interface::mom_write_field
mom_harmonic_analysis::ha_write → mom_io::interface::mom_write_field
mom_hybgen_regrid::write_hybgen_coord_file → mom_io::interface::mom_write_field
mom_regridding::write_regrid_file → mom_io::interface::mom_write_field
mom_restart::save_restart → mom_io::interface::mom_write_field
mom_self_attr_load::sal_init → mom_io::interface::mom_write_field
mom_shared_initialization::write_ocean_geometry_file → mom_io::interface::mom_write_field
mom_sum_output::write_depth_list → mom_io::interface::mom_write_field
- interface read_variable
Read an entire named variable from a named netCDF file using netCDF calls directly, rather than any infrastructure routines and broadcast it from the root PE to the other PEs.
Callers call graph
Text view
mom_horizontal_regridding::horiz_interp_and_extrap_tracer_record → mom_io::interface::read_variable
mom_regridding::initialize_regridding → mom_io::interface::read_variable
mom_shared_initialization::apply_topography_edits_from_file → mom_io::interface::read_variable
mom_sum_output::read_depth_list → mom_io::interface::read_variable
mom_tracer_z_init::read_z_edges → mom_io::interface::read_variable
mom_wave_interface::surface_bands_by_data_override → mom_io::interface::read_variable
- interface read_attribute
Read a global or variable attribute from a named netCDF file using netCDF calls directly, in some cases reading from the root PE before broadcasting to the other PEs.
Functions/Subroutine Documentation
- subroutine create_file(IO_handle, filename, vars, novars, fields, threading, timeunit, G, dG, GV, checksums, extra_axes, global_atts)
create_MOM_file wrapper for the legacy file handle, file_type. NOTE: This function may be removed in a future release.
- Parameters
IO_handle [inout]
Handle for a files or fileset that is to be opened or reopened for writing
filename [in]
full path to the file to create
vars [in]
structures describing fields written to filename
novars [in]
number of fields written to filename
fields [inout]
array of fieldtypes for each variable
threading [in]
SINGLE_FILE or MULTIPLE
timeunit [in]
length of the units for time [s]. The default value is 86400.0, for 1 day.
G [in]
ocean horizontal grid structure; G or dG is required if the new file uses any horizontal grid axes.
dG [in]
dynamic horizontal grid structure; G or dG is required if the new file uses any horizontal grid axes.
GV [in]
ocean vertical grid structure, which is ! required if the new file uses any vertical grid axes.
checksums [in]
checksums of vars
extra_axes [in]
Types with information about some axes that might be used in this file
global_atts [in]
Global attributes to write to this file
- subroutine create_MOM_file(IO_handle, filename, vars, novars, fields, threading, timeunit, G, dG, GV, checksums, extra_axes, global_atts)
Create a new netCDF file and register the MOM_fields to be written.
- Parameters
IO_handle [inout]
Handle for a files or fileset that is to be opened or reopened for writing
filename [in]
full path to the file to create
vars [in]
structures describing fields written to filename
novars [in]
number of fields written to filename
fields [inout]
array of fieldtypes for each variable
threading [in]
SINGLE_FILE or MULTIPLE
timeunit [in]
length of the units for time [s]. The default value is 86400.0, for 1 day.
G [in]
ocean horizontal grid structure; G or dG is required if the new file uses any horizontal grid axes.
dG [in]
dynamic horizontal grid structure; G or dG is required if the new file uses any horizontal grid axes.
GV [in]
ocean vertical grid structure, which is required if the new file uses any vertical grid axes.
checksums [in]
checksums of vars
extra_axes [in]
Types with information about some axes that might be used in this file
global_atts [in]
Global attributes to write to this file
Callees call graph
- subroutine reopen_file(IO_handle, filename, vars, novars, fields, threading, timeunit, G, dG, GV, extra_axes, global_atts)
reopen_MOM_file wrapper for the legacy file handle, file_type. NOTE: This function may be removed in a future release.
- Parameters
IO_handle [inout]
Handle for a file or fileset that is to be opened or reopened for writing
filename [in]
full path to the file to create
vars [in]
structures describing fields written to filename
novars [in]
number of fields written to filename
fields [inout]
array of fieldtypes for each variable
threading [in]
SINGLE_FILE or MULTIPLE
timeunit [in]
length of the units for time [s]. The default value is 86400.0, for 1 day.
G [in]
ocean horizontal grid structure; G or dG is required if a new file uses any horizontal grid axes.
dG [in]
dynamic horizontal grid structure; G or dG is required if a new file uses any horizontal grid axes.
GV [in]
ocean vertical grid structure, which is required if a new file uses any vertical grid axes.
extra_axes [in]
Types with information about some axes that might be used in this file
global_atts [in]
Global attributes to write to this file
mfile
Wrapper to MOM file
mfields
Wrapper to MOM fields
Callees call graph
- subroutine reopen_MOM_file(IO_handle, filename, vars, novars, fields, threading, timeunit, G, dG, GV, extra_axes, global_atts)
This routine opens an existing NetCDF file for output. If it does not find the file, a new file is created. It also sets up structures that describe this file and the variables that will later be written to this file.
- Parameters
IO_handle [inout]
Handle for a file or fileset that is to be opened or reopened for writing
filename [in]
full path to the file to create
vars [in]
structures describing fields written to filename
novars [in]
number of fields written to filename
fields [inout]
array of fieldtypes for each variable
threading [in]
SINGLE_FILE or MULTIPLE
timeunit [in]
length of the units for time [s]. The default value is 86400.0, for 1 day.
G [in]
ocean horizontal grid structure; G or dG is required if a new file uses any horizontal grid axes.
dG [in]
dynamic horizontal grid structure; G or dG is required if a new file uses any horizontal grid axes.
GV [in]
ocean vertical grid structure, which is required if a new file uses any vertical grid axes.
extra_axes [in]
Types with information about some axes that might be used in this file
global_atts [in]
Global attributes to write to this file
Callees call graph
Callers call graph
- integer function stdout_if_root()
Return the index of sdtout if called from the root PE, or 0 for other PEs.
- function num_timelevels(filename, varname, min_dims) result(n_time)
This function determines how many time levels a variable has in a file.
- Parameters
filename [in]
name of the file to read
varname [in]
variable whose number of time levels are to be returned
min_dims [in]
The minimum number of dimensions a variable must have if it has a time dimension. If the variable has 1 less dimension than this, then 0 is returned.
n_time
number of time levels varname has in filename
Callees call graph
- subroutine get_var_sizes(filename, varname, ndims, sizes, match_case, caller, all_read, dim_names, ncid_in)
get_var_sizes returns the number and size of dimensions associate with a variable in a file. Usually only the root PE does the read, and then the information is broadcast
- Parameters
filename [in]
Name of the file to read, used here in messages
varname [in]
The variable name, used here for messages
ndims [out]
The number of dimensions to the variable
sizes [out]
The dimension sizes, or 0 for extra values
match_case [in]
If false, allow for variables name matches to be case insensitive, but take a perfect match if found. The default is true.
caller [in]
The name of a calling routine for use in error messages
all_read [in]
If present and true, all PEs that call this routine actually do the read, otherwise only root PE reads and then it broadcasts the results.
dim_names [out]
The names of the dimensions for this variable
ncid_in [in]
The netCDF ID of an open file. If absent, the file is opened and closed within this routine.
Callees call graph
- subroutine read_var_sizes(filename, varname, ndims, sizes, match_case, caller, dim_names, ncid_in)
read_var_sizes returns the number and size of dimensions associated with a variable in a file. If the variable is not in the file the returned sizes are all 0 and ndims is -1. Every processor for which this is called does the reading.
- Parameters
filename [in]
Name of the file to read, used here in messages
varname [in]
The variable name, used here for messages
ndims [out]
The number of dimensions to the variable
sizes [out]
The dimension sizes, or 0 for extra values
match_case [in]
If false, allow for variables name matches to be case insensitive, but take a perfect match if found. The default is true.
caller [in]
The name of a calling routine for use in error messages
dim_names [out]
The names of the dimensions for this variable
ncid_in [in]
The netCDF ID of an open file. If absent, the file is opened and closed within this routine.
Callees call graph
External calls
- netcdf
NF90_Inquire_Dimension (netcdf::nf90_inquire_dimension)
NF90_STRERROR (netcdf::nf90_strerror)
NF90_inquire_variable (netcdf::nf90_inquire_variable)
- subroutine read_variable_0d(filename, varname, var, ncid_in, scale)
Read a real scalar variable from a netCDF file with the root PE, and broadcast the results to all the other PEs.
- Parameters
filename [in]
The name of the file to read
varname [in]
The variable name of the data in the file
var [inout]
The scalar into which to read the data in arbitrary units [A ~> a]
ncid_in [in]
The netCDF ID of an open file. If absent, the file is opened and closed within this routine
scale [in]
A scaling factor that the variable is multiplied by before it is returned to convert from the units in the file to the internal units for this variable [A a-1 ~> 1]
External calls
- netcdf
NF90_STRERROR (netcdf::nf90_strerror)
NF90_get_var (netcdf::nf90_get_var)
- subroutine read_variable_1d(filename, varname, var, ncid_in, scale)
Read a 1-d real variable from a netCDF file with the root PE, and broadcast the results to all the other PEs.
- Parameters
filename [in]
The name of the file to read
varname [in]
The variable name of the data in the file
var [inout]
The 1-d array into which to read the data in arbitrary units [A ~> a]
ncid_in [in]
The netCDF ID of an open file. If absent, the file is opened and closed within this routine
scale [in]
A scaling factor that the variable is multiplied by before it is returned to convert from the units in the file to the internal units for this variable [A a-1 ~> 1]
External calls
- netcdf
NF90_STRERROR (netcdf::nf90_strerror)
NF90_get_var (netcdf::nf90_get_var)
- subroutine read_variable_0d_int(filename, varname, var, ncid_in)
Read a integer scalar variable from a netCDF file with the root PE, and broadcast the results to all the other PEs.
- Parameters
filename [in]
The name of the file to read
varname [in]
The variable name of the data in the file
var [inout]
The scalar into which to read the data
ncid_in [in]
The netCDF ID of an open file. If absent, the file is opened and closed within this routine.
External calls
- netcdf
NF90_STRERROR (netcdf::nf90_strerror)
NF90_get_var (netcdf::nf90_get_var)
- subroutine read_variable_1d_int(filename, varname, var, ncid_in)
Read a 1-d integer variable from a netCDF file with the root PE, and broadcast the results to all the other PEs.
- Parameters
filename [in]
The name of the file to read
varname [in]
The variable name of the data in the file
var [inout]
The 1-d array into which to read the data
ncid_in [in]
The netCDF ID of an open file. If absent, the file is opened and closed within this routine.
External calls
- netcdf
NF90_STRERROR (netcdf::nf90_strerror)
NF90_get_var (netcdf::nf90_get_var)
- subroutine read_variable_2d(filename, varname, var, start, nread, ncid_in)
Read a 2d array from a netCDF input file and save to a variable.
Start and nread lenths may exceed var rank. This allows for reading slices of larger arrays.
Previous versions of the model required a time axis on IO fields. This constraint was dropped in later versions. As a result, versions both with and without a time axis now exist. In order to support all such versions, we use a reshaped version of start and nread in order to read the variable as it exists in the file.
Certain constraints are still applied to start and nread in order to ensure that varname is a valid 2d array, or contains valid 2d slices.
I/O occurs only on the root PE, and data is broadcast to other ranks. Due to potentially large memory communication and storage, this subroutine should only be used when domain-decomposition is unavaialable.
- Parameters
filename [in]
Name of file to be read
varname [in]
Name of variable to be read
var [out]
Output array of variable [arbitrary]
start [in]
Starting index on each axis.
nread [in]
Number of values to be read along each axis
ncid_in [in]
netCDF ID of an opened file. If absent, the file is opened and closed within this routine.
External calls
- netcdf
nf90_get_var (netcdf::nf90_get_var)
nf90_inquire_dimension (netcdf::nf90_inquire_dimension)
nf90_inquire_variable (netcdf::nf90_inquire_variable)
nf90_strerror (netcdf::nf90_strerror)
subroutine read_variable_3d(filename, varname, var, start, nread, ncid_in)
- Parameters
filename [in]
Name of file to be read
varname [in]
Name of variable to be read
var [out]
Output array of variable [arbitrary]
start [in]
Starting index on each axis.
nread [in]
Number of values to be read along each axis
ncid_in [in]
netCDF ID of an opened file. If absent, the file is opened and closed within this routine.
External calls
- netcdf
nf90_get_var (netcdf::nf90_get_var)
nf90_inquire_dimension (netcdf::nf90_inquire_dimension)
nf90_inquire_variable (netcdf::nf90_inquire_variable)
nf90_strerror (netcdf::nf90_strerror)
- subroutine read_attribute_str(filename, attname, att_val, varname, found, all_read, ncid_in)
Read a character-string global or variable attribute
- Parameters
filename [in]
Name of the file to read
attname [in]
Name of the attribute to read
att_val [out]
The value of the attribute
varname [in]
The name of the variable whose attribute will be read. If missing, read a global attribute.
found [out]
Returns true if the attribute is found
all_read [in]
If present and true, all PEs that call this routine actually do the read, otherwise only root PE reads and then broadcasts the results.
ncid_in [in]
The netCDF ID of an open file. If absent, the file is opened and closed within this routine.
External calls
- netcdf
NF90_STRERROR (netcdf::nf90_strerror)
NF90_get_att (netcdf::nf90_get_att)
NF90_inquire_attribute (netcdf::nf90_inquire_attribute)
- subroutine read_attribute_int32(filename, attname, att_val, varname, found, all_read, ncid_in)
Read a 32-bit integer global or variable attribute
- Parameters
filename [in]
Name of the file to read
attname [in]
Name of the attribute to read
att_val [out]
The value of the attribute
varname [in]
The name of the variable whose attribute will be read. If missing, read a global attribute.
found [out]
Returns true if the attribute is found
all_read [in]
If present and true, all PEs that call this routine actually do the read, otherwise only root PE reads and then broadcasts the results.
ncid_in [in]
The netCDF ID of an open file. If absent, the file is opened and closed within this routine.
External calls
- netcdf
NF90_STRERROR (netcdf::nf90_strerror)
NF90_get_att (netcdf::nf90_get_att)
- subroutine read_attribute_int64(filename, attname, att_val, varname, found, all_read, ncid_in)
Read a 64-bit integer global or variable attribute
- Parameters
filename [in]
Name of the file to read
attname [in]
Name of the attribute to read
att_val [out]
The value of the attribute
varname [in]
The name of the variable whose attribute will be read. If missing, read a global attribute.
found [out]
Returns true if the attribute is found
all_read [in]
If present and true, all PEs that call this routine actually do the read, otherwise only root PE reads and then broadcasts the results.
ncid_in [in]
The netCDF ID of an open file. If absent, the file is opened and closed within this routine.
Callees call graph
Text view
External calls
- netcdf
NF90_STRERROR (netcdf::nf90_strerror)
NF90_close (netcdf::nf90_close)
NF90_get_att (netcdf::nf90_get_att)
- subroutine read_attribute_real(filename, attname, att_val, varname, found, all_read, ncid_in)
Read a real global or variable attribute
- Parameters
filename [in]
Name of the file to read
attname [in]
Name of the attribute to read
att_val [out]
The value of the attribute [arbitrary]
varname [in]
The name of the variable whose attribute will be read. If missing, read a global attribute.
found [out]
Returns true if the attribute is found
all_read [in]
If present and true, all PEs that call this routine actually do the read, otherwise only root PE reads and then broadcasts the results.
ncid_in [in]
The netCDF ID of an open file. If absent, the file is opened and closed within this routine.
External calls
- netcdf
NF90_STRERROR (netcdf::nf90_strerror)
NF90_get_att (netcdf::nf90_get_att)
- subroutine open_file_to_read(filename, ncid, success)
Open a netcdf file for reading, with error handling
- Parameters
filename [in]
path and name of the file to open for reading
ncid [out]
The netcdf handle for the file
success [out]
Returns true if the file was opened, or if this argument is not present, failure is fatal error.
Callers call graph
External calls
- netcdf
NF90_STRERROR (netcdf::nf90_strerror)
NF90_open (netcdf::nf90_open)
- subroutine close_file_to_read(ncid, filename)
Close a netcdf file that had been opened for reading, with error handling
- Parameters
ncid [inout]
The netcdf handle for the file to close
filename [in]
path and name of the file to close
Callers call graph
External calls
- netcdf
NF90_STRERROR (netcdf::nf90_strerror)
NF90_close (netcdf::nf90_close)
- subroutine get_varid(varname, ncid, filename, varid, match_case, found)
get_varid finds the netcdf handle for the potentially case-insensitive variable name in a file
- Parameters
varname [in]
The name of the variable that is being sought
ncid [in]
The open netcdf handle for the file
filename [in]
name of the file to read, used here in messages
varid [out]
The netcdf handle for the variable
match_case [in]
If false, allow for variables name matches to be case insensitive, but take a perfect match if found. The default is true.
found [out]
Returns true if the attribute is found
Callees call graph
Callers call graph
Text view
External calls
- netcdf
NF90_INQ_VARID (netcdf::nf90_inq_varid)
NF90_STRERROR (netcdf::nf90_strerror)
NF90_inquire (netcdf::nf90_inquire)
nf90_inq_varids (netcdf::nf90_inq_varids)
nf90_inquire_variable (netcdf::nf90_inquire_variable)
- subroutine verify_variable_units(filename, varname, expected_units, msg, ierr, alt_units)
Verify that a file contains a named variable with the expected units.
- Parameters
filename [in]
File name
varname [in]
Variable name
expected_units [in]
Expected units of variable
msg [inout]
Message to use for errors
ierr [out]
True if an error occurs
alt_units [in]
Alterate acceptable units of variable
Callees call graph
External calls
- netcdf
NF90_GET_ATT (netcdf::nf90_get_att)
NF90_INQ_VARID (netcdf::nf90_inq_varid)
NF90_close (netcdf::nf90_close)
- function var_desc(name, units, longname, hor_grid, z_grid, t_grid, cmor_field_name, cmor_units, cmor_longname, conversion, caller, position, dim_names, extra_axes, fixed) result(vd)
Returns a vardesc type whose elements have been filled with the provided fields. The argument name is required, while the others are optional and have default values that are empty strings or are appropriate for a 3-d tracer field at the tracer cell centers.
- Parameters
name [in]
variable name
units [in]
variable units
longname [in]
variable long name
hor_grid [in]
A character string indicating the horizontal position of this variable
z_grid [in]
variable vertical staggering
t_grid [in]
time description: s, p, or 1
cmor_field_name [in]
CMOR name
cmor_units [in]
CMOR physical dimensions of variable
cmor_longname [in]
CMOR long name
conversion [in]
for unit conversions, such as needed to convert from intensive to extensive [various] or [a A-1 ~> 1]
caller [in]
The calling routine for error messages
position [in]
A coded integer indicating the horizontal position of this variable if it has such dimensions. Valid values include CORNER, CENTER, EAST_FACE NORTH_FACE, and 0 for no horizontal dimensions.
dim_names [in]
The names of the dimensions of this variable
extra_axes [in]
dimensions other than space-time
fixed [in]
If true, this does not evolve with time
vd
vardesc type that is created
Callees call graph
Callers call graph
Text view
advection_test_tracer::register_advection_test_tracer → mom_io::var_desc
boundary_impulse_tracer::register_boundary_impulse_tracer → mom_io::var_desc
dyed_obc_tracer::register_dyed_obc_tracer → mom_io::var_desc
ideal_age_example::register_ideal_age_tracer → mom_io::var_desc
mom_barotropic::register_barotropic_restarts → mom_io::var_desc
mom_coord_initialization::write_vertgrid_file → mom_io::var_desc
mom_dynamics_split_rk2::register_restarts_dyn_split_rk2 → mom_io::var_desc
mom_dynamics_split_rk2b::register_restarts_dyn_split_rk2b → mom_io::var_desc
mom_hybgen_regrid::write_hybgen_coord_file → mom_io::var_desc
mom_open_boundary::open_boundary_register_restarts → mom_io::var_desc
mom_shared_initialization::write_ocean_geometry_file → mom_io::var_desc
mom_wave_interface::waves_register_restarts → mom_io::var_desc
pseudo_salt_tracer::register_pseudo_salt_tracer → mom_io::var_desc
user_tracer_example::user_register_tracer_example → mom_io::var_desc
- subroutine modify_vardesc(vd, name, units, longname, hor_grid, z_grid, t_grid, cmor_field_name, cmor_units, cmor_longname, conversion, caller, position, dim_names, extra_axes)
This routine modifies the named elements of a vardesc type. All arguments are optional, except the vardesc type to be modified.
- Parameters
vd [inout]
vardesc type that is modified
name [in]
name of variable
units [in]
units of variable
longname [in]
long name of variable
hor_grid [in]
horizontal staggering of variable
z_grid [in]
vertical staggering of variable
t_grid [in]
time description: s, p, or 1
cmor_field_name [in]
CMOR name
cmor_units [in]
CMOR physical dimensions of variable
cmor_longname [in]
CMOR long name
conversion [in]
A multiplicative factor for unit conversions, such as needed to convert from intensive to extensive or dimensional consistency testing [various] or [a A-1 ~> 1]
caller [in]
The calling routine for error messages
position [in]
A coded integer indicating the horizontal position of this variable if it has such dimensions. Valid values include CORNER, CENTER, EAST_FACE NORTH_FACE, and 0 for no horizontal dimensions.
dim_names [in]
The names of the dimensions of this variable
extra_axes [in]
dimensions other than space-time
Callees call graph
Callers call graph
integer function position_from_horgrid(hor_grid)
- Parameters
hor_grid [in]
horizontal staggering of variable
Callers call graph
- subroutine set_axis_info(axis, name, units, longname, ax_size, ax_data, cartesian, sense)
Store information that can be used to create an axis in a subsequent call to create_file.
- Parameters
axis [inout]
A type with information about a named axis
name [in]
The name of this axis for use in files
units [in]
The units of the axis labels
longname [in]
Long name of the axis variable
ax_size [in]
The number of elements in this axis
ax_data [in]
The values of the data on the axis [arbitrary]
cartesian [in]
A variable indicating which direction this axis axis corresponds with. Valid values include 'X', 'Y', 'Z', 'T', and 'N' (the default) for none.
sense [in]
This is 1 for axes whose values increase upward, or -1 if they increase downward. The default, 0, is ignored.
Callees call graph
Callers call graph
- subroutine delete_axis_info(axes)
Delete the information in an array of axis_info types and deallocate memory in them.
- Parameters
axes [inout]
An array with information about named axes
- subroutine get_axis_info(axis, name, longname, units, cartesian, ax_size, ax_data)
Retrieve the information from an axis_info type.
- Parameters
axis [in]
An axis type
name [out]
The axis name.
longname [out]
The axis longname.
units [out]
The axis units.
cartesian [out]
The cartesian attribute of the axis [X,Y,Z,T].
ax_size [out]
The size of the axis.
ax_data [out]
The axis label data [arbitrary]
- subroutine set_attribute_info(attribute, name, str_value)
Store information that can be used to create an attribute in a subsequent call to create_file.
- Parameters
attribute [inout]
A type with information about a named attribute
name [in]
The name of this attribute for use in files
str_value [in]
The value of this attribute
- subroutine delete_attribute_info(atts)
Delete the information in an array of attribute_info types and deallocate memory in them.
- Parameters
atts [inout]
An array of global attributes
- function cmor_long_std(longname) result(std_name)
This function returns the CMOR standard name given a CMOR longname, based on the standard pattern of character conversions.
- Parameters
longname [in]
The CMOR longname being converted
std_name
The CMOR standard name generated from longname
Callers call graph
- subroutine query_vardesc(vd, name, units, longname, hor_grid, z_grid, t_grid, cmor_field_name, cmor_units, cmor_longname, conversion, caller, extra_axes, position, dim_names)
This routine queries vardesc
- Parameters
vd [in]
vardesc type that is queried
name [out]
name of variable
units [out]
units of variable
longname [out]
long name of variable
hor_grid [out]
horizontal staggering of variable
z_grid [out]
verticle staggering of variable
t_grid [out]
time description: s, p, or 1
cmor_field_name [out]
CMOR name
cmor_units [out]
CMOR physical dimensions of variable
cmor_longname [out]
CMOR long name
conversion [out]
for unit conversions, such as needed to convert from intensive to extensive [various] or [a A-1 ~> 1]
caller [in]
calling routine?
extra_axes [out]
dimensions other than space-time
position [out]
A coded integer indicating the horizontal position of this variable if it has such dimensions. Valid values include CORNER, CENTER, EAST_FACE NORTH_FACE, and 0 for no horizontal dimensions.
dim_names [out]
The names of the dimensions of this variable
Callees call graph
Callers call graph
Text view
advection_test_tracer::advection_test_stock → mom_io::query_vardesc
advection_test_tracer::initialize_advection_test_tracer → mom_io::query_vardesc
boundary_impulse_tracer::boundary_impulse_stock → mom_io::query_vardesc
boundary_impulse_tracer::initialize_boundary_impulse_tracer → mom_io::query_vardesc
boundary_impulse_tracer::register_boundary_impulse_tracer → mom_io::query_vardesc
dyed_obc_tracer::initialize_dyed_obc_tracer → mom_io::query_vardesc
ideal_age_example::initialize_ideal_age_tracer → mom_io::query_vardesc
ideal_age_example::register_ideal_age_tracer → mom_io::query_vardesc
isomip_tracer::initialize_isomip_tracer → mom_io::query_vardesc
marbl_tracers::initialize_marbl_tracers → mom_io::query_vardesc
marbl_tracers::register_marbl_tracers → mom_io::query_vardesc
mom_diag_mediator::ocean_register_diag → mom_io::query_vardesc
mom_restart::register_restart_field_ptr0d → mom_io::query_vardesc
mom_restart::register_restart_field_ptr1d → mom_io::query_vardesc
mom_restart::register_restart_field_ptr2d → mom_io::query_vardesc
mom_restart::register_restart_field_ptr3d → mom_io::query_vardesc
mom_restart::register_restart_field_ptr4d → mom_io::query_vardesc
mom_tracer_registry::register_tracer → mom_io::query_vardesc
pseudo_salt_tracer::initialize_pseudo_salt_tracer → mom_io::query_vardesc
pseudo_salt_tracer::pseudo_salt_stock → mom_io::query_vardesc
pseudo_salt_tracer::register_pseudo_salt_tracer → mom_io::query_vardesc
user_tracer_example::user_initialize_tracer → mom_io::query_vardesc
user_tracer_example::user_tracer_stock → mom_io::query_vardesc
- subroutine MOM_read_data_0d(filename, fieldname, data, timelevel, scale, MOM_Domain, global_file, file_may_be_4d)
Read a scalar from file using infrastructure I/O.
- Parameters
filename [in]
Input filename
fieldname [in]
Field variable name
data [inout]
Field value in arbitrary units [A ~> a]
timelevel [in]
Time level to read in file
scale [in]
A scaling factor that the variable is multiplied by before it is returned to convert from the units in the file to the internal units for this variable [A a-1 ~> 1]
MOM_Domain [in]
Model domain decomposition
global_file [in]
If true, read from a single file
file_may_be_4d [in]
If true, fields may be stored as 4d arrays in the file.
- subroutine MOM_read_data_0d_int(filename, fieldname, data, timelevel)
Read a scalar integer from file using infrastructure I/O.
- Parameters
filename [in]
Input filename
fieldname [in]
Field variable name
data [inout]
Field value
timelevel [in]
Time level to read in file
- subroutine MOM_read_data_1d(filename, fieldname, data, timelevel, scale, MOM_Domain, global_file, file_may_be_4d)
Read a 1d array from file using infrastructure I/O.
- Parameters
filename [in]
Input filename
fieldname [in]
Field variable name
data [inout]
Field value in arbitrary units [A ~> a]
timelevel [in]
Time level to read in file
scale [in]
A scaling factor that the variable is multiplied by before it is returned to convert from the units in the file to the internal units for this variable [A a-1 ~> 1]
MOM_Domain [in]
Model domain decomposition
global_file [in]
If true, read from a single file
file_may_be_4d [in]
If true, fields may be stored as 4d arrays in the file.
- subroutine MOM_read_data_1d_int(filename, fieldname, data, timelevel)
Read a 1d integer array from file using infrastructure I/O.
- Parameters
filename [in]
Input filename
fieldname [in]
Field variable name
data [inout]
Field value
timelevel [in]
Time level to read in file
- subroutine MOM_read_data_2d(filename, fieldname, data, MOM_Domain, timelevel, position, scale, global_file, file_may_be_4d, turns)
Read a 2d array from file using infrastructure I/O.
- Parameters
filename [in]
Input filename
fieldname [in]
Field variable name
data [inout]
Field value in arbitrary units [A ~> a]
MOM_Domain [in]
Model domain decomposition
timelevel [in]
Time level to read in file
position [in]
Grid positioning flag
scale [in]
A scaling factor that the variable is multiplied by before it is returned to convert from the units in the file to the internal units for this variable [A a-1 ~> 1]
global_file [in]
If true, read from a single file
file_may_be_4d [in]
If true, fields may be stored as 4d arrays in the file.
turns [in]
Number of quarter-turns to rotate the data. If absent the number of turns is taken from MOM_Domain.
- subroutine read_netCDF_data_2d(filename, fieldname, values, MOM_Domain, timelevel, position, rescale, turns)
Read a 2d array (which might have halos) from a file using native netCDF I/O.
- Parameters
filename [in]
Input filename
fieldname [in]
Field variable name
values [inout]
Field values read from the file. It would be intent(out) but for the need to preserve any initialized values in the halo regions.
MOM_Domain [in]
Model domain decomposition
timelevel [in]
Time level to read in file
position [in]
Grid positioning flag
rescale [in]
Rescale factor, omitting this is the same as setting it to 1.
turns [in]
Number of quarter-turns to rotate the data. If absent the number of turns is taken from MOM_Domain.
- subroutine MOM_read_data_2d_region(filename, fieldname, data, start, nread, MOM_domain, no_domain, scale, turns)
Read a 2d region array from file using infrastructure I/O.
- Parameters
filename [in]
Input filename
fieldname [in]
Field variable name
data [inout]
Field value in arbitrary units [A ~> a]
start [in]
Starting index for each axis. In 2d, start(3:4) must be 1.
nread [in]
Number of values to read along each axis. In 2d, nread(3:4) must be 1.
MOM_Domain [in]
Model domain decomposition
no_domain [in]
If true, field does not use domain decomposion.
scale [in]
A scaling factor that the variable is multiplied by before it is returned to convert from the units in the file to the internal units for this variable [A a-1 ~> 1]
turns [in]
Number of quarter turns from input to model grid
- subroutine MOM_read_data_3d(filename, fieldname, data, MOM_Domain, timelevel, position, scale, global_file, file_may_be_4d, turns)
Read a 3d array from file using infrastructure I/O.
- Parameters
filename [in]
Input filename
fieldname [in]
Field variable name
data [inout]
Field value in arbitrary units [A ~> a]
MOM_Domain [in]
Model domain decomposition
timelevel [in]
Time level to read in file
position [in]
Grid positioning flag
scale [in]
A scaling factor that the variable is multiplied by before it is returned to convert from the units in the file to the internal units for this variable [A a-1 ~> 1]
global_file [in]
If true, read from a single file
file_may_be_4d [in]
If true, fields may be stored as 4d arrays in the file.
turns [in]
Number of quarter-turns to rotate the data. If absent the number of turns is taken from MOM_Domain.
- subroutine MOM_read_data_3d_region(filename, fieldname, data, start, nread, MOM_domain, no_domain, scale, turns)
Read a 3d region array from file using infrastructure I/O.
- Parameters
filename [in]
Input filename
fieldname [in]
Field variable name
data [inout]
Field value in arbitrary units [A ~> a]
start [in]
Starting index for each axis.
nread [in]
Number of values to read along each axis.
MOM_Domain [in]
Model domain decomposition
no_domain [in]
If true, field does not use domain decomposion.
scale [in]
A scaling factor that the variable is multiplied by before it is returned to convert from the units in the file to the internal units for this variable [A a-1 ~> 1]
turns [in]
Number of quarter turns from input to model grid
- subroutine MOM_read_data_4d(filename, fieldname, data, MOM_Domain, timelevel, position, scale, global_file, turns)
Read a 4d array from file using infrastructure I/O.
- Parameters
filename [in]
Input filename
fieldname [in]
Field variable name
data [inout]
Field value in arbitrary units [A ~> a]
MOM_Domain [in]
Model domain decomposition
timelevel [in]
Time level to read in file
position [in]
Grid positioning flag
scale [in]
A scaling factor that the variable is multiplied by before it is returned to convert from the units in the file to the internal units for this variable [A a-1 ~> 1]
global_file [in]
If true, read from a single file
turns [in]
Number of quarter-turns to rotate the data. If absent the number of turns is taken from MOM_Domain.
- subroutine MOM_read_vector_2d(filename, u_fieldname, v_fieldname, u_data, v_data, MOM_Domain, timelevel, stagger, scalar_pair, scale, turns)
Read a 2d vector tuple from file using infrastructure I/O.
- Parameters
filename [in]
Input filename
u_fieldname [in]
Field variable name in u
v_fieldname [in]
Field variable name in v
u_data [inout]
Field value at u points in arbitrary units [A ~> a]
v_data [inout]
Field value at v points in arbitrary units [A ~> a]
MOM_Domain [in]
Model domain decomposition
timelevel [in]
Time level to read in file
stagger [in]
Grid staggering flag
scalar_pair [in]
True if tuple is not a vector
scale [in]
A scaling factor that the vector is multiplied by before it is returned to convert from the units in the file to the internal units for this variable [A a-1 ~> 1]
turns [in]
Number of quarter-turns to rotate the data. If absent the number of turns is taken from MOM_Domain.
Callees call graph
Text view
mom_io::mom_read_vector_2d → mom_array_transform::interface::allocate_rotated_array
mom_io::mom_read_vector_2d → mom_array_transform::interface::rotate_array_pair
mom_io::mom_read_vector_2d → mom_array_transform::interface::rotate_vector
mom_io::mom_read_vector_2d → mom_io_infra::interface::read_vector
- subroutine MOM_read_vector_3d(filename, u_fieldname, v_fieldname, u_data, v_data, MOM_Domain, timelevel, stagger, scalar_pair, scale, turns)
Read a 3d vector tuple from file using infrastructure I/O.
- Parameters
filename [in]
Input filename
u_fieldname [in]
Field variable name in u
v_fieldname [in]
Field variable name in v
u_data [inout]
Field value in u in arbitrary units [A ~> a]
v_data [inout]
Field value in v in arbitrary units [A ~> a]
MOM_Domain [in]
Model domain decomposition
timelevel [in]
Time level to read in file
stagger [in]
Grid staggering flag
scalar_pair [in]
True if tuple is not a vector
scale [in]
A scaling factor that the vector is multiplied by before it is returned to convert from the units in the file to the internal units for this variable [A a-1 ~> 1]
turns [in]
Number of quarter-turns to rotate the data. If absent the number of turns is taken from MOM_Domain.
Callees call graph
Text view
mom_io::mom_read_vector_3d → mom_array_transform::interface::allocate_rotated_array
mom_io::mom_read_vector_3d → mom_array_transform::interface::rotate_array_pair
mom_io::mom_read_vector_3d → mom_array_transform::interface::rotate_vector
mom_io::mom_read_vector_3d → mom_io_infra::interface::read_vector
- subroutine MOM_write_field_legacy_4d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, fill_value, turns, scale, unscale, zero_zeros)
Write a 4d field to an output file, potentially with rotation
- 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]
Unrotated field to write in arbitrary units [A ~> a]
tstamp [in]
Model timestamp, often in [days]
tile_count [in]
PEs per tile (default: 1)
fill_value [in]
Missing data fill value in the units used in the file [a]
turns [in]
Number of quarter-turns to rotate the data
scale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output
unscale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output. Here scale and unscale are synonymous, but unscale takes precedence if both are present.
zero_zeros [in]
If present and true, convert negative zeros into ordinary signless zeros.
Callees call graph
Text view
mom_io::mom_write_field_legacy_4d → mom_array_transform::interface::allocate_rotated_array
mom_io::mom_write_field_legacy_4d → mom_array_transform::interface::rotate_array
mom_io::mom_write_field_legacy_4d → mom_domain_infra::interface::rescale_comp_data
mom_io::mom_write_field_legacy_4d → mom_io_infra::interface::write_field
- subroutine MOM_write_field_legacy_3d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, fill_value, turns, scale, unscale, zero_zeros)
Write a 3d field to an output file, potentially with rotation
- 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]
Unrotated field to write in arbitrary units [A ~> a]
tstamp [in]
Model timestamp, often in [days]
tile_count [in]
PEs per tile (default: 1)
fill_value [in]
Missing data fill value in the units used in the file [a]
turns [in]
Number of quarter-turns to rotate the data
scale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output
unscale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output. Here scale and unscale are synonymous, but unscale takes precedence if both are present.
zero_zeros [in]
If present and true, convert negative zeros into ordinary signless zeros.
Callees call graph
Text view
mom_io::mom_write_field_legacy_3d → mom_array_transform::interface::allocate_rotated_array
mom_io::mom_write_field_legacy_3d → mom_array_transform::interface::rotate_array
mom_io::mom_write_field_legacy_3d → mom_domain_infra::interface::rescale_comp_data
mom_io::mom_write_field_legacy_3d → mom_io_infra::interface::write_field
- subroutine MOM_write_field_legacy_2d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, fill_value, turns, scale, unscale, zero_zeros)
Write a 2d field to an output file, potentially with rotation
- 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]
Unrotated field to write in arbitrary units [A ~> a]
tstamp [in]
Model timestamp, often in [days]
tile_count [in]
PEs per tile (default: 1)
fill_value [in]
Missing data fill value
turns [in]
Number of quarter-turns to rotate the data
scale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output
unscale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output. Here scale and unscale are synonymous, but unscale takes precedence if both are present.
zero_zeros [in]
If present and true, convert negative zeros into ordinary signless zeros.
Callees call graph
Text view
mom_io::mom_write_field_legacy_2d → mom_array_transform::interface::allocate_rotated_array
mom_io::mom_write_field_legacy_2d → mom_array_transform::interface::rotate_array
mom_io::mom_write_field_legacy_2d → mom_domain_infra::interface::rescale_comp_data
mom_io::mom_write_field_legacy_2d → mom_io_infra::interface::write_field
- subroutine MOM_write_field_legacy_1d(IO_handle, field_md, field, tstamp, fill_value, scale, unscale, zero_zeros)
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 in arbitrary units [A ~> a]
tstamp [in]
Model timestamp, often in [days]
fill_value [in]
Missing data fill value [a]
scale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output
unscale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output. Here scale and unscale are synonymous, but unscale takes precedence if both are present.
zero_zeros [in]
If present and true, convert negative zeros into ordinary signless zeros.
Callees call graph
- subroutine MOM_write_field_legacy_0d(IO_handle, field_md, field, tstamp, fill_value, scale, unscale, zero_zeros)
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 in arbitrary units [A ~> a]
tstamp [in]
Model timestamp, often in [days]
fill_value [in]
Missing data fill value [a]
scale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output
unscale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output. Here scale and unscale are synonymous, but unscale takes precedence if both are present.
zero_zeros [in]
If present and true, convert negative zeros into ordinary signless zeros.
Callees call graph
- subroutine MOM_write_field_4d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, fill_value, turns, scale, unscale, zero_zeros)
Write a 4d field to an output file, potentially with rotation
- 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]
Unrotated field to write in arbitrary units [A ~> a]
tstamp [in]
Model timestamp, often in [days]
tile_count [in]
PEs per tile (default: 1)
fill_value [in]
Missing data fill value [a]
turns [in]
Number of quarter-turns to rotate the data
scale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output
unscale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output. Here scale and unscale are synonymous, but unscale takes precedence if both are present.
zero_zeros [in]
If present and true, convert negative zeros into ordinary signless zeros.
- subroutine MOM_write_field_3d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, fill_value, turns, scale, unscale, zero_zeros)
Write a 3d field to an output file, potentially with rotation
- 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]
Unrotated field to write in arbitrary units [A ~> a]
tstamp [in]
Model timestamp, often in [days]
tile_count [in]
PEs per tile (default: 1)
fill_value [in]
Missing data fill value [a]
turns [in]
Number of quarter-turns to rotate the data
scale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output
unscale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output. Here scale and unscale are synonymous, but unscale takes precedence if both are present.
zero_zeros [in]
If present and true, convert negative zeros into ordinary signless zeros.
- subroutine MOM_write_field_2d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, fill_value, turns, scale, unscale, zero_zeros)
Write a 2d field to an output file, potentially with rotation
- 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]
Unrotated field to write in arbitrary units [A ~> a]
tstamp [in]
Model timestamp, often in [days]
tile_count [in]
PEs per tile (default: 1)
fill_value [in]
Missing data fill value [a]
turns [in]
Number of quarter-turns to rotate the data
scale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output
unscale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output. Here scale and unscale are synonymous, but unscale takes precedence if both are present.
zero_zeros [in]
If present and true, convert negative zeros into ordinary signless zeros.
- subroutine MOM_write_field_1d(IO_handle, field_md, field, tstamp, fill_value, scale, unscale, zero_zeros)
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 in arbitrary units [A ~> a]
tstamp [in]
Model timestamp, often in [days]
fill_value [in]
Missing data fill value [a]
scale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output
unscale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output. Here scale and unscale are synonymous, but unscale takes precedence if both are present.
zero_zeros [in]
If present and true, convert negative zeros into ordinary signless zeros.
- subroutine MOM_write_field_0d(IO_handle, field_md, field, tstamp, fill_value, scale, unscale, zero_zeros)
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 in arbitrary units [A ~> a]
tstamp [in]
Model timestamp, often in [days]
fill_value [in]
Missing data fill value [a]
scale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output
unscale [in]
A scaling factor that the field is multiplied by before it is written [a A-1 ~> 1], for example to convert it from its internal units to the desired units for output. Here scale and unscale are synonymous, but unscale takes precedence if both are present.
zero_zeros [in]
If present and true, convert negative zeros into ordinary signless zeros.
- subroutine insert_ensemble_appendix(filename, insert_after)
Insert the ensemble appendix into a filename. If provided, the appendix is inserted after the last occurrence of the insert_after substring in the filename.
- Parameters
filename [inout]
The filename to which the appendix is inserted
insert_after [in]
The string after which the appendix is inserted. If not provided or found, the appendix is inserted at the end of the filename.
Callees call graph
- subroutine field_size(filename, fieldname, sizes, field_found, no_domain, ndims, ncid_in)
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. If ndims is present, the default changes to true.
ndims [out]
The number of dimensions to the variable
ncid_in [in]
The netCDF ID of an open file. If absent, the file is opened and closed within this routine.
Callees call graph
Callers call graph
Text view
mom_open_boundary::allocate_segment_field_data → mom_io::field_size
mom_shared_initialization::apply_topography_edits_from_file → mom_io::field_size
mom_state_initialization::initialize_oda_incupd_file → mom_io::field_size
mom_state_initialization::initialize_sponges_file → mom_io::field_size
mom_tidal_mixing::read_tidal_constituents → mom_io::field_size
- subroutine safe_string_copy(str1, str2, fieldnm, caller)
Copies a string
- Parameters
str1 [in]
The string being copied
str2 [out]
The string being copied into
fieldnm [in]
The name of the field for error messages
caller [in]
The calling routine for error messages
Callers call graph
- function ensembler(name, ens_no_in) result(en_nm)
Returns a name with "%#E" or "%E" replaced with the ensemble member number.
- Parameters
name [in]
The name to be modified
ens_no_in [in]
The number of the current ensemble member
en_nm
The name encoded with the ensemble number
Callees call graph
- subroutine get_filename_appendix(suffix)
Provide a string to append to filenames, to differentiate ensemble members, for example.
- Parameters
suffix [out]
A string to append to filenames
Callers call graph
Text view
mom_diag_mediator::diag_mediator_init → mom_io::get_filename_appendix
mom_ice_shelf_dynamics::initialize_ice_shelf_dyn → mom_io::get_filename_appendix
mom_io::insert_ensemble_appendix → mom_io::get_filename_appendix
mom_is_diag_mediator::mom_is_diag_mediator_init → mom_io::get_filename_appendix
mom_sum_output::mom_sum_output_init → mom_io::get_filename_appendix
- subroutine write_version_number(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
- function open_namelist_file(file) result(unit)
Open a single namelist file that is potentially readable by all PEs.
- Parameters
file [in]
The file to open, by default "input.nml"
unit
The opened unit number of the namelist file
- function check_nml_error(IOstat, nml_name) result(ierr)
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
ierr
A copy of IOstat that is returned to preserve legacy function behavior
Callers call graph
- subroutine MOM_io_init(param_file)
Initialize the MOM_io module
- Parameters
param_file [in]
structure indicating the open file to parse for model parameter values.
- subroutine get_var_axes_info(filename, fieldname, axes_info)
Returns the dimension variable information for a netCDF variable
- Parameters
filename [in]
A filename from which to read
fieldname [in]
The name of the field to read
axes_info [inout]
A returned array of field axis information
local variables
start
cartesian axis data
count
cartesian axis data
Callees call graph
Callers call graph
External calls
- netcdf
NF90_GET_VAR (netcdf::nf90_get_var)
NF90_INQUIRE_DIMENSION (netcdf::nf90_inquire_dimension)
NF90_INQUIRE_VARIABLE (netcdf::nf90_inquire_variable)
NF90_INQ_VARID (netcdf::nf90_inq_varid)