Skip to content

Commit

Permalink
HARMONY-1912: Add support for the average parameter which specifies t…
Browse files Browse the repository at this point in the history
…he averaging method to use for averaging services.
  • Loading branch information
chris-durbin committed Oct 10, 2024
1 parent 5ef9b13 commit 09caf96
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 3 additions & 2 deletions example/example_message.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../harmony/app/schemas/data-operation/0.19.0/data-operation-v0.19.0.json",
"version": "0.19.0",
"$schema": "../../harmony/app/schemas/data-operation/0.20.0/data-operation-v0.20.0.json",
"version": "0.20.0",
"callback": "http://localhost/some-path",
"stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/",
"user": "jdoe",
Expand Down Expand Up @@ -65,6 +65,7 @@
}]
},
"concatenate": false,
"average": "time",
"extendDimensions": [
"lat",
"lon"
Expand Down
3 changes: 3 additions & 0 deletions harmony_service_lib/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,8 @@ class Message(JsonObject):
concatenate: bool
True if the service should concatenate multiple input files into a single output
file and false otherwise.
average: string
The averaging method to use
extendDimensions: list
A list of dimensions to extend.
extraArgs: object
Expand Down Expand Up @@ -657,6 +659,7 @@ def __init__(self, json_str_or_dict, decrypter=lambda x: x):
'subset',
'temporal',
'concatenate',
'average',
'extendDimensions',
'extraArgs'
],
Expand Down
7 changes: 4 additions & 3 deletions tests/example_messages.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
minimal_message = """
{
"$schema": "../../harmony/app/schemas/data-operation/0.19.0/data-operation-v0.19.0.json",
"version": "0.19.0",
"version": "0.20.0",
"callback": "http://localhost/some-path",
"stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/",
"user": "jdoe",
Expand All @@ -20,7 +20,7 @@
minimal_source_message = """
{
"$schema": "../../harmony/app/schemas/data-operation/0.19.0/data-operation-v0.19.0.json",
"version": "0.19.0",
"version": "0.20.0",
"callback": "http://localhost/some-path",
"stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/",
"user": "jdoe",
Expand All @@ -47,7 +47,7 @@
full_message = """
{
"$schema": "../../harmony/app/schemas/data-operation/0.19.0/data-operation-v0.19.0.json",
"version": "0.19.0",
"version": "0.20.0",
"callback": "http://localhost/some-path",
"stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/",
"user": "jdoe",
Expand Down Expand Up @@ -180,6 +180,7 @@
}]
},
"concatenate": true,
"average": "time",
"extendDimensions": ["lat", "lon"],
"extraArgs": {
"cut": false,
Expand Down
1 change: 1 addition & 0 deletions tests/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_when_provided_a_full_message_it_parses_it_into_objects(self):
self.assertEqual(message.isSynchronous, True)
self.assertEqual(message.accessToken, 'ABCD1234567890')
self.assertEqual(message.concatenate, True)
self.assertEqual(message.average, 'time')
self.assertEqual(message.sources[0].collection, 'C0001-EXAMPLE')
self.assertEqual(message.sources[0].shortName, 'example_1_data')
self.assertEqual(message.sources[0].versionId, '1')
Expand Down

0 comments on commit 09caf96

Please sign in to comment.