Commit 638ea2ac authored by LEFEBVREJP email's avatar LEFEBVREJP email
Browse files

Merge branch 'snd2arl' into 'master'

Snd2arl

See merge request !77
parents 8f918616 ada3950f
Pipeline #61491 passed with stages
in 14 minutes and 26 seconds
......@@ -158,7 +158,7 @@ int main(int argc, char **argv)
// Work out which fields are which data points - should be 2nd line (1)
std::cout << "Finding data fields..." << std::endl;
for (int entry = 0; entry < inputData[1].size(); ++entry)
for (size_t entry = 0; entry < inputData[1].size(); ++entry)
{
if (inputData[1][entry] == pressureString)
{
......@@ -250,7 +250,7 @@ int main(int argc, char **argv)
inputWDirs, inputWSpds, inputHeights;
std::cout << "Data fields found - reading data..." << std::endl;
float missingValue = -9999.f;
for (int row = 4; row < inputData.size(); ++row)
for (size_t row = 4; row < inputData.size(); ++row)
{
if (inputData[row].size() < inputData[1].size())
{
......@@ -262,7 +262,7 @@ int main(int argc, char **argv)
bool foundPressure = false, foundTemp = false, foundRelHum = false,
foundDewPt = false, foundWDir = false, foundWSpd = false,
foundHeight = false;
for (int entry = 0; entry < inputData[row].size(); ++entry)
for (size_t entry = 0; entry < inputData[row].size(); ++entry)
{
float thisValue = from_string(inputData[row][entry], missingValue);
......@@ -475,6 +475,11 @@ int main(int argc, char **argv)
std::cout << " Height:" << std::endl;
inputHeights = interpolateValues(inputPressures, inputHeights, true);
}
// First convert temperature from Celsius to Kelvin
std::cout << "Converting Temperature from C to Kelvin." << std::endl;
std::transform(inputTemps.begin(), inputTemps.end(), inputTemps.begin(),
[](double v) { return v - ABS_ZERO_CELSIUS; });
std::cout << " Interpolation complete." << std::endl;
// Check if the grid is of appropriate size - with too small grid/too many
......@@ -538,7 +543,7 @@ int main(int argc, char **argv)
thisIndexHeader.dummy = 0.f;
thisIndexHeader.nx = numberGridCells;
thisIndexHeader.ny = numberGridCells;
thisIndexHeader.nz = inputPressures.size();
thisIndexHeader.nz = int(inputPressures.size());
thisIndexHeader.z_flag = 2;
thisIndexHeader.lenh = numberGridCells * numberGridCells;
thisIndexHeader.levels = inputPressures;
......@@ -604,8 +609,6 @@ int main(int argc, char **argv)
}
// Write temperature levels
// First convert temperature from Celsius to Kelvin
inputTemps[level] = inputTemps[level] - ABS_ZERO_CELSIUS;
{
thisRecordHeader.kvar = "TEMP";
thisRecordHeader.var1 = inputTemps[level];
......@@ -682,6 +685,8 @@ int main(int argc, char **argv)
metTime.tm_year = metTime.tm_year + 400;
#endif // _WIN32
addHour(&metTime, 1);
printf("%d%02d%02d:%02d\n", metTime.tm_year, (metTime.tm_mon + 1),
metTime.tm_mday, metTime.tm_hour);
#ifdef _WIN32
metTime.tm_year = metTime.tm_year - 400;
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment