Skip to main content
Solved

Attribute Totals for Rain Gauges

  • September 10, 2018
  • 3 replies
  • 8 views

I have a table "SensorHistory" that has info pertaining to rain gauge data. My goal is to create a summary information to eventually present rain gauge totals attributes such as 1 day, 7 day, 10 day, 24 day and YTD totals. I was wondering how to go about this in FME so that I have 5 attributes with site_id (see picture) and receive time for that day having the maximum rain gauge accumulation? I assume I would have to query out the table for the given time periods and use the max statistic(receive_time) for that day to get the rain accumulation. Not quite sure how to query that either so any help is appreciated!

Thanks!

Best answer by hollyatsafe

Hi @elisaayalapanto,

I think the best place for you to start would be the StatisticsCalculator. You can set the 'Group By' parameter to site_id and receive_time and the 'Attribute to Analyze' to data_value. Then under the calculations leave only those filled in that are relevant to the translation. In your case I believe that would only be the _max value, or the _sum if you would prefer to have the total rain gauge where there are multiple values for one ID at the same receive time.

Inspect the Summary output and you might see that there are multiple values for the same ID at different receive_times so you may need to filter this result out further. Alternatively if you are just looking for rain gauge values per day then you could group by the date_time attribute instead of receive_time.

But if you want to keep the max receive time for each day one way to do this would be to first add a Sorter after the Summary. In here sort both by ID and then set the _max value to be sorted in descending order.

Now add a DuplicateFilter with the 'Key Attribute' as site_id and as date_time and the 'Input is Ordered' set to YES. This way the duplicate filter will keep the first record for each ID it receives which we know is the max value because of how we set up the sorter. Using the date_time value will mean that you get the max receive_time per day.

View original
Did this help you find an answer to your question?

3 replies

Forum|alt.badge.img+2
  • Best Answer
  • September 10, 2018

Hi @elisaayalapanto,

I think the best place for you to start would be the StatisticsCalculator. You can set the 'Group By' parameter to site_id and receive_time and the 'Attribute to Analyze' to data_value. Then under the calculations leave only those filled in that are relevant to the translation. In your case I believe that would only be the _max value, or the _sum if you would prefer to have the total rain gauge where there are multiple values for one ID at the same receive time.

Inspect the Summary output and you might see that there are multiple values for the same ID at different receive_times so you may need to filter this result out further. Alternatively if you are just looking for rain gauge values per day then you could group by the date_time attribute instead of receive_time.

But if you want to keep the max receive time for each day one way to do this would be to first add a Sorter after the Summary. In here sort both by ID and then set the _max value to be sorted in descending order.

Now add a DuplicateFilter with the 'Key Attribute' as site_id and as date_time and the 'Input is Ordered' set to YES. This way the duplicate filter will keep the first record for each ID it receives which we know is the max value because of how we set up the sorter. Using the date_time value will mean that you get the max receive_time per day.


hollyatsafe wrote:

Hi @elisaayalapanto,

I think the best place for you to start would be the StatisticsCalculator. You can set the 'Group By' parameter to site_id and receive_time and the 'Attribute to Analyze' to data_value. Then under the calculations leave only those filled in that are relevant to the translation. In your case I believe that would only be the _max value, or the _sum if you would prefer to have the total rain gauge where there are multiple values for one ID at the same receive time.

Inspect the Summary output and you might see that there are multiple values for the same ID at different receive_times so you may need to filter this result out further. Alternatively if you are just looking for rain gauge values per day then you could group by the date_time attribute instead of receive_time.

But if you want to keep the max receive time for each day one way to do this would be to first add a Sorter after the Summary. In here sort both by ID and then set the _max value to be sorted in descending order.

Now add a DuplicateFilter with the 'Key Attribute' as site_id and as date_time and the 'Input is Ordered' set to YES. This way the duplicate filter will keep the first record for each ID it receives which we know is the max value because of how we set up the sorter. Using the date_time value will mean that you get the max receive_time per day.

How would I go about putting a writer for this?

Forum|alt.badge.img+2
elisaayalapanto wrote:
How would I go about putting a writer for this?
Hi @elisaayalapanto,

 

 

This would depend on what format you want to present the report in e.g. MS Word, Excel, HTML etc? The second half of this Web Data & Reporting webinar (40 mins in) goes through some of these options in more detail.

 

And also exactly what information you want to include in the report because you could also create charts/other tables depending on how you want to present the information?

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings