Commit e4d52205 authored by Lefebvre, Jordan's avatar Lefebvre, Jordan
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
record_length = id.size() + sizeof(int) * 7;
int year, month, day, hour, forecastHour, minutes, numLocations, packing = 1;
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();
numLocations = mData->numLocations();
......@@ -170,7 +177,13 @@ bool HysplitCDumpStream<data_type>::write_to(const std::string &file) const
float lat, lon, z;
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;
radix_tagged_line("record_length=" << record_length);
fstr.writeHeader(record_length);
......@@ -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.");
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;
radix_tagged_line("record_length=" << record_length);
fstr.writeHeader(record_length);
......@@ -242,7 +262,14 @@ bool HysplitCDumpStream<data_type>::write_to(const std::string &file) const
radix_tagged_line("bytes_written=" << fstr.bytesWritten());
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;
radix_tagged_line("record_length=" << 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