Hi
We can use the function climate.anomaly(...) to calculate anomalies:
data_hist_clim = ct.climate.climatology_mean(data_hist) data_anomalies = ct.climate.anomaly(data_scen, climatology=data_hist_clim)
From looking at the source code I gather it calculates the anomalies by subtracting a reference from the data.
But sometimes (e.g., in case of precipitation) relative anomalies (i.e. a ratio), or anomalies as a percentage of the original, make more sense. What is the best way of doing this? I can of course calculate these myself:
# first mask out very small values in the reference data data_hist_clim = ct.cube.where(data_hist_clim > 0.001, data_hist_clim) data_anomalies = 100*(data_scen - data_hist_clim) / data_hist_clim
Although this seems to work, and appears to give me sensible values, and I can even visualise the result offline, my workflow then fails when I try to visualise these data, e.g. in a LiveMap. Presumably this is because climate.anomaly(...) does something with the dimensions or attributes of the result (data_anomalies) that my simple calculation doesn't, but exactly what I cannot figure out.
So, what is the best way to calculate relative anomalies?
Many thanks!
Rutger