-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
Access YAML annotations #881
Conversation
Codecov Report
@@ Coverage Diff @@
## main #881 +/- ##
==========================================
+ Coverage 72.39% 72.43% +0.03%
==========================================
Files 364 364
Lines 46433 46489 +56
==========================================
+ Hits 33616 33672 +56
Misses 12817 12817
Continue to review full report at Codecov.
|
a33e030
to
80df2ba
Compare
75a3181
to
a9f2065
Compare
a9f2065
to
d15ae54
Compare
As you have anticipated, this overlaps with Cantera/enhancements#11, and my preference would be to provide metadata not used directly by Cantera as a more generic auxiliary data structure. In the long term, I'd like to think that we could better organize this metadata rather than just calling it the "note" associated with a species / reaction / etc, which is about all we can do when translating from Chemkin input. I'll see if I can extract the implementation I have of making the "extra" input data available in Python -- right now, it's a bit tangled up in my work in progress on YAML serialization, which I don't think will be ready for the 2.5.0 release. If that doesn't work out, I would consider as an interim option a version of this which reads the "note" directly from the cantera/include/cantera/base/AnyMap.h Lines 506 to 510 in 047e74b
|
@speth ... thanks for your feedback.
I am aware of this goal; however,
I have no problem with that. Edit: The implementation / underlying data structure is secondary (whether |
@speth, with how you envision the implementation of notes, how would they be accessible? I think keeping auxiliary information separate from the data required for Cantera to compute makes sense. I did find this implementation convenient because when I am iterating through species/reactions it is nice to be able to call the note directly. I started to write a version of soln2ck (soon to be yaml2ck) with this implementation, so I don't want to waste my time if the underlying data structure is going to change. Edit: By underlying data structure, I meant the structure of the Python interface. |
Just because In this case, I think I would want
My current draft implementation provides a Python data structure made of simple types (e.g. nested maps and lists of strings and numbers) which correspond to the YAML entry that would recreate that same object. This includes both the fields used by Cantera as well as those that are not. But maybe Cantera/enhancements#52 is a better place to discuss how to do this without generating extra work as the YAML interface matures. |
@speth ... thank you for your thoughts.
I believe that's not necessarily the case. By including the fields you chose, you have created a precedent that will have to remain backward-compatible, right? I.e. if someone uses a YAML file generated by Regarding the overlap with ongoing work on Cantera/enhancements#11: it appears that there's a need to access
In terms of YAML, I see the appeal of being fully flexible, but am afraid that this will result in clutter, especially if core-Cantera fields are difficult to differentiate from custom fields. Also, doesn't this approach mean that there will be a lot of redundant information (i.e. information stored by both object and
Case in point. I'm not sure that it can be anticipated what users expect from YAML (and this goes beyond metadata), and I'm also not sure that Other thoughts: ... it may make sense to rename The advantage of this would be that |
My point was more that
I don't think we should restrict the organization of data not used directly by Cantera. I would like others who generate YAML files to be able to add fields without imposing this kind of structure. As to your other comments, I would suggest that this discussion wait until I share a draft implementation of Cantera/enhancements#11. I think I agree with most of your goals, but it's apparently hard to show that what I'm doing actually achieves those ends without concrete examples. With the understanding that this addition will provide access to all YAML data, my suggestion is to close this PR. |
The only constraint would be to use the field
I have no objection to closing once the discussions on Cantera/enhancements#52 and Cantera/enhancements#56 have converged. Specifically, I don't see the point why it doesn't make sense to reserve a field name where users can expect to find metadata (if any are specified)? If there's agreement that |
@ischoegl As I said on Cantera/enhancements#56, I have reservations about including access to YAML fields by attributes on a class instance. Since (my understanding of) the main use case for these fields right now is to support There seems to be a tension right now between releasing 2.5.0 ASAP, even though YAML serialization won't be ready, and providing some sort of limited access to certain fields in the YAML. I'm personally in the camp of let's get 2.5.0 out now and accept that it won't be feature-complete. It has been 2 years since 2.4.0 and there are over 800 commits on To specifically address this:
I said on Cantera/enhancements#56 that what is metadata for Cantera may not be metadata for another tool. Rather than restricting those other tools to have to use a specific field if they want to support Cantera, I'd rather be flexible. |
As I have mentioned, there isn’t really a contradiction of implementations whatsoever: what I was proposing is a front end that allows access to existing YAML data. All it would have done is formalize access. |
With #984 now merged and Cantera/enhancements#11 closed, I am reopening this PR. It will require some updates of course. |
I will take a look at this as soon as I can. I'm happy that we'll have access to more fields! |
@tsikes ... not sure whether the PR is necessary at all (will likewise have to look at it again). I mainly re-opened it to ensure that the associated work won't get forgotten. |
d15ae54
to
888d17d
Compare
888d17d
to
c09833c
Compare
c09833c
to
c871bee
Compare
c871bee
to
41540b8
Compare
@speth (and @tsikes) ... I looked over the old PR and blended it with the serialization that was just implemented in #984. After the update, this PR has the exact same external interface for getters as before, and adds setters that had been only partially implemented. So at this point:
In a nutshell, the
|
@ischoegl Is this still worth pursuing? Since |
From what I understand |
Superseded by #1129 |
Checklist
scons build
&scons test
) and unit tests address code coverageIf applicable, fill in the issue number this pull request is fixing
Fixes #1013
Addresses annotations discussed in Cantera/enhancements#52
Changes proposed in this pull request
description
fieldnote
fields forSpecies
,SpeciesThermo
,Reaction
,TransportData
, andThermoPhase
fix an issue where yaml-cpp does not recognize strings containing integers contained in quotes, e.g.… already merged'1234'
Thoughts:
description
andnote
fields are part of the canonical YAML implementation (seeck2yaml
); the explicit inclusion ensures that Sphinx docstrings are generated.Some C++ classes already have aAnyMap input
attribute, which may be used instead of astring m_note
as envisioned in the initial draft.