# Mcip error in CMAQv5.0.2

**URL:** <https://forum.cmascenter.org/t/mcip-error-in-cmaqv5-0-2/1698>\
**Category:** MCIP\
**Created:** [August 6, 2020, 6:40am UTC](https://forum.cmascenter.org/t/mcip-error-in-cmaqv5-0-2/1698 "2020-08-06T06:40:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddmmssddoo](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@ddmmssddoo](https://forum.cmascenter.org/u/ddmmssddoo)\
**Post date:** [August 6, 2020, 6:40am UTC](https://forum.cmascenter.org/t/mcip-error-in-cmaqv5-0-2/1698/1 "2020-08-06T06:40:37Z")

</div>

Hi  
I ran mcip and I got this error.  
I think it’s WRF problem, but I don’t know exactly what it is.

- SUBROUTINE SETUP\_WRFEM - READING WRF HEADER  
WRF GRID DIMENSIONS (X,Y,Z) 124 131 30

+++ met\_pcp\_incr = 0  
PGFIO-F-231/formatted read/internal file/error on data conversion.  
In source file date\_pack\_mod.f90, at line number 132  
Error running mcip

Someone could help me how can I do? Thanks in advance.

---

<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:** [August 6, 2020, 12:23pm UTC](https://forum.cmascenter.org/t/mcip-error-in-cmaqv5-0-2/1698/2 "2020-08-06T12:23:16Z")

</div>

You have a date-formatting error (probably in your namelist): the year-field in NEWDATE is not readable as an integer. Unfortunately, the MCIP author did not include error-checking (or use of I/O API function STR2INT() which logs the nature of the problems) to help diagnose just what the error is…

What would have been better is to have coded something like the following, where at least you’d have a good chance at seeing what the problem is:

```
yrold = STR2INT( odate( 1: 4) )
mold = STR2INT( odate( 6: 7) )
...
scnew = STR2INT( ndate(18:18) )
IF ( MIN( yrold, ..., scnew ) .LT. 0 ) THEN
     CALL M3MESG( 'ODATE=' // ODATE )
     CALL M3MESG( 'NDATE=' // NDATE )
    CALL M3EXIT( 'DATE_PACK/geth_idts', 0.0, 'Badly formatted date string(s)', 2 )
END IF
```

---

<div class="post-metadata">

**Author:** ![tlspero](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@tlspero](https://forum.cmascenter.org/u/tlspero)\
**Post date:** [August 6, 2020, 3:13pm UTC](https://forum.cmascenter.org/t/mcip-error-in-cmaqv5-0-2/1698/3 "2020-08-06T15:13:58Z")

</div>

@cjcoats –

> You have a date-formatting error (probably in your namelist): the year-field in NEWDATE is not readable as an integer. Unfortunately, the MCIP author did not include error-checking (or use of I/O API function STR2INT() which logs the nature of the problems) to help diagnose just what the error is…
> 
> What would have been better is to have coded something like the following, where at least you’d have a good chance at seeing what the problem is:

Overtly insulting other people who don’t use your code is both unprofessional and unproductive. I use a lot of error checking in MCIP. Just because I did not use your specific code does not make my code bad or wrong. The routine that is failing is one that was largely taken from WRF, but that also does not make it bad. It’s not perfect, and it could be better. I would appreciate it if you would not use this forum to publicly denigrate my coding. I’m always open to new ideas on how to improve the MCIP code, but I’m much more receptive when people show respect.

It turns out that the original poster’s code is not failing on a namelist issue. The internal read comes from a character string containing date information that was obtained directly from from the WRF output files in the “Times” variable.

–Tanya

---

<div class="post-metadata">

**Author:** ![tlspero](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@tlspero](https://forum.cmascenter.org/u/tlspero)\
**Post date:** [August 6, 2020, 3:16pm UTC](https://forum.cmascenter.org/t/mcip-error-in-cmaqv5-0-2/1698/4 "2020-08-06T15:16:33Z")

</div>

@ddmmssddoo –

I’m sorry you’re experiencing this issue. It appears that you are using MCIPv4.3; please confirm that.

Please provide a copy of the MCIP namelist that you used. Also, please perform the command “ncdump -V Times wrfout” where you substitute the name of the first wrfout file that you are trying to access with MCIP for this run. It is possible that something is configured incorrectly, and it is also possible that there is a bug in MCIP that the Intel compiler and gcc compiler are not sensitive to but PGF is.

–Tanya

---

<div class="post-metadata">

**Author:** ![ddmmssddoo](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@ddmmssddoo](https://forum.cmascenter.org/u/ddmmssddoo)\
**Post date:** [August 7, 2020, 3:24am UTC](https://forum.cmascenter.org/t/mcip-error-in-cmaqv5-0-2/1698/5 "2020-08-07T03:24:59Z")

</div>

I am using MCIPv3.4.1.

set do = 01  
set YY = 2014  
set Target\_YY = 2014  
set Target\_MM = 07  
set MM\_S = 07  
set DD\_S = 01  
set MM\_E = 07  
set DD\_E = 11  
set J\_SDATE = 182

set APPL = d${do}\_{YY}{J\_SDATE}  
set CoordName = LAM\_GRID # 16-character maximum  
set GridName = $do # 16-character maximum

set DataPath = /home/data/wrfout  
set InMetDir = $DataPath  
set InTerDir = $DataPath  
set InSatDir = DataPath/goes set OutDir = /home/eunae/mcip/d{do}_{YY}{J\_SDATE}  
set ProgDir = /home/eunae/CMAQv5.0.2/scripts/mcip/src  
set WorkDir = $OutDir  
set InMetFiles = ( InMetDir/wrfout\_d{do}_{Target\_YY}-{Target\_MM} )

set IfTer = “T”  
set InTerFile = InTerDir/geo\_em.d{do}.nc

set InSatFiles = ( )

set LPV = 1  
set LWOUT = 1  
set LUVCOUT = 1  
set LSAT = 0

set MCIP\_START = {YY}-{MM\_S}-{DD\_S}-00:00:00.0000 # [UTC] set MCIP\_END = {Target\_YY}-{MM\_E}-{DD\_E}-00:00:00.0000 # [UTC]

set INTVL = 60 # [min]

set CTMLAYS = “-1.0”

set MKGRID = T

set BTRIM = -1

set X0 = 3  
set Y0 = 3  
set NCOLS = 118  
set NROWS = 125

set LPRT\_COL = 0  
set LPRT\_ROW = 0

set WRF\_LC\_REF\_LAT = 38.0

set PROG = mcip

date

if ( ! -d $InMetDir ) then  
echo “No such input directory $InMetDir”  
exit 1  
endif

if ( ! -d $OutDir ) then  
echo “No such output directory…will try to create one”  
mkdir -p $OutDir  
if ( $status != 0 ) then  
echo “Failed to make output directory, $OutDir”  
exit 1  
endif  
endif

if ( ! -d $ProgDir ) then  
echo “No such program directory $ProgDir”  
exit 1  
endif

if ( $LSAT == 1 ) then  
if ( ! -d $InSatDir ) then  
echo “No such satellite input directory $InSatDir”  
exit 1  
endif  
endif

if ( $IfTer == “T” ) then  
if ( ! -f $InTerFile ) then  
echo “No such input file $InTerFile”  
exit 1  
endif  
endif

foreach fil ( $InMetFiles )  
if ( ! -f $fil ) then  
echo “No such input file $fil”  
exit 1  
endif  
end

if ( $LSAT == 1 ) then  
foreach fil ( $InSatFiles )  
if ( ! -f $fil ) then  
echo “No such input file $fil”  
exit 1  
endif  
end  
endif

if ( ! -f ProgDir/{PROG}.exe ) then  
echo “Could not find ${PROG}.exe”  
exit 1  
endif

if ( ! -d $WorkDir ) then  
mkdir -p $WorkDir  
if ( $status != 0 ) then  
echo “Failed to make work directory, $WorkDir”  
exit 1  
endif  
endif

cd $WorkDir

if ( $IfTer == “T” ) then  
if ( -f $InTerFile ) then  
set InTer = $InTerFile  
else  
set InTer = “no\_file”  
endif  
else  
set InTer = “no\_file”  
endif

set FILE\_GD = $OutDir/GRIDDESC  
set FILE\_HDR = OutDir/mmheader.{APPL}

set MACHTYPE = `uname`  
if ( ( $MACHTYPE == “AIX” ) || ( $MACHTYPE == “Darwin” ) ) then  
set Marker = “/”  
else  
set Marker = “&END”  
endif

cat \> WorkDir/namelist.{PROG} \<\< !

&FILENAMES

file\_gd = “$FILE\_GD”  
file\_hdr = “$FILE\_HDR”  
file\_mm = “$InMetFiles[1]”,  
!

if ( $#InMetFiles \> 1 ) then  
@ nn = 2  
while ( nn \<= #InMetFiles )  
cat \>\> WorkDir/namelist.{PROG} \<\< !  
“$InMetFiles[$nn]”,  
!  
@ nn ++  
end  
endif

if ( $IfTer == “T” ) then  
cat \>\> WorkDir/namelist.{PROG} \<\< !  
file\_ter = “$InTer”  
!  
endif

if ( $LSAT == 1 ) then  
cat \>\> WorkDir/namelist.{PROG} \<\< !  
file\_sat = "InSatFiles[1]", ! if ( #InSatFiles \> 1 ) then  
@ nn = 2  
while ( nn \<= #InSatFiles )  
cat \>\> WorkDir/namelist.{PROG} \<\< !  
“$InSatFiles[$nn]”,  
!  
@ nn ++  
end  
endif  
endif

cat \>\> WorkDir/namelist.{PROG} \<\< !  
makegrid = .${MKGRID}.  
$Marker

&USERDEFS  
lpv = $LPV  
lwout = $LWOUT  
luvcout = $LUVCOUT  
lsat = $LSAT  
mcip\_start = “$MCIP\_START”  
mcip\_end = “$MCIP\_END”  
intvl = $INTVL  
coordnam = “$CoordName”  
grdnam = “$GridName”  
ctmlays = $CTMLAYS  
btrim = $BTRIM  
lprt\_col = $LPRT\_COL  
lprt\_row = $LPRT\_ROW  
wrf\_lc\_ref\_lat = $WRF\_LC\_REF\_LAT  
$Marker

&WINDOWDEFS  
x0 = $X0  
y0 = $Y0  
ncolsin = $NCOLS  
nrowsin = $NROWS  
$Marker

!

rm fort.\*  
if ( -f $FILE\_GD ) rm -f $FILE\_GD

ln -s $FILE\_HDR fort.2  
ln -s $FILE\_GD fort.4  
ln -s WorkDir/namelist.{PROG} fort.8  
if ( $IfTer == “T” ) then  
ln -s $InTerFile fort.9  
endif

set NUMFIL = 0  
foreach fil ( $InMetFiles )  
@ NN = $NUMFIL + 10  
ln -s $fil fort.$NN  
@ NUMFIL ++  
end

setenv IOAPI\_CHECK\_HEADERS T  
setenv EXECUTION\_ID $PROG

setenv GRID\_BDY\_2D OutDir/GRIDBDY2D\_{APPL}  
setenv GRID\_CRO\_2D OutDir/GRIDCRO2D\_{APPL}  
setenv GRID\_CRO\_3D OutDir/GRIDCRO3D\_{APPL}  
setenv GRID\_DOT\_2D OutDir/GRIDDOT2D\_{APPL}  
setenv MET\_BDY\_3D OutDir/METBDY3D\_{APPL}  
setenv MET\_CRO\_2D OutDir/METCRO2D\_{APPL}  
setenv MET\_CRO\_3D OutDir/METCRO3D\_{APPL}  
setenv MET\_DOT\_3D OutDir/METDOT3D\_{APPL}

ProgDir/{PROG}.exe

if ( $status == 0 ) then  
rm fort.\*  
exit 0  
else  
echo “Error running $PROG”  
exit 1  
endif  
~

---

<div class="post-metadata">

**Author:** ![ddmmssddoo](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@ddmmssddoo](https://forum.cmascenter.org/u/ddmmssddoo)\
**Post date:** [August 7, 2020, 3:27am UTC](https://forum.cmascenter.org/t/mcip-error-in-cmaqv5-0-2/1698/7 "2020-08-07T03:27:15Z")

</div>

ncdump -V Times wrfout\_d01\_2014-07-01\_00:00:00

ncdump: invalid option – V  
ncdump [-c|-h] [-v …] [[-b|-f] [c|f]] [-l len] [-n name] [-p n[,n]] [-x] [-k] file  
[-c] Coordinate variable data and header information  
[-h] Header information only, no data  
[-v var1[,…]] Data for variable(s) ,… only  
[-b [c|f]] Brief annotations for C or Fortran indices in data  
[-f [c|f]] Full annotations for C or Fortran indices in data  
[-l len] Line length maximum in data section (default 80)  
[-n name] Name for netCDF (default derived from file name)  
[-p n[,n]] Display floating-point values with less precision  
[-x] Output XML (NcML) instead of CDL  
[-k] Output kind of netCDF file  
file Name of netCDF file  
netcdf library version “3.6.3” of Feb 27 2015 15:39:23 $

---

<div class="post-metadata">

**Author:** ![tlspero](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@tlspero](https://forum.cmascenter.org/u/tlspero)\
**Post date:** [August 7, 2020, 12:18pm UTC](https://forum.cmascenter.org/t/mcip-error-in-cmaqv5-0-2/1698/8 "2020-08-07T12:18:02Z")

</div>

@ddmmssddoo –

Sorry about that. It should be “-v” (lower case, not upper case). I want to see what is contained in the Times variable in your wrfout file.

–Tanya

---

<div class="post-metadata">

**Author:** ![tlspero](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@tlspero](https://forum.cmascenter.org/u/tlspero)\
**Post date:** [August 7, 2020, 1:29pm UTC](https://forum.cmascenter.org/t/mcip-error-in-cmaqv5-0-2/1698/9 "2020-08-07T13:29:36Z")

</div>

@ddmmssddoo –

Can you provide the namelist, please? It’s the file called “namelist.mcip”.

Also, please let me know if there is a specific reason that you’re using MCIPv3.4.1. That version of MCIP is very old, and several compiler-specific issues have been corrected since then. I’m not sure if there is a reason why you’re using CMAQv5.0.2 rather than an updated code. Please explain.

–Tanya

---

<div class="post-metadata">

**Author:** ![ddmmssddoo](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@ddmmssddoo](https://forum.cmascenter.org/u/ddmmssddoo)\
**Post date:** [August 8, 2020, 12:25pm UTC](https://forum.cmascenter.org/t/mcip-error-in-cmaqv5-0-2/1698/10 "2020-08-08T12:25:08Z")

</div>

Oh, sorry. I thought you were talking about the mcip script. This is the namelist.mcip

&FILENAMES  
file\_gd = “/home/eunae/mcip/d01\_2014182/GRIDDESC”  
file\_hdr = “/home/eunae/mcip/d01\_2014182/mmheader.d01\_2014182”  
file\_mm = “/home/data/wrfout\_1/wrfout\_d01\_2014-07”,  
file\_ter = “/home/data/wrfout\_1/geo\_em.d01.nc”  
makegrid = .T.  
&END

&USERDEFS  
lpv = 1  
lwout = 1  
luvcout = 1  
lsat = 0  
mcip\_start = “2014-07-01-00:00:00.0000”  
mcip\_end = “2014-07-10-00:00:00.0000”  
intvl = 60  
coordnam = “LAM\_GRID”  
grdnam = “01”  
ctmlays = -1.0  
btrim = -1  
lprt\_col = 0  
lprt\_row = 0  
wrf\_lc\_ref\_lat = 38.0  
&END

&WINDOWDEFS  
x0 = 3  
y0 = 3  
ncolsin = 118  
nrowsin = 125  
&END

How should I put it… There isn’t a specific reason.  
It is installed version at the lab.

---

<div class="post-metadata">

**Author:** ![mmallard](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mmallard](https://forum.cmascenter.org/u/mmallard)\
**Post date:** [August 10, 2020, 2:52pm UTC](https://forum.cmascenter.org/t/mcip-error-in-cmaqv5-0-2/1698/11 "2020-08-10T14:52:50Z")

</div>

Hi,  
According to your namelist here, MCIP is expecting hourly data (intvl=60). Have you been able to check if your wrfout contains hourly data (using ncks as specified above)?  
Megan
