FMS  2024.01.00
Flexible Modeling System
netcdf_io_mod

Creates a basic netcdf type and routines to extend for other uses. More...

Data Types

type  bc_information
 information needed fr regional restart variables More...
 
interface  compressed_write
 
type  compresseddimension_t
 Compressed dimension. More...
 
type  dimension_information
 information about the current dimensions for regional restart variables More...
 
type  fmsnetcdffile_t
 Netcdf file type. More...
 
interface  gather_data_bc
 
interface  get_global_attribute
 
interface  get_variable_attribute
 
interface  is_valid
 The interface is needed to accomodate pgi because it can't handle class * and there was no other way around it. More...
 
interface  netcdf_add_restart_variable
 
interface  netcdf_read_data
 
interface  netcdf_write_data
 
interface  register_global_attribute
 
interface  register_variable_attribute
 
type  restartvariable_t
 Restart variable. More...
 
interface  scatter_data_bc
 
type  valid_t
 Range type for a netcdf variable. More...
 

Functions/Subroutines

subroutine add_restart_var_to_array (fileobj, variable_name)
 Add a restart variable to a FmsNetcdfFile_t type. More...
 
subroutine append_compressed_dimension (fileobj, dim_name, npes_corner, npes_nelems)
 Add a compressed dimension to a file object. More...
 
logical function attribute_exists (ncid, varid, attribute_name, msg)
 Determine if an attribute exists. More...
 
subroutine char_read_0d (fileobj, variable_name, buf, corner, append_error_msg, err, varid)
 Character read 0d function. More...
 
subroutine char_read_1d (fileobj, variable_name, buf, c, append_error_msg, err, varid)
 Character read 1d function. More...
 
subroutine char_write_0d (fileobj, variable_name, variable_data, append_error_msg, err, varid)
 Character write 0d function. More...
 
subroutine character_write_1d (fileobj, variable_name, variable_data, append_error_msg, err, varid)
 Character write 1d function. More...
 
logical function, public check_if_open (fileobj, fname)
 
elemental logical function check_if_valid (rdatum, validobj)
 Determine if a piece of data is "valid" (in the correct range.) More...
 
subroutine, public check_netcdf_code (err, msg)
 Check for errors returned by netcdf. More...
 
subroutine, public compressed_start_and_count (fileobj, nelems, npes_start, npes_count)
 Gathers a compressed arrays size and offset for each pe. More...
 
logical function, public dimension_exists (fileobj, dimension_name, broadcast)
 Determine if a dimension exists. More...
 
subroutine, public flush_file (fileobj)
 flushes the netcdf file into disk More...
 
subroutine gather_data_bc_2d (fileobj, vdata, bc_info)
 gathers the 2d vdata from all of the relevant pes into the root_pe and saves it to a buffer. More...
 
subroutine gather_data_bc_3d (fileobj, vdata, bc_info)
 gathers the 2d vdata from all of the relevant pes into the root_pe and saves it to a buffer. More...
 
integer function get_attribute_type (ncid, varid, attname, msg)
 Get the type of a netcdf attribute. More...
 
integer function get_compressed_dimension_index (fileobj, dim_name)
 Get the index of a compressed dimension in a file object. More...
 
integer function get_dimension_id (ncid, dimension_name, msg, allow_failure)
 Get the id of a dimension from its name. More...
 
subroutine, public get_dimension_names (fileobj, names, broadcast)
 Get the names of the dimensions in a file. More...
 
subroutine, public get_dimension_size (fileobj, dimension_name, dim_size, broadcast)
 Get the length of a dimension. More...
 
logical function, public get_fill_value (fileobj, variable_name, fill_value, broadcast)
 Returns a variable's fill value if it exists in the file. More...
 
subroutine get_global_attribute_0d (fileobj, attribute_name, attribute_value, broadcast)
 Get the value of a global attribute. More...
 
subroutine get_global_attribute_1d (fileobj, attribute_name, attribute_value, broadcast)
 Get the value of a global attribute. More...
 
integer function, public get_num_dimensions (fileobj, broadcast)
 Determine the number of dimensions in a file. More...
 
integer function, public get_num_variables (fileobj, broadcast)
 Determine the number of variables in a file. More...
 
subroutine, public get_time_calendar (fileobj, time_name, calendar_type)
 
subroutine, public get_unlimited_dimension_name (fileobj, dimension_name, broadcast)
 Get the name of the unlimited dimension. More...
 
type(valid_t) function, public get_valid (fileobj, variable_name)
 Store the valid range for a variable. More...
 
subroutine get_variable_attribute_0d (fileobj, variable_name, attribute_name, attribute_value, broadcast, reproduce_null_char_bug_flag)
 Get the value of a variable's attribute. More...
 
subroutine get_variable_attribute_1d (fileobj, variable_name, attribute_name, attribute_value, broadcast)
 Get the value of a variable's attribute. More...
 
integer function, dimension(2) get_variable_compressed_dimension_index (fileobj, variable_name, broadcast)
 Given a compressed variable, get the index of the compressed dimension. More...
 
subroutine, public get_variable_dimension_names (fileobj, variable_name, dim_names, broadcast)
 Get the name of a variable's dimensions. More...
 
integer function get_variable_id (ncid, variable_name, msg, allow_failure)
 Get the id of a variable from its name. More...
 
real(kind=r8_kind) function, public get_variable_missing (fileobj, variable_name)
 
subroutine, public get_variable_names (fileobj, names, broadcast)
 Get the names of the variables in a file. More...
 
integer function, public get_variable_num_dimensions (fileobj, variable_name, broadcast)
 Get the number of dimensions a variable depends on. More...
 
integer function, public get_variable_sense (fileobj, variable_name)
 
subroutine, public get_variable_size (fileobj, variable_name, dim_sizes, broadcast)
 Get the size of a variable's dimensions. More...
 
integer function get_variable_type (ncid, varid, msg)
 Get the type of a netcdf variable. More...
 
subroutine, public get_variable_units (fileobj, variable_name, units)
 
integer function, public get_variable_unlimited_dimension_index (fileobj, variable_name, broadcast)
 Get the index of a variable's unlimited dimensions. More...
 
logical function, public global_att_exists (fileobj, attribute_name, broadcast)
 Determine if a global attribute exists. More...
 
logical function, public is_dimension_unlimited (fileobj, dimension_name, broadcast)
 Determine where or not the dimension is unlimited. More...
 
logical function, public is_registered_to_restart (fileobj, variable_name)
 Determine if a variable has been registered to a restart file.. More...
 
elemental logical function is_valid_r4 (datum, validobj)
 Determine if a piece of (r8) data is "valid" (in the correct range.) More...
 
elemental logical function is_valid_r8 (datum, validobj)
 Determine if a piece of (r4) data is "valid" (in the correct range.) More...
 
subroutine, public netcdf_add_dimension (fileobj, dimension_name, dimension_length, is_compressed)
 Add a dimension to a file. More...
 
subroutine netcdf_add_restart_variable_0d (fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
 Add a restart variable to a netcdf file. More...
 
subroutine netcdf_add_restart_variable_0d_wrap (fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
 Wrapper to distinguish interfaces. More...
 
subroutine netcdf_add_restart_variable_1d (fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
 Add a restart variable to a netcdf file. More...
 
subroutine netcdf_add_restart_variable_1d_wrap (fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
 Wrapper to distinguish interfaces. More...
 
subroutine netcdf_add_restart_variable_2d (fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
 Add a restart variable to a netcdf file. More...
 
subroutine netcdf_add_restart_variable_2d_wrap (fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
 Wrapper to distinguish interfaces. More...
 
subroutine netcdf_add_restart_variable_3d (fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
 Add a restart variable to a netcdf file. More...
 
subroutine netcdf_add_restart_variable_3d_wrap (fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
 Wrapper to distinguish interfaces. More...
 
subroutine netcdf_add_restart_variable_4d (fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
 Add a restart variable to a netcdf file. More...
 
subroutine netcdf_add_restart_variable_4d_wrap (fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
 Wrapper to distinguish interfaces. More...
 
subroutine netcdf_add_restart_variable_5d (fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
 Add a restart variable to a netcdf file. More...
 
subroutine netcdf_add_restart_variable_5d_wrap (fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
 Wrapper to distinguish interfaces. More...
 
subroutine, public netcdf_add_variable (fileobj, variable_name, variable_type, dimensions, chunksizes)
 Add a variable to a file. More...
 
subroutine, public netcdf_add_variable_wrap (fileobj, variable_name, variable_type, dimensions)
 Wrapper to distinguish interfaces. More...
 
subroutine, public netcdf_file_close (fileobj)
 Close a netcdf file. More...
 
subroutine, public netcdf_file_close_wrap (fileobj)
 Wrapper to distinguish interfaces. More...
 
logical function, public netcdf_file_open (fileobj, path, mode, nc_format, pelist, is_restart, dont_add_res_to_filename)
 Open a netcdf file. More...
 
logical function, public netcdf_file_open_wrap (fileobj, path, mode, nc_format, pelist, is_restart, dont_add_res_to_filename)
 Wrapper to distinguish interfaces. More...
 
subroutine, public netcdf_io_init (chksz, header_buffer_val, netcdf_default_format, deflate_level, shuffle)
 Accepts the namelist fms2_io_nml variables relevant to netcdf_io_mod. More...
 
subroutine netcdf_read_data_0d (fileobj, variable_name, buf, unlim_dim_level, corner, broadcast)
 Read in data from a variable in a netcdf file. More...
 
subroutine netcdf_read_data_1d (fileobj, variable_name, buf, unlim_dim_level, corner, edge_lengths, broadcast)
 Read in data from a variable in a netcdf file. More...
 
subroutine netcdf_read_data_2d (fileobj, variable_name, buf, unlim_dim_level, corner, edge_lengths, broadcast)
 Read in data from a variable in a netcdf file. More...
 
subroutine netcdf_read_data_3d (fileobj, variable_name, buf, unlim_dim_level, corner, edge_lengths, broadcast)
 Read in data from a variable in a netcdf file. More...
 
subroutine netcdf_read_data_4d (fileobj, variable_name, buf, unlim_dim_level, corner, edge_lengths, broadcast)
 Read in data from a variable in a netcdf file. More...
 
subroutine netcdf_read_data_5d (fileobj, variable_name, buf, unlim_dim_level, corner, edge_lengths, broadcast)
 Read in data from a variable in a netcdf file. More...
 
subroutine, public netcdf_restore_state (fileobj, unlim_dim_level)
 Loop through registered restart variables and read them from a netcdf file. More...
 
subroutine, public netcdf_save_restart (fileobj, unlim_dim_level)
 Loop through registered restart variables and write them to a netcdf file. More...
 
subroutine, public netcdf_save_restart_wrap (fileobj, unlim_dim_level)
 Wrapper to distinguish interfaces. More...
 
subroutine netcdf_write_data_0d (fileobj, variable_name, variable_data, unlim_dim_level, corner)
 Write data to a variable in a netcdf file. More...
 
subroutine netcdf_write_data_1d (fileobj, variable_name, variable_data, unlim_dim_level, corner, edge_lengths)
 Write data to a variable in a netcdf file. More...
 
subroutine netcdf_write_data_2d (fileobj, variable_name, variable_data, unlim_dim_level, corner, edge_lengths)
 Write data to a variable in a netcdf file. More...
 
subroutine netcdf_write_data_3d (fileobj, variable_name, variable_data, unlim_dim_level, corner, edge_lengths)
 Write data to a variable in a netcdf file. More...
 
subroutine netcdf_write_data_4d (fileobj, variable_name, variable_data, unlim_dim_level, corner, edge_lengths)
 Write data to a variable in a netcdf file. More...
 
subroutine netcdf_write_data_5d (fileobj, variable_name, variable_data, unlim_dim_level, corner, edge_lengths)
 Write data to a variable in a netcdf file. More...
 
subroutine, public read_restart_bc (fileobj, unlim_dim_level, ignore_checksum)
 Loop through the registered restart variables (including regional variables) and read them from the netcdf file. More...
 
subroutine, public register_compressed_dimension (fileobj, dimension_name, npes_corner, npes_nelems)
 Add a compressed dimension. More...
 
subroutine register_global_attribute_0d (fileobj, attribute_name, attribute_value, str_len)
 Add a global attribute. More...
 
subroutine register_global_attribute_1d (fileobj, attribute_name, attribute_value, str_len)
 Add a global attribute. More...
 
subroutine register_restart_region_2d (fileobj, variable_name, vdata, indices, global_size, pelist, is_root_pe, x_halo, y_halo, jshift, ishift, is_optional)
 Registers a regional 2D variable and stores the information needed. More...
 
subroutine register_restart_region_3d (fileobj, variable_name, vdata, indices, global_size, pelist, is_root_pe, x_halo, y_halo, jshift, ishift, is_optional)
 Registers a regional 3D variable and stores the information needed. More...
 
subroutine, public register_unlimited_compressed_axis (fileobj, dimension_name, dimension_length)
 Add a "compressed" unlimited dimension to a netcdf file. More...
 
subroutine scatter_data_bc_2d (fileobj, varname, vdata, bc_info, unlim_dim_level, ignore_checksum)
 
subroutine scatter_data_bc_3d (fileobj, varname, vdata, bc_info, unlim_dim_level, ignore_checksum)
 
subroutine set_dimensions (fileobj, bc_dimensions, dimnames, global_size)
 Updates the dimension information (bc_dimensions) for the give fileobj and outputs the dimensions name of the variable. More...
 
subroutine, public set_fileobj_time_name (fileobj, time_name)
 
subroutine, public set_netcdf_mode (ncid, mode)
 Switch to the correct netcdf mode. More...
 
subroutine unpack_data_0d (fileobj, varid, varname, var_data)
 
subroutine unpack_data_1d (fileobj, varid, varname, var_data)
 
subroutine unpack_data_2d (fileobj, varid, varname, var_data)
 
subroutine unpack_data_3d (fileobj, varid, varname, var_data)
 
subroutine unpack_data_4d (fileobj, varid, varname, var_data)
 
subroutine unpack_data_5d (fileobj, varid, varname, var_data)
 
logical function, public variable_att_exists (fileobj, variable_name, attribute_name, broadcast)
 Determine if a variable's attribute exists. More...
 
logical function, public variable_exists (fileobj, variable_name, broadcast)
 Determine if a variable exists. More...
 
subroutine, public write_restart_bc (fileobj, unlim_dim_level)
 Loop through the registered restart variables (including regional variables) and write them to the netcdf file. More...
 

Variables

integer, parameter, public compressed
 
integer, parameter, public data_mode = 1
 
integer, parameter, public define_mode = 0
 
integer, parameter, public dimension
 
integer, parameter dimension_missing = -1
 
integer, parameter dimension_not_found = 0
 
integer, parameter, public file
 
integer, private fms2_deflate_level = default_deflate_level
 Netcdf deflate level to use in nf90_def_var (integer between 1 to 9)
 
integer, private fms2_header_buffer_val = -1
 value used in NF__ENDDEF
 
logical, private fms2_is_netcdf4 = .false.
 Flag indicating whether the default netcdf file format is netcdf4.
 
character(len=10), private fms2_nc_format
 Netcdf format type used in netcdf_file_open.
 
integer, private fms2_nc_format_param = -1
 Netcdf format type param used in nc_create.
 
integer, private fms2_ncchksz = -1
 Chunksize (bytes) used in nc_open and nc_create.
 
logical, private fms2_shuffle = .false.
 Flag indicating whether to use the netcdf shuffle filter.
 
integer, parameter, public in
 
integer, parameter, public max_num_compressed_dims = 10
 
integer, parameter, public max_num_restart_vars = 250
 
integer, parameter, public maximum
 
integer, parameter missing_ncid = -1
 
character(len=1), parameter missing_path = ""
 
integer, parameter missing_rank = -1
 
integer, parameter, public no
 
integer, parameter, public no_unlimited_dimension = -1
 
integer, parameter, public number
 
integer, parameter, public of
 
integer, parameter, public specify
 
integer, parameter, public to
 
integer, parameter, public unlimited = nf90_unlimited
 
integer, parameter variable_missing = -1
 
integer, parameter, public wrapper
 

Detailed Description

Creates a basic netcdf type and routines to extend for other uses.

Handles type definitions and interfaces for netcdf I/O.


Data Type Documentation

◆ netcdf_io_mod::bc_information

type netcdf_io_mod::bc_information

information needed fr regional restart variables

Definition at line 67 of file netcdf_io.F90.

Collaboration diagram for bc_information:
[legend]

Private Attributes

character(len=32) chksum
 The variable's checksum.
 
logical data_on_file_root
 Flag indicating if the file root is part of the pelist that contains data.
 
integer, dimension(:), allocatable global_size
 Size of the variable for each dimension.
 
real(kind=r4_kind), dimension(:,:), allocatable globaldata2d_r4
 2d data pointer.
 
real(kind=r8_kind), dimension(:,:), allocatable globaldata2d_r8
 2d data pointer.
 
real(kind=r4_kind), dimension(:,:,:), allocatable globaldata3d_r4
 3d data pointer.
 
real(kind=r8_kind), dimension(:,:,:), allocatable globaldata3d_r8
 3d data pointer.
 
integer, dimension(:), allocatable indices
 Indices for the halo region for the variable (starting x, ending x, starting y, ending y)
 
logical is_root_pe
 Flag indicating if this is the root_pe from the pelist.
 
integer ishift
 Shift in the y axis (from center)
 
integer jshift
 Shift in the x axis (from center)
 
integer, dimension(:), allocatable pelist
 List of pelist that have the data for the variable.
 
integer x_halo
 Number of halos in x.
 
integer y_halo
 Number of halos in y.
 

◆ netcdf_io_mod::compressed_write

interface netcdf_io_mod::compressed_write

Definition at line 282 of file netcdf_io.F90.

Private Member Functions

 compressed_write_0d
 
 compressed_write_1d
 
 compressed_write_2d
 
 compressed_write_3d
 
 compressed_write_4d
 
 compressed_write_5d
 

◆ netcdf_io_mod::compresseddimension_t

type netcdf_io_mod::compresseddimension_t

Compressed dimension.

Definition at line 104 of file netcdf_io.F90.

Collaboration diagram for compresseddimension_t:
[legend]

Private Attributes

character(len=256) dimname
 Dimension name.
 
integer nelems
 Total size of the dimension.
 
integer, dimension(:), allocatable npes_corner
 Array of starting indices for each rank.
 
integer, dimension(:), allocatable npes_nelems
 Number of elements associated with each rank.
 

◆ netcdf_io_mod::dimension_information

type netcdf_io_mod::dimension_information

information about the current dimensions for regional restart variables

Definition at line 116 of file netcdf_io.F90.

Collaboration diagram for dimension_information:
[legend]

Private Attributes

integer, dimension(3) cur_dim_len
 
integer, dimension(5) dimension
 
integer, dimension(5) each
 
integer, dimension(3) number
 
integer, dimension(3) of
 
integer, dimension(5) size
 
integer, dimension(5) the
 
integer, dimension(3) unique
 
integer, dimension(5) x
 
integer, dimension(5) xlen
 
integer, dimension(5) y
 
integer, dimension(5) ylen
 
integer, dimension(5) z
 
integer, dimension(5) zlen
 

◆ netcdf_io_mod::fmsnetcdffile_t

type netcdf_io_mod::fmsnetcdffile_t

Netcdf file type.

Definition at line 128 of file netcdf_io.F90.

Collaboration diagram for fmsnetcdffile_t:
[legend]

Public Attributes

type(dimension_informationbc_dimensions
 information about the current dimensions for regional restart variables
 
type(compresseddimension_t), dimension(:), allocatable compressed_dims
 "Compressed" dimension.
 
integer io_root
 I/O root rank of the pelist.
 
logical is_diskless
 Flag telling whether this is a diskless file.
 
logical is_netcdf4
 Flag indicating if the netcdf file type is netcdf4.
 
logical, allocatable is_open
 Allocated and set to true if opened.
 
logical is_readonly
 Flag telling if the file is readonly.
 
logical is_restart
 Flag telling if the this file is a restart file (that has internal pointers to data).
 
logical is_root
 Flag telling if the current rank is the I/O root.
 
logical mode_is_append
 
character(len=256) nc_format
 Netcdf file format.
 
integer ncid
 Netcdf file id.
 
integer num_compressed_dims
 Number of compressed dimensions.
 
integer num_restart_vars
 Number of registered restart variables.
 
character(len=256) path
 File path.
 
integer, dimension(:), allocatable pelist
 List of ranks who will communicate.
 
type(restartvariable_t), dimension(:), allocatable restart_vars
 Array of registered restart variables.
 
integer tile_comm =MPP_COMM_NULL
 MPI communicator used for collective reads. To be replaced with a real communicator at user request.
 
character(len=20) time_name
 
logical use_collective = .false.
 Flag indicating if we should open the file for collective input this should be set to .true. in the user application if they want collective reads (put before open_file())
 

◆ netcdf_io_mod::gather_data_bc

interface netcdf_io_mod::gather_data_bc

Definition at line 327 of file netcdf_io.F90.

Private Member Functions

 gather_data_bc_2d
 
 gather_data_bc_3d
 

◆ netcdf_io_mod::get_global_attribute

interface netcdf_io_mod::get_global_attribute

Definition at line 307 of file netcdf_io.F90.

Private Member Functions

 get_global_attribute_0d
 
 get_global_attribute_1d
 

◆ netcdf_io_mod::get_variable_attribute

interface netcdf_io_mod::get_variable_attribute

Definition at line 314 of file netcdf_io.F90.

Private Member Functions

 get_variable_attribute_0d
 
 get_variable_attribute_1d
 

◆ netcdf_io_mod::is_valid

interface netcdf_io_mod::is_valid

The interface is needed to accomodate pgi because it can't handle class * and there was no other way around it.

Definition at line 334 of file netcdf_io.F90.

Private Member Functions

elemental logical function is_valid_r4 (datum, validobj)
 Determine if a piece of (r8) data is "valid" (in the correct range.) More...
 
elemental logical function is_valid_r8 (datum, validobj)
 Determine if a piece of (r4) data is "valid" (in the correct range.) More...
 

Member Function/Subroutine Documentation

◆ is_valid_r4()

elemental logical function is_valid_r4 ( real(kind=r4_kind), intent(in)  datum,
type(valid_t), intent(in)  validobj 
)
private

Determine if a piece of (r8) data is "valid" (in the correct range.)

Returns
A flag telling if the data element is "valid."
Parameters
[in]datumUnpacked data element.
[in]validobjValid object.

Definition at line 1953 of file netcdf_io.F90.

◆ is_valid_r8()

elemental logical function is_valid_r8 ( real(kind=r8_kind), intent(in)  datum,
type(valid_t), intent(in)  validobj 
)
private

Determine if a piece of (r4) data is "valid" (in the correct range.)

Returns
A flag telling if the data element is "valid."
Parameters
[in]datumUnpacked data element.
[in]validobjValid object.

Definition at line 1940 of file netcdf_io.F90.

◆ netcdf_io_mod::netcdf_add_restart_variable

interface netcdf_io_mod::netcdf_add_restart_variable

Definition at line 250 of file netcdf_io.F90.

Private Member Functions

 netcdf_add_restart_variable_0d
 
 netcdf_add_restart_variable_1d
 
 netcdf_add_restart_variable_2d
 
 netcdf_add_restart_variable_3d
 
 netcdf_add_restart_variable_4d
 
 netcdf_add_restart_variable_5d
 

◆ netcdf_io_mod::netcdf_read_data

interface netcdf_io_mod::netcdf_read_data

Definition at line 260 of file netcdf_io.F90.

Private Member Functions

 netcdf_read_data_0d
 
 netcdf_read_data_1d
 
 netcdf_read_data_2d
 
 netcdf_read_data_3d
 
 netcdf_read_data_4d
 
 netcdf_read_data_5d
 

◆ netcdf_io_mod::netcdf_write_data

interface netcdf_io_mod::netcdf_write_data

Definition at line 271 of file netcdf_io.F90.

Private Member Functions

 netcdf_write_data_0d
 
 netcdf_write_data_1d
 
 netcdf_write_data_2d
 
 netcdf_write_data_3d
 
 netcdf_write_data_4d
 
 netcdf_write_data_5d
 

◆ netcdf_io_mod::register_global_attribute

interface netcdf_io_mod::register_global_attribute

Definition at line 293 of file netcdf_io.F90.

Private Member Functions

 register_global_attribute_0d
 
 register_global_attribute_1d
 

◆ netcdf_io_mod::register_variable_attribute

interface netcdf_io_mod::register_variable_attribute

Definition at line 300 of file netcdf_io.F90.

Private Member Functions

 register_variable_attribute_0d
 
 register_variable_attribute_1d
 

◆ netcdf_io_mod::restartvariable_t

type netcdf_io_mod::restartvariable_t

Restart variable.

Definition at line 88 of file netcdf_io.F90.

Collaboration diagram for restartvariable_t:
[legend]

Private Attributes

type(bc_informationbc_info
 information about the boundary condition variable
 
class(*), pointer data0d => null()
 Scalar data pointer.
 
class(*), dimension(:), pointer data1d => null()
 1d data pointer.
 
class(*), dimension(:,:), pointer data2d => null()
 2d data pointer.
 
class(*), dimension(:,:,:), pointer data3d => null()
 3d data pointer.
 
class(*), dimension(:,:,:,:), pointer data4d => null()
 4d data pointer.
 
class(*), dimension(:,:,:,:,:), pointer data5d => null()
 5d data pointer.
 
logical is_bc_variable
 Flag indicating if variable is a bc_variable.
 
character(len=256) varname
 Variable name.
 
logical was_read
 Flag to support legacy "query_initialized" feature, which keeps track if a file was read.
 

◆ netcdf_io_mod::scatter_data_bc

interface netcdf_io_mod::scatter_data_bc

Definition at line 321 of file netcdf_io.F90.

Private Member Functions

 scatter_data_bc_2d
 
 scatter_data_bc_3d
 

◆ netcdf_io_mod::valid_t

type netcdf_io_mod::valid_t

Range type for a netcdf variable.

Definition at line 163 of file netcdf_io.F90.

Collaboration diagram for valid_t:
[legend]

Public Attributes

real(kind=r8_kind) fill_val
 Unpacked fill value for a variable.
 
logical has_fill
 Flag that's true a user defined fill value.
 
logical has_max
 Flag that's true if max exists for a variable.
 
logical has_min
 Flag that's true if min exists for a variable.
 
logical has_missing
 Flag that's true a user defined missing value.
 
logical has_range
 Flag that's true if both min/max exist for a variable.
 
real(kind=r8_kind) max_val
 Unpacked maximum value allowed for a variable.
 
real(kind=r8_kind) min_val
 Unpacked minimum value allowed for a variable.
 
real(kind=r8_kind) missing_val
 Unpacked missing value for a variable.
 

Function/Subroutine Documentation

◆ add_restart_var_to_array()

subroutine netcdf_io_mod::add_restart_var_to_array ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name 
)
private

Add a restart variable to a FmsNetcdfFile_t type.

Parameters
[in,out]fileobjNetcdf file object.
[in]variable_nameVariable name.

Definition at line 1064 of file netcdf_io.F90.

◆ append_compressed_dimension()

subroutine netcdf_io_mod::append_compressed_dimension ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  dim_name,
integer, dimension(:), intent(in)  npes_corner,
integer, dimension(:), intent(in)  npes_nelems 
)
private

Add a compressed dimension to a file object.

Parameters
[in,out]fileobjFile object.
[in]dim_nameDimension name.
[in]npes_cornerArray of starting indices for each rank.
[in]npes_nelemsNumber of elements associated with each rank.

Definition at line 790 of file netcdf_io.F90.

◆ attribute_exists()

logical function netcdf_io_mod::attribute_exists ( integer, intent(in)  ncid,
integer, intent(in)  varid,
character(len=*), intent(in)  attribute_name,
character(len=*), intent(in), optional  msg 
)
private

Determine if an attribute exists.

Returns
Flag telling if the attribute exists.
Parameters
[in]ncidNetcdf file id.
[in]varidVariable id.
[in]attribute_nameAttribute name.
[in]msgError message

Definition at line 477 of file netcdf_io.F90.

◆ char_read_0d()

subroutine char_read_0d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
character(len=*), intent(inout)  buf,
integer, intent(in), optional  corner,
character(len=200), intent(in)  append_error_msg,
integer, intent(inout)  err,
integer, intent(in)  varid 
)

Character read 0d function.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in,out]bufArray that the data will be read into
[in]cornerIndex of the string to read if the variable contains a 1D array of strings.
[in]append_error_msgMsg to be appended to FATAL error message

Definition at line 27 of file netcdf_read_data.inc.

◆ char_read_1d()

subroutine char_read_1d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
character(len=*), dimension(:), intent(inout)  buf,
integer, dimension(2), intent(in)  c,
character(len=200), intent(in)  append_error_msg,
integer, intent(inout)  err,
integer, intent(in)  varid 
)

Character read 1d function.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in,out]bufArray that the data will be read into.
[in]append_error_msgMsg to be appended to FATAL error message

Definition at line 73 of file netcdf_read_data.inc.

◆ char_write_0d()

subroutine char_write_0d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
character(len=*), intent(in)  variable_data,
character(len=200), intent(in)  append_error_msg,
integer, intent(inout)  err,
integer, intent(in)  varid 
)

Character write 0d function.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]variable_dataData that will be written.
[in]append_error_msgMsg to be appended to FATAL error message

Definition at line 27 of file netcdf_write_data.inc.

◆ character_write_1d()

subroutine character_write_1d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
character(len=*), dimension(:), intent(in)  variable_data,
character(len=200), intent(in)  append_error_msg,
integer, intent(inout)  err,
integer, intent(in)  varid 
)

Character write 1d function.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]variable_dataData that will be written.
[in]append_error_msgMsg to be appended to FATAL error message

Definition at line 67 of file netcdf_write_data.inc.

◆ check_if_open()

logical function, public netcdf_io_mod::check_if_open ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in), optional  fname 
)
Returns
True if the file in the file object is opened
Parameters
[in]fileobjFile object.
[in]fnameOptional filename for checking

Definition at line 2250 of file netcdf_io.F90.

◆ check_if_valid()

elemental logical function netcdf_io_mod::check_if_valid ( real(kind=r8_kind), intent(in)  rdatum,
type(valid_t), intent(in)  validobj 
)
private

Determine if a piece of data is "valid" (in the correct range.)

Returns
A flag telling if the data element is "valid."
Parameters
[in]rdatumpacked data element.
[in]validobjValid object.

Definition at line 1970 of file netcdf_io.F90.

◆ check_netcdf_code()

subroutine, public netcdf_io_mod::check_netcdf_code ( integer, intent(in)  err,
character(len=*), intent(in)  msg 
)

Check for errors returned by netcdf.

Parameters
[in]errCode returned by netcdf.
[in]msgError message to be appended to the FATAL

Definition at line 377 of file netcdf_io.F90.

◆ compressed_start_and_count()

subroutine, public netcdf_io_mod::compressed_start_and_count ( class(fmsnetcdffile_t), intent(in)  fileobj,
integer, intent(in)  nelems,
integer, dimension(:), intent(out), allocatable  npes_start,
integer, dimension(:), intent(out), allocatable  npes_count 
)

Gathers a compressed arrays size and offset for each pe.

Parameters
[in]fileobjFile object.
[in]nelemsNumber of elements on the current pe.
[out]npes_startOffset for each pe.
[out]npes_countNumber of elements for each pe.

Definition at line 2004 of file netcdf_io.F90.

◆ dimension_exists()

logical function, public netcdf_io_mod::dimension_exists ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  dimension_name,
logical, intent(in), optional  broadcast 
)

Determine if a dimension exists.

Returns
Flag telling if the dimension exists.
Parameters
[in]fileobjFile object.
[in]dimension_nameDimension name.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1329 of file netcdf_io.F90.

◆ flush_file()

subroutine, public netcdf_io_mod::flush_file ( class(fmsnetcdffile_t), intent(inout)  fileobj)

flushes the netcdf file into disk

Parameters
[in,out]fileobjFMS2_io fileobj

Definition at line 2389 of file netcdf_io.F90.

◆ gather_data_bc_2d()

subroutine gather_data_bc_2d ( class(fmsnetcdffile_t), intent(inout)  fileobj,
class(*), dimension(:,:), intent(in)  vdata,
type(bc_information), intent(inout)  bc_info 
)

gathers the 2d vdata from all of the relevant pes into the root_pe and saves it to a buffer.

Parameters
[in,out]fileobjFms2io netcdf fileobj
[in]vdataData to be gather
[in,out]bc_infoinformation about the boundary condition variable

Set the indices

This is the section of the PE that will actually be added to the global_buffer

Set up index shifts for global array

Only root allocates a global_buffer that will be written

Gather the data and calculate the checksum for the resulting array.

If the fileobj's root does not have data for this variable

Allocate global_buf_r4_kind to be one size bigger, global_buf_r4_kind(i_glob+1,,:) is just dummy data

Allocate a temp local buffer to the fileobj's root. This is needed because the data needs to be send to the fileobj's root, but because fileobj's root doesn't have any data, we just create dummy data and not write it later

If you are on fileobj's root, calculate the checksum and save the gathered data in a buffer

If the fileobj's root does not have data for this variable

Allocate global_buf_r8_kind to be one size bigger, global_buf_r8_kind(i_glob+1,,:) is just dummy data

Allocate a temp local buffer to the fileobj's root. This is needed because the data needs to be send to the fileobj's root, but because fileobj's root doesn't have any data, we just create dummy data and not write it later

If you are on fileobj's root, calculate the checksum and save the gathered data in a buffer

Save the checksum, so you can write it later

Definition at line 27 of file gather_data_bc.inc.

◆ gather_data_bc_3d()

subroutine gather_data_bc_3d ( class(fmsnetcdffile_t), intent(inout)  fileobj,
class(*), dimension(:,:,:), intent(in)  vdata,
type(bc_information), intent(inout)  bc_info 
)

gathers the 2d vdata from all of the relevant pes into the root_pe and saves it to a buffer.

Parameters
[in,out]fileobjFms2io netcdf fileobj
[in]vdataData to be gather
[in,out]bc_infoinformation about the boundary condition variable

Set the indices

This is the section of the PE that will actually be added to the global_buffer

Set up index shifts for global array

Allocate a global_buffer that will be written

Gather the data and calculate the checksum for the resulting array.

If the fileobj's root does not have data for this variable

Allocate global_buf_r8_kind to be one size bigger, global_buf_r8_kind(i_glob+1,,:) is just dummy data

Allocate a temp local buffer to the fileobj's root. This is needed because the data needs to be send to the fileobj's root, but because fileobj's root doesn't have any data, we just create dummy data and not write it later

If you are on fileobj's root, calculate the checksum and save the gathered data in a buffer

If the fileobj's root does not have data for this variable

Allocate global_buf_r8_kind to be one size bigger, global_buf_r8_kind(i_glob+1,,:) is just dummy data

Allocate a temp local buffer to the fileobj's root. This is needed because the data needs to be send to the fileobj's root, but because fileobj's root doesn't have any data, we just create dummy data and not write it later

If you are on fileobj's root, calculate the checksum and save the gathered data in a buffer

Save the checksum, so you can write it later

Definition at line 147 of file gather_data_bc.inc.

◆ get_attribute_type()

integer function netcdf_io_mod::get_attribute_type ( integer, intent(in)  ncid,
integer, intent(in)  varid,
character(len=*), intent(in)  attname,
character(len=*), intent(in), optional  msg 
)
private

Get the type of a netcdf attribute.

Returns
The netcdf type of the attribute.
Parameters
[in]ncidNetcdf file id.
[in]varidVariable id.
[in]attnameAttribute name.
[in]msgError message

Definition at line 502 of file netcdf_io.F90.

◆ get_compressed_dimension_index()

integer function netcdf_io_mod::get_compressed_dimension_index ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  dim_name 
)
private

Get the index of a compressed dimension in a file object.

Returns
Index of the compressed dimension.
Parameters
[in]fileobjFile object.
[in]dim_nameDimension name.

Definition at line 769 of file netcdf_io.F90.

◆ get_dimension_id()

integer function netcdf_io_mod::get_dimension_id ( integer, intent(in)  ncid,
character(len=*), intent(in)  dimension_name,
character(len=*), intent(in)  msg,
logical, intent(in), optional  allow_failure 
)
private

Get the id of a dimension from its name.

Returns
Dimension id, or dimension_missing if it doesn't exist.
Parameters
[in]ncidNetcdf file id.
[in]dimension_nameDimension name.
[in]msgError message
[in]allow_failureFlag that prevents crash if dimension does not exist.

Definition at line 421 of file netcdf_io.F90.

◆ get_dimension_names()

subroutine, public netcdf_io_mod::get_dimension_names ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), dimension(:), intent(inout)  names,
logical, intent(in), optional  broadcast 
)

Get the names of the dimensions in a file.

Parameters
[in]fileobjFile object.
[in,out]namesNames of the dimensions.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1273 of file netcdf_io.F90.

◆ get_dimension_size()

subroutine, public netcdf_io_mod::get_dimension_size ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  dimension_name,
integer, intent(inout)  dim_size,
logical, intent(in), optional  broadcast 
)

Get the length of a dimension.

Parameters
[in]fileobjFile object.
[in]dimension_nameDimension name.
[in,out]dim_sizeDimension size.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1436 of file netcdf_io.F90.

◆ get_fill_value()

logical function, public netcdf_io_mod::get_fill_value ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), intent(out)  fill_value,
logical, intent(in), optional  broadcast 
)

Returns a variable's fill value if it exists in the file.

Returns
Flag telling if a fill value exists.
Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[out]fill_valueFill value.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 2112 of file netcdf_io.F90.

◆ get_global_attribute_0d()

subroutine get_global_attribute_0d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  attribute_name,
class(*), intent(inout)  attribute_value,
logical, intent(in), optional  broadcast 
)

Get the value of a global attribute.

Parameters
[in]fileobjFile object.
[in]attribute_nameAttribute name.
[in,out]attribute_valueAttribute value
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 27 of file get_global_attribute.inc.

◆ get_global_attribute_1d()

subroutine get_global_attribute_1d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  attribute_name,
class(*), dimension(:), intent(inout)  attribute_value,
logical, intent(in), optional  broadcast 
)

Get the value of a global attribute.

Parameters
[in]fileobjFile object.
[in]attribute_nameAttribute name.
[in,out]attribute_valueAttribute value
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 119 of file get_global_attribute.inc.

◆ get_num_dimensions()

integer function, public netcdf_io_mod::get_num_dimensions ( class(fmsnetcdffile_t), intent(in)  fileobj,
logical, intent(in), optional  broadcast 
)

Determine the number of dimensions in a file.

Returns
The number of dimensions in the file.
Parameters
[in]fileobjFile object.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1245 of file netcdf_io.F90.

◆ get_num_variables()

integer function, public netcdf_io_mod::get_num_variables ( class(fmsnetcdffile_t), intent(in)  fileobj,
logical, intent(in), optional  broadcast 
)

Determine the number of variables in a file.

Returns
The number of variables in the file.
Parameters
[in]fileobjFile object.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1469 of file netcdf_io.F90.

◆ get_unlimited_dimension_name()

subroutine, public netcdf_io_mod::get_unlimited_dimension_name ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(out)  dimension_name,
logical, intent(in), optional  broadcast 
)

Get the name of the unlimited dimension.

Parameters
[in]fileobjFile object.
[out]dimension_nameDimension name.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1401 of file netcdf_io.F90.

◆ get_valid()

type(valid_t) function, public netcdf_io_mod::get_valid ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name 
)

Store the valid range for a variable.

Returns
A ValidType_t object containing data about the valid range data for this variable can take.
Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.

Definition at line 1799 of file netcdf_io.F90.

◆ get_variable_attribute_0d()

subroutine get_variable_attribute_0d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
character(len=*), intent(in)  attribute_name,
class(*), intent(inout)  attribute_value,
logical, intent(in), optional  broadcast,
logical, intent(in), optional  reproduce_null_char_bug_flag 
)

Get the value of a variable's attribute.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]attribute_nameAttribute name.
[in,out]attribute_valueAttribute value
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.
[in]reproduce_null_char_bug_flagFlag indicating to reproduce the mpp_io bug where the null characters were not removed after reading a string attribute

Definition at line 27 of file get_variable_attribute.inc.

◆ get_variable_attribute_1d()

subroutine get_variable_attribute_1d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
character(len=*), intent(in)  attribute_name,
class(*), dimension(:), intent(inout)  attribute_value,
logical, intent(in), optional  broadcast 
)

Get the value of a variable's attribute.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]attribute_nameAttribute name.
[in,out]attribute_valueAttribute value
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 113 of file get_variable_attribute.inc.

◆ get_variable_compressed_dimension_index()

integer function, dimension(2) netcdf_io_mod::get_variable_compressed_dimension_index ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
logical, intent(in), optional  broadcast 
)
private

Given a compressed variable, get the index of the compressed dimension.

Returns
Index of the compressed dimension or dimension_not_found.
Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1017 of file netcdf_io.F90.

◆ get_variable_dimension_names()

subroutine, public netcdf_io_mod::get_variable_dimension_names ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
character(len=*), dimension(:), intent(inout)  dim_names,
logical, intent(in), optional  broadcast 
)

Get the name of a variable's dimensions.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in,out]dim_namesArray of dimension names.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1619 of file netcdf_io.F90.

◆ get_variable_id()

integer function netcdf_io_mod::get_variable_id ( integer, intent(in)  ncid,
character(len=*), intent(in)  variable_name,
character(len=*), intent(in)  msg,
logical, intent(in), optional  allow_failure 
)
private

Get the id of a variable from its name.

Returns
Variable id, or variable_missing if it doesn't exist.
Parameters
[in]ncidNetcdf file object.
[in]variable_nameVariable name.
[in]msgError message
[in]allow_failureFlag that prevents crash if variable does not exist.

Definition at line 449 of file netcdf_io.F90.

◆ get_variable_names()

subroutine, public netcdf_io_mod::get_variable_names ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), dimension(:), intent(inout)  names,
logical, intent(in), optional  broadcast 
)

Get the names of the variables in a file.

Parameters
[in]fileobjFile object.
[in,out]namesNames of the variables.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1497 of file netcdf_io.F90.

◆ get_variable_num_dimensions()

integer function, public netcdf_io_mod::get_variable_num_dimensions ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
logical, intent(in), optional  broadcast 
)

Get the number of dimensions a variable depends on.

Returns
Number of dimensions that the variable depends on.
Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1585 of file netcdf_io.F90.

◆ get_variable_size()

subroutine, public netcdf_io_mod::get_variable_size ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
integer, dimension(:), intent(inout)  dim_sizes,
logical, intent(in), optional  broadcast 
)

Get the size of a variable's dimensions.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in,out]dim_sizesArray of dimension sizes.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1690 of file netcdf_io.F90.

◆ get_variable_type()

integer function netcdf_io_mod::get_variable_type ( integer, intent(in)  ncid,
integer, intent(in)  varid,
character(len=*), intent(in), optional  msg 
)
private

Get the type of a netcdf variable.

Returns
The netcdf type of the variable.
Parameters
[in]ncidNetcdf file id.
[in]varidVariable id.
[in]msgError message to append to netcdf error code

Definition at line 522 of file netcdf_io.F90.

◆ get_variable_unlimited_dimension_index()

integer function, public netcdf_io_mod::get_variable_unlimited_dimension_index ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
logical, intent(in), optional  broadcast 
)

Get the index of a variable's unlimited dimensions.

Returns
The index of the unlimited dimension, or else no_unlimited_dimension.
Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1755 of file netcdf_io.F90.

◆ global_att_exists()

logical function, public netcdf_io_mod::global_att_exists ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  attribute_name,
logical, intent(in), optional  broadcast 
)

Determine if a global attribute exists.

Returns
Flag telling if a global attribute exists.
Parameters
[in]fileobjFile object.
[in]attribute_nameAttribute name.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1180 of file netcdf_io.F90.

◆ is_dimension_unlimited()

logical function, public netcdf_io_mod::is_dimension_unlimited ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  dimension_name,
logical, intent(in), optional  broadcast 
)

Determine where or not the dimension is unlimited.

Returns
True if the dimension is unlimited, or else false.
Parameters
[in]fileobjFile object.
[in]dimension_nameDimension name.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1365 of file netcdf_io.F90.

◆ is_registered_to_restart()

logical function, public netcdf_io_mod::is_registered_to_restart ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name 
)

Determine if a variable has been registered to a restart file..

Returns
Flag telling if the variable has been registered to a restart file.
Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.

Definition at line 2227 of file netcdf_io.F90.

◆ is_valid_r4()

elemental logical function netcdf_io_mod::is_valid_r4 ( real(kind=r4_kind), intent(in)  datum,
type(valid_t), intent(in)  validobj 
)
private

Determine if a piece of (r8) data is "valid" (in the correct range.)

Returns
A flag telling if the data element is "valid."
Parameters
[in]datumUnpacked data element.
[in]validobjValid object.

Definition at line 1953 of file netcdf_io.F90.

◆ is_valid_r8()

elemental logical function netcdf_io_mod::is_valid_r8 ( real(kind=r8_kind), intent(in)  datum,
type(valid_t), intent(in)  validobj 
)
private

Determine if a piece of (r4) data is "valid" (in the correct range.)

Returns
A flag telling if the data element is "valid."
Parameters
[in]datumUnpacked data element.
[in]validobjValid object.

Definition at line 1940 of file netcdf_io.F90.

◆ netcdf_add_dimension()

subroutine, public netcdf_io_mod::netcdf_add_dimension ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  dimension_name,
integer, intent(in)  dimension_length,
logical, intent(in), optional  is_compressed 
)

Add a dimension to a file.

Parameters
[in,out]fileobjFile object.
[in]dimension_nameDimension name.
[in]dimension_lengthDimension length.
[in]is_compressedChanges the meaning of dim_len from referring to the total size of the dimension (when false) to the local size for the current rank (when true).

Definition at line 867 of file netcdf_io.F90.

◆ netcdf_add_restart_variable_0d()

subroutine netcdf_add_restart_variable_0d ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), intent(in), target  vdata,
character(len=*), dimension(1), intent(in), optional  dimensions,
logical, intent(in), optional  is_optional,
integer, dimension(:), intent(in), optional  chunksizes 
)

Add a restart variable to a netcdf file.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data.
[in]dimensionsDimension names.
[in]is_optionalPrevent errors in read-only files if a variable does not exist.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 27 of file netcdf_add_restart_variable.inc.

◆ netcdf_add_restart_variable_0d_wrap()

subroutine netcdf_add_restart_variable_0d_wrap ( type(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), intent(in), target  vdata,
character(len=*), dimension(1), intent(in), optional  dimensions,
logical, intent(in), optional  is_optional,
integer, dimension(:), intent(in), optional  chunksizes 
)

Wrapper to distinguish interfaces.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data.
[in]dimensionsDimension names.
[in]is_optionalPrevent errors in read-only files if a variable does not exist.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 63 of file netcdf_add_restart_variable.inc.

◆ netcdf_add_restart_variable_1d()

subroutine netcdf_add_restart_variable_1d ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:), intent(in), target  vdata,
character(len=*), dimension(:), intent(in), optional  dimensions,
logical, intent(in), optional  is_optional,
integer, dimension(:), intent(in), optional  chunksizes 
)

Add a restart variable to a netcdf file.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data.
[in]dimensionsDimension names.
[in]is_optionalPrevent errors in read-only files if a variable does not exist.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 83 of file netcdf_add_restart_variable.inc.

◆ netcdf_add_restart_variable_1d_wrap()

subroutine netcdf_add_restart_variable_1d_wrap ( type(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:), intent(in), target  vdata,
character(len=*), dimension(:), intent(in), optional  dimensions,
logical, intent(in), optional  is_optional,
integer, dimension(:), intent(in), optional  chunksizes 
)

Wrapper to distinguish interfaces.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data.
[in]dimensionsDimension names.
[in]is_optionalPrevent errors in read-only files if a variable does not exist.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 128 of file netcdf_add_restart_variable.inc.

◆ netcdf_add_restart_variable_2d()

subroutine netcdf_add_restart_variable_2d ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:), intent(in), target  vdata,
character(len=*), dimension(:), intent(in), optional  dimensions,
logical, intent(in), optional  is_optional,
integer, dimension(:), intent(in), optional  chunksizes 
)

Add a restart variable to a netcdf file.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data.
[in]dimensionsDimension names.
[in]is_optionalPrevent errors in read-only files if a variable does not exist.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 148 of file netcdf_add_restart_variable.inc.

◆ netcdf_add_restart_variable_2d_wrap()

subroutine netcdf_add_restart_variable_2d_wrap ( type(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:), intent(in), target  vdata,
character(len=*), dimension(:), intent(in), optional  dimensions,
logical, intent(in), optional  is_optional,
integer, dimension(:), intent(in), optional  chunksizes 
)

Wrapper to distinguish interfaces.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data.
[in]dimensionsDimension names.
[in]is_optionalPrevent errors in read-only files if a variable does not exist.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 193 of file netcdf_add_restart_variable.inc.

◆ netcdf_add_restart_variable_3d()

subroutine netcdf_add_restart_variable_3d ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:,:), intent(in), target  vdata,
character(len=*), dimension(:), intent(in), optional  dimensions,
logical, intent(in), optional  is_optional,
integer, dimension(:), intent(in), optional  chunksizes 
)

Add a restart variable to a netcdf file.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data.
[in]dimensionsDimension names.
[in]is_optionalPrevent errors in read-only files if a variable does not exist.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 213 of file netcdf_add_restart_variable.inc.

◆ netcdf_add_restart_variable_3d_wrap()

subroutine netcdf_add_restart_variable_3d_wrap ( type(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:,:), intent(in), target  vdata,
character(len=*), dimension(:), intent(in), optional  dimensions,
logical, intent(in), optional  is_optional,
integer, dimension(:), intent(in), optional  chunksizes 
)

Wrapper to distinguish interfaces.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data.
[in]dimensionsDimension names.
[in]is_optionalPrevent errors in read-only files if a variable does not exist.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 258 of file netcdf_add_restart_variable.inc.

◆ netcdf_add_restart_variable_4d()

subroutine netcdf_add_restart_variable_4d ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:,:,:), intent(in), target  vdata,
character(len=*), dimension(:), intent(in), optional  dimensions,
logical, intent(in), optional  is_optional,
integer, dimension(:), intent(in), optional  chunksizes 
)

Add a restart variable to a netcdf file.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data.
[in]dimensionsDimension names.
[in]is_optionalPrevent errors in read-only files if a variable does not exist.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 278 of file netcdf_add_restart_variable.inc.

◆ netcdf_add_restart_variable_4d_wrap()

subroutine netcdf_add_restart_variable_4d_wrap ( type(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:,:,:), intent(in), target  vdata,
character(len=*), dimension(:), intent(in), optional  dimensions,
logical, intent(in), optional  is_optional,
integer, dimension(:), intent(in), optional  chunksizes 
)

Wrapper to distinguish interfaces.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data.
[in]dimensionsDimension names.
[in]is_optionalPrevent errors in read-only files if a variable does not exist.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 323 of file netcdf_add_restart_variable.inc.

◆ netcdf_add_restart_variable_5d()

subroutine netcdf_add_restart_variable_5d ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:,:,:,:), intent(in), target  vdata,
character(len=*), dimension(:), intent(in), optional  dimensions,
logical, intent(in), optional  is_optional,
integer, dimension(:), intent(in), optional  chunksizes 
)

Add a restart variable to a netcdf file.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data.
[in]dimensionsDimension names.
[in]is_optionalPrevent errors in read-only files if a variable does not exist.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 343 of file netcdf_add_restart_variable.inc.

◆ netcdf_add_restart_variable_5d_wrap()

subroutine netcdf_add_restart_variable_5d_wrap ( type(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:,:,:,:), intent(in), target  vdata,
character(len=*), dimension(:), intent(in), optional  dimensions,
logical, intent(in), optional  is_optional,
integer, dimension(:), intent(in), optional  chunksizes 
)

Wrapper to distinguish interfaces.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data.
[in]dimensionsDimension names.
[in]is_optionalPrevent errors in read-only files if a variable does not exist.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 388 of file netcdf_add_restart_variable.inc.

◆ netcdf_add_variable()

subroutine, public netcdf_io_mod::netcdf_add_variable ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
character(len=*), intent(in)  variable_type,
character(len=*), dimension(:), intent(in), optional  dimensions,
integer, dimension(:), intent(in), optional  chunksizes 
)

Add a variable to a file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]variable_typeVariable type. Allowed values are: "char", "int", "int64", "float", or "double".
[in]dimensionsDimension names.
[in]chunksizesnetcdf chunksize to use for this variable This feature is only available for netcdf4 files

Definition at line 949 of file netcdf_io.F90.

◆ netcdf_add_variable_wrap()

subroutine, public netcdf_io_mod::netcdf_add_variable_wrap ( type(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
character(len=*), intent(in)  variable_type,
character(len=*), dimension(:), intent(in), optional  dimensions 
)

Wrapper to distinguish interfaces.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]variable_typeVariable type. Allowed values are: "int", "int64", "float", or "double".
[in]dimensionsDimension names.

Definition at line 2087 of file netcdf_io.F90.

◆ netcdf_file_close()

subroutine, public netcdf_io_mod::netcdf_file_close ( class(fmsnetcdffile_t), intent(inout)  fileobj)

Close a netcdf file.

Parameters
[in,out]fileobjFile object.

Definition at line 728 of file netcdf_io.F90.

◆ netcdf_file_close_wrap()

subroutine, public netcdf_io_mod::netcdf_file_close_wrap ( type(fmsnetcdffile_t), intent(inout)  fileobj)

Wrapper to distinguish interfaces.

Parameters
[in,out]fileobjFile object.

Definition at line 2078 of file netcdf_io.F90.

◆ netcdf_file_open()

logical function, public netcdf_io_mod::netcdf_file_open ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  path,
character(len=*), intent(in)  mode,
character(len=*), intent(in), optional  nc_format,
integer, dimension(:), intent(in), optional  pelist,
logical, intent(in), optional  is_restart,
logical, intent(in), optional  dont_add_res_to_filename 
)

Open a netcdf file.

Returns
.true. if open succeeds, or else .false.
Parameters
[in,out]fileobjFile object.
[in]pathFile path.
[in]modeFile mode. Allowed values are: "read", "append", "write", or "overwrite".
[in]nc_formatNetcdf format that new files are written as. Allowed values are: "64bit", "classic", or "netcdf4". Defaults to "64bit". This overwrites the value set in the fms2io namelist
[in]pelistList of ranks associated with this file. If not provided, only the current rank will be able to act on the file.
[in]is_restartFlag telling if this file is a restart file. Defaults to false.
[in]dont_add_res_to_filenameFlag indicating not to add ".res" to the filename

Definition at line 540 of file netcdf_io.F90.

◆ netcdf_file_open_wrap()

logical function, public netcdf_io_mod::netcdf_file_open_wrap ( type(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  path,
character(len=*), intent(in)  mode,
character(len=*), intent(in), optional  nc_format,
integer, dimension(:), intent(in), optional  pelist,
logical, intent(in), optional  is_restart,
logical, intent(in), optional  dont_add_res_to_filename 
)

Wrapper to distinguish interfaces.

Parameters
[in,out]fileobjFile object.
[in]pathFile path.
[in]modeFile mode. Allowed values are: "read", "append", "write", or "overwrite".
[in]nc_formatNetcdf format that new files are written as. Allowed values are: "64bit", "classic", or "netcdf4". Defaults to "64bit".
[in]pelistList of ranks associated with this file. If not provided, only the current rank will be able to act on the file.
[in]is_restartFlag telling if this file is a restart file. Defaults to false.
[in]dont_add_res_to_filenameFlag indicating not to add ".res" to the filename

Definition at line 2047 of file netcdf_io.F90.

◆ netcdf_io_init()

subroutine, public netcdf_io_mod::netcdf_io_init ( integer, intent(in)  chksz,
integer, intent(in)  header_buffer_val,
character (len = 10), intent(in)  netcdf_default_format,
integer, intent(in)  deflate_level,
logical, intent(in)  shuffle 
)

Accepts the namelist fms2_io_nml variables relevant to netcdf_io_mod.

Parameters
[in]chkszChunksize (bytes) used in nc_open and nc_create
[in]netcdf_default_formatNetcdf format type param used in nc_create
[in]header_buffer_valValue used in NF__ENDDEF
[in]deflate_levelNetcdf deflate level to use in nf90_def_var (integer between 1 to 9)
[in]shuffleFlag indicating whether to use the netcdf shuffle filter

Definition at line 345 of file netcdf_io.F90.

◆ netcdf_read_data_0d()

subroutine netcdf_read_data_0d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), intent(inout)  buf,
integer, intent(in), optional  unlim_dim_level,
integer, intent(in), optional  corner,
logical, intent(in), optional  broadcast 
)

Read in data from a variable in a netcdf file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in,out]bufArray that the data will be read into.
[in]unlim_dim_levelUnlimited dimension level.
[in]cornerIndex of the string to read if the variable contains a 1D array of strings.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 123 of file netcdf_read_data.inc.

◆ netcdf_read_data_1d()

subroutine netcdf_read_data_1d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:), intent(inout)  buf,
integer, intent(in), optional  unlim_dim_level,
integer, dimension(:), intent(in), optional  corner,
integer, dimension(:), intent(in), optional  edge_lengths,
logical, intent(in), optional  broadcast 
)

Read in data from a variable in a netcdf file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in,out]bufArray that the data will be read into.
[in]unlim_dim_levelUnlimited dimension level.
[in]cornerArray of starting indices describing where the data will be read from.
[in]edge_lengthsThe number of elements that will be read in each dimension.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 204 of file netcdf_read_data.inc.

◆ netcdf_read_data_2d()

subroutine netcdf_read_data_2d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:), intent(inout)  buf,
integer, intent(in), optional  unlim_dim_level,
integer, dimension(:), intent(in), optional  corner,
integer, dimension(:), intent(in), optional  edge_lengths,
logical, intent(in), optional  broadcast 
)

Read in data from a variable in a netcdf file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in,out]bufArray that the data will be read into.
[in]unlim_dim_levelUnlimited dimension level.
[in]cornerArray of starting indices describing where the data will be read from.
[in]edge_lengthsThe number of elements that will be read in each dimension.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 300 of file netcdf_read_data.inc.

◆ netcdf_read_data_3d()

subroutine netcdf_read_data_3d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:,:), intent(inout)  buf,
integer, intent(in), optional  unlim_dim_level,
integer, dimension(:), intent(in), optional  corner,
integer, dimension(:), intent(in), optional  edge_lengths,
logical, intent(in), optional  broadcast 
)

Read in data from a variable in a netcdf file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in,out]bufArray that the data will be read into.
[in]unlim_dim_levelUnlimited dimension level.
[in]cornerArray of starting indices describing where the data will be read from.
[in]edge_lengthsThe number of elements that will be read in each dimension.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 414 of file netcdf_read_data.inc.

◆ netcdf_read_data_4d()

subroutine netcdf_read_data_4d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:,:,:), intent(inout)  buf,
integer, intent(in), optional  unlim_dim_level,
integer, dimension(:), intent(in), optional  corner,
integer, dimension(:), intent(in), optional  edge_lengths,
logical, intent(in), optional  broadcast 
)

Read in data from a variable in a netcdf file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in,out]bufArray that the data will be read into.
[in]unlim_dim_levelUnlimited dimension level.
[in]cornerArray of starting indices describing where the data will be read from.
[in]edge_lengthsThe number of elements that will be read in each dimension.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 528 of file netcdf_read_data.inc.

◆ netcdf_read_data_5d()

subroutine netcdf_read_data_5d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:,:,:,:), intent(inout)  buf,
integer, intent(in), optional  unlim_dim_level,
integer, dimension(:), intent(in), optional  corner,
integer, dimension(:), intent(in), optional  edge_lengths,
logical, intent(in), optional  broadcast 
)

Read in data from a variable in a netcdf file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in,out]bufArray that the data will be read into.
[in]unlim_dim_levelUnlimited dimension level.
[in]cornerArray of starting indices describing where the data will be read from.
[in]edge_lengthsThe number of elements that will be read in each dimension.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 620 of file netcdf_read_data.inc.

◆ netcdf_restore_state()

subroutine, public netcdf_io_mod::netcdf_restore_state ( type(fmsnetcdffile_t), intent(inout)  fileobj,
integer, intent(in), optional  unlim_dim_level 
)

Loop through registered restart variables and read them from a netcdf file.

Parameters
[in,out]fileobjFile object.
[in]unlim_dim_levelUnlimited dimension level.

Definition at line 1133 of file netcdf_io.F90.

◆ netcdf_save_restart()

subroutine, public netcdf_io_mod::netcdf_save_restart ( class(fmsnetcdffile_t), intent(in)  fileobj,
integer, intent(in), optional  unlim_dim_level 
)

Loop through registered restart variables and write them to a netcdf file.

Parameters
[in]fileobjFile object.
[in]unlim_dim_levelUnlimited dimension level.

Definition at line 1091 of file netcdf_io.F90.

◆ netcdf_save_restart_wrap()

subroutine, public netcdf_io_mod::netcdf_save_restart_wrap ( type(fmsnetcdffile_t), intent(in)  fileobj,
integer, intent(in), optional  unlim_dim_level 
)

Wrapper to distinguish interfaces.

Parameters
[in]fileobjFile object.
[in]unlim_dim_levelUnlimited dimension level.

Definition at line 2100 of file netcdf_io.F90.

◆ netcdf_write_data_0d()

subroutine netcdf_write_data_0d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), intent(in)  variable_data,
integer, intent(in), optional  unlim_dim_level,
integer, intent(in), optional  corner 
)

Write data to a variable in a netcdf file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]variable_dataData that will be written.
[in]unlim_dim_levelUnlimited dimension level.
[in]cornerArray of starting indices describing where the data will be written to.

Definition at line 115 of file netcdf_write_data.inc.

◆ netcdf_write_data_1d()

subroutine netcdf_write_data_1d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:), intent(in)  variable_data,
integer, intent(in), optional  unlim_dim_level,
integer, dimension(1), intent(in), optional  corner,
integer, dimension(1), intent(in), optional  edge_lengths 
)

Write data to a variable in a netcdf file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]variable_dataData that will be written.
[in]unlim_dim_levelUnlimited dimension level.
[in]cornerArray of starting indices describing where the data will be written to.
[in]edge_lengthsThe number of elements that will be written in each dimension.

Definition at line 169 of file netcdf_write_data.inc.

◆ netcdf_write_data_2d()

subroutine netcdf_write_data_2d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:), intent(in)  variable_data,
integer, intent(in), optional  unlim_dim_level,
integer, dimension(2), intent(in), optional  corner,
integer, dimension(2), intent(in), optional  edge_lengths 
)

Write data to a variable in a netcdf file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]variable_dataData that will be written.
[in]unlim_dim_levelUnlimited dimension level.
[in]cornerArray of starting indices describing where the data will be written to.
[in]edge_lengthsThe number of elements that will be written in each dimension.

Definition at line 235 of file netcdf_write_data.inc.

◆ netcdf_write_data_3d()

subroutine netcdf_write_data_3d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:,:), intent(in)  variable_data,
integer, intent(in), optional  unlim_dim_level,
integer, dimension(3), intent(in), optional  corner,
integer, dimension(3), intent(in), optional  edge_lengths 
)

Write data to a variable in a netcdf file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]variable_dataData that will be written.
[in]unlim_dim_levelUnlimited dimension level.
[in]cornerArray of starting indices describing where the data will be written to.
[in]edge_lengthsThe number of elements that will be written in each dimension.

Definition at line 299 of file netcdf_write_data.inc.

◆ netcdf_write_data_4d()

subroutine netcdf_write_data_4d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:,:,:), intent(in)  variable_data,
integer, intent(in), optional  unlim_dim_level,
integer, dimension(4), intent(in), optional  corner,
integer, dimension(4), intent(in), optional  edge_lengths 
)

Write data to a variable in a netcdf file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]variable_dataData that will be written.
[in]unlim_dim_levelUnlimited dimension level.
[in]cornerArray of starting indices describing where the data will be written to.
[in]edge_lengthsThe number of elements that will be written in each dimension.

Definition at line 364 of file netcdf_write_data.inc.

◆ netcdf_write_data_5d()

subroutine netcdf_write_data_5d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
class(*), dimension(:,:,:,:,:), intent(in), target  variable_data,
integer, intent(in), optional  unlim_dim_level,
integer, dimension(5), intent(in), optional  corner,
integer, dimension(5), intent(in), optional  edge_lengths 
)

Write data to a variable in a netcdf file.

Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]variable_dataData that will be written.
[in]unlim_dim_levelUnlimited dimension level.
[in]cornerArray of starting indices describing where the data will be written to.
[in]edge_lengthsThe number of elements that will be written in each dimension.

Definition at line 427 of file netcdf_write_data.inc.

◆ read_restart_bc()

subroutine, public netcdf_io_mod::read_restart_bc ( class(fmsnetcdffile_t), intent(inout)  fileobj,
integer, intent(in), optional  unlim_dim_level,
logical, intent(in), optional  ignore_checksum 
)

Loop through the registered restart variables (including regional variables) and read them from the netcdf file.

Parameters
[in,out]fileobjFile object
[in]unlim_dim_levelUnlimited dimension level.
[in]ignore_checksumChecksum data integrity flag.

Go away if you are not in the pelist!

The file's root pe reads the file and scatters it to the rest of the pes

Definition at line 2286 of file netcdf_io.F90.

◆ register_compressed_dimension()

subroutine, public netcdf_io_mod::register_compressed_dimension ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  dimension_name,
integer, dimension(:), intent(in)  npes_corner,
integer, dimension(:), intent(in)  npes_nelems 
)

Add a compressed dimension.

Parameters
[in,out]fileobjFile object.
[in]dimension_nameDimension name.
[in]npes_cornerArray of starting indices for each rank.
[in]npes_nelemsNumber of elements associated with each rank.

Definition at line 920 of file netcdf_io.F90.

◆ register_global_attribute_0d()

subroutine register_global_attribute_0d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  attribute_name,
class(*), intent(in)  attribute_value,
integer, intent(in), optional  str_len 
)

Add a global attribute.

Parameters
[in]fileobjFile object.
[in]attribute_nameAttribute name.
[in]attribute_valueAttribute value
[in]str_lenLength of the string

Definition at line 27 of file register_global_attribute.inc.

◆ register_global_attribute_1d()

subroutine register_global_attribute_1d ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  attribute_name,
class(*), dimension(:), intent(in)  attribute_value,
integer, intent(in), optional  str_len 
)

Add a global attribute.

Parameters
[in]fileobjFile object.
[in]attribute_nameAttribute name.
[in]attribute_valueAttribute value
[in]str_lenLength of the string

Definition at line 78 of file register_global_attribute.inc.

◆ register_restart_region_2d()

subroutine register_restart_region_2d ( type(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=7), intent(in)  variable_name,
class(*), dimension(:,:), intent(in), target  vdata,
integer, dimension(4), intent(in)  indices,
integer, dimension(1:2), intent(in)  global_size,
integer, dimension(:), intent(in)  pelist,
logical, intent(in)  is_root_pe,
integer, intent(in), optional  x_halo,
integer, intent(in), optional  y_halo,
integer, intent(in), optional  jshift,
integer, intent(in), optional  ishift,
logical, intent(in), optional  is_optional 
)

Registers a regional 2D variable and stores the information needed.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data
[in]indicesIndices for the halo region for the variable (starting x, ending x, starting y, ending y)
[in]x_haloNumber of halos in x
[in]y_haloNumber of halos in y
[in]jshiftShift in the x axis (from center)
[in]ishiftShift in the y axis (from center)
[in]is_optionalPrevent errors in read-only files if a variable does not exist.

If you reading the file and the variable is optional and not in the file, leave

Register the axis for the variable dimension and get the names of the dimensions

Save the boundary conditions information to the bc_info type for the given variable

Definition at line 407 of file netcdf_add_restart_variable.inc.

◆ register_restart_region_3d()

subroutine register_restart_region_3d ( type(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=7), intent(in)  variable_name,
class(*), dimension(:,:,:), intent(in), target  vdata,
integer, dimension(4), intent(in)  indices,
integer, dimension(1:3), intent(in)  global_size,
integer, dimension(:), intent(in)  pelist,
logical, intent(in)  is_root_pe,
integer, intent(in), optional  x_halo,
integer, intent(in), optional  y_halo,
integer, intent(in), optional  jshift,
integer, intent(in), optional  ishift,
logical, intent(in), optional  is_optional 
)

Registers a regional 3D variable and stores the information needed.

Parameters
[in,out]fileobjFile object.
[in]variable_nameVariable name.
[in]vdataPointer to variable data
[in]indicesIndices for the halo region for the variable (starting x, ending x, starting y, ending y)
[in]x_haloNumber of halos in x
[in]y_haloNumber of halos in y
[in]jshiftShift in the y axis (from center)
[in]ishiftShift in the x axis (from center)
[in]is_optionalPrevent errors in read-only files if a variable does not exist.

If you reading the file and the variable is optional and not in the file, leave

Register the axis for the variable dimension and get the names of the dimensions

Save the boundary conditions information to the bc_info type for the given variable

Definition at line 474 of file netcdf_add_restart_variable.inc.

◆ register_unlimited_compressed_axis()

subroutine, public netcdf_io_mod::register_unlimited_compressed_axis ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  dimension_name,
integer, intent(in)  dimension_length 
)

Add a "compressed" unlimited dimension to a netcdf file.

Note
Here compressed means that every rank has a different dimension_length compressed. This was written specifically for the icebergs restarts.
Parameters
[in,out]fileobjFile object.
[in]dimension_nameDimension name.
[in]dimension_lengthDimension length for the current rank

Definition at line 827 of file netcdf_io.F90.

◆ scatter_data_bc_2d()

subroutine scatter_data_bc_2d ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  varname,
class(*), dimension(:,:), intent(inout)  vdata,
type(bc_information), intent(inout)  bc_info,
integer, intent(in), optional  unlim_dim_level,
logical, intent(in), optional  ignore_checksum 
)
Parameters
[in,out]fileobjFms2io netcdf fileobj
[in]varnameVariable name.
[in,out]vdatascattered data
[in,out]bc_infoinformation about the boundary condition variable
[in]unlim_dim_levelUnlimited dimension level.
[in]ignore_checksumChecksum data integrity flag.

Set the indices

This is the section of the PE that will actually be read from the global_buffer

Set up index shifts for global array

If you are the file root, read in the data

If the checksum exists read it and compare it with the calculated from the data that was read

If the fileobj's root is not the same as the variable's root, then no data will be read for the file root

Scatter the data to the other PE

Return if fileobj's root is not the same as the variable's root

Set vdata to equal the scattered data

If you are the file root, read in the data

If the checksum exists read it and compare it with the calculated from the data that was read

If the fileobj's root is not the same as the variable's root, then no data will be read for the file root

Scatter the data to the other PE

Return if fileobj's root is not the same as the variable's root

Set vdata to equal the scattered data

Definition at line 26 of file scatter_data_bc.inc.

◆ scatter_data_bc_3d()

subroutine scatter_data_bc_3d ( class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  varname,
class(*), dimension(:,:,:), intent(inout)  vdata,
type(bc_information), intent(inout)  bc_info,
integer, intent(in), optional  unlim_dim_level,
logical, intent(in), optional  ignore_checksum 
)
Parameters
[in,out]fileobjFms2io netcdf fileobj
[in]varnameVariable name.
[in,out]vdatascattered data
[in,out]bc_infoinformation about the boundary condition variable
[in]unlim_dim_levelUnlimited dimension level.
[in]ignore_checksumChecksum data integrity flag.

Set the indices

This is the section of the PE that will actually be read from the global_buffer

Set up index shifts for global array

If you are the file root, read in the data

If the checksum exists read it and compare it with the calculated from the data that was read

If the fileobj's root is not the same as the variable's root, then no data will be read for the file root

Scatter the data to the other PE

Return if fileobj's root is not the same as the variable's root

Set vdata to equal the scattered data

If you are the file root, read in the data

If the checksum exists read it and compare it with the calculated from the data that was read

If the fileobj's root is not the same as the variable's root, then no data will be read for the file root

Scatter the data to the other PE

Return if fileobj's root is not the same as the variable's root

Set vdata to equal the scattered data

Definition at line 179 of file scatter_data_bc.inc.

◆ set_dimensions()

subroutine set_dimensions ( type(fmsnetcdffile_t), intent(inout)  fileobj,
type(dimension_information), intent(inout)  bc_dimensions,
character(len=7), dimension(4), intent(inout)  dimnames,
integer, dimension(:), intent(in)  global_size 
)

Updates the dimension information (bc_dimensions) for the give fileobj and outputs the dimensions name of the variable.

Check to see if a x dimension with the correct size is already registered

If the x dimension doesn't already exist, register it

Check to see if a y dimension with the correct size is already registered

If the y dimension doesn't already exist, register it

If the variable is 3d:

Check to see if a z dimension with the correct size is already registered

If the z dimension doesn't already exist, register it

Definition at line 543 of file netcdf_add_restart_variable.inc.

◆ set_netcdf_mode()

subroutine, public netcdf_io_mod::set_netcdf_mode ( integer, intent(in)  ncid,
integer, intent(in)  mode 
)

Switch to the correct netcdf mode.

Parameters
[in]ncidNetcdf file id.
[in]modeNetcdf file mode.

Definition at line 393 of file netcdf_io.F90.

◆ unpack_data_0d()

subroutine unpack_data_0d ( class(fmsnetcdffile_t), intent(in)  fileobj,
integer, intent(in)  varid,
character(len=*), intent(in)  varname,
class(*), intent(inout)  var_data 
)
Parameters
[in]fileobjFile object.
[in]varidNetcdf variable ID
[in]varnameName of the variable (for error messages)
[in,out]var_dataArray that the data will be read into.

Definition at line 24 of file unpack_data.inc.

◆ unpack_data_1d()

subroutine unpack_data_1d ( class(fmsnetcdffile_t), intent(in)  fileobj,
integer, intent(in)  varid,
character(len=*), intent(in)  varname,
class(*), dimension(:), intent(inout)  var_data 
)
Parameters
[in]fileobjFile object.
[in]varidNetcdf variable ID
[in]varnameName of the variable (for error messages)
[in,out]var_dataArray that the data will be read into.

Definition at line 68 of file unpack_data.inc.

◆ unpack_data_2d()

subroutine unpack_data_2d ( class(fmsnetcdffile_t), intent(in)  fileobj,
integer, intent(in)  varid,
character(len=*), intent(in)  varname,
class(*), dimension(:,:), intent(inout)  var_data 
)
Parameters
[in]fileobjFile object.
[in]varidNetcdf variable ID
[in]varnameName of the variable (for error messages)
[in,out]var_dataArray that the data will be read into.

Definition at line 112 of file unpack_data.inc.

◆ unpack_data_3d()

subroutine unpack_data_3d ( class(fmsnetcdffile_t), intent(in)  fileobj,
integer, intent(in)  varid,
character(len=*), intent(in)  varname,
class(*), dimension(:,:,:), intent(inout)  var_data 
)
Parameters
[in]fileobjFile object.
[in]varidNetcdf variable ID
[in]varnameName of the variable (for error messages)
[in,out]var_dataArray that the data will be read into.

Definition at line 156 of file unpack_data.inc.

◆ unpack_data_4d()

subroutine unpack_data_4d ( class(fmsnetcdffile_t), intent(in)  fileobj,
integer, intent(in)  varid,
character(len=*), intent(in)  varname,
class(*), dimension(:,:,:,:), intent(inout)  var_data 
)
Parameters
[in]fileobjFile object.
[in]varidNetcdf variable ID
[in]varnameName of the variable (for error messages)
[in,out]var_dataArray that the data will be read into.

Definition at line 200 of file unpack_data.inc.

◆ unpack_data_5d()

subroutine unpack_data_5d ( class(fmsnetcdffile_t), intent(in)  fileobj,
integer, intent(in)  varid,
character(len=*), intent(in)  varname,
class(*), dimension(:,:,:,:,:), intent(inout)  var_data 
)
Parameters
[in]fileobjFile object.
[in]varidNetcdf variable ID
[in]varnameName of the variable (for error messages)
[in,out]var_dataArray that the data will be read into.

Definition at line 244 of file unpack_data.inc.

◆ variable_att_exists()

logical function, public netcdf_io_mod::variable_att_exists ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
character(len=*), intent(in)  attribute_name,
logical, intent(in), optional  broadcast 
)

Determine if a variable's attribute exists.

Returns
Flag telling if the variable's attribute exists.
Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]attribute_nameAttribute name.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1208 of file netcdf_io.F90.

◆ variable_exists()

logical function, public netcdf_io_mod::variable_exists ( class(fmsnetcdffile_t), intent(in)  fileobj,
character(len=*), intent(in)  variable_name,
logical, intent(in), optional  broadcast 
)

Determine if a variable exists.

Returns
Flag telling if the variable exists.
Parameters
[in]fileobjFile object.
[in]variable_nameVariable name.
[in]broadcastFlag controlling whether or not the data will be broadcasted to non "I/O root" ranks. The broadcast will be done by default.

Definition at line 1553 of file netcdf_io.F90.

◆ write_restart_bc()

subroutine, public netcdf_io_mod::write_restart_bc ( class(fmsnetcdffile_t), intent(inout)  fileobj,
integer, intent(in), optional  unlim_dim_level 
)

Loop through the registered restart variables (including regional variables) and write them to the netcdf file.

Parameters
[in,out]fileobjFile object
[in]unlim_dim_levelUnlimited dimension level.

Loop through the variables, root pe gathers the data from the other pes and writes out the checksum. Then loop through the variables again to write the data to the netcdf file. All the metadata should be written before the data to prevent netcdf from rewriting the file if the header is not big enough. That is why the two do loops are needed.

Go away if you are not in the pelist!

Go away if this is not a BC variable

Root pe gathers the data from the other ranks, saves it in a buffer, and writes out the checksum.

Write the data to the netcdf file

Definition at line 2323 of file netcdf_io.F90.