Closed edzer closed 9 months ago
Complete script:
library(openeo)
con = openeo::connect("https://openeo.cloud")
collection = "TERRASCOPE_S5P_L3_NO2_TD_V1"
coll_meta = describe_collection(collection)
w = -20; s = 0; e = 50; n = 70
# smaller:
w = 7; s = 51.5; e = 8; n = 52.5
date1 = "2020-01-01"
date2 = "2021-01-01"
p = processes(con)
datacube = p$load_collection(
id = "TERRASCOPE_S5P_L3_NO2_TD_V1",
spatial_extent = list(west = w, south = s, east = e, north = n),
temporal_extent=c(date1, date2),
bands=c("NO2")
)
# interpolate = function(data,context) {
# return(p$array_interpolate_linear(data = data))
# }
# datacube = p$apply_dimension(process = interpolate,
# data = datacube, dimension = "t")
intervals = list(c('2020-01-01', '2020-02-01'),
c('2020-02-01', '2020-03-01'),
c('2020-03-01', '2020-04-01'),
c('2020-04-01', '2020-05-01'),
c('2020-05-01', '2020-06-01'),
c('2020-06-01', '2020-07-01'),
c('2020-07-01', '2020-08-01'),
c('2020-08-01', '2020-09-01'),
c('2020-09-01', '2020-10-01'),
c('2020-10-01', '2020-11-01'),
c('2020-11-01', '2020-12-01'),
c('2020-12-01', '2020-12-30'))
# and labels
labels = sapply(intervals, head, 1) # create labels from list
temp_period = p$aggregate_temporal(data = datacube,
intervals = intervals,
reducer = function(data, context){p$median(data)},
labels = labels,
dimension = "t")
result = p$save_result(data = temp_period, format="NetCDF")
login()
compute_result(result, format = "NetCDF", output_file = "ndvi.nc", con = con)
same happens for apply_dimension
when that part gets uncommented.
I can confirm this with my R client that I compiled mid-October from dev on Windows! This is a huge privacy issue!
This script sends my local file "t" to the server as value for the dimension parameter. I also tried t as collection name (id in load_colleciton), but there it doesn't load the file.
Sorry about that. The feature to check and read existing files was requested for UDFCode parameter. But somehow the code got duplicated and ended up in argument String.
This is part of my client script:
when I have a file called "t" in my working directory, its content is substituted for the value of
dimension
. If I remove or rename that file, it works fine.