An inventory can used in cmaq but not in wrfcmaq (solved)

The error prompted by wrfcmaq is that the species units is wrong. What really baffles me is that this inventory works fine in cmaq.
I use CMAQv5.3.3 and WRFCMAQ(cmaq5.3.3 wrf 4.3 ) . The inventory is biomass burning form finn. I used barronh’s way to make the inventory (finn2cmaq/README.md at master · barronh/finn2cmaq · GitHub)

Every spices will reprot the error:

and model will carshed :

this is the picture of the inventory :

I didn’t find a discussion about this kind of problem, looking forward to your help! !
There are runscipts of cmaq and wrfcmaq:
run_cctm_CB6_cn04.7-8.txt (39.7 KB)
twoway-coupled.csh.yrd04.finn.txt (49.5 KB)

First, a reminder that finn2cmaq is not a well-established tool – so, you have to be careful.

The units in the file do not match the units that would have come out of finn2cmaq. finn2cmaq does not use capital letters. Below is a list of units that are created.

                CO:units = "moles/s       " ;
                NO:units = "moles/s       " ;
                NO2:units = "moles/s       " ;
                SO2:units = "moles/s       " ;
                NH3:units = "moles/s       " ;
                ECH4:units = "moles/s       " ;
                ACET:units = "moles/s       " ;
                ALD2:units = "moles/s       " ;
                BENZENE:units = "moles/s       " ;
                PAR:units = "moles/s       " ;
                ETHY:units = "moles/s       " ;
                ETHE:units = "moles/s       " ;
                ETHA:units = "moles/s       " ;
                PRPA:units = "moles/s       " ;
                FORM:units = "moles/s       " ;
                GLY:units = "moles/s       " ;
                GLYC:units = "moles/s       " ;
                HAC:units = "moles/s       " ;
                MGLY:units = "moles/s       " ;
                KET:units = "moles/s       " ;
                IOLE:units = "moles/s       " ;
                TOL:units = "moles/s       " ;
                XYL:units = "moles/s       " ;
                POC:units = "g/s" ;
                PEC:units = "g/s" ;
                PSO4:units = "g/s" ;
                PNO3:units = "g/s" ;
                PMOTHR:units = "g/s" ;

You can get a similar list using

ncdump -h ./cmaqready/FINNv1.5_2016-07-01.GEOSCHEM.nc | grep units

Because finn2cmaq is just a quick tool, you probably had to do things like remove species and modify metadata. My guess is that when you did, one or more of the units got changed.

I have no idea why CMAQ vs WRF-CMAQ would give different problems. Perhaps, you are running on different systems or with a different compiler?

With the help of David.Wong , this problem was solved. The reason is in the format of the inventory, if anyone comes across this and wants to fix it, feel free to ask me.

@bandaoshutiao , thank you for reporting back that you and @wong.david-c were able to solve the problem you had encountered.

If it is not too much trouble, would you mind sharing more details on what the inventory format problem was and how you were able to solve it? This information might be useful for other members of the community and documenting it in this post would avoid the need for them to contact you and for you to respond to such requests individually. Thanks for considering this!

The variable unit comes from finn2cmaq tool is a character string with the length of 14. When this emis file feeds into CMAQ which follows IOAPI format that requires length be 16. From length of 14 converts to 16, the last two characters of the unit in the emis file become non-blank garbage. As a result, CMAQ is not able to determine the correct unit. That was the issue reported by the user.
I have asked Barron to see he can modify finn2cmaq accordingly.

1 Like

One of the underlying issues is that netCDF does not really “understand” Fortran character-strings and has an incomplete treatment of them. Quite a lot of work in the C parts of the I/O API is devoted to working around this issue.

When interfacing Fortran with other languages (like C or Python), one must be careful about the Fortran-declared string-length: either pad with blanks if the other-language length is too short, or truncate to the declared length if it is too long.

1 Like