FMS  2024.03
Flexible Modeling System
blackboxio

File utility functions for use within FMS2 IO. More...

Functions/Subroutines

subroutine, public blackboxio_init (chksz)
 Accepts the namelist fms2_io_nml variables relevant to blackboxio.
 
subroutine copy_metadata (fileobj, new_fileobj)
 Copy metadata from one file object to another. More...
 
logical function, public create_diskless_domain_file (fileobj, domain, path)
 Create a "diskless" netcdf file to act as a buffer to support our "register data to a file without knowing its name" legacy restart I/O workflow. More...
 
logical function create_diskless_netcdf_file (fileobj, pelist, path)
 Create a "diskless" netcdf file to act as a buffer to support our "register data to a file without knowing its name" legacy restart I/O workflow. More...
 
logical function, public create_diskless_netcdf_file_wrap (fileobj, pelist, path)
 Wrapper to distinguish interfaces. More...
 
logical function, public create_diskless_unstructured_domain_file (fileobj, domain, path)
 Create a "diskless" netcdf file to act as a buffer to support our "register data to a file without knowing its name" legacy restart I/O workflow. More...
 
subroutine get_new_filename (path, new_path, directory, timestamp, new_name)
 Create a new file path. More...
 
subroutine, public netcdf_restore_state_wrap (fileobj, unlim_dim_level, directory, timestamp, filename)
 Loop through registered restart variables and read them from a netcdf file. More...
 
subroutine, public netcdf_save_restart_wrap2 (fileobj, unlim_dim_level, directory, timestamp, filename, nc_format)
 Support for writing new restarts from a diskless file. More...
 
subroutine new_domain_file (fileobj, path, mode, new_fileobj, nc_format)
 Make a copy of a file's metadata to support "intermediate restarts". More...
 
subroutine new_netcdf_file (fileobj, path, mode, new_fileobj, nc_format)
 Make a copy of a file's metadata to support "intermediate restarts". More...
 
subroutine new_unstructured_domain_file (fileobj, path, mode, new_fileobj, nc_format)
 Make a copy of a file's metadata to support "intermediate restarts". More...
 
subroutine, public restore_domain_state_wrap (fileobj, unlim_dim_level, directory, timestamp, filename, ignore_checksum)
 Loop through registered restart variables and read them from a netcdf file. More...
 
subroutine, public save_domain_restart_wrap (fileobj, unlim_dim_level, directory, timestamp, filename, nc_format)
 Loop through registered restart variables and write them to a netcdf file. More...
 
subroutine tempfile (filename)
 Create a unique filename (poor man's version of mktemp). More...
 
subroutine, public unstructured_write_restart_wrap (fileobj, unlim_dim_level, directory, timestamp, filename, nc_format)
 Wrapper to distinguish interfaces. More...
 

Detailed Description

File utility functions for use within FMS2 IO.

Function/Subroutine Documentation

◆ copy_metadata()

subroutine blackboxio::copy_metadata ( class(fmsnetcdffile_t), intent(in), target  fileobj,
class(fmsnetcdffile_t), intent(inout)  new_fileobj 
)
private

Copy metadata from one file object to another.

Parameters
[in]fileobjFile object.
[in,out]new_fileobjNew file object.

Definition at line 165 of file blackboxio.F90.

◆ create_diskless_domain_file()

logical function, public blackboxio::create_diskless_domain_file ( type(fmsnetcdfdomainfile_t), intent(inout)  fileobj,
type(domain2d), intent(in)  domain,
character(len=*), intent(in), optional  path 
)

Create a "diskless" netcdf file to act as a buffer to support our "register data to a file without knowing its name" legacy restart I/O workflow.

Returns
Flag telling whether the creation of the buffer was successful.
Parameters
[in,out]fileobjFile object.
[in]domainTwo-dimensional domain.
[in]pathFile path.

Definition at line 452 of file blackboxio.F90.

◆ create_diskless_netcdf_file()

logical function blackboxio::create_diskless_netcdf_file ( class(fmsnetcdffile_t), intent(inout)  fileobj,
integer, dimension(:), intent(in), optional  pelist,
character(len=*), intent(in), optional  path 
)
private

Create a "diskless" netcdf file to act as a buffer to support our "register data to a file without knowing its name" legacy restart I/O workflow.

Returns
Flag telling whether the creation of the buffer was successful.
Parameters
[in,out]fileobjFile object.
[in]pelistList of ranks associated with this file. If not provided, only the current rank will be able to act on the file.
[in]pathFile path.

Definition at line 114 of file blackboxio.F90.

◆ create_diskless_netcdf_file_wrap()

logical function, public blackboxio::create_diskless_netcdf_file_wrap ( type(fmsnetcdffile_t), intent(inout)  fileobj,
integer, dimension(:), intent(in), optional  pelist,
character(len=*), intent(in), optional  path 
)

Wrapper to distinguish interfaces.

Returns
Flag telling whether the creation of the buffer was successful.
Parameters
[in,out]fileobjFile object.
[in]pelistList of ranks associated with this file. If not provided, only the current rank will be able to act on the file.
[in]pathFile path.

Definition at line 362 of file blackboxio.F90.

◆ create_diskless_unstructured_domain_file()

logical function, public blackboxio::create_diskless_unstructured_domain_file ( type(fmsnetcdfunstructureddomainfile_t), intent(inout)  fileobj,
type(domainug), intent(in)  domain,
character(len=*), intent(in), optional  path 
)

Create a "diskless" netcdf file to act as a buffer to support our "register data to a file without knowing its name" legacy restart I/O workflow.

Returns
Flag telling whether the creation of the buffer was successful.
Parameters
[in,out]fileobjFile object.
[in]domainTwo-dimensional domain.
[in]pathFile path.

Definition at line 594 of file blackboxio.F90.

◆ get_new_filename()

subroutine blackboxio::get_new_filename ( character(len=*), intent(in)  path,
character(len=*), intent(out)  new_path,
character(len=*), intent(in), optional  directory,
character(len=*), intent(in), optional  timestamp,
character(len=*), intent(in), optional  new_name 
)
private

Create a new file path.

Parameters
[in]pathFile path.
[out]new_pathNew file path.
[in]timestampTime.
[in]new_nameNew file basename.

Definition at line 61 of file blackboxio.F90.

◆ netcdf_restore_state_wrap()

subroutine, public blackboxio::netcdf_restore_state_wrap ( type(fmsnetcdffile_t), intent(inout), target  fileobj,
integer, intent(in), optional  unlim_dim_level,
character(len=*), intent(in), optional  directory,
character(len=*), intent(in), optional  timestamp,
character(len=*), intent(in), optional  filename 
)

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

Parameters
[in,out]fileobjFile object.
[in]unlim_dim_levelUnlimited dimension level.
[in]directoryDirectory to write restart file to.
[in]timestampModel time.
[in]filenameNew name for the file.

Definition at line 418 of file blackboxio.F90.

◆ netcdf_save_restart_wrap2()

subroutine, public blackboxio::netcdf_save_restart_wrap2 ( type(fmsnetcdffile_t), intent(in), target  fileobj,
integer, intent(in), optional  unlim_dim_level,
character(len=*), intent(in), optional  directory,
character(len=*), intent(in), optional  timestamp,
character(len=*), intent(in), optional  filename,
character(len=*), intent(in), optional  nc_format 
)

Support for writing new restarts from a diskless file.

Parameters
[in]fileobjFile object.
[in]unlim_dim_levelUnlimited dimension level.
[in]directoryDirectory to write restart file to.
[in]timestampModel time.
[in]filenameNew name for the file.
[in]nc_formatNetcdf format that new files are written as. Allowed values are: "64bit", "classic", or "netcdf4". Defaults to "64bit".

Definition at line 379 of file blackboxio.F90.

◆ new_domain_file()

subroutine blackboxio::new_domain_file ( type(fmsnetcdfdomainfile_t), intent(in)  fileobj,
character(len=*), intent(in)  path,
character(len=*), intent(in)  mode,
type(fmsnetcdfdomainfile_t), intent(out)  new_fileobj,
character(len=*), intent(in), optional  nc_format 
)
private

Make a copy of a file's metadata to support "intermediate restarts".

Parameters
[in]fileobjFile object.
[in]pathName of new file.
[in]modeFile mode. Allowed values are: "read", "append", "write", or "overwrite".
[out]new_fileobjFile object.
[in]nc_formatNetcdf format that new files are written as. Allowed values are: "64bit", "classic", or "netcdf4". Defaults to "64bit".

Definition at line 484 of file blackboxio.F90.

◆ new_netcdf_file()

subroutine blackboxio::new_netcdf_file ( class(fmsnetcdffile_t), intent(in), target  fileobj,
character(len=*), intent(in)  path,
character(len=*), intent(in)  mode,
class(fmsnetcdffile_t), intent(out)  new_fileobj,
character(len=*), intent(in), optional  nc_format 
)
private

Make a copy of a file's metadata to support "intermediate restarts".

Parameters
[in]fileobjFile object.
[in]pathName of new file.
[in]modeFile mode. Allowed values are: "read", "append", "write", or "overwrite".
[out]new_fileobjNew file object.
[in]nc_formatNetcdf format that new files are written as. Allowed values are: "64bit", "classic", or "netcdf4". Defaults to "64bit".

Definition at line 332 of file blackboxio.F90.

◆ new_unstructured_domain_file()

subroutine blackboxio::new_unstructured_domain_file ( type(fmsnetcdfunstructureddomainfile_t), intent(in)  fileobj,
character(len=*), intent(in)  path,
character(len=*), intent(in)  mode,
type(fmsnetcdfunstructureddomainfile_t), intent(out)  new_fileobj,
character(len=*), intent(in), optional  nc_format 
)
private

Make a copy of a file's metadata to support "intermediate restarts".

Parameters
[in]fileobjFile object.
[in]pathName of new file.
[in]modeFile mode. Allowed values are: "read", "append", "write", or "overwrite."
[out]new_fileobjNew file object.
[in]nc_formatNetcdf format that new files are written as. Allowed values are: "64bit", "classic", or "netcdf4". Defaults to "64bit".

Definition at line 622 of file blackboxio.F90.

◆ restore_domain_state_wrap()

subroutine, public blackboxio::restore_domain_state_wrap ( type(fmsnetcdfdomainfile_t), intent(in), target  fileobj,
integer, intent(in), optional  unlim_dim_level,
character(len=*), intent(in), optional  directory,
character(len=*), intent(in), optional  timestamp,
character(len=*), intent(in), optional  filename,
logical, intent(in), optional  ignore_checksum 
)

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

Parameters
[in]fileobjFile object.
[in]unlim_dim_levelUnlimited dimension level.
[in]directoryDirectory to write restart file to.
[in]timestampModel time.
[in]filenameNew name for the file.
[in]ignore_checksumChecksum data integrity flag.

Definition at line 560 of file blackboxio.F90.

◆ save_domain_restart_wrap()

subroutine, public blackboxio::save_domain_restart_wrap ( type(fmsnetcdfdomainfile_t), intent(in), target  fileobj,
integer, intent(in), optional  unlim_dim_level,
character(len=*), intent(in), optional  directory,
character(len=*), intent(in), optional  timestamp,
character(len=*), intent(in), optional  filename,
character(len=*), intent(in), optional  nc_format 
)

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

Parameters
[in]fileobjFile object.
[in]unlim_dim_levelUnlimited dimension level.
[in]directoryDirectory to write restart file to.
[in]timestampModel time.
[in]filenameNew name for the file.
[in]nc_formatNetcdf format that new files are written as. Allowed values are: "64bit", "classic", or "netcdf4". Defaults to "64bit".

Definition at line 522 of file blackboxio.F90.

◆ tempfile()

subroutine blackboxio::tempfile ( character(len=*), intent(out)  filename)
private

Create a unique filename (poor man's version of mktemp).

Parameters
[out]filenameNew unique filename.

Definition at line 91 of file blackboxio.F90.

◆ unstructured_write_restart_wrap()

subroutine, public blackboxio::unstructured_write_restart_wrap ( type(fmsnetcdfunstructureddomainfile_t), intent(in)  fileobj,
integer, intent(in), optional  unlim_dim_level,
character(len=*), intent(in), optional  directory,
character(len=*), intent(in), optional  timestamp,
character(len=*), intent(in), optional  filename,
character(len=*), intent(in), optional  nc_format 
)

Wrapper to distinguish interfaces.

Parameters
[in]fileobjFile object.
[in]unlim_dim_levelUnlimited dimension level.
[in]directoryDirectory to write restart file to.
[in]timestampModel time.
[in]filenameNew name for the file.
[in]nc_formatNetcdf format that new files are written as. Allowed values are: "64bit", "classic", or "netcdf4". Defaults to "64bit".

Definition at line 648 of file blackboxio.F90.