Skip to content

Commit

Permalink
Fix incorrect parsing of SPECSYS value for ATCA FITS header
Browse files Browse the repository at this point in the history
  • Loading branch information
markccchiang committed May 10, 2024
1 parent 6b28869 commit db44662
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
* Fixed crash when loading non-image HDU by URL ([#1365](https://github.com/CARTAvis/carta-backend/issues/1365)).
* Fix crash when parsing FITS header long value ([#1366](https://github.com/CARTAvis/carta-backend/issues/1366)).
* Fix incorrect parsing of SPECSYS value for ATCA FITS header ([#1375](https://github.com/CARTAvis/carta-backend/issues/1375)).

### Changed
* Move the loader cache to separate files ([#1021](https://github.com/CARTAvis/carta-backend/issues/1021)).
Expand Down
5 changes: 4 additions & 1 deletion src/FileList/FileExtInfoLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ void FileExtInfoLoader::AddEntriesFromHeaderStrings(
// CartaHdf5Image shortens keywords to FITS length 8
std::unordered_map<std::string, std::string> hdf5_keys = {
{"H5SCHEMA", "SCHEMA_VERSION"}, {"H5CNVRTR", "HDF5_CONVERTER"}, {"H5CONVSN", "HDF5_CONVERTER_VERSION"}, {"H5DATE", "HDF5_DATE"}};
bool has_specsys(false);

for (auto& header : headers) {
// Parse header into name, value, comment
Expand Down Expand Up @@ -335,6 +336,8 @@ void FileExtInfoLoader::AddEntriesFromHeaderStrings(
// not numeric
}
is_string_value = true;
} else if (name == "SPECSYS") {
has_specsys = true;
}

// Set name
Expand Down Expand Up @@ -365,7 +368,7 @@ void FileExtInfoLoader::AddEntriesFromHeaderStrings(
}
}

if (!specsys.empty()) {
if (!has_specsys && !specsys.empty()) {
// separated from VELO CTYPE
auto entry = extended_info.add_header_entries();
entry->set_name("SPECSYS");
Expand Down

0 comments on commit db44662

Please sign in to comment.