IDEMSInternational / epicsawrap

GNU Lesser General Public License v3.0
0 stars 0 forks source link

Check `get_total_rain_counts` is working now we do not have `data_name` being read in #137

Open lilyclements opened 3 months ago

lilyclements commented 3 months ago

@jkmusyoka I came across this, it may be an issue, but I don't have the time to check right now, unfortunately, and I'm on leave this week. If you find it's an error then let me know.

I think this is related to if we are looking for the seasonal_rain and annual_rain definitions generation. So, I don't know if we now will get an error when generating definitions relating to the number of rainy days in a season or annually since we no longer call in the raw data on the dialog to help generate this.

My brain is fuzzy -- I need to take a break now and I'll check this when I'm back

lilyclements commented 3 months ago

This is now working for annual

TODO

  1. Need to fix for different options of the "raindays" column name. Currently it is hard coded to look for "sum_rainday" or "sumRainday" Presumably it is called "sum" followed by the name of the "rainday" column on the main raw data frame. We have an issue if we cannot read in the main data frame to create it. Need to work out around this -- check metadata and bits. @jkmusyoka this will work fine provided the rainday col is called "rainday" or "Rainday" on the raw data for now

  2. Need to check on seasonal. It looks like it's hard coded in start and end values for the season, not reading in the start_rains and end_rains dates.

lilyclements commented 3 months ago

To 2.:

@jkmusyoka this assumes that you create the seasonal rainfall definitions for rain days and rainfall totals using the climatic summary dialog, and setting the day range to be from startrain to end*

image

# Dialog: Climatic Summary
day_filter <- instat_calculation$new(type="filter", function_exp="s_doy >= start_rain & s_doy <= end_season", calculated_from=calc_from_convert(x=list(ZambiaEastern="s_doy", ZambiaEastern_by_Station_Name_s_year1=c("start_rain", "end_season"))))
data_book$calculate_summary(columns_to_summarise=c("rainfall","rainday"), data_name="ZambiaEastern", factors=c("Station_Name", "s_year1"), additional_filter=day_filter, j=1, summaries=c("summary_sum"), silent=TRUE)

Otherwise it won't read in the seasonal rainfall, at the moment. I noticed your example is just doing a filter to a predefined set of dates.

For us to allow for this we need to add in new parameters "start_day" and "end_day" under seasonal. This is possible to add in (after Zambia workshop) if this is sensible?