FITS Compression [Deep Sky] Acquisition techniques · blackrig · ... · 2 · 139 · 1

blackrig 4.52
...
· 
Hi

I am looking for a solution to compress raw astronomical images.  Compression has 2 goals: reduce the bandwidth use at the remote observatory, and reduce storage space. 

So far I have tested (or looked at) the following:
  • fits format, compressed by a series of python scripts using regular compression (gzip).
  • xisf with the build in compression (LZ4) which I found very slow and generating files bigger than the compressed fits (I think there is a 16 to 32 bit conversion happening before compression that inflates the file).
  • FITSIO, which I have not tried at this point.

I would be interested if somebody has an good workflow for lossless compression of FITS, or experience with FITSIO.
Like
WhooptieDo 9.82
...
· 
Basic ZIP compression drops file size to almost 50% of original.    Seems like a huge gain to me.  

The best bet in the end is to stack your data on the remote PC, then send it over the web.


zip.png
Like
Eric_B. 0.00
...
· 
The problem of storing original files is a chronic problem...
As a former (very old! lol) computer teacher, I will insist on both the durability of the medium (disc, CD, DVD, tapes, etc.), its duplication (at least two copies and not in the same place! ) and also something we think about less often: the ability to reread archives (who still has a working 8-inch disc drive?) and decompress them on a modern system.
This last point is essential: if all your old archives were compressed with MS-DOS software in a “proprietary” format (case of many compression software from the 80s), how are you going to recover them under Win 11 or under Linux? I will not talk about the case of Mac because I do not want to be responsible for a fratricidal war on this forum.
More seriously, we are not collecting data for posterity. I therefore suggest, and this is my method of operation, to save our files in a "universal" compressed format - zip does the job very well: it is readable everywhere or almost - and on a fast reading medium even if less reliable over time than a certified “archiving” one. Nowadays portable hard drives (not SSDs!) are very affordable even in capacities of several To.
But I insist: these things ALWAYS end up breaking down one day or another, and NEVER at the right moment ! (Lenz’s law. Is there a “right moment” ?) So systematically DUPLICATE. Making a new copy after formatting the media “restores the data”. We would therefore need three discs if we wanted to be coherent.
There are a slew of free and effective ZIP compressors. As a precaution, it is advisable to use one that is well known and reputed to be reliable, avoiding esoteric or “miraculous” software. We simply want to compress data, and that's it. The simpler it is, the less it goes wrong.
For me, as my heirs will hasten to format all my disks to resell them on e-bay, I have no qualms. I use the latest version (no. 7 currently) of WinRAR which is inexpensive and has the good taste of rereading ALL the RAR archives that I have been able to make for 30 years with previous versions. (I have no shares with them!) In zip mode, it is lightning fast (less than 15 seconds to compress 1.3 GB of .FIT files recorded on SSD on my 10 year old machine, and just as fast in RAR mode 1st level.) It is not very useful to use the so-called “super-extra-gimmick” compression modes: they will only save a few % and will slow down the process terribly. But if you have the time, the gain compared to ZIP can be substantial.
I added another free compressor that has been working for decades: 7-ZIP [[url]https://www.7-zip.org/download.html], very effective but a little slower. It is as efficient as WinRAR. I used it a lot, and its archives are readable by WinRAR, but not the other way.
For my tests, I took a directory of .FIT files on the SSD of my machine (DELL Precison 2800, an antique old chap’ under Win7) with  116 files of 11,802 KB each, for a total of 1.3 GB of data.
compressor    compression     type size                  compressed time
None              null                            1 363 963 ko
7-Zip               fast zip                      0 871 051 ko       < 1 min
RAR v3.93      very fast                   0 772 661 ko        < 1mn
RAR v7.0      very fast                     0 726 174  ko       < 1mn
7-zip fast      7-Zip fast                  0 766 236  ko        < 3mn
RAR v7.0      "optimized"               0 682 369 ko        < 3mn

[Ps: RAR files have been compressed with the so-called “recovery” option allowing the archive to be reconstructed in the event of corruption. This adds about 4% to the size and has proven to be very effective in restoring old files saved on floppy disks. For me, this option alone justifies the $25 “for life” purchase. That said, there are probably other compressors that have this option too, but I haven't looked. At the end I criticize WinRar for its fairly commercial side... In cauda venenum !]
I hope I made my small help.

__________________________________________________

Le problème de stockage des fichiers originaux est un problème chronique ...
En tant qu’ancien (très ancien ! lol) prof' informaticien, j’insisterai à la fois sur la pérennité du support (disque, cd, dvd, bandes, etc.), sa duplication (au moins deux exemplaires et pas au même endroit !) et aussi quelque chose auquel on pense moins souvent : la faculté de pouvoir relire les archives (qui a encore un  lecteur fonctionnel de disques 8 pouces ?) et des les décompresser sur un système moderne. Ce dernier point est essentiel :si toutes vos anciennes archives ont été compressées avec un logiciel MS-DOS dons un format « propriétaire » (cas de biens des logiciels de compression des années ’80), comment allez-vous les récupérer sous Win 11 ou sous Linux ? Je ne parlerai pas du cas des Mac car je ne veux pas être responsable d’une guerre fratricide sur ce forum.
Plus sérieusement, nous n’engrangeons pas des données pour la postérité. Je suggère donc, et c’est mon mode de fonctionnement, de sauver nos fichiers sous un format compressé « universel » - zip fait très bien l’affaire : il est lisible partout ou presque - et sur un support à lecture rapide même si moins fiable dans le temps qu’un support certifié « archivage ». De nos jours les disques durs portables (pas les ssd !) sont très abordables même dans des capacités de plusieurs To. Mais j’insiste : ces trucs-là finissent TOUJOURS par tomber en panne un jours ou l’autre, et JAMAIS au bon moment ! (loi de Lenz) Donc on duplique systématiquement. Le fait de faire une nouvelle copie après formatage du support « remet les données à neuf ». Il faudrait donc trois disques si l’on voulait être cohérent.
Il existe une flopée de compresseurs ZIP gratuits et efficaces. Par prudence, il convient d’en prendre un bien connu et réputé fiable, en évitant les logiciels ésotériques ou « miraculeux ». On veut simplement compresser des data, et c’est tout. Plus c’est simple, moins cela se détraque.
Personnellement, comme mes héritiers se hâteront de formater tous mes disques pour les revendre sur e-bay, je n’ai pas d’états d’âme. J’utilise le dernière version (n°7 actuellement) de WinRAR qui est bon marché et a le bon goût de relire TOUTES les archives RAR que j’ai pu faire depuis 30 ans avec les versions précédentes. (Je n’ai pas d’actions chez eux !) En mode zip, il est fulgurant (moins de 15s pour comprimer 1,3Go de fichiers .FIT enregistrés su SSD sur ma machine vielle de 10ans, et tout aussi rapide en mode RAR 1er niveau.) Il n’est pas très utile d’employer les modes compression dits « super-extra-bidule » : ils ne feront gagner que quelques % et ralentiront terriblement le processus. Mais si vous avez le temps, le gain par rapporta au ZIP peut être substantiel. 
J’ai rajouté un autre compresseur gratuit et toujours vaillant depuis des dizaines d’années : 7-ZIP [[url]https://www.7-zip.org/download.html], très efficace mais un peu plus lent. Il est aussi efficace que WinRAR.
Pour mes essais, j’ai pris un répertoire de fichiers .FIT sur le SSD de ma machine (DELL Precison 2800, une antiquité sous Win7)contenant 116 fichiers de 11 802 ko chacun, soit 1,3 Go de données.

compresseur            type de compression   taille compressée   temps
Aucun                        nulle                        1 363 963 ko      
7-Zip                          zip rapide                0 871 051 ko                  < 1mn
RAR v3.93                  très rapide              0 772 661 ko                 < 1mn
RAR v7.0                     très rapide             0 726 174 ko                 < 1mn
7-zip rapide               7-Zip rapide           0 766 236 ko                < 3 mn
RAR v7.0                     optimisé                0 682 369 ko                < 3mn
[Ps : les fichiers RAR ont été compressés avec l’option dite “[i]de récupération” permettant de reconstruire l’archive en cas d’altération. Cela rajout environ 4% à la taille et s’est révélé très efficace dans la restauration de fichiers anciens enregistrés sur disquettes. Rien que cette option justifie à mes yeux les 25$ de l’achat « à vie ». Cela dit, il existe probablement d’autres compresseurs ayant cette option, mais je n’ai pas cherché. Pour finir je reproche à WinRar son côté passablement mercantile ...[i] [/i]In cauda venenum !]
J’espère avoir apporté ma petite contribution.
Edited ...
Like
 
Register or login to create to post a reply.