Skip to content

Commit

Permalink
Merge commit 'b60e4176a5bd6a31324d7d4057096f050a1d0b2e'
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed May 20, 2024
2 parents 6f2530f + b60e417 commit c5e52b9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions agrolib/waterTable/importData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ bool loadCsvRegistry(QString csvRegistry, std::vector<Well> &wellList, QString &
wrongLines++;
continue;
}
items[posId] = items[posId].simplified();
QString id = items[posId].remove(QChar('"'));
if (idList.contains(id))
{
Expand All @@ -49,13 +50,15 @@ bool loadCsvRegistry(QString csvRegistry, std::vector<Well> &wellList, QString &
continue;
}
idList.append(id);
items[posUtmx] = items[posUtmx].simplified();
double utmX = items[posUtmx].remove(QChar('"')).toDouble(&ok);
if (!ok)
{
errorList.append(id);
wrongLines++;
continue;
}
items[posUtmy] = items[posUtmy].simplified();
double utmY = items[posUtmy].remove(QChar('"')).toDouble(&ok);
if (!ok)
{
Expand Down Expand Up @@ -115,6 +118,7 @@ bool loadCsvDepths(QString csvDepths, std::vector<Well> &wellList, int waterTabl
wrongLines++;
continue;
}
items[posId] = items[posId].simplified();
QString id = items[posId].remove(QChar('"'));
bool found = false;
int index = NODATA;
Expand All @@ -134,15 +138,15 @@ bool loadCsvDepths(QString csvDepths, std::vector<Well> &wellList, int waterTabl
wrongLines++;
continue;
}

items[posDate] = items[posDate].simplified();
QDate date = QDate::fromString(items[posDate].remove(QChar('"')),"yyyy-MM-dd");
if (! date.isValid())
{
errorList.append(line);
wrongLines++;
continue;
}

items[posDepth] = items[posDepth].simplified();
int value = items[posDepth].remove(QChar('"')).toInt(&ok);
if (!ok || value == NODATA || value < 0 || value > waterTableMaximumDepth)
{
Expand Down

0 comments on commit c5e52b9

Please sign in to comment.