I have a monthly temperature netCDF dataset with aprox 20 years and I'd like to calculate a monthly climatology (average of all Jan, Feb, Mar...).
I know I can do this with
stackapply from package
raster. But I'm trying to learn the package
stars. I tried using the
aggregate function but I'm not able to figure out how to set the
by argument correctly to apply the
mean function to each month.
This is what my dataset looks like:
stars object with 3 dimensions and 1 attribute attribute(s), summary of first 1e+05 cells: Tavg_monthly_UT_Brazil_v2_19800101_20151231.nc Min. :18.11 1st Qu.:25.00 Median :26.36 Mean :25.85 3rd Qu.:26.85 Max. :29.83 NA's :56236 dimension(s): from to offset delta refsys point values x 1 168 -74.25 0.25 NA NA NULL [x] y 1 162 6.25 -0.25 NA NA NULL [y] time 1 432 NA NA POSIXct NA 1980-01-16,...,2015-12-16
aggregate the correct function to use? I also tried
group_by but that does not work for