Maybe, someone finds it useful: fortran-zlib, my interface bindings to zlib, a data compression library that provides an implementation of the DEFLATE algorithm.
In one of my projects, I call zlib to deflate the Namelist representation of a derived type. The compressed string is sent via HTTP to an CGI applicatiion that runs inflate to decompress the string. The Namelist is then read into the derived type, to be stored in a database.
By using DEFLATE, the content size is reduced from 40 KiB to less than 4 KiB, allowing a higher throughput per second.
One possible application is reading MATLAB 7.0 and higher .MAT files which use compression (I think its zlib) by default. I ran into this last week when trying to put together some code to read some MAT files for a MATLAB program I was trying to compare results with. For now I found it easier to read the file into MATLAB and save it
as a version 6 file without compression.
Thanks Steve. I figured someone had already done this but my first search attempts didn’t show anything. According to the documentation I could find on-line, MATLAB version 7.3 is HDF5+zlib. Version 7.0 is their old format with compression turned on by default.
That’s great news! As @egio mentions, readers/writers for Numpy
.npz files require zlib. We have an issue open for this in stdlib if anyone wants to help: Save and load in binary, compatible with NumPy/Matlab and others · Issue #486 · fortran-lang/stdlib · GitHub.
@interkosmos You have done a great work creating Fortran interfaces for C libraries.
I’d like to know wgether the porting done by looking at the C headers and creating the Fortran interfaces manually or is this work partly supported by software?
Most of my interface bindings are hand-written, as they often require additional wrapper procedures. Also, argument passing from Fortran to C is not always straight forward. In rare circumstances, interfaces can be created automatically. For instance, the OpenGL bindings were generated by a custom Python script.