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

STY: reduce duplication for init and clean #119

Merged
merged 10 commits into from
May 26, 2022
Merged

STY: reduce duplication for init and clean #119

merged 10 commits into from
May 26, 2022

Conversation

jklenzing
Copy link
Member

@jklenzing jklenzing commented May 18, 2022

Description

Addresses #89, #118

Adds two general instrument methods which are frequently repeated:

  • init, where the initialization routine reads from a standard mission-level module (cnofs, de2, icon)
  • clean_warn, a custom clean routine that warns users that cleaning is not available

Additionally, suppresses logger messages during package-level imports of constellation objects. This is required to keep the logger from being saturated until this issue is fixed at the pysat-level. Otherwise verifying the logger here is near-impossible.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

import pysat
import logging
pysat.logger.setLevel(logging.INFO)
ivm = pysat.Instrument('cnofs', 'ivm')

acknowledgement string should go to the logger, and ivm.acknowledgements and ivm.references updated accordingly.

Can be repeated for the cnofs, de2, and icon instruments

For cleaning, attempt to load de2 data, look for the warning.

Test Configuration

  • Operating system: Mac OS X Big Sur
  • Version number: python 3.8.11
  • Any details about your local setup that are relevant

Checklist:

  • Make sure you are merging into the develop (not main) branch
  • 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
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • Add a note to CHANGELOG.md, summarizing the changes
  • Update zenodo.json file for new code contributors

@jklenzing jklenzing added this to the 0.0.4 release milestone May 18, 2022
@jklenzing jklenzing added style bug Something isn't working labels May 18, 2022
@jklenzing
Copy link
Member Author

Topics to discuss:

  • local changes to constellation objects
  • should other instruments conform to the module style and use custom init

@jklenzing jklenzing marked this pull request as ready for review May 25, 2022 19:52
@jklenzing
Copy link
Member Author

jklenzing commented May 25, 2022

I've decided this pull is large enough for review. Follow-on work to update other instruments documented in #119, including consistency issues that are out of scope here.

Copy link
Member

@aburrell aburrell left a comment

Choose a reason for hiding this comment

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

Appreciate the smaller pull request! 🐴

pysatNASA/instruments/de2_lang.py Show resolved Hide resolved
pysatNASA/instruments/methods/general.py Outdated Show resolved Hide resolved
pysatNASA/instruments/methods/general.py Show resolved Hide resolved
pysatNASA/instruments/methods/general.py Outdated Show resolved Hide resolved
Co-authored-by: Angeline Burrell <aburrell@users.noreply.github.com>
@jklenzing jklenzing requested a review from aburrell May 26, 2022 15:34
@jklenzing jklenzing merged commit fb2e29f into develop May 26, 2022
@jklenzing jklenzing deleted the sty/gen_meth branch May 26, 2022 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: generalized init routine Unexpected instantiations when importing
2 participants