# M3tool (m3combo)

**URL:** <https://forum.cmascenter.org/t/m3tool-m3combo/3862>\
**Category:** m3tools\
**Created:** [January 24, 2023, 11:16pm UTC](https://forum.cmascenter.org/t/m3tool-m3combo/3862 "2023-01-24T23:16:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kkkghs0828](https://avatars.discourse-cdn.com/v4/letter/k/ce7236/32.png) [@kkkghs0828](https://forum.cmascenter.org/u/kkkghs0828)\
**Post date:** [January 24, 2023, 11:16pm UTC](https://forum.cmascenter.org/t/m3tool-m3combo/3862/1 "2023-01-24T23:16:38Z")

</div>

Hello.  
I am trying to subtract two files with all variables (A and B)  
But I do not know how to subtract all variables.  
I was able to subtract single variable (NO2 as test)  
[https://www.cmascenter.org/ioapi/documentation/all\_versions/html/M3COMBO.html](https://www.cmascenter.org/ioapi/documentation/all_versions/html/M3COMBO.html)  
Is there any other way to subtract two files, leaving their own units?

NO2  
 ![image](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/8/89da1f8d6693af5c44fa45a33e0fd1e9c9351991.png)

ALL  
 ![image](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/b/b17b4f969b27b82c4afc49a8642836b308e7affa.png)

error  
 ![image](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/1/15f35adbe4a174cad4b3da7bd4196572924afe1d.png)

---

<div class="post-metadata">

**Author:** ![hogrefe.christian](https://avatars.discourse-cdn.com/v4/letter/h/74df32/32.png) [@hogrefe.christian](https://forum.cmascenter.org/u/hogrefe.christian)\
**Post date:** [January 25, 2023, 12:45am UTC](https://forum.cmascenter.org/t/m3tool-m3combo/3862/2 "2023-01-25T00:45:10Z")

</div>

m3tools program [m3diff](https://www.cmascenter.org/ioapi/documentation/all_versions/html/M3DIFF.html) might be what you’re looking for. It can create a gridded output file of the differences between two input files, in addition to creating a text-based REPORT file with a summary of the differences.

---

<div class="post-metadata">

**Author:** ![kkkghs0828](https://avatars.discourse-cdn.com/v4/letter/k/ce7236/32.png) [@kkkghs0828](https://forum.cmascenter.org/u/kkkghs0828)\
**Post date:** [January 25, 2023, 2:55am UTC](https://forum.cmascenter.org/t/m3tool-m3combo/3862/4 "2023-01-25T02:55:25Z")

</div>

How can I create gridded output file?  
I was only able to get report file.

![image](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/4/41dbdd803df393c560eaf56071525a65ed588bee.png)

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/b/b6be21a0efc8dfed6a3a29805752657b6a085070.png)

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/8/849f0b465c9eb421f0bdeb05e9815b2aaf46c8e7.png)

---

<div class="post-metadata">

**Author:** ![hogrefe.christian](https://avatars.discourse-cdn.com/v4/letter/h/74df32/32.png) [@hogrefe.christian](https://forum.cmascenter.org/u/hogrefe.christian)\
**Post date:** [January 25, 2023, 12:16pm UTC](https://forum.cmascenter.org/t/m3tool-m3combo/3862/5 "2023-01-25T12:16:09Z")

</div>

Before running m3diff and entering logical file name ‘TEST’ as the gridded output file, did you do  
`setenv TEST /path/to/some/output_file.nc`, or were you just trying to create a file TEST right in the directory where you were running m3diff? The latter should be fine, though I always prefer to use setenv to associate the logical file names with actual file names.

Frankly, I’m not quite sure what is happening here.

What does the screen output right after the line `Enter logical name for OUTPUT file [OFILE] >> TEST` show? If somehow there was a problem opening the file (e.g. because of an invalid path, or missing write permissions), there should have been some error message, and the program should have just reprompted you for a valid entry. On the other hand, if the file was successfully opened, it should have shown something like this

```
Enter logical name for OUTPUT FILE [OFILE] >>TEST3

 "TEST3" opened as UNKNOWN(R-W)
 File name "TEST3"
 File type GRDDED3

```

and for each time step and variable being processed, the screen output should have looked something like this, including the message that values were being written to TEST3.

```
Date and time 2017274:000000 (0:00:00 Oct. 1, 2017)
  A:AFILE/NO2 vs B:BFILE/NO2 vs (A - B)
     Max @ (c,r,l) Min @ (c,r,l) Mean Sigma
     A 4.31343E-02@( 99,154, 1) 2.50794E-08@( 94, 85, 1) 5.62475E-04 1.63840E-03
     B 4.31343E-02@( 99,154, 1) 2.50793E-08@( 94, 85, 1) 5.62475E-04 1.63840E-03
     Value for IOAPI_LOG_WRITE not defined;returning default: TRUE
     NO2 written to TEST3 for 2017274:000000
    A:B 2.90293E-06@( 65,141, 1) -1.08103E-06@(183,106, 1) -2.60368E-11 1.98708E-08

```
