How do I create monthly or annual average I/O API files (e.g. CMAQ outputs, MCIP, or SMOKE emissions files)?
You can use a combination of the two I/O API M3TOOLS, m3xtract and m3tproc, to calculate the average of whatever time period you choose. Let’s assume you have day-long files of hourly averages (typical of CMAQ files) and you’d like to create an annual average file. First, use m3xtract to create a year-long file of hourly averages. You can do this by setting the OUTFILE to be the file that you want to append to. For example:
setenv INFILE day2.nc
setenv OUTFILE day1.nc
When you run m3xtract following the prompts, it will append day2 to the end of day1. Repeat this, changing the INFILE for each day. This will concatenate the entire period of interest into one long file. You may want to set up a batch script to loop through all the days. Lastly, use m3tproc and follow the prompts to create the monthly/annual average file, setting the INFILE to be the concatenated file you created using m3xtract. There will be a prompt where it asks you the output timestep and analysis duration window. For that you would enter the total number of hours in the year-long file and subtract 1 hour from the end. That will average for the entire year. For example: nHours = 240000 * 365 - 10000 where 365 is the total number of days you’d like to average over (one year in this case).
For additional info about these utilities, please see:
https://www.cmascenter.org/ioapi/documentation/all_versions/html/M3XTRACT.html
https://www.cmascenter.org/ioapi/documentation/all_versions/html/M3TPROC.html
Hi @lizadams, just FYI, the link for M3TRACT and M3TPROC takes you to a 404 page, are these the correct url’s?
https://www.cmascenter.org/ioapi/documentation/all_versions/html/M3XTRACT.html
https://www.cmascenter.org/ioapi/documentation/all_versions/html/M3TPROC.html
@ever.barreto - Yes, thank you, your links are correct. I am updating the links now.
Also from the GitHub I/O API site:
https://cjcoats.github.io/ioapi/M3XTRACT.html
https://cjcoats.github.io/ioapi/M3TPROC.html
Note that generally m3tools-programs open their output files in FSUNKN3 mode (“create if it doesn’t exist; open for appenfd otherwise”)
The Fortran utility “cal_tmetric” released with CMAQv5.3 (b2 and later) will also create temporally averaged or summed files from one or more gridded time-dependent IOAPI files. Documentation and a sample run scripts are located in the CMAQ repository under the POST folder:
https://github.com/USEPA/CMAQ/tree/5.3.b2/POST/calc_tmetric