mom_netcdf module reference

MOM6 interface to netCDF operations.

More…

Data Types

netcdf_file_type

netCDF file abstraction

netcdf_axis

Dimension axis for a netCDF file.

netcdf_field

Field variable for a netCDF file.

Functions/Subroutines

open_netcdf_file()

close_netcdf_file()

Close an opened netCDF file.

flush_netcdf_file()

Flush buffered output to the netCDF file.

enable_netcdf_write()

Change netCDF mode of handle from ‘define’ to ‘write’.

register_netcdf_field()

Register a netCDF variable.

register_netcdf_axis()

Create an axis and associated dimension in a netCDF file.

write_netcdf_field_4d()

Write a 4D array to a compatible netCDF field.

write_netcdf_field_3d()

Write a 3D array to a compatible netCDF field.

write_netcdf_field_2d()

Write a 2D array to a compatible netCDF field.

write_netcdf_field_1d()

Write a 1D array to a compatible netCDF field.

write_netcdf_field_0d()

Write a scalar to a compatible netCDF field.

write_netcdf_axis()

Write axis points to associated netCDF variable.

write_netcdf_attribute()

Write a global attribute to a netCDF file.

get_netcdf_size()

Get the number of dimensions, variables, and timesteps in a netCDF file.

get_netcdf_fields()

Get the metadata of the registered fields in a netCDF file.

get_netcdf_filename()

Return the name of a file from a netCDF handle.

read_netcdf_field()

Read the values of a field from a netCDF file.

update_netcdf_timestep()

Set the current timestep of an open netCDF file.

check_netcdf_call()

Check netCDF function return codes, report the error log, and abort the run.

Detailed Description

MOM6 interface to netCDF operations.

Type Documentation

type mom_netcdf/netcdf_file_type

netCDF file abstraction

Type fields:
  • % ncid [integer,private] :: netCDF file ID

  • % filename [character (len=:),allocatable, private] :: netCDF filename

  • % define_mode [logical,private] :: True if file is in define mode.

  • % time_id [integer,private] :: Time axis variable ID.

  • % time [real,private] :: Current model time.

  • % time_level [integer,private] :: Current time level for output.

type mom_netcdf/netcdf_axis

Dimension axis for a netCDF file.

Type fields:
  • % label [character (len=:),allocatable, public] :: Axis label name.

  • % points [real(:),allocatable, private] :: Grid points along the axis.

  • % dimid [integer,private] :: netCDF dimension ID associated with axis

  • % varid [integer,private] :: netCDF variable ID associated with axis

type mom_netcdf/netcdf_field

Field variable for a netCDF file.

Type fields:
  • % label [character (len=:),allocatable, public] :: Variable name.

  • % varid [integer,private] :: netCDF variable ID for field

Function/Subroutine Documentation

subroutine mom_netcdf/open_netcdf_file(handle, filename, mode)
Parameters:
  • handle :: [inout] netCDF file handle

  • filename :: [in] netCDF filename

  • mode :: [in] Input MOM I/O mode

Call to:

check_netcdf_call mom_error_handler::mom_error write_netcdf_attribute

subroutine mom_netcdf/close_netcdf_file(handle)

Close an opened netCDF file.

Call to:

check_netcdf_call

subroutine mom_netcdf/flush_netcdf_file(handle)

Flush buffered output to the netCDF file.

Call to:

check_netcdf_call

subroutine mom_netcdf/enable_netcdf_write(handle)

Change netCDF mode of handle from ‘define’ to ‘write’.

Call to:

check_netcdf_call

Called from:

write_netcdf_axis mom_netcdf::write_netcdf_field::write_netcdf_field_0d mom_netcdf::write_netcdf_field::write_netcdf_field_1d mom_netcdf::write_netcdf_field::write_netcdf_field_2d mom_netcdf::write_netcdf_field::write_netcdf_field_3d mom_netcdf::write_netcdf_field::write_netcdf_field_4d

function mom_netcdf/register_netcdf_field(handle, label, axes, longname, units) [type(netcdf_field)]

Register a netCDF variable.

Parameters:
  • handle :: [in] netCDF file handle

  • label :: [in] netCDF field name in the file

  • axes :: [in] Axes along which field is defined

  • longname :: [in] Long name of the netCDF field

  • units :: [in] Field units of measurement

Return:

undefined :: netCDF field

Call to:

check_netcdf_call mom_error_handler::mom_error

function mom_netcdf/register_netcdf_axis(handle, label, units, longname, points, cartesian, sense) [type(netcdf_axis)]

Create an axis and associated dimension in a netCDF file.

Parameters:
  • handle :: [inout] netCDF file handle

  • label :: [in] netCDF axis name in the file

  • units :: [in] Axis units of measurement

  • longname :: [in] Long name of the axis

  • points :: [in] Values of axis points (for fixed axes)

  • cartesian :: [in] Character denoting axis direction: X, Y, Z, T, or N for none

  • sense :: [in] Axis direction; +1 if axis increases upward or -1 if downward

Return:

undefined :: netCDF coordinate axis

Call to:

check_netcdf_call mom_error_handler::mom_error nulltime

subroutine mom_netcdf/write_netcdf_field_4d(handle, field, values, time)

Write a 4D array to a compatible netCDF field.

Parameters:
  • handle :: [inout] netCDF file handle

  • field :: [in] Field metadata

  • values :: [in] Field values

  • time :: [in] Timestep index to write data

subroutine mom_netcdf/write_netcdf_field_3d(handle, field, values, time)

Write a 3D array to a compatible netCDF field.

Parameters:
  • handle :: [inout] netCDF file handle

  • field :: [in] Field metadata

  • values :: [in] Field values

  • time :: [in] Timestep index to write data

subroutine mom_netcdf/write_netcdf_field_2d(handle, field, values, time)

Write a 2D array to a compatible netCDF field.

Parameters:
  • handle :: [inout] netCDF file handle

  • field :: [in] Field metadata

  • values :: [in] Field values

  • time :: [in] Timestep index to write data

subroutine mom_netcdf/write_netcdf_field_1d(handle, field, values, time)

Write a 1D array to a compatible netCDF field.

Parameters:
  • handle :: [inout] netCDF file handle

  • field :: [in] Field metadata

  • values :: [in] Field values

  • time :: [in] Timestep index to write data

subroutine mom_netcdf/write_netcdf_field_0d(handle, field, scalar, time)

Write a scalar to a compatible netCDF field.

Parameters:
  • handle :: [inout] netCDF file handle

  • field :: [in] Field metadata

  • scalar :: [in] Field values

  • time :: [in] Timestep index to write data

subroutine mom_netcdf/write_netcdf_axis(handle, axis)

Write axis points to associated netCDF variable.

Parameters:
  • handle :: [inout] netCDF file handle

  • axis :: [in] field variable

Call to:

check_netcdf_call enable_netcdf_write

subroutine mom_netcdf/write_netcdf_attribute(handle, label, attribute)

Write a global attribute to a netCDF file.

Parameters:
  • handle :: [in] netCDF file handle

  • label :: [in] File attribute

  • attribute :: [in] File attribute value

Call to:

check_netcdf_call

Called from:

open_netcdf_file

subroutine mom_netcdf/get_netcdf_size(handle, ndims, nvars, nsteps)

Get the number of dimensions, variables, and timesteps in a netCDF file.

Parameters:
  • handle :: [in] netCDF input file

  • ndims :: [out] number of dimensions in the file

  • nvars :: [out] number of variables in the file

  • nsteps :: [out] number of values in the file’s unlimited axis

Call to:

check_netcdf_call

subroutine mom_netcdf/get_netcdf_fields(handle, axes, fields)

Get the metadata of the registered fields in a netCDF file.

Parameters:
  • handle :: [inout] netCDF file handle

  • axes :: [inout] netCDF file axes

  • fields :: [inout] netCDF file fields

Call to:

check_netcdf_call nulltime

function mom_netcdf/get_netcdf_filename(handle) [character(len=:)]

Return the name of a file from a netCDF handle.

Parameters:

handle :: [in] A netCDF file handle

Return:

undefined :: The name of the file that this handle refers to.

subroutine mom_netcdf/read_netcdf_field(handle, field, values, bounds)

Read the values of a field from a netCDF file.

Call to:

check_netcdf_call

Called from:

mom_io_file::get_field_nc

subroutine mom_netcdf/update_netcdf_timestep(handle, time)

Set the current timestep of an open netCDF file.

Parameters:
  • handle :: [inout] netCDF file handle

  • time :: [in] New model time

Call to:

check_netcdf_call

Called from:

mom_netcdf::write_netcdf_field::write_netcdf_field_0d mom_netcdf::write_netcdf_field::write_netcdf_field_1d mom_netcdf::write_netcdf_field::write_netcdf_field_2d mom_netcdf::write_netcdf_field::write_netcdf_field_3d mom_netcdf::write_netcdf_field::write_netcdf_field_4d

subroutine mom_netcdf/check_netcdf_call(ncerr, header, message)

Check netCDF function return codes, report the error log, and abort the run.

Parameters:
  • ncerr :: [in] netCDF error code

  • header :: [in] Message header (usually calling subroutine)

  • message :: [in] Error message (usually action which instigated the error)

Call to:

mom_error_handler::mom_error

Called from:

close_netcdf_file enable_netcdf_write flush_netcdf_file get_netcdf_fields get_netcdf_size open_netcdf_file read_netcdf_field register_netcdf_axis register_netcdf_field update_netcdf_timestep write_netcdf_attribute write_netcdf_axis mom_netcdf::write_netcdf_field::write_netcdf_field_0d mom_netcdf::write_netcdf_field::write_netcdf_field_1d mom_netcdf::write_netcdf_field::write_netcdf_field_2d mom_netcdf::write_netcdf_field::write_netcdf_field_3d mom_netcdf::write_netcdf_field::write_netcdf_field_4d