Solved

Water deficit calculation

  • 17 May 2023
  • 4 replies
  • 6 views

Badge +3

Hello everyone,

 

I try to automate a monthly calculation of water deficit, based on monthly rainfall data. Each feature is characterized by a year (integer), a month (integer), and rainfalls (float).

 

The calculation involves the water reserve at the end of each month ("final reserve"), based on rainfalls and number of rainy days.

 

My challenge is that I need to carry this quantity to the next month ("former reserve" of current month = "final reserve" of previous month). Easy to do in Excel, but I'm not sure if this is possible and how I should proceed in FME.

 

Is there a matter of "iterative calculation" here, since the data of each month depends on data of previous month ? Should I convert my "year " and "month" integer into date format ?

 

Thank you in advance !

Regards,

Arnaud

 

icon

Best answer by redgeographics 17 May 2023, 19:47

View original

4 replies

Userlevel 5
Badge +25

You can use the Adacent Features option in an AttributeManager to access attributes from the previous feature (month), in fact, the excercise in the FME Academy is very similar to your question.

Badge +3

Thank you very much for your help ! Exactly what I need.

Now I've another challenge : the dataset is a mix of rainfall data for 8 differents locations. Does it mean that I should filter my initial dataset 8 times, use "adjacent feature" for each of them, and then aggregate everything together again ? Thank you in advance.

Badge +3

Thank you very much for your help ! Exactly what I need.

Now I've another challenge : the dataset is a mix of rainfall data for 8 differents locations. Does it mean that I should filter my initial dataset 8 times, use "adjacent feature" for each of them, and then aggregate everything together again ? Thank you in advance.

I used a "FeatureHolder" and enable group processing for my different locations. It's not 100 % correct but it does the trick in this case ("adjacent -1 feature" is sometimes from another location).

Badge +1

You could use a sorter to sort your data by location and date. Then add a conditional to your previous feauture calculation to check that they belong to the same location/group and calculate the running rainfall deficit

Reply