Skip to content

add xml to yaml converter for gemini gems#924

Open
mlee03 wants to merge 10 commits into
NOAA-GFDL:mainfrom
mlee03:xml-converter
Open

add xml to yaml converter for gemini gems#924
mlee03 wants to merge 10 commits into
NOAA-GFDL:mainfrom
mlee03:xml-converter

Conversation

@mlee03

@mlee03 mlee03 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Describe your changes

This PR creates an agent directory and a gem subdirectory containing the instructions used in
Gemini fre-xml-to-yaml-converter Gem

Issue ticket number and link (if applicable)

Fixes #XXX (replace XXX with the issue number and GitHub will autolink the PR to the issue)

Checklist before requesting a review

  • I ran my code
  • I tried to make my code readable
  • I tried to comment my code
  • I wrote a new test, if applicable
  • I wrote new instructions/documentation, if applicable
  • I ran pytest and inspected it's output
  • I ran pylint and attempted to implement some of it's feedback
  • No print statements; all user-facing info uses logging module

Note: If you are a code maintainer updating the tag or releasing a new fre-cli version, please use the release_procedure.md template. To quickly use this template, open a new pull request, choose your branch, and add ?template=release_procedure.md to the end of the url.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should be a pretty easy merge+review, can you add to the ok-unknown-words list?


## Example platform.yaml
```
platforms:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@singhd789, what do you think about this platforms section?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll be reading this today, sorry this slipped under the radar

@thomas-robinson

Copy link
Copy Markdown
Member

Your gem needs to add this to these fre properties to the model yaml:

  - &FMSIncludes "-IFMS/fms2_io/include -IFMS/include -IFMS/mpp/include"
  - &MOMIncludes "-Iocean/MOM6-examples/src/MOM6/pkg/CVMix-src/include -Iocean/MOM6-examples/src/MOM6/src -Iocean/MOM6-examples/src/MOM6/src/framework"

The MOMIncludes will be dependent on where MOM is cloned. In this case, I had this:

    <component name="mom6" requires="fms" paths="mom6/src/MOM6/config_src/{infra/FMS2,memory/dynamic_nonsymmetric,drivers/FMS_cap} mom6/src/MOM6/src/{*,*/*} mom6/src/MOM6/config_src/external/{ODA_hooks,database_comms,drifters,stochastic_physics,MARBL} ocean_BGC/generic_tracers ocean_BGC/mocsy/src ">
       <source versionControl="git" root="https://github.com/NOAA-GFDL">
        <codeBase version="main"> ocean_BGC.git </codeBase>
        <csh><![CDATA[
          ( cd ocean_BGC && git checkout $(OCEAN_BGC_GIT_TAG) )
	  git clone -b dev/gfdl https://github.com/NOAA-GFDL/MOM6-examples.git mom6
	  pushd mom6
	  git checkout $(MOM6_GIT_TAG)
	  git submodule update --recursive --init src/MOM6 src/SIS2 src/icebergs

          (cd src/icebergs && git checkout dev/gfdl)
          popd

          pushd mom6
          set platform_domain = `perl -T -e "use Net::Domain(hostdomain) ; print hostdomain"`
          if ("${platform_domain}" =~ *"MsState"* ) then
            ln -s /work/noaa/gfdlscr/pdata/gfdl/gfdl_O/datasets/ .datasets
          else
            ln -s /gpfs/f5/gfdl_o/world-shared/datasets .datasets
          endif
          popd

          test -e mom6/.datasets
          if ($status != 0) then
            echo ""; echo "" ; echo "   WARNING:  .datasets link in MOM6 examples directory is invalid"; echo ""; echo ""
          endif


        ]]></csh>
      </source>
      <compile>
        <cppDefs><![CDATA[ $(F2003_FLAGS) -DMAX_FIELDS_=100 -DNOT_SET_AFFINITY -D_USE_MOM6_DIAG -D_USE_GENERIC_TRACER -DUSE_PRECISION=2 ]]></cppDefs>
        <makeOverrides>OPENMP=""</makeOverrides> <!-- openmp switch for MOM6 may cause crash -->
      </compile>
    </component>

and consolidated the two ocean repos into a single ocean component like this:

    - component: "ocean"
      requires: ["FMS"]
      repo: ["https://github.com/NOAA-GFDL/ocean_BGC.git","https://github.com/NOAA-GFDL/MOM6-examples.git"]
      branch: [*OCEAN_BGC_GIT_TAG,"dev/gfdl"]
      paths:
        - "ocean/MOM6-examples/src/MOM6/config_src/infra/FMS2"
        - "ocean/MOM6-examples/src/MOM6/config_src/memory/dynamic_nonsymmetric"
        - "ocean/MOM6-examples/src/MOM6/config_src/drivers/FMS_cap"
        - "ocean/MOM6-examples/src/MOM6/src/*"
        - "ocean/MOM6-examples/src/MOM6/src/*/*"
        - "ocean/MOM6-examples/src/MOM6/config_src/external/ODA_hooks"
        - "ocean/MOM6-examples/src/MOM6/config_src/external/database_comms"
        - "ocean/MOM6-examples/src/MOM6/config_src/external/drifters"
        - "ocean/MOM6-examples/src/MOM6/config_src/external/stochastic_physics"
        - "ocean/MOM6-examples/src/MOM6/config_src/external/MARBL"
        - "ocean/ocean_BGC/generic_tracers"
        - "ocean/ocean_BGC/mocsy/src"
      additionalInstructions: !join [
        "\n",
        " cd ocean/MOM6-examples \n",
        " git checkout ",*MOM6_GIT_TAG,"\n",
        " git submodule update --recursive --init src/MOM6 src/SIS2 src/icebergs \n",
        " cd src/icebergs \n",
        " git checkout dev/gfdl \n",
        " cd ../../../ \n",
        "            ln -s /gpfs/f5/gfdl_o/world-shared/datasets .datasets\n",
        "            echo \"\"; echo \"\" ; echo \"    WARNING:  .datasets link in MOM6 examples directory is invalid\"; echo \"\"; echo \"\"\n"
      ]
      cppdefs: !join [*F2003_FLAGS, " -DMAX_FIELDS_=100 -DNOT_SET_AFFINITY -D_USE_MOM6_DIAG -D_USE_GENERIC_TRACER -DUSE_PRECISION=2 "]
      makeOverrides: 'OPENMP=""'
      otherFlags: !join [*FMSIncludes," ", *MOMIncludes]

and needs to add this to each component:

      otherFlags: !join [*FMSIncludes," ", *MOMIncludes]

@ceblanton ceblanton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great!

Will this convert postprocessing XMLs to Yamls?

How can users use that Gem markdown file? (I'll serve as your naive user)

@mlee03

mlee03 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@thomas-robinson 😱

Comment thread agents/gems/xml-to-yaml-converters.md Outdated
- `compileYaml: "compile.yaml"`
- `platformYaml: "platforms.yaml"`
6. Validate following [Validation checklist](#validation-checklist)
7. State that `FMSIncludes` and `MOMIncludes` were added because they are required by fre-cli. Ask users to verify the location of `MOM6-examples`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@thomas-robinson, blurb about FMSIncludes MOMIncludes

| `cppdefs` | `<cppDefs>` (incl. CDATA) | Apply anchor conventions; omit if absent |
| `makeOverrides` | `<makeOverrides>` text | Preserve exactly; use single quotes if it contains `"`; omit if absent |
| `doF90Cpp` | `<compile doF90Cpp>` | `"yes"` → `true`; omit otherwise |
| `otherFlags` | no xml equivalent | mandatory field, if `requires` includes `ocean` or `MOM6`, put `!join [*FMSIncludes, *MOMIncludes]`; else put `*FMSIncludes`

@mlee03 mlee03 Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@thomas-robinson , otherFlags instructions. This can be changed to add FMSIncludes and MOMIncludes regardless of dependencies

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.

5 participants