Skip to main content

I have a raster wherein the values are in epoch time (number of days since 1970-01-01)

Is there a way in FME to convert these values into different date formats, such as yyyyddd?

DateTimeConverter seems to only work with attributes, but translating all pixels to polygons with attributes for the pixel value is not optimal. I would guess this could be possible with RasterExpressionEvaluator, but if someone can give an example that would be really helpful.

 

Thanks!

You could use the RasterCellCoercer to convert the cells to points. The band values will be converted to attributes.

It does mean you will have one point per pixel, which depending on the size of your raster, may or may not be a problem


@hkingsbury this is not feasible since it is a global raster.


Hi ​@wolters,

This can be done using an RGB48 palette to hold year, month and day values, then a RasterExpressionEvaluator to convert these into a single integer value:

The PythonCaller generates an RGB48 palette for dates from 1970 to 2149, which is applied to the image in the RasterPaletteAdder. The RasterPaletteResolver replaces the index values with the RGB48 values. Finally, the RasterExpressionEvaluator creates a new INT32 value from the RGB48 using the expression: A[0]*10000 + A[1]*100 + A[2].

I am attaching the workspace snippet for you.