I have a netcdf file containing daily precipitation over many years. I want to calcul annual precipitation. To achieve that I am using cf-python. I run into the following error: ‘UFuncTypeError: Cannot cast ufunc ‘subtract’ output from dtype(‘float64’) to dtype(‘int64’) with casting rule ‘same_kind‘. Attached is the screenshot of the full error.
Here is my code:
import cf
file_in = "C:/Users/gilunga/Documents/Projet CIV/processing/pr_day_INM-CM4-8_historical_r1i1p1f1_gr1_19750101-20141231_regrid.nc"
data = cf.read(file_in)[0]
group = cf.Y(month=1)
a = data.collapse("T: sum", group = group)
Then I received the following error: