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. |
|
Returns a character string of a comma-separated, compact formatted, integers e.g. |
|
Returns a left-justified string with a real formatted like ‘(G)’. |
|
Returns a character string of a comma-separated, compact formatted, reals e.g. |
|
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. |
|
Returns the string corresponding to the nth word in the argument or “” if the string is not long enough. |
|
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. |
|
True if i1 is not equal to i2. |
|
True if r1 is not equal to r2. |
|
Returns a directory name that is terminated with a “/” or “./” if the argument is an empty 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.
Function/Subroutine Documentation¶
-
function
mom_string_functions/
lowercase
(input_string) [character(len=len(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
- Return:
undefined :: The modified output string
- Called from:
basin_builder::basin_builder_topography
mom_io::cmor_long_std
mom_io::create_mom_file
mom_diag_remap::diag_remap_configure_axes
mom_io::get_varid
mom_oda_driver_mod::init_oda
mom_meke::meke_init
mom_state_initialization::mom_initialize_state
mom_tracer_registry::register_tracer
mom_tracer_registry::register_tracer_diagnostics
mom_restart::restore_state
mom_is_diag_mediator::set_is_axes_info
mom_tidal_mixing::tidal_mixing_init
mom_tracer_registry::tracer_name_lookup
-
function
mom_string_functions/
uppercase
(input_string) [character(len=len(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
- Return:
undefined :: The modified output string
- Called from:
regrid_consts::coordinatemode
mom_coriolisadv::coriolisadv_init
mom_energetic_pbl::energetic_pbl_init
regrid_interp::interpolation_scheme
mom6
mom_is_diag_mediator::mom_is_diag_mediator_init
ocean_model_mod::ocean_model_init
mom_opacity::opacity_init
mom_shared_initialization::read_face_length_list
mom_tidal_mixing::read_tidal_energy
mom_shared_initialization::reset_face_lengths_list
mom_open_boundary::scale_factor_from_name
mom_remapping::setreconstructiontype
mom_surface_forcing_gfdl::surface_forcing_init
mom_tidal_mixing::tidal_mixing_init
mom_surface_forcing::wind_forcing_from_file
-
function
mom_string_functions/
left_int
(i) [character(len=19)]¶ 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
- Return:
undefined :: The output string
- Called from:
-
function
mom_string_functions/
left_ints
(i) [character(len=1320)]¶ 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
- Return:
undefined :: The output string
- Call to:
- Called from:
-
function
mom_string_functions/
left_real
(val) [character(len=32)]¶ 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]
- Return:
undefined :: The output string
- Call to:
- Called from:
-
function
mom_string_functions/
left_reals
(r, sep) [character(len=:)]¶ 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 ‘, ‘.
- Return:
undefined :: The output string
- Call to:
- Called from:
-
function
mom_string_functions/
isformattedfloatequalto
(str, val) [logical]¶ 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]
- Called from:
-
function
mom_string_functions/
extractword
(string, n) [character(len=120)]¶ 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
- Call to:
- Called from:
mom_diag_remap::diag_remap_init
mom_regridding::initialize_regridding
mom_int_tide_input::int_tide_input_init
string_functions_unit_tests
-
function
mom_string_functions/
extract_word
(string, separators, n) [character(len=120)]¶ 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
- Called from:
extract_integer
extract_real
extractword
mom_open_boundary::parse_segment_data_str
mom_open_boundary::parse_segment_manifest_str
mom_open_boundary::parse_segment_str
string_functions_unit_tests
-
function
mom_string_functions/
extract_integer
(string, separators, n, missing_value) [integer]¶ 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
- Call to:
- Called from:
mom_regridding::initialize_regridding
string_functions_unit_tests
-
function
mom_string_functions/
extract_real
(string, separators, n, missing_value) [real]¶ 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]
- Call to:
- Called from:
mom_regridding::initialize_regridding
mom_internal_tides::internal_tides_init
string_functions_unit_tests
-
function
mom_string_functions/
remove_spaces
(string) [character(len=120)]¶ Returns string with all spaces removed.
- Parameters:
string :: [in] String to scan
- Called from:
mom_open_boundary::open_boundary_config
string_functions_unit_tests
-
function
mom_string_functions/
string_functions_unit_tests
(verbose) [logical]¶ Returns true if a unit test of string_functions fails.
- Parameters:
verbose :: [in] If true, write results to stdout
- Call to:
extract_integer
extract_real
extract_word
extractword
left_int
left_ints
left_real
left_reals
localtesti
localtestr
localtests
remove_spaces
- Called from:
-
function
mom_string_functions/
localtests
(verbose, str1, str2) [logical]¶ True if str1 does not match str2. False otherwise.
- Parameters:
verbose :: [in] If true, write results to stdout
str1 :: [in] String
str2 :: [in] String
- Called from:
-
function
mom_string_functions/
localtesti
(verbose, i1, i2) [logical]¶ 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
- Called from:
-
function
mom_string_functions/
localtestr
(verbose, r1, r2) [logical]¶ 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]
- Called from:
-
function
mom_string_functions/
slasher
(dir) [character(len=len(dir)+2)]¶ 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.
- Called from:
mom_hybgen_regrid::init_hybgen_regrid
mom_domains::mom_domains_init
mom_is_diag_mediator::mom_is_diag_mediator_init
mom_coord_initialization::set_coord_from_file
mom_coord_initialization::set_coord_from_ts_profile