-
Notifications
You must be signed in to change notification settings - Fork 56
[newchem-cpp] hdf5 io refactor #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: newchem-cpp
Are you sure you want to change the base?
Conversation
This commit includes a few more changes than I initially wanted
This was spurred on by deprecation warnings included on macOS's implementation of the standard library
| // Ideally we would uncomment the following block of logic that verifies | ||
| // that the Grid Table properties are identical to the cooling table | ||
| // -> uncommenting the logic would be useful for enforcing consistency | ||
| // in any new data files (all files currently shipped with Grackle | ||
| // already satisfy this requirement) | ||
| // -> the only downside to uncommenting the block is a little overhead | ||
|
|
||
| //if (h5io::assert_has_consistent_GridTableProps(file_id, dset_name, | ||
| // grid_props) != GR_SUCCESS){ | ||
| // h5io::drop_GridTableProps(&grid_props); | ||
| // H5Fclose(file_id); | ||
| // return GR_FAIL; | ||
| //} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would really like to make this change. The only drawback is that it will introduce slight overhead at startup. But, I think it's probably worth it
| // Ideally we would uncomment the following block of logic that verifies | |
| // that the Grid Table properties are identical to the cooling table | |
| // -> uncommenting the logic would be useful for enforcing consistency | |
| // in any new data files (all files currently shipped with Grackle | |
| // already satisfy this requirement) | |
| // -> the only downside to uncommenting the block is a little overhead | |
| //if (h5io::assert_has_consistent_GridTableProps(file_id, dset_name, | |
| // grid_props) != GR_SUCCESS){ | |
| // h5io::drop_GridTableProps(&grid_props); | |
| // H5Fclose(file_id); | |
| // return GR_FAIL; | |
| //} | |
| // validate that Heating table has have identical GridTableProps | |
| if (h5io::assert_has_consistent_GridTableProps(file_id, dset_name, | |
| grid_props) != GR_SUCCESS){ | |
| h5io::drop_GridTableProps(&grid_props); | |
| H5Fclose(file_id); | |
| return GR_FAIL; | |
| } |
| // Ideally we would uncomment the following block of logic that verifies | ||
| // that the Grid Table properties are identical to the cooling table | ||
| // -> uncommenting the logic would be useful for enforcing consistency | ||
| // in any new data files (all files currently shipped with Grackle | ||
| // already satisfy this requirement) | ||
| // -> the only downside to uncommenting the block is a little overhead | ||
|
|
||
| //if (h5io::assert_has_consistent_GridTableProps(file_id, mmw_dset_name, | ||
| // grid_props) != GR_SUCCESS){ | ||
| // h5io::drop_GridTableProps(&grid_props); | ||
| // H5Fclose(file_id); | ||
| // return GR_FAIL; | ||
| //} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just like the preceding comment, I would really like to make this change
| // Ideally we would uncomment the following block of logic that verifies | |
| // that the Grid Table properties are identical to the cooling table | |
| // -> uncommenting the logic would be useful for enforcing consistency | |
| // in any new data files (all files currently shipped with Grackle | |
| // already satisfy this requirement) | |
| // -> the only downside to uncommenting the block is a little overhead | |
| //if (h5io::assert_has_consistent_GridTableProps(file_id, mmw_dset_name, | |
| // grid_props) != GR_SUCCESS){ | |
| // h5io::drop_GridTableProps(&grid_props); | |
| // H5Fclose(file_id); | |
| // return GR_FAIL; | |
| //} | |
| // validate that MMW table has have identical GridTableProps | |
| if (h5io::assert_has_consistent_GridTableProps(file_id, mmw_dset_name, | |
| grid_props) != GR_SUCCESS){ | |
| h5io::drop_GridTableProps(&grid_props); | |
| H5Fclose(file_id); | |
| return GR_FAIL; | |
| } |
To be reviewed after #454 is merged
Refactor a bunch of hdf5 file-reading functionality.
The biggest change here is that I factored out the parsing of the attributes of the tabulated interpolation datasets. This is now handled by
parse_GridTablePropsand returns an object that summarizes the information"hdens","redshift","Temperature","metal * log")Footnotes
Honestly, if I had to do it all over again, I would do it slightly differently. This was a lot more effort than I expected. But I think it is a very useful improvement for us to have. ↩