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

HARMONY-1965: Add pixelSubset to data operation schema 0.21.0 #59

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.20.0/data-operation-v0.20.0.json",
"version": "0.20.0",
"$schema": "../../harmony/app/schemas/data-operation/0.21.0/data-operation-v0.21.0.json",
"version": "0.21.0",
"callback": "http://localhost/some-path",
"stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/",
"user": "jdoe",
Expand Down Expand Up @@ -70,6 +70,7 @@
"lat",
"lon"
],
"pixelSubset": false,
"extraArgs": {
"cut": false
}
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 @@ -619,6 +619,8 @@ class Message(JsonObject):
The averaging method to use
extendDimensions: list
A list of dimensions to extend.
pixelSubset : bool
True if pixel subset should be performed by the service.
extraArgs: object
A map of key (string type) and value (any type) pairs indicating the extra arguments
that should be passed to the worker command
Expand Down Expand Up @@ -659,6 +661,7 @@ def __init__(self, json_str_or_dict, decrypter=lambda x: x):
'concatenate',
'average',
'extendDimensions',
'pixelSubset',
'extraArgs'
],
list_properties={'sources': Source}
Expand Down
13 changes: 7 additions & 6 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.20.0",
"$schema": "../../harmony/app/schemas/data-operation/0.21.0/data-operation-v0.21.0.json",
"version": "0.21.0",
"callback": "http://localhost/some-path",
"stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/",
"user": "jdoe",
Expand All @@ -19,8 +19,8 @@

minimal_source_message = """
{
"$schema": "../../harmony/app/schemas/data-operation/0.19.0/data-operation-v0.19.0.json",
"version": "0.20.0",
"$schema": "../../harmony/app/schemas/data-operation/0.21.0/data-operation-v0.21.0.json",
"version": "0.21.0",
"callback": "http://localhost/some-path",
"stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/",
"user": "jdoe",
Expand All @@ -46,8 +46,8 @@

full_message = """
{
"$schema": "../../harmony/app/schemas/data-operation/0.19.0/data-operation-v0.19.0.json",
"version": "0.20.0",
"$schema": "../../harmony/app/schemas/data-operation/0.21.0/data-operation-v0.21.0.json",
"version": "0.21.0",
"callback": "http://localhost/some-path",
"stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/",
"user": "jdoe",
Expand Down Expand Up @@ -182,6 +182,7 @@
"concatenate": true,
"average": "time",
"extendDimensions": ["lat", "lon"],
"pixelSubset": true,
"extraArgs": {
"cut": false,
"intParam": 100,
Expand Down
7 changes: 4 additions & 3 deletions tests/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def setUp(self):
def test_when_provided_a_full_message_it_parses_it_into_objects(self):
message = Message(full_message)

self.assertEqual(message.version, '0.20.0')
self.assertEqual(message.version, '0.21.0')
self.assertEqual(message.callback, 'http://localhost/some-path')
self.assertEqual(message.stagingLocation, 's3://example-bucket/public/some-org/some-service/some-uuid/')
self.assertEqual(message.user, 'jdoe')
Expand Down Expand Up @@ -80,13 +80,14 @@ def test_when_provided_a_full_message_it_parses_it_into_objects(self):
self.assertEqual(message.subset.dimensions[1].min, None)
self.assertEqual(message.subset.dimensions[1].max, 10)
self.assertEqual(message.extendDimensions, ["lat", "lon"])
self.assertEqual(message.pixelSubset, True)
self.assertEqual(message.extraArgs['cut'], False)


def test_when_provided_a_minimal_message_it_parses_it_into_objects(self):
message = Message(minimal_message)

self.assertEqual(message.version, '0.20.0')
self.assertEqual(message.version, '0.21.0')
self.assertEqual(message.callback, 'http://localhost/some-path')
self.assertEqual(message.stagingLocation, 's3://example-bucket/public/some-org/some-service/some-uuid/')
self.assertEqual(message.user, 'jdoe')
Expand All @@ -106,7 +107,7 @@ def test_when_provided_a_minimal_message_it_parses_it_into_objects(self):
def test_when_provided_a_message_with_minimal_source_it_parses_it_into_objects(self):
message = Message(minimal_source_message)

self.assertEqual(message.version, '0.20.0')
self.assertEqual(message.version, '0.21.0')
self.assertEqual(message.callback, 'http://localhost/some-path')
self.assertEqual(message.user, 'jdoe')
self.assertEqual(message.accessToken, 'ABCD1234567890')
Expand Down