Mcip error in CMAQv5.0.2

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.

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

@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

@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

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
~

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 $

@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

@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

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.

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