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

Add Julia function reduce #25

Closed
danlooo opened this issue Jan 15, 2024 · 2 comments
Closed

Add Julia function reduce #25

danlooo opened this issue Jan 15, 2024 · 2 comments

Comments

@danlooo
Copy link
Collaborator

danlooo commented Jan 15, 2024

Use julia function reduce that creates process calls with reduce_dimension to use Julia syntax in openEO transformations.

using Statistics
reduce(*, [2; 3; 4])
#  24
reduce(max, [1,2,3], dims=1)
#1-element Vector{Int64}:
# 3
maximum([1,2,3], dims=1)
#1-element Vector{Int64}:
# 3
max([1,2,3]...)
# 3

In Julia reduce takes an 2-argument function, whereas in openEO, reduce_dimension takes a process with only one argument i.e. data.

danlooo added a commit that referenced this issue Jan 15, 2024
danlooo added a commit that referenced this issue Jan 15, 2024
danlooo added a commit that referenced this issue Jan 15, 2024
@danlooo
Copy link
Collaborator Author

danlooo commented Jan 15, 2024

One can now do this:

using OpenEOClient
con = connect("openeocloud.vito.be/openeo", "1.0.0", OpenEOClient.oidc_auth)
cube1 = DataCube(con, "LANDSAT8-9_L2",
    BoundingBox(west=10.8, south=54.1, east=11.6, north=54.5),
    ("2020-01-20", "2020-01-30"), ["B01", "B02", "B03"]
)

cube2 = maximum(cube1["B01"], dims="t")
cube3 = reduce(con.max, cube1["B01"], dims="t")
#openEO DataCube
#   collection: LANDSAT8-9_L2
#   dimensions: ["x", "y"]
#   bands: Unknown
#   spatial extent: nothing
#   temporal extent: nothing
#   license: proprietary
#   connection: https://openeocloud.vito.be/openeo/1.0.0
compute_result(cube3)

@danlooo
Copy link
Collaborator Author

danlooo commented Jan 15, 2024

merged see #23

@danlooo danlooo closed this as completed Jan 15, 2024
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

No branches or pull requests

1 participant