adokter / rsl

TRMM Radar Software Library (RSL)
https://trmm-fc.gsfc.nasa.gov/trmm_gv/software/rsl/
Other
25 stars 6 forks source link

missing Windows compatibility #8

Open adokter opened 5 years ago

adokter commented 5 years ago

RLS currently uses unix specific piping to access gzip (e.g. here, here), as well to decode recent nexrad files with decode_ar2v, with statements like

  fpipe = popen("gzip -q -d -f --stdout", "r");

These pipes are unavailable on Windows platforms, and need to be removed

adokter commented 5 years ago

zlib can handle .gz files

See also https://stackoverflow.com/questions/1838699/how-can-i-decompress-a-gzip-stream-with-zlib:

To decompress a gzip format file with zlib, call inflateInit2 with the windowBits parameter as 16+MAX_WBITS, like this:

inflateInit2(&stream, 16+MAX_WBITS);

If you don't do this, zlib will complain about a bad stream format. By default, zlib creates streams with a zlib header, and on inflate does not recognise the different gzip header unless you tell it so. Although this is documented starting in version 1.2.1 of the zlib.h header file, it is not in the zlib manual. From the header file:

windowBits can also be greater than 15 for optional gzip decoding. Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a crc32 instead of an adler32.