For MODIS LAI images in an FME output folder, how do I select appropriate images based on date ranges? Image date is given in year + Julian day e.g. A2021123 for 2021 May 3?
Best answer by geomancer
To get the date from year and day number you can use the @DateTimeParse() function:
@DateTimeParse(@Value(Year_and_Day_Number),%Y%j)
2010169 gives 20100618 (June 18, 2010), 2010177 gives 20100626 (June 26, 2010).
Your next question may be how to extract the year and day number from the image name.
There are several possible solutions for this.
In both your examples, the year starts at the same position, so it may be enough to use the @Substring() function.
Or you can use a regular expression to get all the numbers between the first and second dot.
Or you can write the image name to a list with the AttributeSplitter transformer, write the second element (element 1) to a new attribute with the ListIndexer transformer, and ger the year and day number from that attribute.
And there are probably other ways to get the year and day number. Just dive into the possibilities.
FME is best learned by trying it yourself. Use the documentation, it is very extensive. And of course you can ask questions at the forum when you can't figure it out completely.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.