Append multiple monthly emission files to get annual emission

Hi all,

I have run 12 biogenic emission files separately and have following 12 files:

  1. b3gts_l.20170101.31.us1330.nctox.ncf
  2. b3gts_l.20170201.28.us1330.nctox.ncf
  3. b3gts_l.20170301.31.us1330.nctox.ncf
  4. b3gts_l.20170401.30.us1330.nctox.ncf
  5. b3gts_l.20170501.31.us1330.nctox.ncf
  6. b3gts_l.20170601.30.us1330.nctox.ncf
  7. b3gts_l.20170701.31.us1330.nctox.ncf
  8. b3gts_l.20170801.31.us1330.nctox.ncf
  9. b3gts_l.20170901.30.us1330.nctox.ncf
    10.b3gts_l.20171001.31.us1330.nctox.ncf
    11.b3gts_l.20171101.30.us1330.nctox.ncf
    12.b3gts_l.20171201.31.us1330.nctox.ncf

I want to get 1 single file that will have annual data from those 12 files. (All the hours in a year) All of those files have the same dimensions (105X135) and the same resolution (1330 meters). I will be grateful if anyone can help me on this issue.

Hasibul

Hello Hasibul,

one way of doing this would be to use m3tools program m3xtract. I don’t have a script ready, but conceptually this sequence should work - @cjcoats , please correct me if I’m missing something.

  1. copy b3gts_l.20170101.31.us1330.nctox.ncf to your desired output file name, e.g. b3gts_l.2017.365.us1330.nctox.ncf

  2. setenv OUTFILE b3gts_l.2017.365.us1330.nctox.ncf

  3. setenv INFILE b3gts_l.20170201.28.us1330.nctox.ncf

  4. run m3xtract, following the prompts to select all variables, layers, and time steps. This will copy all time steps from INFILE (your February file) to OUTFILE (the copy of your January file)

  5. Repeat steps 3 and 4 (i.e. change the setting for INFILE and run m3xtract) for the remaining months. This could easily be scripted in bash or csh

Actually, either m3xtract or m3cple would work, although the latter would be simpler since it automatically works for all the variables – just use grid=SAME so that the program does copy rather than grid-to-grid interpolate: see https://cjcoats.github.io/ioapi/M3CPLE.html or https://www.cmascenter.org/ioapi/documentation/all_versions/html/M3CPLE.html

As far as scripting goes, these programs are designed to support interactive command-line use (with meaningful prompts, etc.). That would be a bit tedious for combining twelve files; however, you might do the first pair of files interactively to see what needs to drive the script for the rest of them.