openghg / openghg_inversions

University of Bristol Atmospheric Chemistry Research Group RHIME Inversion code (with openghg dependency)
MIT License
5 stars 0 forks source link

Variable length data is no longer compressed #19

Closed brendan-m-murphy closed 1 year ago

brendan-m-murphy commented 1 year ago

Compressing variable length data when writing a dataset to netcdf can cause a "Filter Error".

To avoid this, I modified the encoding in infterpymc_postprocessouts to not apply zlib to data variables whose data type is variable length.

These data types are: "Object" and "Unicode". These are numpy datatypes with codes "O" and "U". I used a regex to parse the datatype string for each data variables, since these strings can start with a symbol to specify the byte-order.

This elimiates the FilterError from the inversion run on Iss18, and the netCDF output seems to be about 1/3 the size of the output if encoding = None (i.e. no additional compression from zlib=True) is used.

This closes Issue #18.