IDEMSInternational / R-Instat

A statistics software package powered by R
http://r-instat.org/
GNU General Public License v3.0
38 stars 103 forks source link

Small problem with climatic summaries #5372

Open rdstern opened 5 years ago

rdstern commented 5 years ago

This dialogue is working much better now.

When I use it with the middle tab, i.e. within year, I use the month as the factor.
Then, in the summary data frame the month is not recognised as a month climatically. The year is ok.
If I instead use the Prepare > Column: Reshape > Column Summaries it works ok. I noticed this with the library data from Nigeria - Samaru - where I started by getting monthly summaries from the second data frame. With the monthly summaries I then proceeded to the Climatic > Prepare > SPI dialogue, where the month was not available.

stevenndungu commented 5 years ago

@I have been looking at this and seen where the error is coming from. It is on the filter obtained day_filter <- instat_calculation$new(type="filter", function_exp="doy_366 >= 1 & doy_366 <= 366", calculated_from=calc_from_convert(x=list(guinea_2="doy_366"))) To solve this I will have to discuss with @dannyparsons.

dannyparsons commented 5 years ago

@stevenndungu why is the filter the cause here?

stevenndungu commented 5 years ago

So I noted that this error happens only when the parameter additional_filter is added in the climatic_summary function. Otherwise the metadata is updated correctly (factors included).

I think it is in the Calculations.R file where we have manipulations = lapply(self$manipulations, function(x) x$data_clone()) such that the factor variable(s) used in the by function loses its climatic properties. At first i thought lappy was the one losing the metadata.

That's what i think after having a closer look.

dannyparsons commented 5 years ago

Ok that could be right, and we could look into this more.

stevenndungu commented 5 years ago

Yes, for sure.