Package: harmony-py
harmony-pyHarmony-Py is a Python library for integrating with NASA'sHarmonyServices.Harmony-Py provides a Python alternative to directly usingHarmony's RESTful API. It handles NASAEarthdata Login (EDL)authentication and optionally integrates with theCMR Python Wrapperby accepting collection results as a request parameter. It's convenient for scientists who wish to use Harmony from Jupyter notebooks as well as machine-to-machine communication with larger Python applications.We welcome feedback on Harmony-Py viaGitHub IssuesUsing Harmony PyPrerequisitesPython 3.8+InstallingThe library is available fromPyPIand can be installed with pip:$ pip install -U harmony-pyThis will install harmony-py and its dependencies into your current Python environment. It's recommended that you install harmony-py into a virtual environment along with any other dependencies you may have.Running Examples & Developing on Harmony PyPrerequisitesPython 3.7+, ideally installed via a virtual environmentInstalling Development & Example DependenciesInstall dependencies:$ make installOptionally register your local copy with pip:$ pip install -e ./path/to/harmony_pyRunning the Example Jupyter NotebooksJupyter notebooks in theexamplessubdirectory show how to use the Harmony Py library. Start up the Jupyter Lab notebook server and run these examples:The Jupyter Lab server will start andopen in your browser. Double-click on a notebook in the file-browser sidebar and run the notebook. Note that some notebooks may have cells which prompt for your EDL username and password. Be sure to use your UAT credentials since most of the example notebooks use the Harmony UAT environment.$ make examplesDevelopingGenerating DocumentationDocumentation on the Read The Docs site is generated automatically. It is generated by usingsphinxwith reStructuredText (.rst) and other files in thedocsdirectory. To generate the docs locally and see what they look like:$ make docsYou can then view the documentation in a web browser under./docs/_build/html/index.html.IMPORTANT: The documentation uses a notebook from theexamplesdirectory rendered as HTML. If you've modified that notebook (seeMakefilefor notebook that is currently rendered), you will need to runmake docslocally. You will see a change to thedocs/user/notebook.htmlfile after doing so. This file should be committed to the git repo since it is used when the latest docs are pushed to the Read The Docs site (it can't currently be generated as part of the build).Running the Linter & Unit TestsRun the linter on the project source:$ make lintRun unit tests and test coverage. This will display terminal output and generate an HTML coverage report in thehtmlcovdirectory.$ make testFor development, you may want to run the unit tests continuously as you update tests and the code-under-test:$ make test-watchGenerating Request ParametersTheharmony.Requestconstructor can accept parameters that are defined in theHarmony OGC API schema. If this schema has been changed and theRequestconstructor needs to be updated, you may run the generator utility. This tool reads the Harmony schema and generates a partial constructor signature with docstrings:$ python internal/genparams.py ${HARMONY_DIR}/app/schemas/ogc-api-coverages/1.0.0/ogc-api-coverages-v1.0.0.ymlEither setHARMONY_DIRor replace it with your Harmony project directory path. You may then write standard output to a file and then use it to update theharmony.Requestconstructor and code.CIHarmony-py usesGitHub
Actionsto run the Linter
& Unit Tests. The test coverage output is saved as a build artifact.Building and ReleasingNew versions of Harmony-Py will be published to PyPi via a GitHubactionwhenever a draft release is marked as publishedhttps://github.com/nasa/harmony-py/releases.