Skip to content

Commit

Permalink
additions to make BFAST_udf.R work in R-UDF
Browse files Browse the repository at this point in the history
The return object has to be a stars object (not a raster object)
No NA's are allowed 
The file has to have a valid projection/epsg code. This is not the case in the current state of the UDF script.
  • Loading branch information
przell authored Mar 12, 2021
1 parent 315df36 commit a631ecf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions WUR_BFAST_UseCase/R/BFAST_udf.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ values(raster_out_bw_filt) = raster_out_bw_filt_mat

# multiply the original output with the bw mask and save locally:
raster_out_filt = raster_out*raster_out_bw_filt

# there are some parts missing for this function to work in the UDF Service as currently defined:
# - convert the raster object to a stars object
raster_out_filt = st_as_stars(raster_out_filt, att = 1, ignore_file = FALSE)
# - make sure no NA values are in the file
raster_out_filt[is.na(raster_out_filt)] <- -9999 # this value can be chosen differently
# - make sure the file has a valid projection (this was the last error we haven't resolved yet)
# still to be checked where the crs is lost. When ingesting the json data transfer file back into rasdaman the epsg field is empty "".
# st_crs(raster_out_filt)

# the final output raster:
raster_out_filt

Expand Down

0 comments on commit a631ecf

Please sign in to comment.