00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OMGCLIMATEDATAPROCESSORCONTROLLER_H
00021 #define OMGCLIMATEDATAPROCESSORCONTROLLER_H
00022
00023 #include "omgclimatedataprocessor.h"
00024 #include "omgfilewriter.h"
00025 #include "omgclimatefilereader.h"
00026 #include "omgclimatefilegroup.h"
00027 #include <QMap>
00028 #include <QString>
00029 #include <QObject>
00030
00035 struct OMG_LIB_EXPORT OmgFileWriterStruct
00036 {
00038 OmgFileWriter * fileWriter;
00040 QString fullFileName;
00041 };
00042
00043
00050 class OMG_LIB_EXPORT OmgClimateDataProcessorController : public QObject {
00051 Q_OBJECT;
00052 public:
00054 OmgClimateDataProcessorController();
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00066 ~OmgClimateDataProcessorController();
00067
00068
00069
00075 void setMeanTempFileName ( QString theFileName);
00080 const QString getMeanTempFileName ();
00081
00087 void setMinTempFileName ( QString theFileName);
00092 const QString getMinTempFileName ();
00093
00099 void setMaxTempFileName ( QString theFileName);
00104 const QString getMaxTempFileName ();
00105
00111 void setDiurnalTempFileName ( QString theFileName);
00116 const QString getDiurnalTempFileName ();
00117
00123 void setMeanPrecipFileName ( QString theFileName);
00128 const QString getMeanPrecipFileName ();
00129
00135 void setFrostDaysFileName ( QString theFileName);
00140 const QString getFrostDaysFileName ();
00141
00147 void setTotalSolarRadFileName ( QString theFileName);
00152 const QString getTotalSolarRadFileName ();
00153
00159 void setWindSpeedFileName ( QString theFileName);
00164 const QString getWindSpeedFileName ();
00165
00171 void setOutputFilePathString( QString theFilePathString);
00175 const QString getOutputFilePathString();
00176
00185 void setFileStartYear( const int theYear);
00187 const int getFileStartYear();
00188
00196 void setJobStartYear( const int theYear);
00202 const int getJobStartYear();
00203
00211 void setJobEndYear( const int theYear);
00217 const int getJobEndYear();
00218
00224 void setInputFileType( const OmgClimateFileReader::FileType theInputFileType);
00243 void setInputFileType( const QString theInputFileTypeString);
00248 const OmgClimateFileReader::FileType getInputFileType();
00249
00256 void setOutputFileType( const OmgFileWriter::FileType theOutputFileType);
00269 void setOutputFileType( const QString theOutputFileTypeString);
00274 const OmgFileWriter::FileType getOutputFileType();
00275
00276
00281 bool makeFileGroups();
00282
00287 bool makeAvailableCalculationsMap();
00294 QMap <QString, bool > getAvailableCalculationsMap();
00295
00304 bool addUserCalculation(QString theCalculationName);
00305
00317 bool run();
00318
00326 QString getDescription();
00327
00349 void setFilesInSeriesFlag( const bool theFlag);
00355 const bool getFilesInSeriesFlag();
00356
00363 void setOutputHeader( const QString& theOutputHeader);
00368 const QString getOutputHeader();
00369
00370
00371 signals:
00378 void numberOfVariablesToCalc(int theNumber);
00385 void numberOfCellsToCalc(int theNumber);
00393 void variableStart(QString theName);
00400 void variableDone(QString theFileName);
00407 void cellDone(float theResult);
00408
00409 private:
00410
00411
00412
00414 void printVectorAndResult(QVector<float> theVector, float theResult);
00415
00418 OmgClimateFileGroup *initialiseFileGroup(QString theFileName,int theStartYear);
00419
00423 bool makeInputFileTypeMap();
00424
00428 bool makeOutputFileTypeMap();
00429
00431 QString intToString(int theInt);
00432
00433
00435 QString outputFilePath;
00437 OmgClimateFileReader::FileType inputFileType;
00438
00440 OmgFileWriter::FileType outputFileType;
00441
00449 QMap <QString,OmgClimateFileReader::FileType > inputFileTypeMap;
00450
00451
00459 QMap <QString, OmgFileWriter::FileType > outputFileTypeMap;
00460
00469 QMap <QString, bool > availableCalculationsMap;
00470
00471
00473 OmgClimateFileGroup * meanTempFileGroup;
00477 QString meanTempFileName;
00478
00480 OmgClimateFileGroup *minTempFileGroup;
00484 QString minTempFileName;
00485
00487 OmgClimateFileGroup * maxTempFileGroup;
00491 QString maxTempFileName;
00492
00494 OmgClimateFileGroup * diurnalTempFileGroup;
00498 QString diurnalTempFileName;
00499
00501 OmgClimateFileGroup * meanPrecipFileGroup;
00505 QString meanPrecipFileName;
00506
00508 OmgClimateFileGroup * frostDaysFileGroup;
00512 QString frostDaysFileName;
00513
00515 OmgClimateFileGroup * totalSolarRadFileGroup;
00519 QString totalSolarRadFileName;
00520
00522 OmgClimateFileGroup * windSpeedFileGroup;
00526 QString windSpeedFileName;
00527
00533 bool filesInSeriesFlag;
00534
00536 QString outputHeader;
00537 };
00538
00539 #endif //CLIMATEDATAPROCESSORCONTROLLER
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576