How to get hourly average O3 from a month of hourly O3 CMAQ output?

I have combined the daily hour-resolution CCTM_ACONC* output file from CMAQ into one single file (still hour-resolution) for the month using COMBINE tool. Now, I would like to create average for the month but for each hour (that is 24 datapoints for 24 hours) from the month-span COMBINE file of CCTM_ACONC*. How would I go about doing this?

I’m not aware of an off-the-shelf utility tool for creating an average diurnal cycle at each grid point using a month’s worth of hourly gridded data as input. However, maybe there is some clever combination of m3tools programs that could be used to accomplish this, maybe @cjcoats could weigh in.

In the absence of such an existing tool, your best approach probably would be to write Fortran code linked with I/O API to read in the COMBINE file and then compute the desired diurnal cycle at each grid point before writing it out to a new output file. During the calculation stage, you may then also want to apply time shifting from GMT to local time using a gridded time shift map depending on the desired use of your diurnal cycle. I’m sure you could also handle the reading and calculation part with custom python, R, or NCL code, but of course the output files created by such tools likely wouldn’t be I/O API compliant without a lot of extra effort.

Finally, it seems people using the CDO and NCO packages to work with earth system model output have asked similar questions, and there may be some built-in capabilities according to the discussion in this thread:

Of course, going down that path entails the same warning regarding I/O API non-compliance of the output files created by these packages.

I think it would be easy to use NCL to directly get the monthly average ozone for each hour and then write it as a new netcdf file.
you just need to write a loop for dividing these data.