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

Standardizing module import method for pyFV3 #5

Merged
merged 10 commits into from
Feb 21, 2024

Conversation

fmalatino
Copy link
Contributor

@fmalatino fmalatino commented Feb 13, 2024

Description
Adding __init__ files to standardize import method of modules

How Has This Been Tested?
Tested via lint and currently implemented translate tests
OS: RHEL 8.9 Ootpa
Built conda environment using workflow in github action configurations

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included
  • Targeted model if this changed was triggered by a model need/shortcoming

Copy link
Collaborator

@FlorianDeconinck FlorianDeconinck left a comment

Choose a reason for hiding this comment

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

Good stuff. I'd drop the test one, what do you think?

@@ -0,0 +1,28 @@
from .a2b_ord4 import AGrid2BGridFourthOrder
Copy link
Collaborator

Choose a reason for hiding this comment

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

Poking @oelbert : an idea here. If we put down some one/two liner to explicitly describe each Module scientific purpose it may look nice in the docs. To be tested.

Copy link
Collaborator

Choose a reason for hiding this comment

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

probably a good idea, something like?

""" Converts a field from the Arakawa A grid to B grid """

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, we have to generate the docs and see how it shows

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to package the sub-directories of the test? Those are more end-user files, with no real API to publicize

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's unnecessary, but if MSD wants to package the tests I won't object too strongly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no immediate need or reason to package them. I have been adding __init__ where they aren't for anything that looks like it can/might have a reason to have one.

@@ -1 +1,3 @@
from .analytic_init import init_analytic_state
Copy link
Collaborator

Choose a reason for hiding this comment

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

Like in stencils this might be a good place for some cursory scientific description

@fmalatino fmalatino changed the title Standardizing module import method Standardizing module import method for pyFV3 Feb 14, 2024
xyuan
xyuan previously approved these changes Feb 14, 2024
Copy link

@xyuan xyuan left a comment

Choose a reason for hiding this comment

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

this looks good to me

@FlorianDeconinck
Copy link
Collaborator

Please merge in develop instead of main

@fmalatino fmalatino changed the base branch from main to develop February 16, 2024 17:27
@fmalatino fmalatino marked this pull request as ready for review February 20, 2024 13:56
Copy link
Collaborator

@oelbert oelbert left a comment

Choose a reason for hiding this comment

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

There are a couple of docstrings that should be clarified, and there's a lot more exposed in the pyFV3 init than I thought we'd agreed on?

Comment on lines 3 to 31
from .stencils import (
AcousticDynamics,
AdjustNegativeTracerMixingRatio,
CGridShallowWaterDynamics,
DGrid2AGrid2CGridVectors,
DivergenceDamping,
DryConvectiveAdjustment,
DynamicalCore,
FiniteVolumeFluxPrep,
FiniteVolumeTransport,
HyperdiffusionDamping,
LagrangianToEulerian,
NonhydrostaticVerticalSolver,
NonhydrostaticVerticalSolverCGrid,
PK3Halo,
RayleighDamping,
SatAdjust3d,
TracerAdvection,
UpdateGeopotentialHeightOnCGrid,
UpdateHeightOnDGrid,
XPiecewiseParabolic,
YPiecewiseParabolic,
)
from .testing import (
TranslateDycoreFortranData2Py,
TranslateDynCore,
TranslateFVDynamics,
)
from .wrappers import GeosDycoreWrapper
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought we weren't going to expose the stencil classes or test code or wrapper at this level?

Copy link
Collaborator

Choose a reason for hiding this comment

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

testing definitely not.
stencils we can discuss. DynamicalCore needs to be exposed or else Pace can't do anything really, the other could be hidden if we consider them not re-usable.
wrappers needs to be exposed, it's public API.

pyFV3/testing/__init__.py Outdated Show resolved Hide resolved
@fmalatino fmalatino requested a review from oelbert February 20, 2024 17:51
oelbert
oelbert previously approved these changes Feb 20, 2024
Copy link
Collaborator

@oelbert oelbert left a comment

Choose a reason for hiding this comment

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

Minor note about exposing wrappers, but not blocking

from .stencils.fv_subgridz import DryConvectiveAdjustment
from .wrappers.geos_wrapper import GeosDycoreWrapper
from .stencils import DryConvectiveAdjustment, DynamicalCore
from .wrappers import GeosDycoreWrapper
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not totally convinced we want to expose the wrappers here, but it's probably ok with just the GEOS wrapper, though I may want to revisit if it starts getting unwieldy

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair opposition.

Technically a Wrapper is so bespoke it's a bit of a stretch for me to call it a "public" API. I wouldn't object to removing it.

I might in the future take it off pyFV3 entirely and move it to GEOS itself

Copy link
Collaborator

@oelbert oelbert left a comment

Choose a reason for hiding this comment

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

👍

@fmalatino fmalatino merged commit 1deb6c6 into develop Feb 21, 2024
2 checks passed
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.

4 participants