CTM_LOG_001.v532_intel_2020_1_20200110.txt (64.7 KB)
dataset_attrs.log.txt (10.0 KB)
run_cctm.csh (36.5 KB)
Hi, everyone.
I just started using CMAQ not long ago. I am trying to use adapt my emission inventory to CMAQ-5.3.2. The emission files were generated by Python script. And I got this error while running CCTM. I can be sure that no value less than 0 exists in my emissions file. There are my running script, error log, and emission file attributes. Some variables in the running script are defined in another bash script.
Many thanks for your help!
ERROR: Invalid Negative emission rate -Infinity has been
for CMAQ species AECJ.
Please inspect the Emission Control Namelist File.
*** ERROR ABORT in subroutine EMISS_NEG_CHECK on PE 001
Negative Emissions Detected
PM3EXIT: date&time specified as 0
Date&time specified as 0
The dataset_attrs.log.txt suggests that the minimum value for PEC is 0 and the max is 1263.509. On its face, this range seems reasonable. The problem is that it may have been generated in a way that ignores missing values. For example, both netcdf4-python and xarray will automatically mask missing values and ignore them in the min/max calculations.
If any values are missing, CMAQ would likely read them in incorrectly. The script below will help to identify any missing values.
import netCDF4
import numpy as np
epath = '/home/chengy/CMAQ/CMAQ-5.3/data/2020_1/emis/ALL_20200110_area.nc'
f = netCDF4.Dataset(epath)
misscount = []
for k in sorted(f.variables):
vals = f.variables[k][:]
cmask = np.ma.getmaskarray(vals).sum()
misscount.append((cmask, k))
print(k, cmask, ('<-- has missing values' if cmask > 0 else ''))
print('Problems:', sorted([(c, k) for c, k in misscount if c > 0]))
If any of the variables has more than 0 missing, then the file needs to be fixed.
p.s., the long_name attribute should be only 16 characters long, but is 80 right now.
2 Likes
In addition to the test suggested by @barronh , I also suggest trying to run I/O API tools program m3stat to confirm that the file you generated with python can be successfully read by the I/O API library functions also used in CMAQ and to see what species statistics are being reported by that program.
Along the lines mentioned by @barronh, one thing that stands out to me is that one of your global attributes is ā_FillValueā and itās set to 0.0, so while (I think) I/O API doesnāt explicitly use that attribute, the underlying netCDF layer possibly does and then possibly sets all zero values encountered in the emission fields to some internal very large value. Possibly not, butās itās not a standard I/O API attribute.
1 Like
I agree with everything that @hogrefe.christian said. Iāll note that the _FillValue attribute was shown as a file attribute. This is unusual. Usually, the _FillValue is a property of each variable. Either way, IOAPI and thus CMAQ will not handle _FillValue the same way that netcdf4-python or xarray will.
@hogrefe.christian recommendation to use m3stat
is a great one!
1 Like
For what itās worth: from the I/O API point of view, āmissingā is either BADVAL3=-9.999e36
(for REAL
or DOUBLE
) or IMISS3=-9999
(for INTEGER); for reasons of avoiding round-off/processor-platform/compiler issues, the correct āmissingā test for REAL
or DOUBLE
is
X < AMISS3
_FillValue=0
is not supported by the I/O API.
1 Like
Sorry for reply late. Great thanks to all of you. I have tried m3stat and it failed. So itās the problem of my python script. I think @barronh 's suggestion is right, and I will try it in the future. And I also suggest the python-ioapi method in this url netCDF Wrapper Library for Gridded I/O API-like files - PYTHON - CMAS CENTER FORUM, to whom may use python to create the ioapi emission file.
Be aware that this interface (attempting to treat the I/O API as defining a ādata formatā instead of as a āprogramming interfaceā (thatās what the āPIā stands for, after all)) does NOT correctly handle time-independent nor restart files: see https://cjcoats.github.io/ioapi/DATETIME.html or https://www.cmascenter.org/ioapi/documentation/all_versions/html/DATETIME.html.
Nor does it handle distributed-I/O files, File-Set File Lists, COUPLING-MODE Virtual Files, nor Native-Binary Real Files ;-(
Nor who knows what elseā¦
1 Like
Many thanks for your kind reminder. I am a new user of CMAQ, honestly i have not fully understand of I/O API.
Itās quite well-documented, starting at https://www.cmascenter.org/ioapi/documentation/all_versions/html/AA.html or https://cjcoats.github.io/ioapi/AA.html. Note that there is an extensive Tutorial, as well as sections detailing the underlying conventions and concepts, and manual-pages for all the routines and for the M3Tools related programs.
1 Like