TAG_VALUE
Name
TAG_VALUE
Purpose
Return the value for a given structure or hash tag.
Category
Calling Sequence
val = tag_value(ss, tag)
Inputs
ss = given structure or hash. in
tag = given tag(s) or key(s). in
Keyword Parameters
Keywords
INDEX=in Index where tag is found (-1 if none).
Only indexes the level referenced by the compound tag.
Could access value as val=ss.(in) if a structure.
Also works for hashes but indirectly through an array
of hash keys at the referenced level.
MINLEN=mn Minimum tag length to match (def=exact match).
SS may have the tag abbreviated down to mn characters.
(But tag must be at least as long as appears in ss).
TRUNCATE=len Length to optionally truncate SS tag names to.
First match, if any, of truncated tags will be returned.
So tag of 'GRIB_PAT' and TRUNCATE=8 will match
'GRIB_PAT_00Z' or 'GRIB_PAT_12Z' if they are in SS.
ERROR=err Error flag: 0=ok, else tag not found.
On error returned value is a null string.
Outputs
val = returned value. out
Common Blocks
Notes
Notes: The word tag means structure tag or hash key here.
Tag may be a compound tag to access any item in a
nested structure. For example:
tag = 'tag1.tag2.tag3' to access value of ss.tag1.tag2.tag3
Nesting may mix structures and hashes.
Modification History
R. Sterner, 2004 May 05
R. Sterner, 2006 Sep 27 --- Added MINLEN.
R. Sterner, 2008 Oct 24 --- Added INDEX=in.
R. Sterner, 2009 Mar 27 --- Added TRUNCATE=len.
R. Sterner, 2011 Jul 11 --- Now gives error if ss undefined.
R. Sterner, 2012 Aug 10 --- Allowed compound tags for nested structures.
R. Sterner, 2012 Aug 13 --- Now works for structures or hashes.
R. Sterner, 2013 Mar 19 --- Now returns error if input undefined.
Copyright (C) 2004, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.