Skip to content
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

roman_datamodel attribute filename used consistently #1026

Closed
stscijgbot-rstdms opened this issue Nov 22, 2023 · 2 comments · Fixed by spacetelescope/roman_datamodels#295
Closed

Comments

@stscijgbot-rstdms
Copy link
Collaborator

Issue RCAL-723 was created on JIRA by Jonathan Eisenhamer:

In writing tests and other development, inconsistencies in how model.meta.filename is set have been seen.

A particular example is the given data model:

>>> from roman_datamodels import datamodels as rdm
>>> model = rdm.open('r0000101001001001001_01101_0001_WFI01_rampfit.asdf')
>>> model.meta.filename
'r0000101001001001001_01101_0001_WFI01_uncal.asdf'

The meta value is not updated to represent the filename the model has just been read from, but retains the value given to it in some way(?).

Investigate usage and use cases for this meta and resolve inconsistencies.

@stscijgbot-rstdms
Copy link
Collaborator Author

Comment by William Jamieson on JIRA:

I have had a look at this, and can confirm this occurs when outputting any step file (rampfit, saturation, refpix, etc), but does not occur when one runs the entire pipeline. The reason for the exception for the entire pipeline case is that the last thing done in that case is to manually update the model.meta.filename, see here.

Everywhere else the difference between the model.meta.filename is induced by a combination of stpipe and roman_datamodels. In particular, when stpipe is commanded to write the output of a particular step, it modifies the input file's name to use the suffix mapped to the step (if there is one). This means that the actual (on disk) file names are "correct". However, stpipe calls into the roman_datamodels.datamodels.DataModel.save method, which calls down into ASDF to actually save the file. No modifications to the model.meta.filename field occur as part of this. Thus since the model.meta contents are either unchanged or copied from one step to the next, the model.meta.filename is never updated except by manual calls.

I believe the solution is to add conditional logic in roman_datamodels.datamodels.DataModel.save which sets the model.meta.filename to the indicated file name for the save, provided the model.meta.filename field is present in the data model being saved.

@stscijgbot-rstdms
Copy link
Collaborator Author

Comment by William Jamieson on JIRA:

This will be completed by: spacetelescope/roman_datamodels#295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant