Hi to everyone!
I am new in Julia and i have monthly values of a climate variable. I calculate the annual cycle but i can’t find the way to compute the anomalies. Here is the part of the code:
using DataFrames ; using CSV ; using Statistics
tmp= CSV.read(“/home/michael/tmp.txt”,DataFrame)
monthly=combine(groupby(dropmissing(tmp),[:year,:month]), :tmpr => mean)
456×3 DataFrame
Row │ year month tmpr_mean
│ Int64 Int64 Float64
─────┼─────────────────────────
1 │ 1980 1 78.1718
2 │ 1980 2 110.061
3 │ 1980 3 144.611
…
454 │ 2017 11 76.494
455 │ 2017 12 59.1205
456 │ 2018 1 79.8317
climatology=combine(groupby(dropmissing(tmp),:month), :tmpr=>mean) #i.e. annual cycle
12×2 DataFrame
Row │ month tmpr_mean
│ Int64 Float64
─────┼──────────────────
1 │ 1 75.6246
2 │ 2 104.963
3 │ 3 145.721
…
But trying to compute the deseasonalized anomalies (thinking similar to Python’s way)
julia> groupby(monthly,:month) .- climatology
i take this error
ERROR: ArgumentError: broadcasting over GroupedDataFrame
s is reserved
So, which is the Julia’s easy way (similar to python) to find this ?
Thanks a lot!!