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

DAS-2252 Initial Repository Import #1

Merged

Conversation

flamingbear
Copy link
Member

@flamingbear flamingbear commented Nov 19, 2024

Description

This is the first import of the software to be used in the SMAP-L2-Gridding-Service.

This PR contains the software and tests to allow a user to create gridded NetCDF4-CF output data from SMAP Enhanced L2 Radiometer Half-Orbit 9 km EASE-Grid Soil Moisture data (SPL2SMP_E).

The Acceptance Criteria for this ticket are:

  • Software is available in a public repository on GitHub (should be under NASA organization, but could be personal repo if the NAMS request is held up.)
  • All code is properly formatted and named according to black and pep8.
  • pre-commit hooks are set up and run automatically on the repository as well as for developers locally.
  • Bonus points for mypy checking

To satisfy those critera:

What is not complete:

  • Wrapping with harmony service built with Docker (DAS-2254)
  • Building Docker Images and Testing with GitHub actions (DAS-2267)
  • Connecting Service to Harmony with UMM-S and harmony PRs (DAS-2255)

Jira Issue ID

DAS-2252

Local Test Steps

  • Complete a full review of the codebase.

  • Download a SPL2SMP_E granule (two ways):

    • Download the .h5 file directly from Earthdata Search to be used as your input file.
    • Use Earthdata Search customization and reformat to NetCDF4-CF without any other transformations to get your processed_granule.nc file
  • Create an isolated python 3.12 environment installing packages from the pip_requirements.txt and pip_dev_requirements.txt file.

  • run the tests:
    ❯ PYTHONPATH=. pytest .
    not sure why I needed to set my PYTHONPATH...

  • You can check the test coverage:
    ❯ PYTHONPATH=. pytest --cov=smap_l2_gridder --cov-report=term-missing --cov-report=html
    you have to install pytest-coverage and __main__.py is not tested.

  • regrid your granule. From the root directory run:
    python -m smap_l2_gridder --input [path/to/input-file.h5] --output [path/to/output_granule.nc]

  • Validate your output against the processed_granule.nc from EDS. (Look on the DAS-2252 ticket for notebook that you can use.)

    • You should be able to open both the processed_granule.nc and your output_granule.nc files with panoply.
    • Run the notebook and verify all of the data is the same with the exception of the incorrect coordinate variables in the EDS generated file.

PR Acceptance Checklist

  • Jira ticket acceptance criteria met.
  • CHANGELOG.md updated to include high level summary of PR changes.
  • [N/A] docker/service_version.txt updated if publishing a release.
  • Tests added/updated and passing.
  • Documentation updated (if needed).

I might put logging in later.
Copy link

@lyonthefrog lyonthefrog left a comment

Choose a reason for hiding this comment

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

I reviewed the code to the best of my understanding. Most of my feedback are questions for my own benefit, with the real requested changes being typos and a potential mistake in grid.get_metadata_children().

Also, would we like to add a check for unused variables? I think we could just add --unused-variable to the ruff args list in .pre-commit-config.yaml.

Other than that, I appreciate how clean this code is and I hope to get to know it better in the future!

.github/workflows/mypy.yml Show resolved Hide resolved
.github/workflows/run_tests_on_pull_requests.yml Outdated Show resolved Hide resolved
.github/workflows/mypy.yml Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
smap_l2_gridder/__main__.py Show resolved Hide resolved
smap_l2_gridder/grid.py Outdated Show resolved Hide resolved
tests/unit/test_crs.py Show resolved Hide resolved
tests/unit/test_grid.py Outdated Show resolved Hide resolved
tests/unit/test_grid.py Outdated Show resolved Hide resolved
tests/unit/test_grid.py Outdated Show resolved Hide resolved
@flamingbear flamingbear marked this pull request as ready for review November 21, 2024 23:17
@lyonthefrog
Copy link

I ran the pytests, set up the local development environment to run the SMAP L2 Gridder locally, and ran notebook attached to the ticket using two different granules, SMAP_L2_SM_P_E_52352_D_20241119T043136_R19240_001.h5 and SMAP_L2_SM_P_E_52397_D_20241122T062227_R19240_001.h5.

All tests passed. Hurray!

@flamingbear
Copy link
Member Author

@owenlittlejohns I'm merging this and will address anything in follow on PRs if you find problems.

@flamingbear flamingbear merged commit df84655 into nasa:main Nov 25, 2024
1 check passed
@flamingbear flamingbear deleted the mhs/DAS-2252/initial-repository-import branch November 25, 2024 16:42
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.

3 participants