Error when trying to load_result() and apply further processes

Hi,
to test a small dummy ML workflow I would like to extract pixel values from an existing job result to generate a training data set.
The preprocessed raster data cube (jobID = vito-j-0af01b04c09940ef968374f7fc951502) has multiple bands but no temporal dimension. I can view it in the editor and download it as a .tif (10 Mb).
The sampling locations are simplified 20m buffers around two point coordinates (octagons) to make sure they overlap cell centers. Using the R-client I pass them as an sf object projected in the right CRS.

My process fails when using the preprocessed data cube, but succeeds when using an existing collection like CLC. I saw load_result() is labeled experimental. If this is the reason, would you suggest processing it all in one go (produce raster data cube -> aggregate_spatial() -> fit_class_random_forest() -> predict_random_forest() -> save_result())

Error message:
Your openEO batch job failed: OpenEOApiException(status_code=501, code=‘Internal’, message=‘Job j-6f51cbbe0ee94e328aedc68f2bdd016e contains no results of supported type GTiff.’, id=‘no-request’) ID: [1674716812200, 24146]

R-code:
library(sf)
library(openeo)
con = connect(host = "https://openeo.cloud")
login()

p = processes()
ff = list_file_formats()

be_small = list(st_point(c(4.329291, 51.30488)), 
                st_point(c(4.437202, 51.36415))) |> 
  st_as_sfc(crs=st_crs(4326)) |> 
  st_as_sf(id = 1:2) |> 
  st_transform(st_crs(3035)) |> 
  st_buffer(20) |> 
  st_simplify(dTolerance = 2)

extract_data = p$load_result(id = "vito-j-6f51cbbe0ee94e328aedc68f2bdd016e") |> 
  p$aggregate_spatial(geometries = be_small, reducer = p$max) |> 
  p$save_result(format = ff$output$JSON)

test_job = create_job(extract_data, "Test Extract from S2 cube")
start_job(test_job)
Graph:
{
  "process_graph": {
    "load_result_LYWXF2858F": {
      "process_id": "load_result",
      "arguments": {
        "id": "vito-j-6f51cbbe0ee94e328aedc68f2bdd016e"
      }
    },
    "aggregate_spatial_ZLYWF7289H": {
      "process_id": "aggregate_spatial",
      "arguments": {
        "data": {
          "from_node": "load_result_LYWXF2858F"
        },
        "geometries": {
          "type": "FeatureCollection",
          "name": "file180a8e2ea70",
          "features": [
            {
              "type": "Feature",
              "properties": {
                "id": 1
              },
              "geometry": {
                "type": "Polygon",
                "coordinates": [
                  [
                    [
                      4.32957706670498,
                      51.3048939387064
                    ],
                    [
                      4.32950895799758,
                      51.3047631809687
                    ],
                    [
                      4.32931317322611,
                      51.304700852543
                    ],
                    [
                      4.32910439980373,
                      51.3047434642879
                    ],
                    [
                      4.3290049334548,
                      51.3048660550208
                    ],
                    [
                      4.32907304086815,
                      51.3049968130406
                    ],
                    [
                      4.32926882655979,
                      51.3050591418734
                    ],
                    [
                      4.32947760127622,
                      51.3050165298463
                    ],
                    [
                      4.32957706670498,
                      51.3048939387064
                    ]
                  ]
                ]
              }
            },
            {
              "type": "Feature",
              "properties": {
                "id": 2
              },
              "geometry": {
                "type": "Polygon",
                "coordinates": [
                  [
                    [
                      4.43748846286936,
                      51.3641636763723
                    ],
                    [
                      4.43741996947082,
                      51.3640329805689
                    ],
                    [
                      4.43722379329038,
                      51.363970831476
                    ],
                    [
                      4.4370148510183,
                      51.3640136349018
                    ],
                    [
                      4.43691553728796,
                      51.3641363173806
                    ],
                    [
                      4.43698402939125,
                      51.3642670134679
                    ],
                    [
                      4.43718020649887,
                      51.3643291629676
                    ],
                    [
                      4.43738915006619,
                      51.3642863592579
                    ],
                    [
                      4.43748846286936,
                      51.3641636763723
                    ]
                  ]
                ]
              }
            }
          ]
        },
        "reducer": {
          "process_graph": {
            "max_XNBMR8214N": {
              "process_id": "max",
              "arguments": {
                "data": {
                  "from_parameter": "data"
                },
                "ignore_nodata": {
                  "from_parameter": "context"
                }
              },
              "result": true
            }
          }
        },
        "target_dimension": "result"
      }
    },
    "save_result_JJFOT1948T": {
      "process_id": "save_result",
      "arguments": {
        "data": {
          "from_node": "aggregate_spatial_ZLYWF7289H"
        },
        "format": "JSON",
        "options": {}
      },
      "result": true
    }
  },
  "parameters": [],
  "returns": {
    "schema": {
      "type": "boolean"
    }
  }
} 

Thanks for your help!

Hi,
I have the impression that job id’s got mixed up:
vito-j-6f51cbbe0ee94e328aedc68f2bdd016e indeed does not contain geotiffs
vito-j-0af01b04c09940ef968374f7fc951502 has geotiff

So can you make sure to try load_result with vito-j-0af01b04c09940ef968374f7fc951502 ?

thanks!

Thanks for your quick response, Jeroen.
You are right, I mixed up the IDs, sorry!
Nevertheless, my job result seems to lack a timestamp…

Error message:
Your openEO batch job failed: OpenEOApiException(status_code=400, code=‘Internal’, message=‘Cannot load results of job j-0af01b04c09940ef968374f7fc951502 because they lack timestamp information.’, id=‘no-request’)

Does that have to do with dropping the time dimension when creating the cube?

R-Code for Raster Data Cube Creation
small_bbox = st_bbox(c(xmin=4.225, xmax=4.446, ymin= 51.296, ymax=51.393), crs = 4326)
t = list("2018-04-01", "2018-08-31")

s2 = p$load_collection(id=col$SENTINEL2_L2A, 
                       spatial_extent = small_bbox, 
                       temporal_extent = t) |> 
  p$resample_spatial(20) |> 
  p$mask_scl_dilation("SCL") |> 
  p$reduce_dimension(reducer = p$median, dimension = "t") |> 
  p$ndvi(target_band = "NDVI", nir="B08", red="B04") |> 
  p$save_result(ff$output$GTiff)

s2_job = create_job(s2, "S2 Median 04-08/2018 Bands + NDVI")
start_job(s2_job)

Cheers!

Yes, indeed, it seems that we don’t support cubes without timestamp in load_result, we’ll want to log an issue for that.
In the meantime, you could try not dropping the time dimension entirely, by just keeping one date?

Good to know, thank you!
apply_dimension() instead of reduce_dimension() made it work :nerd_face:

1 Like