Skip to content

Adds capability to read and write grid data to HDF5.#235

Merged
allegroLeiden merged 5 commits intolime-rt:masterfrom
allegroLeiden:hdf5
Jun 9, 2017
Merged

Adds capability to read and write grid data to HDF5.#235
allegroLeiden merged 5 commits intolime-rt:masterfrom
allegroLeiden:hdf5

Conversation

@allegroLeiden
Copy link
Copy Markdown
Contributor

@allegroLeiden allegroLeiden commented May 29, 2017

Previously the only file format available has been FITS. Now HDF5 can be selected. Currently this must be done by hand via commenting/uncommenting appropriate lines of gridio.h. Better would be to do it via a Makefile switch.

- countDensityCols() no longer accepts a file pointer argument.

- par->collPartNames is now sent to writeGrid() and the names are thus written to file.

- In writeKeywordsToFITS() and readKeywordsFromFITS(), the file pointer argument is now of type fitsfile* rather than lime_fptr*.

- In readGridExtFromFITS(), the count of ABUNMOL columns has been moved back to just before the columns are read, since its value is no longer being used to malloc the grid .mol pointer.

- In readGridExtFromFITS(), status is now set to 0 before the COLLPARn keywords are read. This prevents the 'column not found' value set by the previous attempt to read a B_FIELDn column from triggering FITS error reporting.

- Extra defines added to grid2fits.h.

- The way that grid2fits.h is imported has been changed.

- In initializeKeyword(), character pointers keyname, comment and charValue are now malloc'd rather than set to NULL. Functions freeKeywords() and freeKeyword() have been added to gridio.c to free up this memory again.

- Everywhere in gridio.c 'lime_fptr *fptr' has been replaced by 'lime_fptr fptr', and the definition of lime_fptr has been adjusted accordingly.
  - I added -DH5_NO_DEPRECATED_SYMBOLS to the compile commands to force macros such as H5Dcreate map to H5Dcreate2 and not H5Dcreate1.

  - Added -Wformat -Wformat-security to the compiler flags invoked with the test switch.

  - Fixed 3 or 4 formatting bugs.
@tlunttil
Copy link
Copy Markdown
Contributor

tlunttil commented Jun 8, 2017

I'm afraid I won't have time to go through all 2000+ lines of new code... However, your truly Stakhanovite effort is highly appreciated.

Is there a specific reason why you're not using a Makefile switch for selecting the file format? It might also be better to set the default to using just fits. Not all systems have HDF5 libraries installed.

@allegroLeiden
Copy link
Copy Markdown
Contributor Author

Thanks for the kudos. :) No, I was going to add a Makefile switch before I merged. It was pure laziness not to do so before. Point about fits/hdf5 also well taken.

@allegroLeiden allegroLeiden merged commit af0741e into lime-rt:master Jun 9, 2017
@allegroLeiden allegroLeiden deleted the hdf5 branch June 9, 2017 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants