; https://confluence.ecmwf.int/display/CKB/ERA5+data+documentation#ERA5datadocumentation-Meanratesandaccumulations ; The accumulations in the short forecasts (from 06 and 18 UTC) of ERA5 are treated differently compared with those in ERA-Interim ; (where they are from the beginning of the forecast to the forecast step). ; In the short forecasts of ERA5 the accumulations are since the previous post processing (archiving) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;---Main script was written by Dennis Shea from (ncl-talk@ucar.edu) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;---main code begin ;---input t18s7-12 diri = "./" fili = "era5precjan2018t6s1_12.nc" pthi = diri+fili f = addfile(pthi, "r") tp = short2flt(f->tp) printVarSummary(tp) ; [time | 372] x [latitude | 69] x [longitude | 89] printMinMax(tp,0) print("--------") ymdh_erai1 = cd_calendar(tp&time, -3) ; -3: The values returned will be in the format YYYYMMDDHH LAT = 35 ; arbitrary grid point LON = 55 print("ERA5: "+ymdh_erai1+" "+tp(:,{LAT},{LON})) print("==================================") ;---sum t18s7-12 ; NCL: calculate_daily_values ; set 'nval_crit': require 12-values ****per calendar day**** opt1 = True opt1@nval_crit = 12 ; require 12 or more values per calendar date tp_ncl = calculate_daily_values(tp, "sum", 0, opt1) printVarSummary(tp_ncl) printMinMax(tp_ncl,0) print("----") ymdh_ncl = cd_calendar(tp_ncl&time, -3) print("NCL: "+ymdh_ncl+" "+tp_ncl(:,{LAT},{LON})) print("==================================") ;---writing tp_ncl in nc file setfileoption("nc", "Format", "NetCDF4") dn = "./" fn = "era5precjan2018t6s1_12_sum.nc4" pn = dn + fn ; path name system("/bin/rm -f " + pn) fo = addfile(pn, "c") fAtt = True ; assign file attributes fAtt@title = "ERA5: six-timestep sum" fAtt@source_file = fili fAtt@Conventions = "None" fAtt@creation_date = systemfunc("date") fileattdef(fo, fAtt) ;;; Following line causes unusual size 24 MB for just 1 month. If it is commented the output will be 755 KB. ; filedimdef(fo,"time",-1,True) ; make time UNLIMITED var_name1 = "TPs1" fo->$var_name1$ = tp_ncl print("==================================") end