Commit fd9769cd authored by Purves, Murray's avatar Purves, Murray
Browse files

Reworked resampling limits to enable matching between different runs/files

parent 943e3531
Pipeline #28459 failed with stages
in 6 minutes and 42 seconds
......@@ -55,7 +55,13 @@ int main(int argc, char **argv)
commandLine.addOption(
"rs", "Resample input data to uniform pressure levels (value=interval)",
false);
commandLine.addOption("rsstart", "Resampling start pressure level[950]",
commandLine.addOption("rsstart",
"Resampling start pressure level - "
"Defaults to use input pressure extent",
false);
commandLine.addOption("rsend",
"Resampling end pressure level - "
"Defaults to use input pressure extent",
false);
// Ensure required options present
......@@ -85,7 +91,8 @@ int main(int argc, char **argv)
float groundElevation = commandLine.get<float>("g", 0.f);
std::string startTime = commandLine.get<std::string>("t", "1951111917");
float resampleInterval = commandLine.get<float>("rs", -1.f);
float resampleStart = commandLine.get<float>("rsstart", 50.f);
float resampleStart = commandLine.get<float>("rsstart", -1.f);
float resampleEnd = commandLine.get<float>("rsend", -1.f);
// Get the grid size
int numberGridCells = (int)(extent / resolution);
if (!numberGridCells % 2 == 1)
......@@ -375,12 +382,31 @@ int main(int argc, char **argv)
std::cout << " Resampling input data using sampling interval: "
<< resampleInterval << " mb" << std::endl;
std::vector<float> resampledPressures;
float minPressure =
*std::min_element(std::begin(inputPressures), std::end(inputPressures));
// Calculate the upper and lower bounds of the resampled pressure array
radix_line(" input start = " << resampleStart
<< "; end = " << resampleEnd);
if (resampleStart < 0)
{
resampleStart =
(float)roundUpInt((int)*std::max_element(std::begin(inputPressures),
std::end(inputPressures)),
resampleInterval);
}
if (resampleEnd < 0)
{
resampleEnd =
(float)roundDownInt((int)*std::min_element(std::begin(inputPressures),
std::end(inputPressures)),
resampleInterval);
}
std::cout << " Using start = " << resampleStart
<< "; end = " << resampleEnd << std::endl;
// Calculate the resampled pressure values using the interval given
std::cout << " Calculating resampled pressure values..." << std::endl;
float thisPressure;
for (thisPressure = resampleStart; thisPressure > minPressure;
for (thisPressure = resampleStart; thisPressure > resampleEnd;
thisPressure -= resampleInterval)
{
resampledPressures.push_back(thisPressure);
......
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