Skip to content

Conversation

@guoqing-noaa
Copy link
Collaborator

When we do coldstart data assimilation on init.nc using JEDI, we will get a crash in MPAS IO with the following error:

ERROR: MPAS IO Error: PIO error -38: NetCDF: Operation not allowed in data mode

Per discussions with NCAR people and @SamuelTrahanNOAA, and the great debugging work by @SamuelTrahanNOAA, we identified that the problem came from src/framework/mpas_stream_manager.F where mpas_writeStreamAtt tries to write not-defined global attributes to init.nc. Since we don't expect JEDI to update any global attributes (at least for init.nc), we can skip the relevant mpas_writeStreamAtt part when doing JEDI data assimilation.

This PR is to address this issue by adding a new stream property gattr_update. It takes values of yes or no and defaults to yes. So it does not affect any existing MPAS-Model capability but allow coldstart JEDI DA to skip the relevant mpas_writeStreamAtt part to avoid crash, by setting gattr_update=no in the analysis stream.

Resolve issue #176

Priority Reviewers

@clark-evans
Copy link
Collaborator

Hi @guoqing-noaa - thanks for this PR as well. I've manually requested the one failed test to re-run, as the output log indicated that it failed on one of its early wget commands (which is usually a hiccup on Github's end and not an issue with the code). The updated results should populate this PR soon.

I noticed this appears to be related to PIO. Is PIO a requisite for rrfs-workflow or other applications? We have primarily used MPAS's SMIOL (simple MPAS I/O layer) and have little experience with PIO.

@SamuelTrahanNOAA
Copy link
Collaborator

The MPAS cmake build system requires that all output options be enabled while building. That means you are required to have PIO even if you don't want it.

@guoqing-noaa
Copy link
Collaborator Author

Thanks, @clark-evans! And thank @SamuelTrahanNOAA for input.

In my impression, when we write out large MPAS output file, PIO will improve the performance.

@SamuelTrahanNOAA Does your HFIP runs use PIO?

@clark-evans
Copy link
Collaborator

Thanks, @clark-evans! And thank @SamuelTrahanNOAA for input.

In my impression, when we write out large MPAS output file, PIO will improve the performance.

@SamuelTrahanNOAA Does your HFIP runs use PIO?

We didn't set it up to use PIO, but perhaps Sam changed that later in the experiment?

Copy link
Collaborator

@clark-evans clark-evans left a comment

Choose a reason for hiding this comment

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

Looks good to me pending one typo correction

integer, intent(out), optional :: precisionProperty !< Output: Integer describing the precision of the stream
character (len=StrKIND), intent(out), optional :: filenameIntervalProperty !< Output: String containing the filename interval for the stream
integer, intent(out), optional :: clobberProperty !< Output: Interger describing the clobber mode of the stream
integer, intent(out), optional :: gattrUpdateProperty !< Output: Interger describing whether to update global attributes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor nitpick: "Interger" should be "Integer." I see NCAR's code also has this typo for clobberProperty, but I'm OK with leaving that one alone also correcting that line could cause us issues with future code merges.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@clark-evans Thanks for finding out this! I will fix my part. Then leave the NCAR one as is?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, that's my recommendation - even as I'd love to update the NCAR part, I don't want to cause us merging issues later on.

Copy link
Collaborator

@dustinswales dustinswales left a comment

Choose a reason for hiding this comment

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

This doesn't break existing functionality. Thanks for adding this.
I do wonder if this is something that should make its way back to MPAS-Dev? (We don't need to do this now, but we have a label to keep track of these things)

@guoqing-noaa
Copy link
Collaborator Author

This doesn't break existing functionality. Thanks for adding this. I do wonder if this is something that should make its way back to MPAS-Dev? (We don't need to do this now, but we have a label to keep track of these things)

Thanks @dustinswales
I would hope this goes back to the NCAR repo. I have created a similar PR there so that MMM DA folks are aware of this capability: MPAS-Dev#1368

@dustinswales dustinswales added the upstream Believed to originate in the MPAS-Dev/MPAS-Model code rather than ufs-community/MPAS-Model code. label Dec 2, 2025
@dustinswales
Copy link
Collaborator

Excellent @guoqing-noaa.
I don't know the future for getting all of our innovations back to the authoritative repo, but adding a label to keep track seems like the minimum for the moment :).

@clark-evans
Copy link
Collaborator

@guoqing-noaa - please feel free to go ahead and update the version number to v8.3.1-2.5 in preparation for merging. Thanks!

@guoqing-noaa
Copy link
Collaborator Author

@guoqing-noaa - please feel free to go ahead and update the version number to v8.3.1-2.5 in preparation for merging. Thanks!

Done. Thanks, @clark-evans

@jderrico-noaa jderrico-noaa merged commit c6ea19a into ufs-community:gsl/develop Dec 3, 2025
18 checks passed
@guoqing-noaa guoqing-noaa deleted the gattr_update_ufs branch December 8, 2025 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream Believed to originate in the MPAS-Dev/MPAS-Model code rather than ufs-community/MPAS-Model code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERROR: MPAS IO Error: PIO error -38: NetCDF: Operation not allowed in data mode

5 participants