Open thegoldenhop opened 3 months ago
I am using the gdalcubes project to do some work with ice concentration data and I want to get a difference between two dates.
My initial cube object output looks like this:
A data cube proxy object
Dimensions: low high count pixel_size chunk_size t 2016-09-19 2024-05-29 2810 P1D 1 y 75 79 40 0.1 256 x -102 -76 260 0.1 256
Bands: name offset scale nodata unit 1 Ice_Concentration 0 1 NaN
I am applying the following functions to the cube to get what I want:
trend_function = function(x) { (x["Ice_Concentration",][2] - x["Ice_Concentration",][1]) } select = select_time(result, c("2024-05-13", "2024-05-20")) trend.cube = reduce_time(select, names="Ice_Concentration_Trend", FUN=trend_function)
After the functions are applied I get the following datacube output.
Dimensions: low high count pixel_size chunk_size values t 2024-05-13 2024-05-13 1 P0D 1 2024-05-13 y 75 79 40 0.1 256 x -102 -76 260 0.1 256
Bands: name offset scale nodata unit 1 Ice_Concentration_Trend 0 1 NaN
Then attempting to write the output of the cube as a tif with the following code:
write_tif(trend.cube, dir=tempdir())
Gets me this error:
/usr/include/c++/11/bits/stl_vector.h:1045: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = gdalcubes::datetime; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::reference = gdalcubes::datetime&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__n < this->size()' failed. /usr/include/c++/11/bits/stl_vector.h:1045: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = gdalcubes::datetime; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::reference = gdalcubes::datetime&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__n < this->size()' failed. [ERROR] worker process #0 returned 134 [ERROR] worker process #1 returned 134
Any idea on how to approach this or what I'm doing wrong.
I am using the gdalcubes project to do some work with ice concentration data and I want to get a difference between two dates.
My initial cube object output looks like this:
A data cube proxy object
Dimensions: low high count pixel_size chunk_size t 2016-09-19 2024-05-29 2810 P1D 1 y 75 79 40 0.1 256 x -102 -76 260 0.1 256
Bands: name offset scale nodata unit 1 Ice_Concentration 0 1 NaN
I am applying the following functions to the cube to get what I want:
trend_function = function(x) { (x["Ice_Concentration",][2] - x["Ice_Concentration",][1]) } select = select_time(result, c("2024-05-13", "2024-05-20")) trend.cube = reduce_time(select, names="Ice_Concentration_Trend", FUN=trend_function)
After the functions are applied I get the following datacube output.
A data cube proxy object
Dimensions: low high count pixel_size chunk_size values t 2024-05-13 2024-05-13 1 P0D 1 2024-05-13 y 75 79 40 0.1 256
x -102 -76 260 0.1 256
Bands: name offset scale nodata unit 1 Ice_Concentration_Trend 0 1 NaN
Then attempting to write the output of the cube as a tif with the following code:
write_tif(trend.cube, dir=tempdir())
Gets me this error:
/usr/include/c++/11/bits/stl_vector.h:1045: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = gdalcubes::datetime; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::reference = gdalcubes::datetime&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__n < this->size()' failed.
/usr/include/c++/11/bits/stl_vector.h:1045: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = gdalcubes::datetime; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::reference = gdalcubes::datetime&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__n < this->size()' failed.
[ERROR] worker process #0 returned 134
[ERROR] worker process #1 returned 134
Any idea on how to approach this or what I'm doing wrong.