# How to output one nc file with MEGANv3.2

**URL:** <https://forum.cmascenter.org/t/how-to-output-one-nc-file-with-meganv3-2/4917>\
**Category:** MEGAN\
**Created:** [May 7, 2024, 8:22am UTC](https://forum.cmascenter.org/t/how-to-output-one-nc-file-with-meganv3-2/4917 "2024-05-07T08:22:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Starry](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Starry](https://forum.cmascenter.org/u/Starry)\
**Post date:** [May 7, 2024, 8:22am UTC](https://forum.cmascenter.org/t/how-to-output-one-nc-file-with-meganv3-2/4917/1 "2024-05-07T08:22:43Z")

</div>

Hi everyone  
I run MEGANv3.2 to get input for CMAQv5.4, but the result of MEGANv3.2 is daily.

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/7/7fe569519659e063ea8d9aea1d092824d6bd9f42.png)  
I want to combine these nc files into one. I used “cdo mergetime \*.nc result.nc” but it will change the “TSTEP” dimension name to “time”. I also used “ncrcat .nc result.nc” and the result will have NaN which causes abort in CMAQ.  
Any suggestions will be welcomed.  
Li

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [May 7, 2024, 10:09am UTC](https://forum.cmascenter.org/t/how-to-output-one-nc-file-with-meganv3-2/4917/2 "2024-05-07T10:09:53Z")

</div>

This is a frequently asked question.

See [https://cjcoats.github.io/ioapi/M3CPLE.html](https://cjcoats.github.io/ioapi/M3CPLE.html):

> Note that repeated copy-operations may be used to concatenate multiple files that have the same grid and set of variables: for example, if FILE1 has hourly data from 2018017:00 through 2018018:00 and FILE2 has hourly data from 2018018:00 through 2018019:00, a M3CPLE using FILE2 as infile and FILE1 as outfile may be used to copy the 2018018:01-2018019:00 data from FILE2 to FILE1. Repeated runs of this sort may be used to construct month-, year-, or even decade-long files from a (large) set of single-day files…

---

<div class="post-metadata">

**Author:** ![willison.jeff](https://avatars.discourse-cdn.com/v4/letter/w/c89c15/32.png) [@willison.jeff](https://forum.cmascenter.org/u/willison.jeff)\
**Post date:** [May 7, 2024, 12:56pm UTC](https://forum.cmascenter.org/t/how-to-output-one-nc-file-with-meganv3-2/4917/3 "2024-05-07T12:56:15Z")

</div>

Another option is to run MEGAN 3.2 inline, which will give (almost) the exact same result as running offline. In other words, you can pass CMAQ the time independent MEGAN inputs instead of those daily MEGAN emission outputs.

See: [CMAQ/DOCS/Users\_Guide/CMAQ\_UG\_ch04\_model\_inputs.md at main · USEPA/CMAQ · GitHub](https://github.com/USEPA/CMAQ/blob/main/DOCS/Users_Guide/CMAQ_UG_ch04_model_inputs.md)

| **Environment Variable Name for File** | **File Type** | **Time-Dependence** | **Spatial Dimensions** | **Source** | **Required** |
| --- | --- | --- | --- | --- | --- |
| MEGAN\_CTS | GRDDED3 | Time-invariant | XYZ | MEGAN preprocessor | required for running CMAQ with online MEGAN biogenics |
| MEGAN\_LDF | GRDDED3 | Time-invariant | XY | MEGAN preprocessor | required for running CMAQ with online MEGAN biogenics |
| MEGAN\_EFS | GRDDED3 | Time-invariant | XY | MEGAN preprocessor | required for running CMAQ with online MEGAN biogenics |
| MEGAN\_LAI | GRDDED3 | Time-invariant | XY | MEGAN preprocessor | optional for running CMAQ with online MEGAN biogenics |
| BDSNP\_AFILE | GRDDED3 | Time-invariant | XY | MEGAN preprocessor | required for BDSNP soil NO |
| BDSNP\_NAFILE | GRDDED3 | Time-invariant | XY | MEGAN preprocessor | required for BDSNP soil NO model |
| BDSNP\_LFILE | GRDDED3 | Time-invariant | XY | MEGAN preprocessor | required for BDSNP soil NO model |
| BDSNP\_FFILE | GRDDED3 | Time-invariant | XY | MEGAN preprocessor | required for BDSNP soil NO model |
| BDSNP\_NFILE | GRDDED3 | Time-invariant | XY | MEGAN preprocessor | required for BDSNP soil NO model |

Then set these in the run script:

setenv CTM\_BIOGEMIS\_MG Y #\> turns on MEGAN biogenic emission [default: N]  
setenv BDSNP\_MEGAN Y #\> turns on BDSNP soil NO emissions [default: N]  
setenv USE\_MEGAN\_LAI Y #\> Uses MEGAN LAI input (only compatible with 8-daily)

---

<div class="post-metadata">

**Author:** ![Starry](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Starry](https://forum.cmascenter.org/u/Starry)\
**Post date:** [May 8, 2024, 1:38am UTC](https://forum.cmascenter.org/t/how-to-output-one-nc-file-with-meganv3-2/4917/4 "2024-05-08T01:38:23Z")

</div>

Hi cjcoats  
Thank you very much for your help.

---

<div class="post-metadata">

**Author:** ![Starry](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Starry](https://forum.cmascenter.org/u/Starry)\
**Post date:** [May 8, 2024, 1:40am UTC](https://forum.cmascenter.org/t/how-to-output-one-nc-file-with-meganv3-2/4917/5 "2024-05-08T01:40:34Z")

</div>

Hi Willison.jeff  
Thank you very much for your help. I will try this version in the future.
