Skip to content

Conversation

nusbaume
Copy link
Collaborator

@nusbaume nusbaume commented Jul 25, 2025

Tag name (required for release branches):
Originator(s): nusbaume

Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number):

This PR does several things:

  1. Modifies the "get_var" methods to expect allocatables and not pointers, which is needed for Change file reader class allocation methods atmospheric_physics#265

  2. Adds optional "start" and "count" variables to the "get_var" method, in preparation for variable subsetting. However, for now these variables are both no-ops.

  3. Cleanup the code by creating a new "get_dim_sizes" subroutine, which noticeably reduces the amount of duplicated code.

Addresses #406

Describe any changes made to build system: N/A

Describe any changes made to the namelist: N/A

List any changes to the defaults for the input datasets (e.g. boundary datasets): N/A

List all files eliminated and why: N/A

List all files added and what they do: N/A

List all existing files that have been modified, and describe the changes:
(Helpful git command: git diff --name-status development...<your_branch_name>)

M .gitmodules
M src/physics/ncar_ccpp

  • Update atmospheric_physics external to use new abstract NetCDF file reader interface.

M src/physics/utils/pio_reader.F90

  • Implement the three different changes listed above in the "Description"

M test/unit/fortran/src/pio_reader/test_pio_reader.pf

  • Update the pio_reader unit tests so that they work with the new file reader interfaces.

If there are new failures (compared to the test/existing-test-failures.txt file),
have them OK'd by the gatekeeper, note them here, and add them to the file.
If there are baseline differences, include the test and the reason for the
diff. What is the nature of the change? Roundoff?

derecho/intel/aux_sima: ALL PASS

derecho/gnu/aux_sima: ALL PASS

If this changes climate describe any run(s) done to evaluate the new
climate in enough detail that it(they) could be reproduced:

CAM-SIMA date used for the baseline comparison tests if different than latest:

@nusbaume nusbaume self-assigned this Jul 25, 2025
@nusbaume nusbaume added bug-fix This PR was created to fix a specific bug. code clean-up Made code simpler, better, and/or easier to read. labels Jul 25, 2025
@@ -371,7 +326,7 @@ subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode)
errmsg = ''
end subroutine get_netcdf_var_int_1d

subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode)
subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode, start, count)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You've added start/count to all of these routines, but you are not doing anything with them yet. I assume this is for future development. I would suggest that you might want to have

  1. A check that both start and count are either set or not set, as I don't know if the underlying netCDF routines will gracefully handle just one of them being present
  2. A check that the dimensionality of start and count matches var_ndims
  3. That count(i) <= dim_sizes(i)
  4. That start(i) <= dim_sizes(i)

Some of these may be handled by the pio calls, but if they are not, perhaps checks like these should be made

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for these great suggestions! My hope was to tackle all of the actual subsetting code in a future PR (as we needed this one in ASAP), so is it ok if I implement these requests then? If not then please let me know!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Leaving this unresolved to aid in finding it again with the future PR

@nusbaume nusbaume requested a review from cacraigucar July 31, 2025 15:56
Copy link
Collaborator

@peverwhee peverwhee left a comment

Choose a reason for hiding this comment

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

a couple of wee questions

@@ -371,7 +326,7 @@ subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode)
errmsg = ''
end subroutine get_netcdf_var_int_1d

subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode)
subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode, start, count)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Leaving this unresolved to aid in finding it again with the future PR

@nusbaume nusbaume requested a review from peverwhee July 31, 2025 17:32
Copy link
Collaborator

@peverwhee peverwhee left a comment

Choose a reason for hiding this comment

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

thanks for accommodating my pedantry!

@nusbaume nusbaume merged commit a3a54d1 into ESCOMP:development Jul 31, 2025
12 checks passed
@nusbaume nusbaume deleted the pio_reader_updates branch August 4, 2025 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix This PR was created to fix a specific bug. code clean-up Made code simpler, better, and/or easier to read.
Projects
Status: Tag
Development

Successfully merging this pull request may close these issues.

3 participants