Text::NASA_Ames - Reading data from NASA Ames files
my $nasaAmes = new Text::NASA_Ames('this_file'); # or $nasaAmes = new Text::NASA_Ames(new IO::File "this_file", "r"); print STDERR "3 independent variables"; $nasaAmes->nAuxV; # number of (real) auxiliary variables not containing # a independent variable $nasaAmes->nV; # number of independent variables # scanning through the file: while (my $entry = $nasaAmes->nextDataEntry) { my @X = @{ $dataEntry->X }; my @aux = @{ $dataEntry->A }; my @V = @{ $dataEntry->V }; }
This is the factory class for reading on of the Text::NASA_Ames formats (currently 9). The function-names are related to the format specification as in http://cloud1.arc.nasa.gov/solve/archiv/archive.tutorial.html by Gaines and Hipkinds.
All lists are returned as references to lists.
The names of the public methods are identical to the format specifications. In some formats, auxiliary variables are misused to store independent variables. In those cases, I return the real number of auxiliary variables with nAuxV and not nAuxV as sum of auxiliray variables plus stored independent variables as written in the file.
not implemented, see nextDataEntry
list of missing values of the auxiliary variables
list of names of the auxiliary variables
list of scaling factors of the auxiliary variables
UT date marking the beginning of the data: format 'YYYY MM DD'
list of interval between the indep. variables (0 means no linear interval)
File Format Index of the parsed file
total number of volumes belonging to complete dataset (see nVol) (starting at 1)
list of character length of the auxiliary string variables
list of character length of the independent string variables
mission name
number of auxiliary string variables
number of total auxiliary variables (including string variables). The numeric auxiliary variables come allways in front of the string variables.
list of normal comment strings
number of independent variables (== first number of ffi)
number of header lines
number of normal comment lines
number of special comment lines
number of primary variables
total number of volumes required to store complete dataset
number of independent variable between variable marks
list of numbers of values of the primary variables
list of numbers of values of the independent variable defined in the header
originator name
originators organization
date of last revision (format as data)
list of special comment lines
source name
list of missing values of the variables
list of variable names
list of scaling factor of variables
might be used for temporary variables, for iterator-access, see nextDataEntry
parse the first line and distribute the file to the correct Text::NASA_Ames::FFI object;
the current line in the file, starting at 1
get the next chomped/trimmed line from the file and set the currentLine counter
set/get the complete dataBuffer. Don't use this method manually without knowing what you're doing. Think about using nextDataEntry.
fetch the next Text::NASA_Ames::DataEntry from the dataBuffer, which will be filled automatically. The data will not be set to memory.
The variables (primary and auxiliary) are stored in the following structure:
$self->{_variables}{X1}{..}{Xn}->{V} = [v1..vn] $self->{_variables}{X1}{..}{Xn}->{A} = [a1..an]
It is possible to modify a lot of variables which should be read-only.
In the time of XML such an ASCI format does not seem very reasonable. To the rescue: It is older than XML, much leaner (what isn't?) and at least well documented.
maybe implementing writing routines maybe implementing a direct-access mode
Heiko Klein, <H.Klein@gmx.net>
http://cloud1.arc.nasa.gov/solve/archiv/archive.tutorial.html, Text::NASA_Ames::DataEntry, Text::NASA_Ames::FFI1001, NASA_Ames::FFI1010, NASA_Ames::FFI1020, Text::NASA_Ames::FFI2010, NASA_Ames::FFI2110, NASA_Ames::FFI2160, Text::NASA_Ames::FFI2310, NASA_Ames::FFI3010, NASA_Ames::FFI4010
To install Pure::Text::NASA_Ames, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pure::Text::NASA_Ames
CPAN shell
perl -MCPAN -e shell install Pure::Text::NASA_Ames
For more information on module installation, please visit the detailed CPAN module installation guide.