MCIP v5.3.3 error when processing WRFchem output

I am trying to compare spatial-temporal patterns of some target species simulated by CMAQ and WRFchem, I tried to use MCIP (v5.3.3) to process WRFchem (v4.3.3) outputs in order to get the same meteorology input to CMAQ. I then got trouble due to the following errors:


I checked the routine where the error comes from and commented out two lines with

CALL graceful_stop (pname)

and let MCIP keep going but I failed to realize to process WRFchem with MCIP due to more errors as below:

*** IVERSION = 0

*** MCIP lower-left corner is not in met domain
*** X0, Y0 = 5 5
*** NX, NY = 0 0

 *** ERROR ABORT in subroutine SETGRIDDEFS
 Date and time  0:00:00   July 3, 2018    (2018184:000000)

My questions are:

Is MCIP set up to run from WRFchem outputs?

If YES, what is wrong for my case?

If NO, how to get same meteorology fields from WRFchem to feed CMAQ?

Do we need to run WRF without chemistry after we ran WRFchem already? If this is answer, we never have the completely same meteorology for both CAMQ and WRFchem because WRF w/o chemistry will be different because gas and aerosol chemistry processes will update meteorological conditions. Then it becomes difficulty and challenge to compare CMAQ and WRFchem under the the same meteorology.

I would highly appreciate if you could have comments and suggestions to help.

F. Liu


I did not make the effort to explicitly allow MCIP to handle data from WRF-Chem, but I did not explicitly stop it either. In some ways, I figured that it made little sense to want to use data from WRF-Chem to run CMAQ, largely because the WRF-Chem output has already been influenced by interactions with chemistry through the coupled model in that system. I’m not sure I follow the scientific merit of using WRF-Chem output in CMAQ.

If you want to proceed, there are probably a few changes that will need to be made to MCIP. From the error messages that you provided, the internal variables IVERSION, NX, and NY were not set properly.

To set IVERSION correctly, you will need to insert some code in MCIP setup.f90 near line 127 to account for the global attribute, TITLE, to include “WRF-Chem”. Because of the way the TITLE variable is populated in WRF with a lot of blank spaces (in the the WRF routine, chem/chemics.F), to do this correctly, please consider using the Fortran intrinsic, SCAN, to locate whether “Chem” appears in the internal string loaded from TITLE into the MCIP variable, “wrfversion”. You will want to set the internal MCIP variable for met_iversion to 2. For simplicity and to see if you encounter other errors, consider (temporarily) commenting out MCIP setup.f90 lines 127 and 129-132. If that works, then I can help you with the syntax for the SCAN function, if you want.

Assuming that setting met_iversion also messed up NX and NY, we can see whether you encounter other errors. The variables NX and NY should be the domain dimensions (west-east and south-north) from your WRF domain.

Please keep me posted.


That needs to be INDEX, not SCAN: see

Scans a STRING for any of the characters in a SET of characters.

whereas see

Returns the position of the start of the first occurrence of string SUBSTRING as a substring in STRING…


I really meant SCAN, not INDEX. In this case, I don’t care where “WRF-Chem” appears in the string. Instead, I just want to know whether it is part of the string. If SCAN is case-sensitive, then my suggestion is correct. Otherwise, I appreciate the correction.


No. Read the references (maybe Intel does a better explanation here:

SCAN does not ask whether “WRF-Chem” appears in the string. That is the question INDEX answers (it returns a positive result in that case, zero otherwise.

Instead, SCAN asks whether any one of the characters 'W', 'R', 'F', '-', 'C', 'h', 'e', 'm' occurs within the string and if so, what is the first location at which any of them occurs.


You are correct. Thank you for the clarification.


@tlspero -
Hi Tanya,

Thank you very much for your response.

YES, “…the WRF-Chem output has already been influenced by interactions with chemistry through the coupled model in that system”, you are right. However, meteorology is never influenced by chemistry processes and has no feedback from atmospheric chemistry if driving CMAQ by offline WRF outputs. But in fact it is not true. I need meteorology from WRF-Chem to drive CMAQ and see how meteorology already adjusted by interactions with chemistry to influence chemistry because offline CMAQ is not able to realize chemical feedback effects on meteorology. The key issue here for the comparison is that the chemistry mechanism may be different from CMAQ and WRF-Chem that provide different feedbacks to meteorology. But comparison between CMAQ driven by meteorology from outputs of WRF and WRF-Chem is scientifically meaningful to understand interactions between meteorology and chemistry in one way offline model.

BTW, The comparison between online coupled models like CMAQ-WRF and WRF-chem is also conducted at the same time.

@tlspero @cjcoats
I will make some changes in routine setup.f90 according to your suggestions and try make MCIP is suitable for processing data from WRF-Chem.

Thank you very much for your time and comments.


Are you aware that there exists a coupled version of WRF-CMAQ?
It sounds like you are interested in comparing two runs of that model, one with feedbacks turned on and one without the feedbacks. Or, if you’re interested specifically in the influence of different chemical mechanisms on the meteorology, perhaps you should compare coupled WRF-CMAQ with WRF-Chem?

@cgnolte ,

Thanks you for your reply and comments.

I am more interested in comparing chemistry results between online and offline models using the same chemistry mechanism.


In that case, it seems to me you should use either WRF-CMAQ or WRF-Chem, rather than a hybrid between the two.


Thank you for your suggestion, I do work on model performance evaluation for both WRF-CMAQ and WRF-Chem. In order not to mislead and confuse CMAQ users, you can close this post. I am no longer replying any questions about this topic.

BTW, I can now process WRF-Chem outputs by using updated MCIP.



Hi Feng,

I’m quite new to MCIP, and want to use it for running MEGAN. I also have WRF-Chem outputs and want to use them for MCIP (I could run WRF only, but thought maybe you have the answers to use WRF-Chem without running WRF again). I follow the instructions and still couldn’t get it to work. Would you please share the modified setup.f90 file to me and/or are there any other modifications I need to do in order to use WRF-Chem output?

Thanks in advance!


Hello Xiaoya,

You may replace 3 routines in mcip/src/ with updated ones attached (please remove file extension .txt, I added it because *.f90 is not authorized for uploading here), then you will get new mcip.exe after you re-compile your mcip. It can be used for processing WRFchem output. It worked well here.

Hope that is helpful.
chkwpshdr.f90.txt (11.3 KB)
rdwrfem.f90.txt (94.2 KB)
setup.f90.txt (7.4 KB)

Hi Feng,

Thank you so much for sharing the files! I will work on this right away.