fileout_netcdf not making compressed files when it should

Description

Reported by Aron.Bartle@mechdyne.com

I started writing an email asking how we can get better compression from the Netcdf4 return file handler... but then I started digging through the fileout_netcdf source code I think I found my problem:

A bug prevents any NetCDF compression for structure members (which are themselves returned as normal NetCDF arrays).

FONcStructure.cc line 108:
FONcBaseType *fbt = FONcUtils::convert(bt);

At this point in the code, the FONcStructure will have had its return type set (e.g. "netcdf-4") but its member array, created here, does not. As a result, when we get to FONcArray::define the type does is not set to netcdf-4 so no compression happens.

I think the fix is to add "setVersion" to FONcStructure and recursively call setVersion on its vars, or to make FONcUtils::convert set this field.

The original email is below, which can probably be ignored now...

-Aron

And,

Just FYI I made a patch where I just added this line after the call to FONcUtils::convert:
fbt->setVersion(this->_ncVersion);

And as a result:
rw-rr-. 1 abartle clarreo 1097513462 Apr 15 2019 filtertest.nc

...is now compressed!
rw-rr-. 1 abartle clarreo 64682295 Apr 15 2019 filtertest.nc

Environment

None

Status

Assignee

James Gallagher

Reporter

James Gallagher

Labels

Fix versions

None

Story Points

0

Epic Link

Priority

Medium
Configure