##// END OF EJS Templates
Fixed bug 388...
Fixed bug 388 Added cassini FGM download from Time table files. Fixed smal issue on export function. Some Work on QLop database.

File last commit:

r14:0e9217f77498 default
r14:0e9217f77498 default
Show More
cassinidatadownloader.cpp
109 lines | 4.0 KiB | text/x-c | CppLexer
/ src / Cassini / cassinidatadownloader.cpp
added missing GPL headers...
r11 /*------------------------------------------------------------------------------
-- This file is a part of the QLop Software
-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-------------------------------------------------------------------------------*/
/*-- Author : Alexis Jeandet
-- Mail : alexis.jeandet@member.fsf.org
----------------------------------------------------------------------------*/
Added Python Console and some Wrappers....
r5 #include "cassinidatadownloader.h"
#include "ui_cassinidatadownloader.h"
#include <filedownloader.h>
#include <QDir>
#include <QFileDialog>
#include <QFile>
CassiniDataDownloader::CassiniDataDownloader(QWidget *parent) :
QWidget(parent),
ui(new Ui::CassiniDataDownloader)
{
ui->setupUi(this);
m_xmlLoader = new ExpXmlDownLoader();
Fixed bug #388...
r14 m_TTDownLoader = new ExpTimeTableDownLoader();
Added Python Console and some Wrappers....
r5 connect(this->ui->calendar,SIGNAL(activated(QDate)),this,SLOT(downloadData(QDate)));
connect(this->ui->LoadXmlFileQpb,SIGNAL(clicked()),this,SLOT(loadXmlFile()));
Fixed bug #388...
r14 connect(this->ui->LoadTimeTableQpb,SIGNAL(clicked()),this,SLOT(loadTimeTableFile()));
Added Python Console and some Wrappers....
r5 }
CassiniDataDownloader::~CassiniDataDownloader()
{
delete ui;
delete m_xmlLoader;
}
void CassiniDataDownloader::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void CassiniDataDownloader::downloadData(const QDate &date)
{
QDate tmpDate;
QStringList months=QStringList()<< "JAN" << "FEB" << "MAR" << "APR" << "MAY" << "JUN" << "JUI" << "AUG" << "SEP" << "OCT" << "NOV" << "DEC";
tmpDate.setDate(date.year(),date.month(),1);
int firstDayOfMonth=tmpDate.dayOfYear();
tmpDate.setDate(tmpDate.year(),tmpDate.month(),tmpDate.daysInMonth());
int lastDayOfMonth=tmpDate.dayOfYear();
QString link="http://ppi.pds.nasa.gov/ditdos/download?id=pds://PPI/CO-E_SW_J_S-MAG-3-RDR-FULL-RES-V1.0/DATA/" \
+ QString("%1").arg(date.year()) +"/" + QString("%1_%2_").arg(firstDayOfMonth,3).arg(lastDayOfMonth,3).replace(' ','0') \
+ months.at(date.month()-1) + "/" ;
qDebug()<<link;
QString dataFileName= QString("%1%2").arg(date.year()-2000,2).arg(date.dayOfYear(),3).replace(' ','0') + "_FGM_KRTP.TAB";
QString headerFileName= QString("%1%2").arg(date.year()-2000,2).arg(date.dayOfYear(),3).replace(' ','0') + "_FGM_KRTP.LBL";
// "_FGM_KRTP.TAB"
FileDownloader::downloadFile(link+dataFileName,QDir::homePath() +"/Téléchargements/"+dataFileName);
FileDownloader::downloadFile(link+headerFileName,QDir::homePath() +"/Téléchargements/"+headerFileName);
}
void CassiniDataDownloader::loadXmlFile()
{
QString file=QFileDialog::getOpenFileName();
if(QFile::exists(file))
{
if(m_xmlLoader->parseXml(file))
{
QList<QDate> daysToDl = m_xmlLoader->daysToDownload();
for(int i=0;i<daysToDl.count();i++)
{
downloadData(daysToDl.at(i));
}
}
}
}
Fixed bug #388...
r14
void CassiniDataDownloader::loadTimeTableFile()
{
QString file=QFileDialog::getOpenFileName();
if(QFile::exists(file))
{
if(m_TTDownLoader->parseFile(file))
{
QList<QDate> daysToDl = m_TTDownLoader->daysToDownload();
for(int i=0;i<daysToDl.count();i++)
{
downloadData(daysToDl.at(i));
}
}
}
}