pytesmo
pytesmo copied to clipboard
Documentation of "calc_climatology"
I think the calc_climatology routine might benefit from updating its documentation.
For example, I think "Returns always 366 values" is no longer up to date, if a monthly climatology is being calculated, in which case it is just 12 values, is that correct? If so, the "calc_anomaly" documentation might need to be updated accordingly?
Also, the distinction between a "normal" and a "monthly" climatology is not entirely clear to me... Is the latter always being produced, if unit="month", or can unit="month" be equally applied to both, and the output is determined by the frequency of the input DatetimeIndex?
In my opinion, it might help avoiding confusion to drop the "moving_avg_month_clim" keyword entirely because it seems to be redundant with the "unit" + "moving_avg_clim" keywords. Also, having an "output_freq" keyword or something of the like to switch between outputting a daily or monthly climatology might make things more clear?
@pstradio can you update the descriptions?
Another thing related to this: There are now 2 keywords to set the moving average window for the climatology, "moving_avg_clim" and "moving_avg_month_clim". I think it would be nicer if we had only one keyword "moving_avg_clim" and then work out the default value based on the unit, e.g. set moving_avg_clim=None
in the header and then do
default_moving_avg_clim = {"day": 35, "month": 3}
if moving_avg_clim is None:
moving_avg_clim = default_moving_avg_clim["unit"]
if unit == "month" and moving_avg_clim > 5:
# in case someone changes unit but not moving_avg_clim a warning might be useful
warnings.warn(f"Window for moving average of climatology set to {moving_avg_clim} months, is this intentional?")