#include <omgclimatefilereader.h>
Inheritance diagram for OmgClimateFileReader:
Definition at line 37 of file omgclimatefilereader.h.
Public Types | |
enum | FileType { GDAL, HADLEY_SRES, HADLEY_IS92, HADLEY_SRES_MEAN, IPCC_OBSERVED, VALDES, ECHAM4, CSIRO_MK2, NCAR_CSM_PCM, GFDL_R30, CGCM2, CCSR_AGCM_OGCM, CRU_CL1_MONTHLY } |
Signals | |
void | error (QString theError) |
void | message (QString theMessage) |
Public Member Functions | |
OmgClimateFileReader () | |
OmgClimateFileReader (QString theFileName, FileType theFileType) | |
~OmgClimateFileReader () | |
bool | initialise (QString theFileNameString, FileType theFileType) |
float | getElement () |
const long | currentElementNo () |
const long | currentRow () |
const long | currentCol () |
const int | headerLineCount () |
bool | setActiveBlock (const unsigned int theBlockNo) |
const int | activeBlock () |
const bool | isAtMatrixEnd () |
const QString | filename () |
const OmgClimateFileReader::FileType | getFileType () |
const long | yDim () |
const long | xDim () |
const int | blockHeaderLineCount () |
QString | getOmgClimateFileReaderInfo () |
const int | blockStartPos () |
bool | moveToHeader () |
const int | blockCount () |
int | getNumberOfBlocks () |
void | printFirstCellInEachBlock () |
void | printLastCellInEachBlock () |
void | printBlockMarkers () |
void | printBlock (int theBlock) |
Private Member Functions | |
bool | setFileType (const FileType theNewVal) |
QVector< int > | getBlockMarkers (bool forceFlag=false) |
double | readValue (void *theData, GDALDataType theType, int theIndex) |
Private Attributes | |
unsigned int | mXDim |
unsigned int | mYDim |
FileType | mFileType |
QString | mFileName |
bool | mEndOfMatrixFlag |
int | mActiveBlockNo |
int | mFileHeaderLines |
unsigned int | mCurrentColumn |
unsigned int | mCurrentRow |
unsigned int | mCurrentElementNo |
std::ifstream | mTextStream |
char | mBuffer [mMaxLineLength] |
GDALDataset * | mGdalDataset |
int | mBlockHeaderLines |
int | mBlockStartPos |
QVector< int > | mBlockMarkersVector |
Static Private Attributes | |
static const unsigned int | mMaxLineLength = 100 |
|
This enum defines the different types of files that can be read in.
Definition at line 49 of file omgclimatefilereader.h. |
|
Default constructor Definition at line 29 of file omgclimatefilereader.cpp. |
|
Constructor (default ctor is in private section to stop progrmmers using it!) Definition at line 32 of file omgclimatefilereader.cpp. References initialise(). |
Here is the call graph for this function:
|
Destructor Definition at line 39 of file omgclimatefilereader.cpp. References GDAL, mFileType, mGdalDataset, and mTextStream. |
|
Accessor of int mActiveBlockNo. This is really only applicable for file formats that include muliple months / years data in a single file such as Hadley SRES data.
Definition at line 241 of file omgclimatefilereader.cpp. References mActiveBlockNo. |
|
The number of blocks available in this file. Definition at line 590 of file omgclimatefilereader.cpp. References mBlockMarkersVector. Referenced by OmgClimateImporter::import(). |
|
Read property of int mBlockHeaderLines. Definition at line 306 of file omgclimatefilereader.cpp. References mBlockHeaderLines. |
|
Read property of blockStartPos. Definition at line 311 of file omgclimatefilereader.cpp. References mBlockStartPos. |
|
Accessor property of long mCurrentColumn.
Definition at line 286 of file omgclimatefilereader.cpp. References mCurrentColumn. Referenced by OmgRasterThreshold::accept(), OmgClimateImporter::import(), and printBlock(). |
|
Accessor for long mCurrentElementNo. Calculated as (currentRowLong * rows) + mCurrentColumn.
Definition at line 300 of file omgclimatefilereader.cpp. References mCurrentElementNo. |
|
Accessor property of long currentRowLong.
Definition at line 293 of file omgclimatefilereader.cpp. References mCurrentRow. Referenced by OmgRasterThreshold::accept(), and OmgClimateImporter::import(). |
|
Referenced by getBlockMarkers(), getElement(), initialise(), and setActiveBlock(). |
|
Accessor for QString Filename.
Definition at line 226 of file omgclimatefilereader.cpp. References mFileName. |
|
Use the header info for a given file type to determine the begining of the data block(s) and position the blockStartPos there. This method will need to be called explicitly by the client app so that when multiple copies of the same file are being opened, we dont need to do the same thing each time.
Definition at line 319 of file omgclimatefilereader.cpp. References error(), GDAL, mBlockHeaderLines, mBlockMarkersVector, mBuffer, mCurrentColumn, mCurrentElementNo, mCurrentRow, message(), mFileHeaderLines, mFileName, mFileType, mMaxLineLength, mTextStream, mXDim, and mYDim. Referenced by initialise(). |
|
*Get the next available element from the file matrix. *The cell index will be advanced by one.
Definition at line 471 of file omgclimatefilereader.cpp. References error(), GDAL, mCurrentColumn, mCurrentElementNo, mCurrentRow, mEndOfMatrixFlag, mFileType, mGdalDataset, mTextStream, mXDim, mYDim, and readValue(). Referenced by OmgRasterThreshold::accept(), OmgClimateFileGroup::getElementVector(), OmgClimateImporter::import(), printBlock(), printFirstCellInEachBlock(), and printLastCellInEachBlock(). |
Here is the call graph for this function:
|
Read property of FileTypeEnum fileType.
Definition at line 103 of file omgclimatefilereader.cpp. References mFileType. |
|
Find out how many blocks (useful in multiblock formats such as SRES) are in this file. |
|
Return the various metadata stored for the open file. |
|
Accessor for the int mFileHeaderLines.
Definition at line 280 of file omgclimatefilereader.cpp. References mFileHeaderLines. |
|
Setup the file reader
Definition at line 52 of file omgclimatefilereader.cpp. References error(), GDAL, getBlockMarkers(), mCurrentColumn, mCurrentElementNo, mCurrentRow, mEndOfMatrixFlag, mFileName, mGdalDataset, mTextStream, and setFileType(). Referenced by OmgClimateImporter::import(), OmgClimateDataProcessorController::initialiseFileGroup(), and OmgClimateFileReader(). |
Here is the call graph for this function:
|
Accessor for bool endOfMatrixFlag.
Definition at line 235 of file omgclimatefilereader.cpp. References mEndOfMatrixFlag. Referenced by OmgRasterThreshold::accept(), OmgClimateFileGroup::getElementVector(), OmgClimateImporter::import(), printBlock(), and printLastCellInEachBlock(). |
|
Referenced by getBlockMarkers(). |
|
Move the internal file pointer to the start of the file header. |
|
A helper function to show a whole block.
Definition at line 631 of file omgclimatefilereader.cpp. References currentCol(), getElement(), isAtMatrixEnd(), and setActiveBlock(). |
Here is the call graph for this function:
|
A helper function to see if the block markers are correct. The value of each block marker file seek position will be printed.
Definition at line 622 of file omgclimatefilereader.cpp. References mBlockMarkersVector. |
|
A helper function to see if the block markers are correct. The value of the first element in each block will be printed to console on std out.
Definition at line 595 of file omgclimatefilereader.cpp. References getElement(), mBlockMarkersVector, and setActiveBlock(). |
Here is the call graph for this function:
|
A helper function to see if the block markers are correct. The value of the last element in each block will be printed to console on std out.
Definition at line 606 of file omgclimatefilereader.cpp. References getElement(), isAtMatrixEnd(), mBlockMarkersVector, and setActiveBlock(). |
Here is the call graph for this function:
|
A helper method for gdal reading to get a value into the correct type.
Definition at line 557 of file omgclimatefilereader.cpp. Referenced by getElement(). |
|
Mutator for int mActiveBlockNo. It will move the file pointer too the start of the data block indicated by the start month. This is really only applicable for file formats that include muliple months / years data in a single file such as Hadley SRES data.
Definition at line 247 of file omgclimatefilereader.cpp. References error(), mActiveBlockNo, mBlockMarkersVector, mBlockStartPos, mCurrentColumn, mCurrentElementNo, mCurrentRow, mEndOfMatrixFlag, and mTextStream. Referenced by OmgClimateImporter::import(), OmgClimateDataProcessorController::initialiseFileGroup(), printBlock(), printFirstCellInEachBlock(), printLastCellInEachBlock(), and OmgClimateFileGroup::rewind(). |
|
Mutator of FileTypeEnum fileType.
Definition at line 110 of file omgclimatefilereader.cpp. References CCSR_AGCM_OGCM, CGCM2, CRU_CL1_MONTHLY, CSIRO_MK2, ECHAM4, GDAL, GFDL_R30, HADLEY_IS92, HADLEY_SRES, HADLEY_SRES_MEAN, IPCC_OBSERVED, mBlockHeaderLines, mFileHeaderLines, mFileType, mGdalDataset, mXDim, mYDim, NCAR_CSM_PCM, and VALDES. Referenced by initialise(). |
|
Read property of long mXDim. Definition at line 88 of file omgclimatefilereader.cpp. References mXDim. Referenced by OmgRasterThreshold::accept(), and OmgClimateImporter::import(). |
|
Read property of long mYDim. Definition at line 96 of file omgclimatefilereader.cpp. References mYDim. Referenced by OmgRasterThreshold::accept(), and OmgClimateImporter::import(). |
|
Block in file that matrix extraction should start at. Definition at line 254 of file omgclimatefilereader.h. Referenced by activeBlock(), and setActiveBlock(). |
|
Number of header lines per month data block (applicable to files containing multiple months in a single file only. Definition at line 271 of file omgclimatefilereader.h. Referenced by blockHeaderLineCount(), getBlockMarkers(), and setFileType(). |
|
This is a vector that stores the filepos for each datablock in the file Definition at line 275 of file omgclimatefilereader.h. Referenced by blockCount(), getBlockMarkers(), printBlockMarkers(), printFirstCellInEachBlock(), printLastCellInEachBlock(), and setActiveBlock(). |
|
The offset of the start of the header. This may not be after the header in instances where files contain more the one dataset. Definition at line 273 of file omgclimatefilereader.h. Referenced by blockStartPos(), and setActiveBlock(). |
|
This is a buffer for holding read in lines Definition at line 266 of file omgclimatefilereader.h. Referenced by getBlockMarkers(). |
|
Current column in the matrix Definition at line 258 of file omgclimatefilereader.h. Referenced by currentCol(), getBlockMarkers(), getElement(), initialise(), and setActiveBlock(). |
|
Position in the matrix expressed as (current row * cols) + current col Definition at line 262 of file omgclimatefilereader.h. Referenced by currentElementNo(), getBlockMarkers(), getElement(), initialise(), and setActiveBlock(). |
|
Current row in matrix Definition at line 260 of file omgclimatefilereader.h. Referenced by currentRow(), getBlockMarkers(), getElement(), initialise(), and setActiveBlock(). |
|
Whether the file pointer has reached the end of the matrix Definition at line 252 of file omgclimatefilereader.h. Referenced by getElement(), initialise(), isAtMatrixEnd(), and setActiveBlock(). |
|
Number of header lines specifically at start of file. Definition at line 256 of file omgclimatefilereader.h. Referenced by getBlockMarkers(), headerLineCount(), and setFileType(). |
|
The name of the file, including full path if neccessary. Definition at line 250 of file omgclimatefilereader.h. Referenced by filename(), getBlockMarkers(), and initialise(). |
|
Type of file we are reading. Definition at line 248 of file omgclimatefilereader.h. Referenced by getBlockMarkers(), getElement(), getFileType(), setFileType(), and ~OmgClimateFileReader(). |
|
if the file type is a gdal dataset we will store the handle to the dataset here rather than in the text stream Definition at line 268 of file omgclimatefilereader.h. Referenced by getElement(), initialise(), setFileType(), and ~OmgClimateFileReader(). |
|
This is a maximum length for lines that shall be skipped Definition at line 242 of file omgclimatefilereader.h. Referenced by getBlockMarkers(). |
|
The text stream that will be used to pull data from the file Definition at line 264 of file omgclimatefilereader.h. Referenced by getBlockMarkers(), getElement(), initialise(), setActiveBlock(), and ~OmgClimateFileReader(). |
|
This is the xDim (columns) of a matrix for one month (files may contain more than one matrix). Definition at line 244 of file omgclimatefilereader.h. Referenced by getBlockMarkers(), getElement(), setFileType(), and xDim(). |
|
Number of rows in matrix for one month / year Definition at line 246 of file omgclimatefilereader.h. Referenced by getBlockMarkers(), getElement(), setFileType(), and yDim(). |