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

mdsio global-file sections #753

Open
jm-c opened this issue Jul 24, 2023 · 0 comments
Open

mdsio global-file sections #753

jm-c opened this issue Jul 24, 2023 · 0 comments

Comments

@jm-c
Copy link
Member

jm-c commented Jul 24, 2023

This issue is directly related to @timothyas 's PR #359, but I though it would make it easier to reference in a specific issue.

One thing to clarify regarding global-file sections:

Because of the shape of MITgcm slice arrays (i/j,k,bi,bj), there is no issue to read-in global-files into this tiled array: for a slice along X-dir, all bj tiles will get a copy of the value contained in the file.
However, when writing to a global-file, the "bj" dimension (i.e., nSy) needs to collapse or, more precisely, we need to select which "bj" tile holds the correct value to write to the global-file.

This is all taken care of in PR #359, assuming any section is related to an OB section. And this is the reason for adding the argument "slice" to most of the section/slice I/O routines in pkg/mdsio and pkg/rw (and updating the calls).

We could consider an alternative interface:

  1. Keep PR 359 changes in mdsio_read_section.F and mdsio_write_section.F, with additional arguments to these routines to be able to write OB sections to global-files. But also recognize the "empty" slice argument to default back to current tiled files for sections.
  2. Keep the argument list of current pkg/rw section routines unchanged, meaning they will still be able to write only tiled files for sections. But for the general case of a section that is not necessary related to OB this is all what can be done without knowing which section it is.
  3. Add new interface S/R in pkg/rw to deal with section I/O associated with OB section, similar to [READ/WRITE]REC[X/Y]Z_R[L/S] but with additional argument "slice".
    My suggestion would be to put these new pkg/rw S/R in 2 new files (since read_rec.F and write_rec.F are already long enough): read_obsec.F and write_obsec.F, each containing 4 S/R: READ_OBSEC_[X/Y]XZ_R[L/S] and WRITE_OBSEC_[X/Y]Z_R[L/S].

The advantage of this alternative interface:

  1. We keep the original interface (i.e., argument list) of current pkg/rw routines, so there is not need to change all the calls right away (e.g., adding the 2 arguments "kLo,kLi" to pkg/mdsio section S/R in PR Update mdsio slice I/O routines #747 only requires modifying 7 files); could pick the most relevant first (e.g., for OBCS pickup files, which are tested when running restart test do_tst_2+2); and once we know it's working well we could make changes (the best would be in a dedicated PR) to S/R calls in the rest of the code.
  2. This does not break user customized code that relies on pkg/rw I/O routines.
  3. If, in the future, a new type of section is introduced (e.g., for diagnostics) that is not related to OB, the old pkg/rw I/O routine could still be used but only to write tiled files.
    And writing these new sections to global-file would require providing more informations and changes to mdsio_read_section.F and mdsio_write_section.F.
@jm-c jm-c mentioned this issue Jul 24, 2023
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

No branches or pull requests

1 participant