MOM_string_functions module reference
Handy functions for manipulating strings
Functions/Subroutines
Return a string in which all uppercase letters have been replaced by their lowercase counterparts. |
|
Return a string in which all uppercase letters have been replaced by their lowercase counterparts. |
|
Returns a character string of a left-formatted integer e.g. "123 " (assumes 19 digit maximum) |
|
Returns a character string of a comma-separated, compact formatted, integers e.g. "1, 2, 3, 4" |
|
Returns a left-justified string with a real formatted like '(G)' |
|
Returns a character string of a comma-separated, compact formatted, reals e.g. "1., 2., 5*3., 5.E2" |
|
Returns True if the string can be read/parsed to give the exact value of "val" |
|
Returns the string corresponding to the nth word in the argument or "" if the string is not long enough. Both spaces and commas are interpreted as separators. |
|
Returns the string corresponding to the nth word in the argument or "" if the string is not long enough. Words are delineated by the mandatory separators argument. |
|
Returns the integer corresponding to the nth word in the argument. |
|
Returns the real corresponding to the nth word in the argument, in arbitrary units [A]. |
|
Returns string with all spaces removed. |
|
Returns true if a unit test of string_functions fails. |
|
True if str1 does not match str2. False otherwise. |
|
True if i1 is not equal to i2. False otherwise. |
|
True if r1 is not equal to r2. False otherwise. |
|
Returns a directory name that is terminated with a "/" or "./" if the argument is an empty string. |
|
Returns a left-adjusted string with trailing blanks and commas removed. |
|
Convert the first n elements (3 by default) of an integer array into an underscore delimited string. |
Detailed Description
By Alistair Adcroft and Robert Hallberg, last updated Sept. 2013.
The functions here perform a set of useful manipulations of character strings. Although they are a part of MOM6, the do not require any other MOM software to be useful.
Functions/Subroutine Documentation
- function lowercase(input_string)
Return a string in which all uppercase letters have been replaced by their lowercase counterparts.
- Parameters
input_string [in]
The string to modify
lowercase
The modified output string
Callers call graph
Text view
basin_builder::basin_builder_topography → mom_string_functions::lowercase
mom_diag_remap::diag_remap_configure_axes → mom_string_functions::lowercase
mom_interp_infra::init_extern_field → mom_string_functions::lowercase
mom_oda_driver_mod::init_oda → mom_string_functions::lowercase
mom_open_boundary::register_obgc_segments → mom_string_functions::lowercase
mom_restart::restore_state → mom_string_functions::lowercase
mom_self_attr_load::sal_init → mom_string_functions::lowercase
mom_state_initialization::initialize_sponges_file::separate_idamp_for_uv → mom_string_functions::lowercase
mom_state_initialization::mom_initialize_obcs → mom_string_functions::lowercase
mom_tidal_mixing::tidal_mixing_init → mom_string_functions::lowercase
mom_tracer_registry::register_tracer → mom_string_functions::lowercase
mom_tracer_registry::register_tracer_diagnostics → mom_string_functions::lowercase
mom_tracer_registry::tracer_name_lookup → mom_string_functions::lowercase
- function uppercase(input_string)
Return a string in which all uppercase letters have been replaced by their lowercase counterparts.
- Parameters
input_string [in]
The string to modify
uppercase
The modified output string
Callers call graph
Text view
mom_coriolisadv::coriolisadv_init → mom_string_functions::uppercase
mom_energetic_pbl::energetic_pbl_init → mom_string_functions::uppercase
mom_internal_tides::internal_tides_init → mom_string_functions::uppercase
mom_is_diag_mediator::mom_is_diag_mediator_init → mom_string_functions::uppercase
mom_open_boundary::register_segment_tracer → mom_string_functions::uppercase
mom_open_boundary::scale_factor_from_name → mom_string_functions::uppercase
mom_open_boundary::segment_thickness_reservoir_init → mom_string_functions::uppercase
mom_remapping::setreconstructiontype → mom_string_functions::uppercase
mom_shared_initialization::read_face_length_list → mom_string_functions::uppercase
mom_shared_initialization::reset_face_lengths_list → mom_string_functions::uppercase
mom_surface_forcing::wind_forcing_from_file → mom_string_functions::uppercase
mom_tidal_mixing::read_tidal_energy → mom_string_functions::uppercase
mom_tidal_mixing::tidal_mixing_init → mom_string_functions::uppercase
regrid_consts::coordinatemode → mom_string_functions::uppercase
regrid_interp::interpolation_scheme → mom_string_functions::uppercase
- function left_int(i)
Returns a character string of a left-formatted integer e.g. "123 " (assumes 19 digit maximum)
- Parameters
i [in]
The integer to convert to a string
left_int
The output string
Callers call graph
- function left_ints(i)
Returns a character string of a comma-separated, compact formatted, integers e.g. "1, 2, 3, 4"
- Parameters
i [in]
The array of integers to convert to a string
left_ints
The output string
- function left_real(val)
Returns a left-justified string with a real formatted like '(G)'
- Parameters
val [in]
The real variable to convert to a string, in arbitrary units [A]
left_real
The output string
Callees call graph
- function left_reals(r, sep)
Returns a character string of a comma-separated, compact formatted, reals e.g. "1., 2., 5*3., 5.E2"
- Parameters
r [in]
The array of real variables to convert to a string, in arbitrary units [A]
sep [in]
The separator between successive values, by default it is ', '.
left_reals
The output string
Callees call graph
- function isFormattedFloatEqualTo(str, val)
Returns True if the string can be read/parsed to give the exact value of "val"
- Parameters
str [in]
The string to parse
val [in]
The real value to compare with, in arbitrary units [A]
Callers call graph
- character(len=120) function extractWord(string, n)
Returns the string corresponding to the nth word in the argument or "" if the string is not long enough. Both spaces and commas are interpreted as separators.
- Parameters
string [in]
The string to scan
n [in]
Number of word to extract
Callers call graph
Text view
mom_diag_remap::diag_remap_init → mom_string_functions::extractword
mom_int_tide_input::int_tide_input_init → mom_string_functions::extractword
mom_regridding::initialize_regridding → mom_string_functions::extractword
mom_string_functions::string_functions_unit_tests → mom_string_functions::extractword
- character(len=120) function extract_word(string, separators, n)
Returns the string corresponding to the nth word in the argument or "" if the string is not long enough. Words are delineated by the mandatory separators argument.
- Parameters
string [in]
String to scan
separators [in]
Characters to use for delineation
n [in]
Number of word to extract
Callers call graph
Text view
mom_open_boundary::parse_segment_data_str → mom_string_functions::extract_word
mom_open_boundary::parse_segment_manifest_str → mom_string_functions::extract_word
mom_open_boundary::parse_segment_str → mom_string_functions::extract_word
mom_string_functions::extract_integer → mom_string_functions::extract_word
mom_string_functions::extract_real → mom_string_functions::extract_word
mom_string_functions::extractword → mom_string_functions::extract_word
mom_string_functions::string_functions_unit_tests → mom_string_functions::extract_word
- integer function extract_integer(string, separators, n, missing_value)
Returns the integer corresponding to the nth word in the argument.
- Parameters
string [in]
String to scan
separators [in]
Characters to use for delineation
n [in]
Number of word to extract
missing_value [in]
Value to assign if word is missing
Callees call graph
- real function extract_real(string, separators, n, missing_value)
Returns the real corresponding to the nth word in the argument, in arbitrary units [A].
- Parameters
string [in]
String to scan
separators [in]
Characters to use for delineation
n [in]
Number of word to extract
missing_value [in]
Value to assign if word is missing, in arbitrary units [A]
Callees call graph
- character(len=120) function remove_spaces(string)
Returns string with all spaces removed.
- Parameters
string [in]
String to scan
- logical function string_functions_unit_tests(verbose)
Returns true if a unit test of string_functions fails.
- Parameters
verbose [in]
If true, write results to stdout
Callees call graph
Text view
mom_string_functions::string_functions_unit_tests → mom_string_functions::extract_integer
mom_string_functions::string_functions_unit_tests → mom_string_functions::extract_real
mom_string_functions::string_functions_unit_tests → mom_string_functions::extract_word
mom_string_functions::string_functions_unit_tests → mom_string_functions::extractword
mom_string_functions::string_functions_unit_tests → mom_string_functions::ints_to_string
mom_string_functions::string_functions_unit_tests → mom_string_functions::left_int
mom_string_functions::string_functions_unit_tests → mom_string_functions::left_ints
mom_string_functions::string_functions_unit_tests → mom_string_functions::left_real
mom_string_functions::string_functions_unit_tests → mom_string_functions::left_reals
mom_string_functions::string_functions_unit_tests → mom_string_functions::localtesti
mom_string_functions::string_functions_unit_tests → mom_string_functions::localtestr
mom_string_functions::string_functions_unit_tests → mom_string_functions::localtests
mom_string_functions::string_functions_unit_tests → mom_string_functions::remove_spaces
mom_string_functions::string_functions_unit_tests → mom_string_functions::trim_trailing_commas
Callers call graph
- logical function localTestS(verbose, str1, str2)
True if str1 does not match str2. False otherwise.
- Parameters
verbose [in]
If true, write results to stdout
str1 [in]
String
str2 [in]
String
Callers call graph
- logical function localTestI(verbose, i1, i2)
True if i1 is not equal to i2. False otherwise.
- Parameters
verbose [in]
If true, write results to stdout
i1 [in]
Integer
i2 [in]
Integer
Callers call graph
- logical function localTestR(verbose, r1, r2)
True if r1 is not equal to r2. False otherwise.
- Parameters
verbose [in]
If true, write results to stdout
r1 [in]
The first value to compare, in arbitrary units [A]
r2 [in]
The first value to compare, in arbitrary units [A]
Callers call graph
- function slasher(dir)
Returns a directory name that is terminated with a "/" or "./" if the argument is an empty string.
- Parameters
dir [in]
A directory to be terminated with a "/" or changed to "./" if it is blank.
Callers call graph
Text view
advection_test_tracer::register_advection_test_tracer → mom_string_functions::slasher
dome_tracer::register_dome_tracer → mom_string_functions::slasher
dyed_obc_tracer::register_dyed_obc_tracer → mom_string_functions::slasher
ideal_age_example::register_ideal_age_tracer → mom_string_functions::slasher
isomip_initialization::isomip_initialize_sponges → mom_string_functions::slasher
isomip_tracer::register_isomip_tracer → mom_string_functions::slasher
marbl_tracers::register_marbl_tracers → mom_string_functions::slasher
meso_surface_forcing::meso_surface_forcing_init → mom_string_functions::slasher
mom_barotropic::barotropic_init → mom_string_functions::slasher
mom_cfc_cap::register_cfc_cap → mom_string_functions::slasher
mom_coord_initialization::set_coord_from_file → mom_string_functions::slasher
mom_coord_initialization::set_coord_from_ts_profile → mom_string_functions::slasher
mom_diabatic_aux::diabatic_aux_init → mom_string_functions::slasher
mom_diag_mediator::diag_mediator_init → mom_string_functions::slasher
mom_domains::mom_domains_init → mom_string_functions::slasher
mom_file_parser::open_param_file → mom_string_functions::slasher
mom_geothermal::geothermal_init → mom_string_functions::slasher
mom_get_input::get_mom_input → mom_string_functions::slasher
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_string_functions::slasher
mom_hybgen_regrid::init_hybgen_regrid → mom_string_functions::slasher
mom_ice_shelf::initialize_ice_shelf → mom_string_functions::slasher
mom_ice_shelf::initialize_ice_smb → mom_string_functions::slasher
mom_ice_shelf::initialize_shelf_mass → mom_string_functions::slasher
mom_ice_shelf_dynamics::initialize_ice_shelf_dyn → mom_string_functions::slasher
mom_ice_shelf_initialize::initialize_ice_aglen → mom_string_functions::slasher
mom_ice_shelf_initialize::initialize_ice_c_basal_friction → mom_string_functions::slasher
mom_ice_shelf_initialize::initialize_ice_flow_from_file → mom_string_functions::slasher
mom_ice_shelf_initialize::initialize_ice_shelf_boundary_from_file → mom_string_functions::slasher
mom_ice_shelf_initialize::initialize_ice_thickness_from_file → mom_string_functions::slasher
mom_int_tide_input::int_tide_input_init → mom_string_functions::slasher
mom_internal_tides::internal_tides_init → mom_string_functions::slasher
mom_is_diag_mediator::mom_is_diag_mediator_init → mom_string_functions::slasher
mom_mixed_layer_restrat::mixedlayer_restrat_init → mom_string_functions::slasher
mom_ocmip2_cfc::register_ocmip2_cfc → mom_string_functions::slasher
mom_oda_driver_mod::init_oda → mom_string_functions::slasher
mom_open_boundary::initialize_segment_data → mom_string_functions::slasher
mom_regridding::initialize_regridding → mom_string_functions::slasher
mom_self_attr_load::sal_init → mom_string_functions::slasher
mom_set_diffusivity::set_diffusivity_init → mom_string_functions::slasher
mom_shared_initialization::apply_topography_edits_from_file → mom_string_functions::slasher
mom_shared_initialization::initialize_topography_from_file → mom_string_functions::slasher
mom_shared_initialization::reset_face_lengths_file → mom_string_functions::slasher
mom_shared_initialization::reset_face_lengths_list → mom_string_functions::slasher
mom_shared_initialization::set_meansl_from_file → mom_string_functions::slasher
mom_shared_initialization::set_subgrid_topo_at_vel_from_file → mom_string_functions::slasher
mom_state_initialization::depress_surface → mom_string_functions::slasher
mom_state_initialization::initialize_oda_incupd_file → mom_string_functions::slasher
mom_state_initialization::initialize_sponges_file → mom_string_functions::slasher
mom_state_initialization::initialize_temp_salt_from_file → mom_string_functions::slasher
mom_state_initialization::initialize_temp_salt_from_profile → mom_string_functions::slasher
mom_state_initialization::initialize_thickness_from_file → mom_string_functions::slasher
mom_state_initialization::initialize_thickness_list → mom_string_functions::slasher
mom_state_initialization::initialize_velocity_from_file → mom_string_functions::slasher
mom_state_initialization::mom_initialize_state → mom_string_functions::slasher
mom_state_initialization::mom_temp_salt_initialize_from_z → mom_string_functions::slasher
mom_state_initialization::trim_for_ice → mom_string_functions::slasher
mom_sum_output::mom_sum_output_init → mom_string_functions::slasher
mom_surface_forcing::surface_forcing_init → mom_string_functions::slasher
mom_thickness_diffuse::thickness_diffuse_init → mom_string_functions::slasher
mom_tidal_mixing::tidal_mixing_init → mom_string_functions::slasher
mom_vert_friction::vertvisc_init → mom_string_functions::slasher
oil_tracer::register_oil_tracer → mom_string_functions::slasher
rgc_initialization::rgc_initialize_sponges → mom_string_functions::slasher
rgc_tracer::register_rgc_tracer → mom_string_functions::slasher
user_tracer_example::user_register_tracer_example → mom_string_functions::slasher
- function trim_trailing_commas(in_str) result(out_str)
Returns a left-adjusted string with trailing blanks and commas removed.
- Parameters
in_str [in]
A string that is to be left adjusted and have its trailing commas and white space removed.
out_str
A left-adjusted version of in_str with trailing commas and white space removed
Callers call graph
Text view
mom_diag_mediator::register_diag_field → mom_string_functions::trim_trailing_commas
mom_diag_mediator::register_static_field → mom_string_functions::trim_trailing_commas
mom_is_diag_mediator::register_mom_is_diag_field → mom_string_functions::trim_trailing_commas
mom_is_diag_mediator::register_mom_is_static_field → mom_string_functions::trim_trailing_commas
mom_string_functions::string_functions_unit_tests → mom_string_functions::trim_trailing_commas
- function ints_to_string(a, n) result(i2s)
Convert the first n elements (3 by default) of an integer array into an underscore delimited string.
- Parameters
a [in]
The array of integers to translate
n [in]
The number of elements to translate, by default the lesser of 3 or all of the integers
i2s
The returned underscore delimited string of integers
Callers call graph
Text view
mom_diag_mediator::define_axes_group → mom_string_functions::ints_to_string
mom_diag_mediator::define_axes_group_dsamp → mom_string_functions::ints_to_string
mom_is_diag_mediator::define_axes_group → mom_string_functions::ints_to_string
mom_string_functions::string_functions_unit_tests → mom_string_functions::ints_to_string