~ubuntu-branches/ubuntu/karmic/kst/karmic

« back to all changes in this revision

Viewing changes to kst/src/datasources/planckIDEF/planckIDEF.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-28 15:16:16 UTC
  • mfrom: (1.2.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080628151616-9hvxg0nmnlkmyz4y
Tags: 1.6.0-1
* New upstream release.
* Change B-D to libnetcdf-dev.
* Add dh_icons call.  Closes: #457853.
* Bump Standards-Version to 3.8.0.
* Bump debhelper dependency for dh_icons.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
bool PLANCKIDEFSource::isValidFilename( const QString& filename )
54
54
{
55
55
  bool ok = false;
 
56
  unsigned minLength = 21;
 
57
 
 
58
  if( filename.right( 3 ).lower( ) == ".gz" ) 
 
59
  {
 
60
    minLength += 3;
 
61
  }
56
62
 
57
63
  //
58
64
  // _yyyymmddhhmm_vv.fits
63
69
  //  mm = two digits coding the start timeline minute
64
70
  //  vv = version number (to be used in case of regeneration of HK timelines, starting from 00)
65
71
  //
66
 
  if( filename.length() > 21 )
 
72
  if( filename.length() > minLength )
67
73
  {
68
74
    int year;
69
75
    int month;
72
78
    int minute;
73
79
    int version;
74
80
 
75
 
    QString tail = filename.right( 21 );
 
81
    QString tail = filename.right( minLength );
76
82
 
77
83
    if( sscanf( tail.latin1(), "_%4d%2d%2d%2d%2d_%2d.fits", &year, &month, &day, &hour, &minute, &version ) == 6 )
78
84
    {
99
105
QString PLANCKIDEFSource::baseFilename( const QString& filename )
100
106
{
101
107
  QString base;
 
108
  unsigned minLength = 21;
 
109
 
 
110
  if( filename.right( 3 ).lower( ) == ".gz" ) 
 
111
  {
 
112
    minLength += 3;
 
113
  }
102
114
 
103
115
  //
104
116
  // _yyyymmddhhmm_vv.fits
109
121
  //  mm = two digits coding the start timeline minute
110
122
  //  vv = version number (to be used in case of regeneration of HK timelines, starting from 00)
111
123
  //
112
 
  if( filename.length() > 21 )
 
124
  if( filename.length() > minLength )
113
125
  {
114
 
    base = filename.left( filename.length() - 21 );
 
126
    base = filename.left( filename.length() - minLength );
115
127
  }
116
128
 
117
129
  return base;
121
133
int PLANCKIDEFSource::versionNumber( const QString& filename )
122
134
{
123
135
  int version = -1;
 
136
  unsigned minLength = 21;
 
137
 
 
138
  if( filename.right( 3 ).lower( ) == ".gz" ) 
 
139
  {
 
140
    minLength += 3;
 
141
  }
124
142
 
125
143
  //
126
144
  // _yyyymmddhhmm_vv.fits
131
149
  //  mm = two digits coding the start timeline minute
132
150
  //  vv = version number (to be used in case of regeneration of HK timelines, starting from 00)
133
151
  //
134
 
  if( filename.length() > 21 )
 
152
  if( filename.length() > minLength )
135
153
  {
136
154
    char time[13];
137
155
 
138
 
    QString tail = filename.right( 21 );
 
156
    QString tail = filename.right( minLength );
139
157
 
140
158
    if( sscanf( tail.latin1(), "_%12s_%2d.fits", time, &version ) != 2 )
141
159
    {
286
304
          else
287
305
          {
288
306
            str = QString( "%1/%2" ).arg( prefix ).arg( charName );
 
307
            if( _fields.find( str ) != 0 )
 
308
            {
 
309
              str = QString( "%1/%2_%3" ).arg( prefix ).arg( charName ).arg( iHDUNumber-1 );
 
310
            }
289
311
          }
290
312
 
291
313
          fld->basefile = baseName;
537
559
 
538
560
bool PLANCKIDEFSource::initFolder( )
539
561
{
540
 
  QDir        folder( _filename, "*.fits", QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::Readable );
 
562
  QDir        folder( _filename, "*.fits *.fits.gz", QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::Readable );
541
563
  QStringList files;
542
564
  QStringList filesBase;
543
565
  bool        bRetVal = true;
955
977
 
956
978
bool PLANCKIDEFSource::checkValidPlanckIDEFFolder( const QString& filename )
957
979
{
958
 
  QDir folder( filename, "*.fits", QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::Readable );
 
980
  QDir folder( filename, "*.fits *.fits.gz", QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::Readable );
959
981
  QStringList files;
960
982
  QString pathname;
961
983
  bool ok = false;