SMOKE v4.8 process MEIC inventory, using EDGAR program

Hi, I’m trying to process MEIC inventory to CMAQ input files using SMOKEv4.8. I’ve processed the MEIC inventory liked the EDGAR (netcdf format, per file included three variables, lat, lon and one pollutant respectively), the GRIDMASK file is the edgar GRIDMASK file, an error occurred when executed the smkinven part, detail as follow:

     This program uses the EPA-AREAL/MCNC-EnvPgms/BAMS Models-3      
     I/O Applications Programming Interface, [I/O API] which is      
     built on top of the netCDF I/O library (Copyright 1993, 1996    
     University Corporation for Atmospheric Research/Unidata         
     Program) and the PVM parallel-programming library (from         
     Oak Ridge National Laboratory).                                 
     Copyright (C) 1992-2002 MCNC,                                   
     (C) 1992-2018 Carlie J. Coats, Jr.,                             
     (C) 2003-2012 Baron Advanced Meteorological Systems, LLC, and   
     (C) 2014-2020 UNC Institute for the Environment.                
     Released under the GNU LGPL  License, version 2.1.  See URL     
                                                                     
         https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html     
                                                                     
     for conditions of use.                                          
                                                                     
     ioapi-3.2: $Id: init3.F90 185 2020-08-28 16:49:45Z coats $
     Version with PARMS3.EXT/PARAMETER::MXVARS3= 2048
     netCDF version 4.7.0 of Aug 30 2021 10:00:11 $
      
      
     Missing environment variable EXECUTION_ID
     SMOKE ---------------
     Copyright (c)2004 Environmental Modeling for Policy Development
     All rights reserved

     Program SMKINVEN, Version SMOKEv4.8_Oct2020
     Online documentation 
         http://www.cep.unc.edu/empd/products/smoke                 
      
     Program SMKINVEN to take ASCII area or point source files
     in IDA, EMS-95, or SMOKE list format, or mobile files
     in IDA format, and produce the I/O API and ASCII SMOKE
     inventory files and list of unique SCCs in the inventory.
      
      
     You will need to enter the logical names for the input and
     output files (and to have set them prior to program start,
     using "setenv <logicalname> <pathname>").
      
     You may use END_OF-FILE (control-D) to quit the program
     during logical-name entry. Default responses are given in
     brackets [LIKE THIS] and can be accepted by hitting the
     <RETURN> key.
      
     Value for PROMPTFLAG:  N returning FALSE
     Returning default value TRUE for query:
     "Continue with program?"
     Value for SMK_SOURCE:  'A'
     Value for SMK_SOURCE:  'A'
     Value for OUTZONE:  0
     Value for SMKINVEN_FORMULA:  'PMC=PM10-PM2_5'
     Value for SMKINVEN_FORMULA:  'PMC=PM10-PM2_5'
     Value for IMPORT_AVEINV_YN not defined;returning default:   TRUE
     Value for DAY_SPECIFIC_YN:  N returning FALSE
     Value for HOUR_SPECIFIC_YN:  N returning FALSE
     Value for SMK_PROCESS_HAPS not defined; returning defaultval ':  ' '
     Value for SMK_PROCESS_HAPS not defined; returning defaultval ':  ' '
     No processing of combining criteria VOC with hazardous air pollutants (HAP).
     Value for SMK_ARTOPNT_YN not defined;returning default:   FALSE
     Value for IMPORT_GRDIOAPI_YN:  N returning FALSE
     Value for IMPORT_GRDNETCDF_YN:  Y returning TRUE
     Value for NETCDF_POL_UNIT:  'kg m-2 s-1'
     Value for NETCDF_POL_UNIT:  'kg m-2 s-1'
     
     Value for PROMPTFLAG:  N returning FALSE
     Value for IOAPI_CHECK_HEADERS not defined;returning default:   FALSE
      
     "GRIDMASK" opened as OLD:READ-ONLY   
     File name "/home/atmos/MODEL/SMOKE/data/ge_dat/EDGAR/GRIDMASK_EDGAR.ncf"
     File type GRDDED3 
     Execution ID "????????????????"
     Grid name "LATLON_EDGAR0.1"
     Dimensions: 1800 rows, 3600 cols, 1 lays, 2 vbles
     NetCDF ID:     65536  opened as READONLY            
     Time-independent data.
     Value for USE_EXP_GEO_CODES:  Y returning TRUE
     Value for PROMPTFLAG:  N returning FALSE

     File "INVTABLE" opened for input on unit:  98
     /home/atmos/MODEL/SMOKE/data/inventory/meic2017/other/invtable_hapcap_cb05soa.txt

     Setting up to read inventory data...
     Value for SMK_DEFAULT_TZONE:  0
     Reading geographic region names and time zones...

     File "GEOCODE_LEVEL1" opened for input on unit:  97
     /home/atmos/MODEL/SMOKE/data/ge_dat/EDGAR/geocode1_edgar.txt


     File "GEOCODE_LEVEL2" opened for input on unit:  97
     /home/atmos/MODEL/SMOKE/data/ge_dat/EDGAR/geocode2_edgar.txt


     File "GEOCODE_LEVEL3" opened for input on unit:  97
     /home/atmos/MODEL/SMOKE/data/ge_dat/EDGAR/geocode3_edgar.txt


     File "GEOCODE_LEVEL4" opened for input on unit:  97
     /home/atmos/MODEL/SMOKE/data/ge_dat/EDGAR/geocode4_edgar.txt

     Value for SMKINVEN_MONTH not defined; returning default:  0
     Value for NETCDF_INV_YEAR:  2017

     File "ARINV" opened for input on unit:  97
     /home/atmos/MODEL/SMOKE/data/inventory/meic2017/arinv.meic.lst

     Value for WKDAY_NORMALIZE:  N returning FALSE
     NOTE: Setting inventory to use full-week normalizer for weekly profiles
     Bad COL dimension for  "CO" in "TMPFILE"
     Could not read "CO" from gridded inventory file
     Bad COL dimension for  "NH3" in "TMPFILE"
     Could not read "NH3" from gridded inventory file
     Bad COL dimension for  "NOx" in "TMPFILE"
     Could not read "NOx" from gridded inventory file
...
     Bad COL dimension for  "VOC" in "TMPFILE"
     Could not read "VOC" from gridded inventory file
     Bad COL dimension for  "CO" in "TMPFILE"
     Could not read "CO" from gridded inventory file
     Bad COL dimension for  "NH3" in "TMPFILE"
     Could not read "NH3" from gridded inventory file
     Bad COL dimension for  "NOx" in "TMPFILE"
     Could not read "NOx" from gridded inventory file
     Bad COL dimension for  "BC" in "TMPFILE"
     Could not read "BC" from gridded inventory file
     Bad COL dimension for  "PM25" in "TMPFILE"
     Could not read "PM25" from gridded inventory file
     Bad COL dimension for  "PM10" in "TMPFILE"
     Could not read "PM10" from gridded inventory file
     Bad COL dimension for  "OC" in "TMPFILE"
     Could not read "OC" from gridded inventory file
     Bad COL dimension for  "SO2" in "TMPFILE"
     Could not read "SO2" from gridded inventory file
     Bad COL dimension for  "VOC" in "TMPFILE"
     Could not read "VOC" from gridded inventory file

     *** ERROR ABORT in subroutine RDGRDNCF
     Problem reading gridded inventory file

Now, I have a few questions:

  1. Can I use SMOKE EDGAR processing MEIC inventory? I look previous topics in the forum, seem that the EDGAR is not appropriate the MEIC inventory?
    If I can use EDGAR process MEIC inventory, then I have following questions:
  2. What’s the reason of the above error?
  3. Can I use the EDGAR GRIDMASK file directly, or I need create a new one for my own and how can I make a new one?
  4. Can I use the “invtable_hapcap_cb05soa.txt” file for CMAQv5.3.2(the chemical mechnism is CB06)? or how can I make a new one?

Specifically what file do you mean when referring to the MEIC inventory?

Hi, alison. Thank you for your replying. Well, I want to use SMOKE to process the MEIC inventory so that it can be inputted into the CMAQ. The MEIC inventory is an grid inventory with res=0.25degrees, nrows=200, ncols=320.
The original MEIC inventory as below (using the “ncdump” tool):

netcdf \2017_0_power_NOx {
dimensions:
	side = 2 ;
	xysize = 64000 ;
variables:
	double x_range(side) ;
	double y_range(side) ;
	double spacing(side) ;
	int dimension(side) ;
	float z(xysize) ;
		z:scale_factor = 1. ;
		z:add_offset = 0. ;
		z:node_offset = 1 ;
		z:nodata_value = -9999. ;

// global attributes:
		:title = "" ;
		:source = "MEIC Core gridding - GMTEngine" ;
}

I used the python to process the MEIC inventory so that it maybe like the EDGAR inventory, the processed MEIC inventory as below:

netcdf meic_NOx_transportation_2017 {
dimensions:
	lat = 200 ;
	lon = 320 ;
variables:
	float lat(lat) ;
	float lon(lon) ;
	float NOx(lat, lon) ;
		NOx:units = "Mg/m2" ;
}

As compare, I post the EDGAR inventory information as below:

netcdf edgar_HTAP_NOx_emi_TRANSPORT_2010.0.1x0.1 {
dimensions:
	lat = 1800 ;
	lon = 3600 ;
variables:
	float lat(lat) ;
		lat:standard_name = "latitude" ;
		lat:long_name = "latitude" ;
		lat:units = "degrees_north" ;
		lat:comment = "center_of_cell" ;
	float lon(lon) ;
		lon:standard_name = "longitude" ;
		lon:long_name = "longitude" ;
		lon:units = "degrees_east" ;
		lon:comment = "center_of_cell" ;
	float emi_nox(lat, lon) ;
		emi_nox:standard_name = "tendency_of_atmosphere_mass_content_of_nox_expressed_as_nitrogen_dioxide_due_to_emission" ;
		emi_nox:long_name = "Emissions of NOX - " ;
		emi_nox:units = "kg m-2 s-1" ;
		emi_nox:cell_method = "time: mean (interval: 1 year, 365 days)" ;
		emi_nox:total_emi_nox = "   4.18267e+010 kg/year" ;
		emi_nox:comment = " (see http://edgar.jrc.ec.europa.eu/methodology.php#12sou for the definitions of the single sources)" ;

// global attributes:
		:Conventions = "CF-1.0" ;
		:title = "Annual Mean Emissions of NOX - " ;
		:institution = "European Commission, Joint Research Centre" ;
		:source = "http://edgar.jrc.ec.europa.eu/htap_v2/" ;
		:history = "MICS Asia, EPA US/Canada, EMEP/TNO Europe, EDGARv4.3 Rest of the world on Fri Dec 20 13:51:25 2013" ;
		:references = "EC, JRC / US EPA, HTAP_V2. http://edgar.jrc.ec.europa.eu/htap/EDGAR-HTAP_v1_final_jan2012.pdf" ;
		:contact = "greet.maenhout@jrc.ec.europa.eu" ;
}

Is there something wrong? Looking forward to any suggestions, thank you.

What does

mean? That’s not a standard units-designation…

oh, the units is also have influence, I’ll change it and try again. Thank you, cjcoats.

The GRIDMASK might be causing the “Bad COL dimension” error, but either way, they will need to create a GRIDMASK for the same domain as their MEIC inventory (res=0.25degrees, nrows=200, ncols=320).

To make a GRIDMASK, you first need to determine the primary country (GEOCODE) and time zone (TZONES) for each 0.25x0.25 degree grid cell. Making a CSV with that information first (col,row,GEOCODE,TZONES) and then converting that to I/O API is one way to do it. There may be some past CMAS forum threads that have also discussed how to create GRIDMASKs.

Hello!
I am trying to do the same thing as you do, processing the MEIC dataset to CMAQ!
I have built the GRIDMASK and transformed the MEIC inventory to EDGAR-like files. I am not sure whether I did right… I tried to re-run the script but a segmentation fault occurred.

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x2B852C6D6467
#1  0x2B852C6D6AAE
#2  0x2B852CF3324F
#3  0x2B852C7B4DBF
#4  0x47CB5B in wrinvchr_
#5  0x474602 in MAIN__ at smkinven.f:?
Segmentation fault (core dumped)

Did you manage to form the emission files?

I have figured out how to solve this problem.
But another error came out:

     "IOAPI_DAT" opened as NEW(READ-WRITE )
     File name "/nuist/scratch/pb02005030/lism/v47_smoke/data/inventory/test_meic/edgar.out_meic_dat/VOC.ncf"
     File type GRDDED3
     Execution ID "????????????????"
     Grid name ""
     Dimensions: 15803 rows, 1 cols, 1 lays, 7 vbles
     NetCDF ID:    196608  opened as READWRITE
     Time-independent data.
     SRCID written to IOAPI_DAT
     VOC written to IOAPI_DAT
     DY_VOC written to IOAPI_DAT
     EF_VOC written to IOAPI_DAT
     CE_VOC written to IOAPI_DAT
     RE_VOC written to IOAPI_DAT
     RP_VOC written to IOAPI_DAT
     Closing file IOAPI_DAT
     Determining number of time steps for day  -specific files...
     Value for SMKINVEN_FORMULA defined but empty; returning default:  ' '
     Value for SMKINVEN_FORMULA defined but empty; returning default:  ' '

     *** ERROR ABORT in subroutine GETFORMT
     I/O error    5007 reading inventory file at line       1

Hello again!
I have solved this problem.
The GETFORMT error mainly casued by the format of the attribute ‘total_emi_<pollute>’.
I used the Python format function to form the number, which was a little different from it in Fortran.
The right format was like:
emi_nox:total_emi_nox = " 1.72115e+006 kg/month" .

Detailed information can be found in 4.4.2.7.1. Pre-gridded inventories from the same modeling domain as an area source without source characterization or attributes in user’s manual.

Hope this helps.