The function QTideEffect::readOCEANFile cannot read the coefficients from blq file.
The function not find the station name in the blq file.
In the following block of code I explain the problem:
....
308 while (!m_readOCEANClass.atEnd())
{
//2-6 per line is empty, it means the data will start "$$" and the length is 4
while (4 != tempLine.length()) //<--- The program exit of this cycle only at end of file. The lines length is always different from 4.
{
tempLine = m_readOCEANClass.readLine();
if (m_readOCEANClass.atEnd())
{
isOCEANTide = false;
oceaData.isRead = false;
break;
}
}
//Read station data
tempLine = m_readOCEANClass.readLine();//Read header file line
if (m_readOCEANClass.atEnd())
{
isOCEANTide = false;
oceaData.isRead = false;
break;
}
tempStationName = tempLine.mid(2,4).trimmed().toUpper();
if (tempStationName != StationName) continue;
//Find the station
tempOCEANData.StationName = tempStationName;
//Skip comments (can read station BLH, not read here)
tempLine = m_readOCEANClass.readLine();//Read comment
while (tempLine.mid(0,2).contains("$"))
337 tempLine = m_readOCEANClass.readLine();//Read comment
....
Here how I would have built the block of code:
...
while (!m_readOCEANClass.atEnd())
{
// Skip comments
while (tempLine.startsWith("$$"))
{
tempLine = m_readOCEANClass.readLine();
if (m_readOCEANClass.atEnd())
{
isOCEANTide = false;
oceaData.isRead = false;
break;
}
}
// Possible line with station name
tempStationName = tempLine.mid(2,4).trimmed().toUpper();
if (tempStationName != StationName) {
tempLine = m_readOCEANClass.readLine();
if (m_readOCEANClass.atEnd())
{
isOCEANTide = false;
oceaData.isRead = false;
break;
}
continue;
}
//Find the station
tempOCEANData.StationName = tempStationName;
//Skip comments
tempLine = m_readOCEANClass.readLine();//Read comment
while (tempLine.startsWith("$$"))
tempLine = m_readOCEANClass.readLine();//Read comment
...
The function QTideEffect::readOCEANFile cannot read the coefficients from blq file. The function not find the station name in the blq file. In the following block of code I explain the problem:
Here how I would have built the block of code: