Skip to content

Comments

Documentation#13

Open
rjplevin wants to merge 4 commits intomainfrom
documentation
Open

Documentation#13
rjplevin wants to merge 4 commits intomainfrom
documentation

Conversation

@rjplevin
Copy link
Collaborator

Added documentation in preparation for a "SoftwareX" journal article on OPGEE.

@rjplevin rjplevin requested review from lloyd-rmi and mbarlow12 May 12, 2025 17:01
@lloyd-rmi
Copy link

Can we get a rough overview of what is planned to be talked about in the SoftwareX article?

@lloyd-rmi
Copy link

Do the updates here mean that the online readthedocs will be deployed from this repo going forward?

Copy link

@lloyd-rmi lloyd-rmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still some comments to address but overall the updates look reasonable.


All XML elements are described further in :doc:`opgee-xml`.
When the model is built, all the ``Streams`` and ``Processes`` identified by
``StreamRef`` and ``ProcessRef`` elements within the enclosed ``<ProcessGroup>>``

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete additional '>' around ProcessGroup

@@ -134,13 +136,36 @@ is used for both validation and to generate the interactive user interface.

ProcessChoice and ProcessGroup

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be consist on whether you always want to have <> brackets when referring to XML elements, or if you don't want to use them at all (or only use them the first time a new element is talked about/introduced). Right now it's not completely consistent.

Copy link
Collaborator Author

@rjplevin rjplevin May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I will address.

Note, though, that there are many Python classes of the same name as the XML elements, so whether to include "" brackets depends on whether the element or class is being discussed.

The file ``etc/opgee.xml``, included in the OPGEE distribution,
defines a ``Field`` named ``template`` that provides the basis for common
oil and gas field configurations. The subcommand ``csv2xml`` allows a
user to define ``Fields`` using a small number of attributes by generating

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a limit on the # of attributes that can be used by the csv2xml script when creating fields?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No limit.

definitions for the 9,000 Fields used in testing OPGEE. See the schematic
figure below for an illustration of one such field.

.. figure:: images/gas_lifting.*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this is just an issue with how GitHub previews these files, but this currently doesn't show up correctly when reviewing on GitHub. I can see the image successfully in the images directory though, so it might just be a GitHub thing

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a Sphinx/ReStrucutredText feature and goes beyond the basic Github rendering. You actually need to run sphinx-build to get the properly rendered content.

I just built the docs locally, and the image appears as expected.

.. figure:: images/gas_lifting.*
:figclass: align-center

Schematic diagram of a "gas lifting field" from the "template" field

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this text supposed to be tied to the figure in some way like as a sub-header? currently it just shows up as a "normal" paragraph in the preview after where the image is supposed to be.

Copy link
Collaborator Author

@rjplevin rjplevin May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears as a caption because it's indented and "within" the ..figure. You can build the docs locally by changing to the OPGEEv4/docs directory and running "make html" (at least on a Mac or in Linux. There's also a make.bat there, which I assume works, but I've never used it.)

After building the docs, you can open docs/build/html/index.html to see the resulting files.

@mbarlow12
Copy link

Do the updates here mean that the online readthedocs will be deployed from this repo going forward?

@lloyd-rmi I would support this option given the lack of permissions on the upstream repo. However, before fully committing to this, we should probably have a clearer plan for how changes in the fork will get pushed/synced with upstream.

@rjplevin
Copy link
Collaborator Author

Can we get a rough overview of what is planned to be talked about in the SoftwareX article?

It's just a basic description of the software and it's value. Wennan and Adam wanted a journal article on OPGEEv4 that could be cited in other publications. Note that Stanford is funding the development of the paper.

Rather than publish the traditional "supporting information", I decided it made more sense to include everything worth discussing directly in the readthedocs documentation.

I think it ultimately makes sense to automate the doc generation from the RMI repo, since there's no guarantee that the documentation will remain consistent with whatever the Pitt folks are doing, and which I'm not tracking.

Copy link

@mbarlow12 mbarlow12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a coupe non-essential notes for additional content.

I'll also create an issue to add the auditing documentation and clean up those docstrings.

definitions for the 9,000 Fields used in testing OPGEE. See the schematic
figure below for an illustration of one such field.

.. figure:: images/gas_lifting.*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a Sphinx/ReStrucutredText feature and goes beyond the basic Github rendering. You actually need to run sphinx-build to get the properly rendered content.

I just built the docs locally, and the image appears as expected.

Comment on lines -137 to 145
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A ``<ProcessGroup>`` describes a set of ``<ProcessRef>`` and ``<StreamRef>`` elements that
The ``<ProcessChoice>`` and ``<ProcessGroup>`` elements enable ``Fields`` to be used
as parameterized templates. A ``<ProcessGroup>`` encloses a set of ``<ProcessRef>``
and ``<StreamRef>`` elements that
can be enabled or disabled as a set. The ``<ProcessChoice>`` element encloses multiple
``<ProcessGroup>`` elements and selects among them based on the value of an attribute
``<ProcessGroup>`` elements and selects among them based on the value of a ``Field`` attribute
named in the ``<ProcessChoice>``, whose value must match the name of one of the enclosed
``<ProcessGroup>`` elements.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be beneficial to add an example to show the 2 equivalent ways of creating the same input?

E.g.
Given the following in opgee.xml and attributes.xml:

<!-- opgee.xml or other template XML file -->
<Field name="my_template">
  <!-- ... other field elements -->
  <ProcessChoice name="gas_path">
    <ProcessGroup name="Minimal">
      <ProcessRef name="GasGathering" />
      <ProcessRef name="GasDehydration" />
      <StreamRef name="GasGathering => GasDehydration" />
      <StreamRef name="GasDehydration => GasPartition" />
    </ProcessGroup>
    <ProcessGroup name="Acid Wet Gas">
      <ProcessRef name="GasGathering" />
      <ProcessRef name="GasDehydration" />
      <ProcessRef name="AcidGasRemoval" />
      <ProcessRef name="Demethanizer" />
      <ProcessRef name="NGL" />
      <StreamRef name="GasGathering => GasDehydration" />
      <StreamRef name="GasDehydration => AcidGasRemoval" />
      <StreamRef name="AcidGasRemoval => Demethanizer" />
      <StreamRef name="Demethanizer => GasPartition" />
      <StreamRef name="Demethanizer => NGL" />
    </ProcessGroup>

    <ProcessGroup name="Acid Gas">
      <ProcessRef name="GasGathering" />
      <ProcessRef name="GasDehydration" />
      <ProcessRef name="AcidGasRemoval" />
      <StreamRef name="GasGathering => GasDehydration" />
      <StreamRef name="GasDehydration => AcidGasRemoval" />
      <StreamRef name="AcidGasRemoval => GasPartition" />
    </ProcessGroup>
  </ProcessChoice>
</Field>

<!-- attributes.xml -->
<ClassAttrs name="Field">
  <Options name="gas_path" default="Minimal">
    <Option desc="">None</Option>
    <Option desc="Dehydrator">Minimal</Option>
    <Option desc="Dehydrator + Amine Process">Acid Gas</Option>
    <Option desc="Dehydrator + Amine Process + Demethanizer">Acid Wet Gas</Option>
  </Options>
</ClassAttrs>

The 2 XML inputs below are equivalent.

<!-- using process choice attribute -->

<Field name="my_field" modifies="my_template">
  <A name="gas_path">Acid Gas</A>
</Field>

<!-- using explicit process/stream definitions -->

<Field name="my_field">
  <Process class="GasGathering"/>
  <Process class="GasDehydration"/>
  <Process class="AcidGasRemoval"/>
  <Stream src="GasGathering" dst="GasDehydration">
    <Contains>gas for gas dehydration</Contains>
  </Stream>
  <Stream src="GasDehydration" dst="AcidGasRemoval">
    <Contains>gas for AGR</Contains>
  </Stream>
  <Stream src="AcidGasRemoval" dst="GasPartition">
    <Contains>gas for gas partition</Contains>
  </Stream>
</Field>

matching process proceeds recursively to the next lower level of the XML structure. If a final
XML element (i.e., one with no children) matches, its text is copied in place of any that appeared
in the currently merged XML. **Give example.**
in the currently merged XML. More examples are available in the ``tests/test_merge_xml.py``.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to create a hyperlink to the test file in the github repo? I tinkered and got this to work.

... merged XML. More examples are available in the |test_merge_xml|_.

.. |test_merge_xml| replace:: ``tests/test_merge_xml.py``
.. _test_merge_xml: https://github.com/RMI/OPGEEv4/blob/main/tests/test_merge_xml.py

The link works, but it displays as any other inline code with no visual link indicator. The following gets the link highlighting but no code formatting:

`tests/tests_merge_xml.py <https://github.com/RMI/OPGEEv4/blob/main/tests/test_merge_xml.py>`_

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