Documentation for pp_lib

Generated by IDLdoc

single page | use frames     summary     class     fields     routine details     file attributes

./

pp_readcube__define.pro


Author information

Author

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Other file information

Uses:

pp_getcubeheadervalue, pp_extractfields, pp_buffered_vector

Class description for pp_readcube

Inheritance

Subclasses: pp_editablecube

Properties

Properties in pp_readcube

all get
backnames get
backplanes get
backunits get
bands get
bottomnames get
bottomplanes get
bottomunits get
core get
file get
history get
info get
labels get
lats get
lines get
lons get
nback get
nbottom get
npixels get
nside get
rawdata get
samples get
sidenames get
sideplanes get
sideunits get
special get init
struct_backplanes get
units get
wavelengths get

Fields

Fields in IDL_OBJECT

Fields in pp_readcube

BACKPLANES ptr_new()
BNAMES ptr_new()
BONAMES ptr_new()
BOTTOMPLANES ptr_new()
BOUNITS ptr_new()
BUNITS ptr_new()
CORE ptr_new()
DWAVS ptr_new()
FILE ''
HISTORY ptr_new()
IDWAVS ptr_new()
INFO { PP_READCUBE_INFO, DATATYPE: 0L, LITTLEENDIAN: 0B, RECORDBYTES: 0L, FILERECORDS: 0L, LABELRECORDS: 0L, HISTORYRECORDS: 0L, BINARYRECORDS: 0L, HISTORYSTART: 0L, BINARYSTART: 0L, BYTES: 0B, TYPE: '', DIMS: [0L, 0L, 0L], COREDIMS: [0L, 0L, 0L], SUFFDIMS: [0L, 0L, 0L] }
LABELS ptr_new()
RAW ptr_new()
SIDEPLANES ptr_new()
SNAMES ptr_new()
SPECIAL 0B
SUNITS ptr_new()
THISTORY ptr_new()
TLABELS ptr_new()
UNITS ''
WAVS ptr_new()

Routines

Routines from pp_readcube__define.pro

result = pp_readcube::init(file [, special=special])

Provided with the name of the file, initializes the object reading the cube in it.

pp_readcube::cleanup
result = pp_readcube::parselabels()
pp_readcube::processdata
result = pp_readcube::getspecialvalues(default=default)

Provides a structure with the special values to use in this cube, determined by the special replacement mode selected when the object was created (see documentation of the init method).

result = pp_readcube_specialreplace(data, special)
result = pp_readcube::getexerpt()
pp_readcube::getproperty [, all=all] [, file=file] [, special=special] [, labels=labels] [, history=history] [, core=core] [, backplanes=backplanes] [, sideplanes=sideplanes] [, bottomplanes=bottomplanes] [, info=info] [, lines=lines] [, bands=bands] [, samples=samples] [, nback=nback] [, nside=nside] [, nbottom=nbottom] [, rawdata=rawdata] [, wavelengths=wavelengths] [, backnames=backnames] [, sidenames=sidenames] [, bottomnames=bottomnames] [, units=units] [, backunits=backunits] [, sideunits=sideunits] [, bottomunits=bottomunits] [, struct_backplanes=struct_backplanes], npixels=npixels, lats=lats, lons=lons

Retrieves parts of the data contained in the object.

result = pp_readcube::getproperty(all=all, file=file, special=special, labels=labels, history=history, core=core, backplanes=backplanes, sideplanes=sideplanes, bottomplanes=bottomplanes, info=info, lines=lines, bands=bands, samples=samples, nback=nback, nside=nside, nbottom=nbottom, rawdata=rawdata, wavelengths=wavelengths, backnames=backnames, sidenames=sidenames, bottomnames=bottomnames, units=units, backunits=backunits, sideunits=sideunits, bottomunits=bottomunits)

Simple function wrapper for the routine method getproperty.

result = pp_readcube::getsuffixbyname(names [, found=found] [, case_sensitive=case_sensitive] [, side=side] [, bottom=bottom] [, back=back] [, index=index])

Retrieves suffix planes by their names.

result = pp_readcube::getbandbywavelength(wavs [, index=index] [, wavelengths=wavelengths])

Retrieves one or more core bands from their wavelengths.

result = pp_readcube::getbandbyindex(index [, wavelengths=wavelengths])

Retrieves one or more core bands from their indexes.

result = pp_readcube::getfromheader(key [, history=history] [, count=count] [, fold_case=fold_case] [, lines=lines] [, unquote=unquote] [, sel=sel], cont=cont)

Retrieves values contained in the label or history part of the cube header.

result = pp_readcube::_overloadBracketsRightSide(isRange, sub1, sub2, sub3, sub4, sub5, sub6, sub7, sub8)

Simple overloading to retrieve core bands, backplanes, or wavelenghts from the cube.

pp_readcube__define

Routine details

top source pp_readcube::init

result = pp_readcube::init(file [, special=special])

Provided with the name of the file, initializes the object reading the cube in it.

Parameters

file in required

The name of the file that contains the cube.

Keywords

special in optional default=0

Determines the type of special value replacement to use:

0 uses the default special values

1 uses the special values found in the header

2 disables special value replacement

Examples

See the example on pp_readcube__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Statistics

Lines:
59 lines
Cyclomatic complexity:
14
Modified cyclomatic complexity:
14

top source pp_readcube::cleanup

pp_readcube::cleanup

Statistics

Lines:
7 lines
Cyclomatic complexity:
2
Modified cyclomatic complexity:
2

top source pp_readcube::parselabels

result = pp_readcube::parselabels()

Statistics

Lines:
61 lines
Cyclomatic complexity:
22
Modified cyclomatic complexity:
16

top source pp_readcube::processdata

pp_readcube::processdata

Statistics

Lines:
29 lines
Cyclomatic complexity:
15
Modified cyclomatic complexity:
15

top source pp_readcube::getspecialvalues

result = pp_readcube::getspecialvalues(default=default)

Provides a structure with the special values to use in this cube, determined by the special replacement mode selected when the object was created (see documentation of the init method).

Return value

A structure where each field is one of the six special values: VALID_MIN,NULL,LOW_REPR_SAT,LOW_INSTR_SAT,HIGH_INSTR_SAT,HIGH_REPR_SAT

Keywords

default

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Statistics

Lines:
75 lines
Cyclomatic complexity:
70
Modified cyclomatic complexity:
37

top source pp_readcube_specialreplace

result = pp_readcube_specialreplace(data, special)

Parameters

data
special

Statistics

Lines:
43 lines
Cyclomatic complexity:
10
Modified cyclomatic complexity:
7

top source pp_readcube::getexerpt

result = pp_readcube::getexerpt()

Statistics

Lines:
34 lines
Cyclomatic complexity:
2
Modified cyclomatic complexity:
2

top source pp_readcube::getproperty

pp_readcube::getproperty [, all=all] [, file=file] [, special=special] [, labels=labels] [, history=history] [, core=core] [, backplanes=backplanes] [, sideplanes=sideplanes] [, bottomplanes=bottomplanes] [, info=info] [, lines=lines] [, bands=bands] [, samples=samples] [, nback=nback] [, nside=nside] [, nbottom=nbottom] [, rawdata=rawdata] [, wavelengths=wavelengths] [, backnames=backnames] [, sidenames=sidenames] [, bottomnames=bottomnames] [, units=units] [, backunits=backunits] [, sideunits=sideunits] [, bottomunits=bottomunits] [, struct_backplanes=struct_backplanes], npixels=npixels, lats=lats, lons=lons

Retrieves parts of the data contained in the object. If keyword all is given, returns all the properties as fields of a structure.

Keywords

all out optional

A structure containing every property as a field with the same name as the corresponding keyword.

file out optional

File from which the cube was read.

special out optional

The special value replacement mode used when the data was processed: 0 for default special values, 1 for special values given in the header, 2 for no special value replacement.

labels out optional

String array with one element for each line of the label part of the cube header.

history out optional

String array with one element for each line of the history part of the cube header.

core out optional

3D array with the core data values.

backplanes out optional

3D array with the backplane values, if there are blackplanes, a null pointer otherwise.

sideplanes out optional

3D array with the sideplane values, if there are sideplanes, a null pointer otherwise.

bottomplanes out optional

3D array with the bottomplane values, if there are bottomplanes, a null pointer otherwise.

info out optional

A structure with the cube parameters that were used to read it.

lines out optional

The number of lines in the core.

bands out optional

The number of bands in the core.

samples out optional

The number of samples in the core.

nback out optional

The number of backplanes in the suffix.

nside out optional

The number of sideplanes in the suffix.

nbottom out optional

The number of bottomplanes in the suffix.

rawdata out optional

The unprocessed binary part of the cube.

wavelengths out optional

A string array with the wavelength of each core band ('UNKNOWN's if not found).

backnames out optional

A string array with the name of each backplane ('UNKNOWN_'+sindgen(nback) if not found).

sidenames out optional

A string array with the name of each sideplane ('UNKNOWN_'+sindgen(nside) if not found).

bottomnames out optional

A string array with the name of each bottomplane ('UNKNOWN_'+sindgen(nbottom) if not found).

units out optional

A string with the wavelength unit of the core bands ('UNKNOWN' if not found).

backunits out optional

A string array with the name of each backplane's unit ('UNKNOWN's if not found).

sideunits out optional

A string array with the name of each sideplane's unit ('UNKNOWN's if not found).

bottomunits out optional

A string array with the name of each bottomplane's unit ('UNKNOWN's if not found).

struct_backplanes out optional

2D array of structures, each with one field for each backplane, if there are blackplanes, a null pointer otherwise.

npixels
lats
lons

Examples

See the example on pp_readcube__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Statistics

Lines:
61 lines
Cyclomatic complexity:
68
Modified cyclomatic complexity:
68

top source pp_readcube::getproperty

result = pp_readcube::getproperty(all=all, file=file, special=special, labels=labels, history=history, core=core, backplanes=backplanes, sideplanes=sideplanes, bottomplanes=bottomplanes, info=info, lines=lines, bands=bands, samples=samples, nback=nback, nside=nside, nbottom=nbottom, rawdata=rawdata, wavelengths=wavelengths, backnames=backnames, sidenames=sidenames, bottomnames=bottomnames, units=units, backunits=backunits, sideunits=sideunits, bottomunits=bottomunits)

Simple function wrapper for the routine method getproperty. Has the same keywords, and retrieves the same values, but with function semantics instead of routine. Only one keyword should be set, and the corresponding value is the function's return value.

Keywords

all
file
special
labels
history
core
backplanes
sideplanes
bottomplanes
info
lines
bands
samples
nback
nside
nbottom
rawdata
wavelengths
backnames
sidenames
bottomnames
units
backunits
sideunits
bottomunits

Examples

See the example on pp_readcube__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Statistics

Lines:
34 lines
Cyclomatic complexity:
28
Modified cyclomatic complexity:
28

top source pp_readcube::getsuffixbyname

result = pp_readcube::getsuffixbyname(names [, found=found] [, case_sensitive=case_sensitive] [, side=side] [, bottom=bottom] [, back=back] [, index=index])

Retrieves suffix planes by their names. If all suffix planes, or their names, are to be retrieved, the getproperty method should be used instead. By default, backplanes are retrieved, but sideplanes and bottomplanes can be returned if the corresponding keyword is set.

Return value

A 2D array (if only one plane is requested) or 3D array (if several planes) with the names suffix planes. If one plane is not found, the corresponding array plane contains either NaN (for real types) or special.null (for integer types).

Parameters

names in required

A scalar or string array with the name(s) of the suffix plane(s) to retrieve. If more than one plane is returned, their order (in the 3rd dimension of the returned array) is the same as the order of the names in this array.

Keywords

found out optional

An integer array with the same number of elements as names, with the number of suffix planes that match each given name. If more than one suffix plane has the selected name, the first one is the one returned (though proper cubes should not have multiple planes with the same name).

case_sensitive in optional default=0

If set, name matches are case-sensitive (though proper cubes should not have planes the same name in different capitalizations).

side in optional default=0

By default, the search for the planes is done among the cube's backplanes. If this keyword is set, sideplanes are used instead.

bottom in optional default=0

By default, the search for the planes is done among the cube's backplanes. If this keyword is set, bottomplanes are used instead.

back in optional default=1

If set, the search for the planes is done among the cube's backplanes (default).

index out optional

An integer array with the same number of elements as names, with the index of the returned suffix planes that matched each given name. If more than one suffix plane has the selected name, the first one is the one returned (though proper cubes should not have multiple planes with the same name). When that plane was not found, the corresponding index will be -1.

Examples

See the example on pp_readcube__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Statistics

Lines:
38 lines
Cyclomatic complexity:
23
Modified cyclomatic complexity:
20

top source pp_readcube::getbandbywavelength

result = pp_readcube::getbandbywavelength(wavs [, index=index] [, wavelengths=wavelengths])

Retrieves one or more core bands from their wavelengths. The returned bands are those with wavelength nearest to the ones provided, so they need not match exactly.

Return value

If only one wavelength is provided, returns a 2D array with that band. If more than one wavelength is provided, the result is a 3D array, with the 3rd dimension being the bands.

Parameters

wavs in required

A scalar or array with the value(s) of the wavelength(s) to search for.

Keywords

index out optional

Returns the index of the band that matched each provided wavelength.

wavelengths out optional

Returns the wavelength of the band that matched each provided wavelength.

Examples

See the example on pp_readcube__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Statistics

Lines:
18 lines
Cyclomatic complexity:
4
Modified cyclomatic complexity:
4

top source pp_readcube::getbandbyindex

result = pp_readcube::getbandbyindex(index [, wavelengths=wavelengths])

Retrieves one or more core bands from their indexes.

Return value

If only one index is provided, returns a 2D array with that band. If more than one index is provided, the result is a 3D array, with the 3rd dimension being the bands.

Parameters

index in required

A scalar or array with the value(s) of the index(es) to search for.

Keywords

wavelengths out optional

Returns the wavelength of the band that matched each provided index.

Examples

See the example on pp_readcube__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Statistics

Lines:
13 lines
Cyclomatic complexity:
4
Modified cyclomatic complexity:
4

top source pp_readcube::getfromheader

result = pp_readcube::getfromheader(key [, history=history] [, count=count] [, fold_case=fold_case] [, lines=lines] [, unquote=unquote] [, sel=sel], cont=cont)

Retrieves values contained in the label or history part of the cube header. Just a wrapper for pp_getcubeheadervalue. See its documentation for details.

Parameters

key in

Key name to be retrieved.

Keywords

history in optional default=0

If set, reading is done on the history part of the header, instead of the label part.

count out optional

Passed to pp_getcubeheadervalue. The number of occurences of the key found in the header. If more than 1 is found, the last occurence is used. Check this value to determine if the key was not found (count will be 0 in that case).

fold_case in optional

Passed to pp_getcubeheadervalue. Passed to stregex when searching for the key. If set, capitalization of the key is ignored.

lines out optional

Passed to pp_getcubeheadervalue. 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

Passed to pp_getcubeheadervalue. If set, enclosing quotes are removed from the return values

sel in optional

Passed to pp_getcubeheadervalue. 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.

cont

Examples

See the examples on pp_readcube__define and pp_getcubeheadervalue.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Statistics

Lines:
8 lines
Cyclomatic complexity:
4
Modified cyclomatic complexity:
4

top source pp_readcube::_overloadBracketsRightSide

result = pp_readcube::_overloadBracketsRightSide(isRange, sub1, sub2, sub3, sub4, sub5, sub6, sub7, sub8)

Simple overloading to retrieve core bands, backplanes, or wavelenghts from the cube.

Only 1D is processed. If more than 1D is specified, !null is returned.

Return value

The returned value depends on the type of the index provided:

If the index is an integer type (including a range), a 2D or 3D array is returned, with the corresponding core band(s).

If the index is of string type, then a 2D or 3D array with the corresponsing backplane(s) is returned.

If the index is of type double, a 2D or 3D array is returned with the core bands that have wavelength(s) closest to the wavelength(s) given by the subscript.

If the index is of type float, a 1D array is returned with the core wavelengths that are nearest to the correspoinding given wavelength(s).

Parameters

isRange
sub1
sub2
sub3
sub4
sub5
sub6
sub7
sub8

Examples

See the example on pp_readcube__define.

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Feb/2011

Statistics

Lines:
19 lines
Cyclomatic complexity:
10
Modified cyclomatic complexity:
5

top source pp_readcube__define

pp_readcube__define

Object to read an ISIS cube.

Initialization parses the cube into the object, other methods retrieve parts of it.

Assumes that all suffix items are the same data type as core items.

Assumes that cube has 3 axes in BSQ order.

Assumes constant length records.

The only methods intended to be public are getproperty,getspecialvalues, getfromheader, getsuffixbyname, and getbandbywavelength.

Examples

To read the cube CM_1553510065_1_ir.cub:

a=obj_new('pp_readcube','CM_1553510065_1_ir.cub')
To get the core and its wavelengths:
a->getproperty,core=core,wavelengths=wavs print,min(wavs,max=mw),mw ;0.88421000 5.1225000
To get the backplanes and their names:
a->getproperty,backplanes=back,backnames=bnames print,bnames ;LATITUDE LONGITUDE SAMPLE_RESOLUTION LINE_RESOLUTION PHASE_ANGLE INCIDENCE_ANGLE EMISSION_ANGLE NORTH_AZIMUTH
To get the file name:
print,a->getproperty(/file) ;CM_1553510065_1_ir.cub
To get all the properties at once:
a->getproperty,all=a_all ;** Structure PP_READCUBE_ALL, 24 tags, length=98912, data length=98895: ; FILE STRING 'CM_1553510065_1_ir.cub' ; SPECIAL BYTE 0 ; LABELS STRING Array[268] ; HISTORY STRING Array[479] ; CORE FLOAT Array[1, 40, 256] ; BACKPLANES FLOAT Array[1, 40, 8] ; SIDEPLANES POINTER <NullPointer> ; BOTTOMPLANES POINTER <NullPointer> ; INFO STRUCT -> PP_READCUBE_INFO Array[1] ; LINES LONG 40 ; SAMPLES LONG 1 ; BANDS LONG 256 ; NBACK LONG 8 ; NSIDE LONG 0 ; NBOTTOM LONG 0 ; RAW FLOAT Array[1, 40, 264] ; WAVELENGTHS DOUBLE Array[256] ; BACKNAMES STRING Array[8] ; SIDENAMES POINTER <NullPointer> ; BOTTOMNAMES POINTER <NullPointer> ; UNITS STRING 'MICROMETER' ; BACKUNITS STRING Array[8] ; SIDEUNITS POINTER <NullPointer> ; BOTTOMUNITS POINTER <NullPointer>
To get the latitudes:
lats=a->getsuffixbyname('LATITUDE')
Or, equivalenty:
lats=a['LATITUDE']
To get the band with wavelength nearest to 2.1 (in the units used in the cube):
selband=a->getbandbywavelength(2.1,wavelengths=selwavs) print,selwavs ;2.1003400
Or, equivalently:
selband=a[2.1d0] selwavs=a[2.1] print,selwavs ;2.1003400
To get the start time of the cube:
print,a->getfromheader('START_TIME') ;"2007-084T10:00:57.286Z"
Destroy the object when done with it:
obj_destroy,a

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Oct/2009

Other attributes

Uses:

pp_getcubeheadervalue, pp_extractfields

Statistics

Lines:
21 lines
Cyclomatic complexity:
36
Modified cyclomatic complexity:
36

File attributes

Modification date: Wed Jun 22 21:48:38 2016
Lines: 520
Docformat: rst rst