MOM6
|
This module contains I/O framework code.
This file contains a number of subroutines that manipulate NetCDF files and handle input and output of fields. These subroutines, along with their purpose, are:
Data Types | |
interface | file_exists |
interface | mom_read_data |
type | vardesc |
Type for describing a variable, typically a tracer. More... | |
Functions/Subroutines | |
subroutine, public | create_file (unit, filename, vars, novars, fields, threading, timeunit, G, dG, GV) |
Routine creates a new NetCDF file. It also sets up structures that describe this file and variables that will later be written to this file. Type for describing a variable, typically a tracer. More... | |
subroutine, public | reopen_file (unit, filename, vars, novars, fields, threading, timeunit, G, dG, GV) |
This routine opens an existing NetCDF file for output. If it does not find the file, a new file is created. It also sets up structures that describe this file and the variables that will later be written to this file. More... | |
subroutine, public | read_axis_data (filename, axis_name, var) |
integer function, public | num_timelevels (filename, varname, min_dims) |
This function determines how many time levels a variable has. More... | |
type(vardesc) function, public | var_desc (name, units, longname, hor_grid, z_grid, t_grid, cmor_field_name, cmor_units, conversion, caller) |
Returns a vardesc type whose elements have been filled with the provided fields. The argument name is required, while the others are optional and have default values that are empty strings or are appropriate for a 3-d tracer field at the tracer cell centers. More... | |
subroutine, public | modify_vardesc (vd, name, units, longname, hor_grid, z_grid, t_grid, cmor_field_name, cmor_units, conversion, caller) |
This routine modifies the named elements of a vardesc type. All arguments are optional, except the vardesc type to be modified. More... | |
subroutine, public | query_vardesc (vd, name, units, longname, hor_grid, z_grid, t_grid, cmor_field_name, cmor_units, conversion, caller) |
This routine queries vardesc. More... | |
subroutine | safe_string_copy (str1, str2, fieldnm, caller) |
Copies a string. More... | |
character(len=len(name)) function, public | ensembler (name, ens_no_in) |
Returns a name with "%#E" or "%E" replaced with the ensemble member number. More... | |
logical function | mom_file_exists (file_name, MOM_Domain) |
Returns true if the named file or its domain-decomposed variant exists. More... | |
subroutine | mom_read_data_1d (filename, fieldname, data) |
This function uses the fms_io function read_data to read 1-D data field named "fieldname" from file "filename". More... | |
subroutine | mom_read_data_2d (filename, fieldname, data, MOM_Domain, timelevel, position) |
This function uses the fms_io function read_data to read a distributed 2-D data field named "fieldname" from file "filename". Valid values for "position" include CORNER, CENTER, EAST_FACE and NORTH_FACE. More... | |
subroutine | mom_read_data_3d (filename, fieldname, data, MOM_Domain, timelevel, position) |
This function uses the fms_io function read_data to read a distributed 2-D data field named "fieldname" from file "filename". Valid values for "position" include CORNER, CENTER, EAST_FACE and NORTH_FACE. More... | |
subroutine, public | mom_io_init (param_file) |
Initialize the MOM_io module. More... | |
subroutine, public mom_io::create_file | ( | integer, intent(out) | unit, |
character(len=*), intent(in) | filename, | ||
type(vardesc), dimension(:), intent(in) | vars, | ||
integer, intent(in) | novars, | ||
type(fieldtype), dimension(:), intent(inout) | fields, | ||
integer, intent(in), optional | threading, | ||
real, intent(in), optional | timeunit, | ||
type(ocean_grid_type), intent(in), optional | G, | ||
type(dyn_horgrid_type), intent(in), optional | dG, | ||
type(verticalgrid_type), intent(in), optional | GV | ||
) |
Routine creates a new NetCDF file. It also sets up structures that describe this file and variables that will later be written to this file. Type for describing a variable, typically a tracer.
[out] | unit | unit id of an open file or -1 on a nonwriting PE with single file output |
[in] | filename | full path to the file to create |
[in] | vars | structures describing fields written to filename |
[in] | novars | number of fields written to filename |
[in,out] | fields | array of fieldtypes for each variable |
[in] | threading | SINGLE_FILE or MULTIPLE |
[in] | timeunit | length, in seconds, of the units for time. The default value is 86400.0, for 1 day. |
[in] | g | ocean horizontal grid structure; G or dG is required if the new file uses any horizontal grid axes. |
[in] | dg | dynamic horizontal grid structure; G or dG is required if the new file uses any horizontal grid axes. |
[in] | gv | ocean vertical grid structure, which is required if the new file uses any vertical grid axes. |
Definition at line 82 of file MOM_io.F90.
References mom_error_handler::mom_error().
Referenced by mom_ale::ale_writecoordinatefile(), and reopen_file().
character(len=len(name)) function, public mom_io::ensembler | ( | character(len=*), intent(in) | name, |
integer, intent(in), optional | ens_no_in | ||
) |
Returns a name with "%#E" or "%E" replaced with the ensemble member number.
Definition at line 724 of file MOM_io.F90.
References mom_error_handler::mom_error().
subroutine, public mom_io::modify_vardesc | ( | type(vardesc), intent(inout) | vd, |
character(len=*), intent(in), optional | name, | ||
character(len=*), intent(in), optional | units, | ||
character(len=*), intent(in), optional | longname, | ||
character(len=*), intent(in), optional | hor_grid, | ||
character(len=*), intent(in), optional | z_grid, | ||
character(len=*), intent(in), optional | t_grid, | ||
character(len=*), intent(in), optional | cmor_field_name, | ||
character(len=*), intent(in), optional | cmor_units, | ||
real, intent(in), optional | conversion, | ||
character(len=*), intent(in), optional | caller | ||
) |
This routine modifies the named elements of a vardesc type. All arguments are optional, except the vardesc type to be modified.
[in,out] | vd | vardesc type that is modified |
[in] | name | name of variable |
[in] | units | units of variable |
[in] | longname | long name of variable |
[in] | hor_grid | horizonal staggering of variable |
[in] | z_grid | vertical staggering of variable |
[in] | t_grid | time description: s, p, or 1 |
[in] | cmor_field_name | CMOR name |
[in] | cmor_units | CMOR physical dimensions of variable |
[in] | conversion | for unit conversions, such as needed to convert from intensive to extensive |
[in] | caller | calling routine? |
Definition at line 623 of file MOM_io.F90.
References safe_string_copy().
Referenced by mom_diag_to_z::ocean_register_diag_with_z(), and var_desc().
|
private |
Returns true if the named file or its domain-decomposed variant exists.
Definition at line 782 of file MOM_io.F90.
subroutine, public mom_io::mom_io_init | ( | type(param_file_type), intent(in) | param_file | ) |
Initialize the MOM_io module.
[in] | param_file | structure indicating the open file to parse for model parameter values. |
Definition at line 840 of file MOM_io.F90.
|
private |
This function uses the fms_io function read_data to read 1-D data field named "fieldname" from file "filename".
Definition at line 798 of file MOM_io.F90.
|
private |
This function uses the fms_io function read_data to read a distributed 2-D data field named "fieldname" from file "filename". Valid values for "position" include CORNER, CENTER, EAST_FACE and NORTH_FACE.
Definition at line 811 of file MOM_io.F90.
|
private |
This function uses the fms_io function read_data to read a distributed 2-D data field named "fieldname" from file "filename". Valid values for "position" include CORNER, CENTER, EAST_FACE and NORTH_FACE.
Definition at line 827 of file MOM_io.F90.
integer function, public mom_io::num_timelevels | ( | character(len=*), intent(in) | filename, |
character(len=*), intent(in) | varname, | ||
integer, intent(in), optional | min_dims | ||
) |
This function determines how many time levels a variable has.
[in] | filename | name of the file to read |
[in] | varname | variable whose number of time levels are to be returned |
[in] | min_dims | The minimum number of dimensions a variable must have if it has a time dimension. If the variable has 1 less dimension than this, then 0 is returned. |
Definition at line 463 of file MOM_io.F90.
References mom_string_functions::lowercase(), and mom_error_handler::mom_error().
subroutine, public mom_io::query_vardesc | ( | type(vardesc), intent(in) | vd, |
character(len=*), intent(out), optional | name, | ||
character(len=*), intent(out), optional | units, | ||
character(len=*), intent(out), optional | longname, | ||
character(len=*), intent(out), optional | hor_grid, | ||
character(len=*), intent(out), optional | z_grid, | ||
character(len=*), intent(out), optional | t_grid, | ||
character(len=*), intent(out), optional | cmor_field_name, | ||
character(len=*), intent(out), optional | cmor_units, | ||
real, intent(out), optional | conversion, | ||
character(len=*), intent(in), optional | caller | ||
) |
This routine queries vardesc.
[in] | vd | vardesc type that is queried |
[out] | name | name of variable |
[out] | units | units of variable |
[out] | longname | long name of variable |
[out] | hor_grid | horiz staggering of variable |
[out] | z_grid | vert staggering of variable |
[out] | t_grid | time description: s, p, or 1 |
[out] | cmor_field_name | CMOR name |
[out] | cmor_units | CMOR physical dimensions of variable |
[out] | conversion | for unit conversions, such as needed to convert from intensive to extensive |
[in] | caller | calling routine? |
Definition at line 664 of file MOM_io.F90.
References safe_string_copy().
Referenced by advection_test_tracer::advection_test_stock(), boundary_impulse_tracer::boundary_impulse_stock(), ideal_age_example::ideal_age_stock(), advection_test_tracer::initialize_advection_test_tracer(), boundary_impulse_tracer::initialize_boundary_impulse_tracer(), dome_tracer::initialize_dome_tracer(), regional_dyes::initialize_dye_tracer(), ideal_age_example::initialize_ideal_age_tracer(), isomip_tracer::initialize_isomip_tracer(), mom_ocmip2_cfc::initialize_ocmip2_cfc(), oil_tracer::initialize_oil_tracer(), pseudo_salt_tracer::initialize_pseudo_salt_tracer(), mom_diag_mediator::ocean_register_diag(), mom_diag_to_z::ocean_register_diag_with_z(), mom_ocmip2_cfc::ocmip2_cfc_stock(), pseudo_salt_tracer::pseudo_salt_stock(), boundary_impulse_tracer::register_boundary_impulse_tracer(), regional_dyes::register_dye_tracer(), ideal_age_example::register_ideal_age_tracer(), oil_tracer::register_oil_tracer(), pseudo_salt_tracer::register_pseudo_salt_tracer(), mom_tracer_registry::register_tracer(), mom_diag_to_z::register_z_diag(), mom_diag_to_z::register_zint_diag(), user_tracer_example::user_initialize_tracer(), and user_tracer_example::user_tracer_stock().
subroutine, public mom_io::read_axis_data | ( | character(len=*), intent(in) | filename, |
character(len=*), intent(in) | axis_name, | ||
real, dimension(:), intent(out) | var | ||
) |
Definition at line 424 of file MOM_io.F90.
References mom_error_handler::mom_error().
subroutine, public mom_io::reopen_file | ( | integer, intent(out) | unit, |
character(len=*), intent(in) | filename, | ||
type(vardesc), dimension(:), intent(in) | vars, | ||
integer, intent(in) | novars, | ||
type(fieldtype), dimension(:), intent(inout) | fields, | ||
integer, intent(in), optional | threading, | ||
real, intent(in), optional | timeunit, | ||
type(ocean_grid_type), intent(in), optional | G, | ||
type(dyn_horgrid_type), intent(in), optional | dG, | ||
type(verticalgrid_type), intent(in), optional | GV | ||
) |
This routine opens an existing NetCDF file for output. If it does not find the file, a new file is created. It also sets up structures that describe this file and the variables that will later be written to this file.
[out] | unit | unit id of an open file or -1 on a nonwriting PE with single file output |
[in] | filename | full path to the file to create |
[in] | vars | structures describing fields written to filename |
[in] | novars | number of fields written to filename |
[in,out] | fields | array of fieldtypes for each variable |
[in] | threading | SINGLE_FILE or MULTIPLE |
[in] | timeunit | length, in seconds, of the units for time. The default value is 86400.0, for 1 day. |
[in] | g | ocean horizontal grid structure; G or dG is required if a new file uses any horizontal grid axes. |
[in] | dg | dynamic horizontal grid structure; G or dG is required if a new file uses any horizontal grid axes. |
[in] | gv | ocean vertical grid structure, which is required if a new file uses any vertical grid axes. |
Definition at line 337 of file MOM_io.F90.
References create_file(), and mom_error_handler::mom_error().
|
private |
Copies a string.
Definition at line 705 of file MOM_io.F90.
References mom_error_handler::mom_error().
Referenced by modify_vardesc(), query_vardesc(), and var_desc().
type(vardesc) function, public mom_io::var_desc | ( | character(len=*), intent(in) | name, |
character(len=*), intent(in), optional | units, | ||
character(len=*), intent(in), optional | longname, | ||
character(len=*), intent(in), optional | hor_grid, | ||
character(len=*), intent(in), optional | z_grid, | ||
character(len=*), intent(in), optional | t_grid, | ||
character(len=*), intent(in), optional | cmor_field_name, | ||
character(len=*), intent(in), optional | cmor_units, | ||
real, intent(in), optional | conversion, | ||
character(len=*), intent(in), optional | caller | ||
) |
Returns a vardesc type whose elements have been filled with the provided fields. The argument name is required, while the others are optional and have default values that are empty strings or are appropriate for a 3-d tracer field at the tracer cell centers.
[in] | name | variable name |
[in] | units | variable units |
[in] | longname | variable long name |
[in] | hor_grid | variable horizonal staggering |
[in] | z_grid | variable vertical staggering |
[in] | t_grid | time description: s, p, or 1 |
[in] | cmor_field_name | CMOR name |
[in] | cmor_units | CMOR physical dimensions of variable |
[in] | conversion | for unit conversions, such as needed to convert from intensive to extensive |
[in] | caller | calling routine? |
Definition at line 585 of file MOM_io.F90.
References modify_vardesc(), and safe_string_copy().
Referenced by mom_diabatic_driver::diabatic_driver_init(), mom_meke::meke_alloc_register_restart(), mom_mixed_layer_restrat::mixedlayer_restrat_register_restarts(), advection_test_tracer::register_advection_test_tracer(), mom_barotropic::register_barotropic_restarts(), boundary_impulse_tracer::register_boundary_impulse_tracer(), mom_controlled_forcing::register_ctrl_forcing_restarts(), dome_tracer::register_dome_tracer(), regional_dyes::register_dye_tracer(), ideal_age_example::register_ideal_age_tracer(), isomip_tracer::register_isomip_tracer(), mom_ocmip2_cfc::register_ocmip2_cfc(), oil_tracer::register_oil_tracer(), pseudo_salt_tracer::register_pseudo_salt_tracer(), mom_set_visc::set_visc_register_restarts(), user_tracer_example::user_register_tracer_example(), mom_shared_initialization::write_ocean_geometry_file(), and mom_coord_initialization::write_vertgrid_file().