./
pp_getcubeheadervalue.pro
Routines
top source pp_getcubeheadervalue
result = pp_getcubeheadervalue(header, key [, not_trimmed=not_trimmed] [, count=count] [, fold_case=fold_case] [, lines=lines] [, unquote=unquote] [, sel=sel], continueblank=continueblank)
Retrieves the value of the given key from the given header in ISIS cube format.
Return value
A string scalar or vector (depending on the value being scalar or not) with the value of the given key from the header. If not found, returns 0. If the value is a quoted string, the quotes are not removed.
Parameters
- header in required
A string array where each element is one line of an ISIS cube.
- key in required
A string scalar with the key to be retrieved. Regular expression metacharacters must be escaped.
Keywords
- not_trimmed in optional default=0
This routine needs that each line of the header is trimmed from whitespaces on both sides. If the provided header is not trimmed, set this keyword so that it will be trimmed before processing (the input variable is unchanged). This option exists to save repeated trimming on multiple queries of the same header, in which case it should be trimmed before the multiple calls of this routine, for better efficiency.
- count out optional
The number of occurences of the key found in the header. If more than 1 is found, the last occurence is used by default. Check this value to determine if the key was not found (count will be 0 in that case).
- fold_case in optional
Passed to stregex when searching for the key. If set, capitalization of the key is ignored.
- lines out optional
The line index (starting at zero) of the line in the header that provided the retrieved value. If valued spanned more than one line, this is a vector with the indexes of all such lines. If key not found, -1 is returned.
- unquote in optional
If set, enclosing quotes are removed from the return values
- sel in optional
In case more than one ocurrence of a keyword is found, sel gives the index of the ocurrence to use (starts at 0). If not set, the last ocurrence is the one used.
- continueblank
Examples
Make a simple example header:
head=strarr(3)
head[0]='BAND_SUFFIX_NAME = (LATITUDE,LONGITUDE,SAMPLE_RESOLUTION,LINE_RESOLUTION,'
head[1]='PHASE_ANGLE,INCIDENCE_ANGLE,EMISSION_ANGLE,NORTH_AZIMUTH)'
head[2]='START_TIME = "2007-084T10:00:57.286Z"'
print,pp_getcubeheadervalue(head,'BAND_SUFFIX_NAME')
;LATITUDE LONGITUDE SAMPLE_RESOLUTION LINE_RESOLUTION PHASE_ANGLE INCIDENCE_ANGLE EMISSION_ANGLE NORTH_AZIMUTH
print,pp_getcubeheadervalue(head,'START_TIME')
;"2007-084T10:00:57.286Z"
Author information
- Author:
Paulo Penteado (pp.penteado@gmail.com), Oct/2009
Other attributes
- Uses:
Statistics
Lines: | 61 lines |
Cyclomatic complexity: | 15 |
Modified cyclomatic complexity: | 15 |
File attributes
Modification date: | Fri Nov 13 12:55:33 2015 |
Lines: | 61 |
Docformat: | rst rst |