Documentation for pp_lib

Generated by IDLdoc

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

./

pp_cubecollection__define.pro


Author information

Author

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

Other file information

Uses:

pp_editablecube__define, pp_getcubeheadervalue, pp_extractfields, pp_setcubeheadervalue, pp_readcube__define

Class description for pp_cubecollection

Subclasses: pp_titanbrowse_metadb

Properties

Properties in pp_cubecollection

_ref_extra init
build init
class init
compress init
cubefiles init
ir init
vis init

Fields

Fields in pp_cubecollection

CUBEFILES ptr_new()
HEAPINDS ptr_new()
NCUBES 0L
OSAV obj_new()
SAVEFILE ''

Routines

Routines from pp_cubecollection__define.pro

result = pp_cubecollection::init(savefile [, build=build] [, cubefiles=cubefiles] [, vis=vis] [, ir=ir], compress=compress, class=class, _ref_extra=_ref_extra)

Initializes a pp_cubecollection object, either from a previously built file, or builds the file from cube files.

pp_cubecollection::cleanup
result = pp_cubecollection::getcube( [index] [, name=name])

Retrieves selected cubes from the container, by their indexes or filenames.

pp_cubecollection::opensav, close=close
result = pp_cubecollection::filenames( [ncubes=ncubes])

Returns a string array with the filenames of all cubes in the collection.

pp_cubecollection__define

Object that contains a collection of cubes, that can be retrieved as pp_editablecube objects by their names or indexes.

Routine details

top source pp_cubecollection::init

result = pp_cubecollection::init(savefile [, build=build] [, cubefiles=cubefiles] [, vis=vis] [, ir=ir], compress=compress, class=class, _ref_extra=_ref_extra)

Initializes a pp_cubecollection object, either from a previously built file, or builds the file from cube files.

Parameters

savefile in required

The name of the file that either will contain the object's data, or the data will be read from, depending on the build keyword.

Keywords

build in optional default=0

If set, the cubes named in cubefiles are read from disk and the container file is created. Otherwise, it is assumed the container file was previously created, and the object gets its data from that file.

cubefiles in out optional

If build is set, a string array with the names of the cube files to read. If absent and build is set, all cubes found in the current directory (ending with '_eg.cub', '_ir_eg.cub', or '_vis_eg.cub', depending on the vis and ir keywords) are used, and their names are returned in this keyword.

vis in optional default=0

If set, cubes matching '*_vis_eg.cub' are used when building the container file, instead of '*_eg.cub'.

ir in optional default=0

If set, cubes matching '*_ir_eg.cub' are used when building the container file, instead of '*_eg.cub'.

compress
class
_ref_extra

Examples

See the example on pp_editablecube__define.

Author information

Author:

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

Statistics

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

top source pp_cubecollection::cleanup

pp_cubecollection::cleanup

Statistics

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

top source pp_cubecollection::getcube

result = pp_cubecollection::getcube( [index] [, name=name])

Retrieves selected cubes from the container, by their indexes or filenames.

Return value

If index or name are scalars, the object with the selected cube. If they are arrays, an object array of the same dimensions, with each containing the corresponding object. If a requested object is not found, a null object is returned in its place. If both index and name are provided, the index values are used to select the cubes, with their names returned in names.

The object references returned are to the same objects: no copy is made on successive calls to get the same cube. A copy can be made making a new pp_editablecube object from the returned object reference, as shown in the example.

Parameters

index in optional

The index numbers of the cubes to retrieve.

Keywords

name in optional

The names of the cubes to retrieve.

Examples

See the example on pp_editablecube__define.

Author information

Author:

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

Statistics

Lines:
27 lines
Cyclomatic complexity:
9
Modified cyclomatic complexity:
9

top source pp_cubecollection::opensav

pp_cubecollection::opensav, close=close

Keywords

close

Statistics

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

top source pp_cubecollection::filenames

result = pp_cubecollection::filenames( [ncubes=ncubes])

Returns a string array with the filenames of all cubes in the collection.

Keywords

ncubes optional

The number of cubes contained in the collection.

Examples

See the example on pp_editablecube__define.

Author information

Author:

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

Statistics

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

top source pp_cubecollection__define

pp_cubecollection__define

Object that contains a collection of cubes, that can be retrieved as pp_editablecube objects by their names or indexes. The cubes are stored in a savefile instead of memory, so initializing from an existing file is a quick and light operation. The cube data is only read when that particular cube is to be retrieved, and only those selected to be retrieved are read from the file. Thus a savefile made by a pp_cubecollecion object is a portable, convenient and efficient way to store and carry several cubes.

Examples

Initially, a container file must be built from cube files. To take all files ending with '_ir_eg.cub' from the current directory (which can be a long operation and use a lot of memory if there are many cubes):

a=obj_new('pp_cubecollection','testcollection.sav',/build,/ir)
If a collection savefile already exists, no matter how large it is, loading it is a quick and light operation, because only meta-data is read:
a=obj_new('pp_cubecollection','testcollection.sav')
To get the names of the cubes present in the collection:
print,a->filenames(ncubes=ncubes) ;CM_1467426144_5_ir_eg.cub CM_1467426479_1_ir_eg.cub CM_1467426798_1_ir_eg.cub CM_1467427145_1_ir_eg.cub ;(...) print,ncubes 57
To retrieve the first 3 cubes:
b=a->getcube([0,1,2])
To retrieve the cube of name CM_1467426479_1_ir_eg:
c=a->getcube(name='CM_1467426479_1_ir_eg.cub') b[1] and c are the same object:
;print,b[1],c
To make a copy of that object, to keep after the collection is destroyed:
d=obj_new('pp_editablecube',c) print,obj_valid(b),obj_valid(c),obj_valid(d) ;1 1 1 ;1 ;1 obj_destroy,b print,obj_valid(b),obj_valid(c),obj_valid(d) ;0 0 0 ;0 ;1
Get rid of the collection once it is done with. This does not affect the savefile, which can be used to reobtain this collection in the future:
obj_destroy,a
See pp_editablecube__define for examples on how to use the cube objects.

Author information

Author:

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

Other attributes

Uses:

pp_editablecube__define, pp_getcubeheadervalue, pp_extractfields, pp_setcubeheadervalue, pp_readcube__define

Statistics

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

File attributes

Modification date: Fri Nov 13 12:55:33 2015
Lines: 98
Docformat: rst rst