1

I have been working with precipitation data from the IMERG satellite which is every 30 minutes.

I have been building the precipitation between 12 UTC one day and 12 UTC the other day.

cdo shifttime,-12hours -daysum -shifttime,12hours in.nc4 out.nc4

But I see that the "daysum" command adds 2 times each value, check this by downloading a daily data and I see that the values ​​are exactly double.

Does anyone know how to fix this since it seems that the daysum command is not working for me.

Thank you very much!

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
  • This is either a data problem or a bug in CDO. Please provide a link to your data, otherwise there is no way to tell – Robert Wilson Jun 24 '22 at 06:29
  • @Fernando - did this soln solve your problem? – ClimateUnboxed Aug 03 '22 at 14:35
  • Adrian, yes! In fact, I apologize for the delay in my response. I kept thinking if it would also be the same step for another satellite called PERSIANN but that it would accumulate its precipitation every 60 min, that is, it has 24 data per day of mm/h, the truth is that I have not controlled this file, but I suppose that it would not have the problem that the values ​​are repeated twice since I have only 1 data per time step. – Fernando Primo Forgioni Aug 04 '22 at 15:12

1 Answers1

1

I think the issue is that the units of the 30 minute data are mm/hour and so if you sum the data you will not get mm/day, since the data is every thirty minutes, but 2*mm/day. Instead the file you downloaded to check has units of mm/day (well done, by the way, for independently checking your answer). This is why self-describing files having units is so important ;-)

To get units of mm/day you simply need to divide by 2:

cdo -divc,2 -shifttime,-12hours -daysum -shifttime,12hours in.nc4 out.nc4

Easy error to make by the way, I've done it myself in the past, especially if you are used to dealing with fluxes from weather forecast output which are usually always accumulated over the output step time (i.e. that would be 30 minutes in this case).

This is why it is usually safer and less confusing to use mean instead of sum for two reasons.

  1. if you use mean you have always exactly the same units as the input file correctly, in this case mm/hr. It doesn't matter what the data frequency is, you can't get it wrong. If you prefer something like mm/day then you can convert using cdo mulc and update the metadata but it is easier to do this without making mistakes.
  2. by using mean you can also control in cdo how to handle missing data, i.e. using mean or avg.
ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
  • 1
    Upvoted. I may be misremembering, but aren't there some gaps due to cloud cover in IMERG, in which case a daily mean multiplied by 24 might be more appropriate – Robert Wilson Jun 24 '22 at 08:29
  • Good point. Actually this is an example where it is actually better to take the mean and scale up rather than the sum and scale down, safer for missing values and then you can even use avg instead of mean if you want to simply flag these cases with missing – ClimateUnboxed Jun 24 '22 at 11:55