Skip to content

Conversation

christine-e-smit
Copy link
Contributor

Jira Issue ID

HARMONY-2166

Description

Added the 'average' parameter, which is used by the Cloud Giovanni averaging service, to request.py. I wasn't sure if this needed an update to unit tests or not. The 'average' parameter is not validated because it will expand beyond the current two options. I checked your request.py tests and I don't see a test for 'variable', which is similarly not validated in the request.py module, so I decided that meant you didn't need a test. Please let me know if this is incorrect.

I wasn't sure how to handle documentation since this service isn't in production yet.

Local Test Steps

The averaging service is only in UAT at this time, so you'll need to make the request against that baseline.

from harmony import Dimension, Client, Collection, Request, Environment
import datetime as dt
import os

harmony_client = Client(env=Environment.UAT)
collection=Collection(id='C1240560361-GES_DISC')
request = Request(
    collection=collection,
    temporal={'start':dt.datetime(2010,1,1),'stop':dt.datetime(2010,1,2)},
    dimensions=[Dimension('lat',40,41),Dimension('lon',-120,-119)],
    variables=['GPM_3IMERGHH_07_precipitation'],
    format='image/tiff',
    average='time'
)

job_id = harmony_client.submit(request)
results = harmony_client.download_all(job_id,directory='/tmp')
for r in results:
    filepath=r.result()
    assert os.path.exists(filepath)

PR Acceptance Checklist

  • Acceptance criteria met
  • Tests added/updated (if needed) and passing
  • Documentation updated (if needed)

@chris-durbin
Copy link
Contributor

Thanks for submitting the PR - as far as unit tests can you add one simple one in test_request.py after test_request_with_service_id()?

Something along the lines of:

def test_request_with_average():
    request = Request(collection=Collection('foobar'), average='time')
    assert request.is_valid()
    assert request.average == 'time'

Copy link
Contributor

@chris-durbin chris-durbin left a comment

Choose a reason for hiding this comment

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

Tested successfully.

@chris-durbin chris-durbin merged commit 8cb4e53 into nasa:main Aug 4, 2025
6 checks passed
@christine-e-smit christine-e-smit deleted the add_average branch August 4, 2025 19:00
@christine-e-smit
Copy link
Contributor Author

Silly question - but do you have a sense for when you'll do your next release?

@chris-durbin
Copy link
Contributor

Silly question - but do you have a sense for when you'll do your next release?

The change is in 1.3.0 published this morning.

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.

2 participants