Commit e4d52205 authored by LEFEBVREJP email's avatar LEFEBVREJP email
Browse files

Patching the radixio/hysplitcdump write routine to force a YY formatted year.

parent dfafc980
Pipeline #11992 failed with stages
in 3 minutes and 50 seconds
...@@ -156,6 +156,13 @@ bool HysplitCDumpStream<data_type>::write_to(const std::string &file) const ...@@ -156,6 +156,13 @@ bool HysplitCDumpStream<data_type>::write_to(const std::string &file) const
record_length = id.size() + sizeof(int) * 7; record_length = id.size() + sizeof(int) * 7;
int year, month, day, hour, forecastHour, minutes, numLocations, packing = 1; int year, month, day, hour, forecastHour, minutes, numLocations, packing = 1;
mData->dateTime(year, month, day, hour); mData->dateTime(year, month, day, hour);
//
// Adjust the date from YYYY to YY format.
// HYSPLIT utils always assume YY format
if (year > 99)
{
year = year % 100;
}
forecastHour = mData->forecastHour(); forecastHour = mData->forecastHour();
numLocations = mData->numLocations(); numLocations = mData->numLocations();
...@@ -170,7 +177,13 @@ bool HysplitCDumpStream<data_type>::write_to(const std::string &file) const ...@@ -170,7 +177,13 @@ bool HysplitCDumpStream<data_type>::write_to(const std::string &file) const
float lat, lon, z; float lat, lon, z;
for (int i = 0; i < numLocations; ++i) for (int i = 0; i < numLocations; ++i)
{ {
mData->location(i, year, month, day, hour, lat, lon, z, minutes); mData->location(i, year, month, day, hour, lat, lon, z, minutes); //
// Adjust the date from YYYY to YY format.
// HYSPLIT utils always assume YY format
if (year > 99)
{
year = year % 100;
}
record_length = sizeof(int) * 5 + sizeof(float) * 3; record_length = sizeof(int) * 5 + sizeof(float) * 3;
radix_tagged_line("record_length=" << record_length); radix_tagged_line("record_length=" << record_length);
fstr.writeHeader(record_length); fstr.writeHeader(record_length);
...@@ -234,7 +247,14 @@ bool HysplitCDumpStream<data_type>::write_to(const std::string &file) const ...@@ -234,7 +247,14 @@ bool HysplitCDumpStream<data_type>::write_to(const std::string &file) const
"The number of start times did not match the number of end times."); "The number of start times did not match the number of end times.");
for (int timeIndex = 0; timeIndex < numStartTimes; ++timeIndex) for (int timeIndex = 0; timeIndex < numStartTimes; ++timeIndex)
{ {
mData->startTime(timeIndex, year, month, day, hour, minutes, forecastHour); mData->startTime(timeIndex, year, month, day, hour, minutes,
forecastHour); //
// Adjust the date from YYYY to YY format.
// HYSPLIT utils always assume YY format
if (year > 99)
{
year = year % 100;
}
record_length = sizeof(int) * 6; record_length = sizeof(int) * 6;
radix_tagged_line("record_length=" << record_length); radix_tagged_line("record_length=" << record_length);
fstr.writeHeader(record_length); fstr.writeHeader(record_length);
...@@ -242,7 +262,14 @@ bool HysplitCDumpStream<data_type>::write_to(const std::string &file) const ...@@ -242,7 +262,14 @@ bool HysplitCDumpStream<data_type>::write_to(const std::string &file) const
radix_tagged_line("bytes_written=" << fstr.bytesWritten()); radix_tagged_line("bytes_written=" << fstr.bytesWritten());
fstr.writeFooter(record_length); fstr.writeFooter(record_length);
mData->endTime(timeIndex, year, month, day, hour, minutes, forecastHour); mData->endTime(timeIndex, year, month, day, hour, minutes,
forecastHour); //
// Adjust the date from YYYY to YY format.
// HYSPLIT utils always assume YY format
if (year > 99)
{
year = year % 100;
}
record_length = sizeof(int) * 6; record_length = sizeof(int) * 6;
radix_tagged_line("record_length=" << record_length); radix_tagged_line("record_length=" << record_length);
fstr.writeHeader(record_length); fstr.writeHeader(record_length);
......
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