ERROR ABORT in subroutine OPENMRGIN

Hello,
I am trying to use EDGAR data for Iran and I have encountered the following error in smkmerge:

`
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.1.3 of Feb 27 2021 04:51:37 $
  
  
 Missing environment variable EXECUTION_ID
 SMOKE ---------------
 Copyright (c)2004 Environmental Modeling for Policy Development
 All rights reserved

 Program SMKMERGE, Version SMOKEv4.8.1_Jan2021
 Online documentation 
     http://www.cep.unc.edu/empd/products/smoke                 
  
 Program SMKMERGE to merge the inventory or hourly emission
 files with gridding matrices and with optionally any
 combination of speciation matrices, multiplicative control
 matrices, additive control matrices, or reactivity control
 matrices. The program can operate on one to four source 
 categories (area, biogenic, mobile, or point sources), or any
 combination of these.  Gridded and/or state reports and/or
 county reports can be written from this program. If a layer-
 fractions file is input, then the total emissions output file
 is three-dimensional.
  
  
 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 MRG_SOURCE:  'A'
 Value for MRG_SOURCE:  'A'
 Value for MRG_CTLMAT_MULT not defined; returning defaultval ':  ' '
 Value for MRG_CTLMAT_MULT not defined; returning defaultval ':  ' '
 Value for MRG_CTLMAT_REAC not defined; returning defaultval ':  ' '
 Value for MRG_CTLMAT_REAC not defined; returning defaultval ':  ' '
 Value for MRG_BYDAY not defined; returning defaultval ':  ' '
 Value for MRG_BYDAY not defined; returning defaultval ':  ' '
 Value for MRG_TEMPORAL_YN:  Y returning TRUE
 Value for MRG_SPCMAT_YN:  Y returning TRUE
 Value for MRG_METCHK_YN not defined;returning default:   TRUE
 Value for MRG_MARKETPEN_YN not defined;returning default:   TRUE
 Value for MRG_GRDOUT_YN:  Y returning TRUE
 Value for MRG_REPSTA_YN:  Y returning TRUE
 Value for MRG_REPCNY_YN:  Y returning TRUE
 Value for MRG_REPINV_YN not defined;returning default:   TRUE
 Value for MRG_REPSPC_YN not defined;returning default:   TRUE
 Value for MRG_REPCTL_YN not defined;returning default:   FALSE
 Value for USE_VARIABLE_GRID not defined;returning default:   FALSE
 Value for SMK_SRCGROUP_OUTPUT_YN not defined;returning default:   FALSE
 Value for SMK_SUB_SECTOR_OUTPUT_YN not defined;returning default:   FALSE
 Value for SMK_AVEDAY_YN:  N returning FALSE
 Value for GRIDDESC:  '/home/amir/SMK_HOME//data/ge_dat/GRIDDESC'
 Value for GRIDDESC:  '/home/amir/SMK_HOME//data/ge_dat/GRIDDESC'

 File "GRIDDESC" opened for input on unit:  98
 /home/amir/SMK_HOME//data/ge_dat/GRIDDESC

 Value for IOAPI_GRIDNAME_1:  'MIDEAST_0pt1'
 Value for IOAPI_GRIDNAME_1:  'MIDEAST_0pt1'

 File "GRIDDESC" opened for input on unit:  98
 /home/amir/SMK_HOME//data/ge_dat/GRIDDESC

 
 >>--->> WARNING in subroutine DSCGRID
 Missing coord system "LATLON" for grid "MIDEAST_0pt1" in GRIDDEFS
 
 NOTE: Grid settings initialized using general in  
      grid description file.
 Value for PROMPTFLAG:  N returning FALSE

 File "AREA" opened for input on unit:  98
 /home/amir/SMK_HOME//data/inventory/iran/area.map.edgar.iran.txt

 Value for AREA:  '/home/amir/SMK_HOME//data/inventory/iran/area.map.edgar.iran.txt'
 Value for AREA:  '/home/amir/SMK_HOME//data/inventory/iran/area.map.edgar.iran.txt'

 File "ASRC" opened for input on unit:  97
 /home/amir/SMK_HOME//data/inventory/iran/edgarsrc.edgar.txt

 Value for IOAPI_CHECK_HEADERS not defined;returning default:   FALSE
  
 "AREA" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/iran/edgar.edgar.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 32763 rows, 1 cols, 1 lays, 4 vbles
 NetCDF ID:     65536  opened as READONLY            
 Time-independent data.
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/iran/edgar.edgar_dat/CO.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 30247 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
 Value for PROMPTFLAG:  N returning FALSE
  
 "ATMP" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/run_edgar/scenario/atmp.edgar.edgar.2005191.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 32763 rows, 1 cols, 1 lays, 1 vbles
 NetCDF ID:    131072  opened as READONLY            
 Starting date and time  2005191:000000 (0:00:00   July 10, 2005)
 Timestep                          010000 (1:00:00 hh:mm:ss)
 Maximum current record number        25
 NOTE: Time zone initialized using ATMP             hourly emissions file.
 
 Value for PROMPTFLAG:  N returning FALSE
  
 "AGMAT" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/run_edgar/static/agmat.edgar.ir_edgar.edgar.ncf"
 File type SMATRX3 
 Execution ID "????????????????"
 Grid name "WRF_CMAQ_2WAY"
 Dimensions: 34969 rows, 39299 cols, 1 lays, 1 vbles
 NetCDF ID:    196608  opened as READONLY            
 Time-independent data.
 ERROR: Grid type, cell sizes, or grid projection for area in  
      gridding matrix are inconsistent with initialized values.
 ERROR: Grid origins not compatible between area in  
      gridding matrix and initialized values.
 ERROR: Grid parameters for area in  
      gridding matrix are inconsistent with initialized values.
  
 "ASMAT" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/run_edgar/static/asmat_l.edgar.cmaq_cb05_soa.edgar.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 32763 rows, 1 cols, 1 lays, 1 vbles
 NetCDF ID:    262144  opened as READONLY            
 Time-independent data.
 NOTE: Speciation type initialized using area speciation matrix.

 File "INVTABLE" opened for input on unit:  96
 /home/amir/SMK_HOME//data/inventory/iran/other/invtable_hapcap_cb05soa.txt

 Value for USE_EXP_GEO_CODES:  Y returning TRUE
 
 *** ERROR ABORT in subroutine OPENMRGIN
 Problems opening input files. See ERROR(S) above.
 `

I made changes only to GRIDMASK, GRIDDESC, and arinv files in order to run my case.
grdmat, smkinven, spcmat and temporal indicate normal completion of the programs but I get errors in smkmerge.
I searched for the appropriate answer but I could not find any.
Thanks for your time

What kind of changes did you make to GRIDMASK input file? Smkmerge is complaining that your output modeling domain has some issues. What is your output modeling domain?

I created a new GRIDMASK file using this piece of code:

!pip install netCDF4

!pip install pyproj

!pip install pseudonetcdf

!pip install matplotlib pycno

import pandas as pd
import PseudoNetCDF as pnc

from google.colab import files
csvpath = files.upload()

data = pd.read_csv('final_for_code.csv')

with open('GRIDDESC_MidEast', 'w') as gdf:
    gdf.write("""' '
    'LATLON'
    1 0.0 0.0 0.0 0.0 0.0
    ' '
    'MIDEAST_0pt1'
    'LATLON' 43.8 23.7 0.1 0.1 201 163 1
    ' '""")

gf = pnc.pncopen('GRIDDESC_MidEast', format='griddesc', GDNAM='MIDEAST_0pt1')


outf = gf.subset([])
delattr(outf, 'VAR-LIST')
GEOCODE = outf.createVariable('GEOCODE', 'i', ('TSTEP', 'LAY', 'ROW', 'COL'))
GEOCODE.long_name = "GEOCODE"

GEOCODE.units = "none           "
GEOCODE.var_desc = ""

TZONES = outf.createVariable('TZONES', 'i', ('TSTEP', 'LAY', 'ROW', 'COL'))
TZONES.long_name = "TZONES"

TZONES.units = "none            "
TZONES.var_desc = ""

GEOCODE[0, 0, data.Y - 1, data.X - 1] = data.Country_Code
TZONES[0, 0, data.Y - 1, data.X - 1] = data.Time_Zone

outf.SDATE = 2000001
outf.updatemeta()
outf.variables.move_to_end('TFLAG', last=False)
outf.SDATE = -635
outf.variables['TFLAG'][:, :, 0] = 0
outf.save('GRIDMASK.nc', format='NETCDF3_CLASSIC').close()

I used this csv in order to generate GRIDMASK
Grid.csv (655.4 KB)

And this is how my GRIDMASK.nc file looks like:
GRIDMASK_as_txt.txt (271.6 KB)

I think that the problem is due to the difference in surrogate files. Is there a way that I can create surrogate files using my netCDF emission data?

I am not sure why you have to create your own GRIDMASK input file. If you are processing EDGAR lat/long projection global inventories, then you do not need to regenerate the GRIDMASK input file since it is preconfigured. You just need to specify the output modeling domain to SMOKE. Here is the user’s guide on how to process EDGAR inventory for your own modeling domains.

1 Like

We normally create spatial surrogates from Shapefiles and not netCDF fies, but theoretically you may be able to do what you are suggesting, just our tools don’t support this.

1 Like

Dear Dr.Baek, @bbaek

I have tried to do this with existing GRIDMASK for EDGAR and according to “Hemispheric Modelling Support in SMOKE Modelling System”, I only changed ​ IOAPI_GRIDNAME_1​ to MIDEAST which is in my GRIDDESC File as follows:

!  coords --line:  name; type, P-alpha, P-beta, P-gamma, xcent, ycent
'LAM_40N97W'
2, 33.0D0, 45.D0, -97.D0, -97.D0, 40.D0
'POL_HEMI'
6, 1.D0, 45.D0, -98.D0, -98.D0, 90.D0   
'LATLON'
1, 0.0, 0.0, 0.0, 0.0, 0.0
' '  !  end coords.  grids:  name; xorig,yorig,xcell,ycell,ncols,nrows,nthik
'MOVES12k_42x32'
'LAM_40N97W', 1032D3, -816D3, 12.D3, 12.D3, 42, 32, 1
'US12NC_66X52'
'LAM_40N97W', 1128D3, -672D3, 12.D3, 12.D3, 66, 52, 1
'US12NC_66X52_DOT'
'LAM_40N97W', 1122D3, -678D3, 12.D3, 12.D3, 67, 53, 1
'HEMI_108k'
'POL_HEMI', -10098D3, -10098D3, 108.D3, 108.D3, 187, 187, 1
'MIDEAST'
'LATLON', 43.8, 23.7, 0.1, 0.1, 201, 163, 1 
' '  !  end grids.

But still I get the same error which is this one:

 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.1.3 of Feb 27 2021 04:51:37 $
  
  
 Missing environment variable EXECUTION_ID
 SMOKE ---------------
 Copyright (c)2004 Environmental Modeling for Policy Development
 All rights reserved

 Program SMKMERGE, Version SMOKEv4.8.1_Jan2021
 Online documentation 
     http://www.cep.unc.edu/empd/products/smoke                 
  
 Program SMKMERGE to merge the inventory or hourly emission
 files with gridding matrices and with optionally any
 combination of speciation matrices, multiplicative control
 matrices, additive control matrices, or reactivity control
 matrices. The program can operate on one to four source 
 categories (area, biogenic, mobile, or point sources), or any
 combination of these.  Gridded and/or state reports and/or
 county reports can be written from this program. If a layer-
 fractions file is input, then the total emissions output file
 is three-dimensional.
  
  
 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 MRG_SOURCE:  'A'
 Value for MRG_SOURCE:  'A'
 Value for MRG_CTLMAT_MULT not defined; returning defaultval ':  ' '
 Value for MRG_CTLMAT_MULT not defined; returning defaultval ':  ' '
 Value for MRG_CTLMAT_REAC not defined; returning defaultval ':  ' '
 Value for MRG_CTLMAT_REAC not defined; returning defaultval ':  ' '
 Value for MRG_BYDAY not defined; returning defaultval ':  ' '
 Value for MRG_BYDAY not defined; returning defaultval ':  ' '
 Value for MRG_TEMPORAL_YN:  Y returning TRUE
 Value for MRG_SPCMAT_YN:  Y returning TRUE
 Value for MRG_METCHK_YN not defined;returning default:   TRUE
 Value for MRG_MARKETPEN_YN not defined;returning default:   TRUE
 Value for MRG_GRDOUT_YN:  Y returning TRUE
 Value for MRG_REPSTA_YN:  Y returning TRUE
 Value for MRG_REPCNY_YN:  Y returning TRUE
 Value for MRG_REPINV_YN not defined;returning default:   TRUE
 Value for MRG_REPSPC_YN not defined;returning default:   TRUE
 Value for MRG_REPCTL_YN not defined;returning default:   FALSE
 Value for USE_VARIABLE_GRID not defined;returning default:   FALSE
 Value for SMK_SRCGROUP_OUTPUT_YN not defined;returning default:   FALSE
 Value for SMK_SUB_SECTOR_OUTPUT_YN not defined;returning default:   FALSE
 Value for SMK_AVEDAY_YN:  N returning FALSE
 Value for GRIDDESC:  '/home/amir/SMK_HOME//data/ge_dat/GRIDDESC'
 Value for GRIDDESC:  '/home/amir/SMK_HOME//data/ge_dat/GRIDDESC'

 File "GRIDDESC" opened for input on unit:  98
 /home/amir/SMK_HOME//data/ge_dat/GRIDDESC

 Value for IOAPI_GRIDNAME_1:  'MIDEAST'
 Value for IOAPI_GRIDNAME_1:  'MIDEAST'

 File "GRIDDESC" opened for input on unit:  98
 /home/amir/SMK_HOME//data/ge_dat/GRIDDESC

 NOTE: Grid settings initialized using general in  
      grid description file.
 Value for PROMPTFLAG:  N returning FALSE

 File "AREA" opened for input on unit:  98
 /home/amir/SMK_HOME//data/inventory/HEMI_108k/area.map.edgar.HEMI_108k.txt

 Value for AREA:  '/home/amir/SMK_HOME//data/inventory/HEMI_108k/area.map.edgar.HEMI_108k.txt'
 Value for AREA:  '/home/amir/SMK_HOME//data/inventory/HEMI_108k/area.map.edgar.HEMI_108k.txt'

 File "ASRC" opened for input on unit:  97
 /home/amir/SMK_HOME//data/inventory/HEMI_108k/edgarsrc.HEMI_108k.txt

 Value for IOAPI_CHECK_HEADERS not defined;returning default:   FALSE
  
 "AREA" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 6480000 rows, 1 cols, 1 lays, 4 vbles
 NetCDF ID:     65536  opened as READONLY            
 Time-independent data.
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/CO.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1087264 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/NH3.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1078304 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/NOX.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1087658 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/PM10.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1086698 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/PM2_5.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1086591 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/SO2.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1086050 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/VOC.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1086621 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/PMC.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 677872 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
 Value for PROMPTFLAG:  N returning FALSE
  
 "ATMP" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/run_HEMI_108k/scenario/atmp.edgar.HEMI_108k.2005191.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 6480000 rows, 1 cols, 1 lays, 8 vbles
 NetCDF ID:    131072  opened as READONLY            
 Starting date and time  2005191:000000 (0:00:00   July 10, 2005)
 Timestep                          010000 (1:00:00 hh:mm:ss)
 Maximum current record number        25
 NOTE: Time zone initialized using ATMP             hourly emissions file.
 
 Value for PROMPTFLAG:  N returning FALSE
  
 "AGMAT" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/run_HEMI_108k/static/agmat.edgar.MIDEAST.HEMI_108k.ncf"
 File type SMATRX3 
 Execution ID "????????????????"
 Grid name "WRF_CMAQ_2WAY"
 Dimensions: 34969 rows, 3666650 cols, 1 lays, 1 vbles
 NetCDF ID:    196608  opened as READONLY            
 Time-independent data.
 ERROR: Grid type, cell sizes, or grid projection for area in  
      gridding matrix are inconsistent with initialized values.
 ERROR: Grid origins not compatible between area in  
      gridding matrix and initialized values.
 ERROR: Grid parameters for area in  
      gridding matrix are inconsistent with initialized values.
  
 "ASMAT" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/run_HEMI_108k/static/asmat_l.edgar.cmaq_cb05_soa.HEMI_108k.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 6480000 rows, 1 cols, 1 lays, 32 vbles
 NetCDF ID:    262144  opened as READONLY            
 Time-independent data.
 NOTE: Speciation type initialized using area speciation matrix.

 File "INVTABLE" opened for input on unit:  96
 /home/amir/SMK_HOME//data/inventory/nei2005/other/invtable_hapcap_cb05soa.txt

 Value for USE_EXP_GEO_CODES:  Y returning TRUE
 
 *** ERROR ABORT in subroutine OPENMRGIN
 Problems opening input files. See ERROR(S) above.

Here’s the problem (below); do ncdump -h on AGMAT to see what it thinks the grid description parameters are, and then compare the result with your GRIDDESC.

Dear @cjcoats
This is the result:

netcdf agmat.edgar.MIDEAST.HEMI_108k {
dimensions:
	TSTEP = 1 ;
	DATE-TIME = 2 ;
	LAY = 1 ;
	VAR = 1 ;
	ROW-NO = 34969 ;
	SP-COEF-NO = 3666650 ;
variables:
	int TFLAG(TSTEP, VAR, DATE-TIME) ;
		TFLAG:units = "<YYYYDDD,HHMMSS>" ;
		TFLAG:long_name = "TFLAG           " ;
		TFLAG:var_desc = "Timestep-valid flags:  (1) YYYYDDD or (2) HHMMSS                                " ;
	int COL-COUNT(TSTEP, ROW-NO) ;
	int COEFF-INDEX(TSTEP, SP-COEF-NO) ;
	float AGRDMAT(TSTEP, SP-COEF-NO) ;
		AGRDMAT:long_name = "AGRDMAT         " ;
		AGRDMAT:units = "n/a             " ;
		AGRDMAT:var_desc = "Area source re-gridding coefficients                                            " ;

// global attributes:
		:IOAPI_VERSION = "ioapi-3.2: $Id: init3.F90 185 2020-08-28 16:49:45Z coats $                      " ;
		:EXEC_ID = "????????????????                                                                " ;
		:FTYPE = 6 ;
		:CDATE = 2021156 ;
		:CTIME = 184335 ;
		:WDATE = 2021156 ;
		:WTIME = 184335 ;
		:SDATE = 2010121 ;
		:STIME = 0 ;
		:TSTEP = 0 ;
		:NTHIK = 6480000 ;
		:NCOLS = 3666650 ;
		:NROWS = 34969 ;
		:NLAYS = 1 ;
		:NVARS = 1 ;
		:GDTYP = 6 ;
		:P_ALP = 1. ;
		:P_BET = 45. ;
		:P_GAM = -98. ;
		:XCENT = -98. ;
		:YCENT = 90. ;
		:XORIG = -10098000. ;
		:YORIG = -10098000. ;
		:XCELL = 108000. ;
		:YCELL = 108000. ;
		:VGTYP = 7 ;
		:VGTOP = 5000.f ;
		:VGLVLS = 1.f, 0.9975f ;
		:GDNAM = "WRF_CMAQ_2WAY   " ;
		:UPNAM = "GENLGMAT/WRITELL" ;
		:VAR-LIST = "AGRDMAT         " ;
		:FILEDESC = "Area source re-gridding coefficients                                            /FROM/ GENLGMAT/WRITELLG                                                        /VERSION/                                                                       /GDESC/                                                                         /NCOLS3D/      187                                                              /NROWS3D/      187                                                                                                                                                                                                                                                                                                                                                                                              /INVEN FROM/                                                                    /INVEN VERSION/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 " ;
		:HISTORY = "" ;
}

It does not match with my GRIDDESC. Could this be the result of the GRID_CRO_2D file which is pre-configured for EDGAR?

Possibly – that’s a question for BH Baek or Alison Eyth…

1 Like

I am confused. You said your domain is “MIDEAST” but the AGMAT (Grdmat output file) said its domain name is “WRF_CMAQ_2WAY”. I think you need to double check to make sure that you are not mixing or providing a wrong AGMAT output file to Smkmerge. First, check the Grdmat log file to make sure it ran successfully with your domain and then make sure Smkmerge use that output file for merging step.

1 Like

Dear @bbaek, You are right.
Here is my Grdmat log.

 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.1.3 of Feb 27 2021 04:51:37 $
  
  
 Missing environment variable EXECUTION_ID
 SMOKE ---------------
 Copyright (c)2004 Environmental Modeling for Policy Development
 All rights reserved

 Program GRDMAT, Version SMOKEv4.8.1_Jan2021
 Online documentation 
     http://www.cep.unc.edu/empd/products/smoke                 
  
 Program GRDMAT to take a SMOKE area, mobile, or point source
 inventory file, gridding surrogates,  surrogate cross-
 reference, and an optional link definitions file, and produce
 a SMOKE gridding matrix for a grid defined at run time. For
 mobile sources, an "ungridding" matrix is also created to
 allow the use of gridded temperature data in assigning
 factors to mobile sources.
  
  
 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 GRDMAT_ADJUST not defined;returning default:   FALSE
 Value for GRDMAT_LINKDEFS not defined;returning default:   FALSE
 Value for USE_VARIABLE_GRID not defined;returning default:   FALSE
 Value for IMPORT_GRDNETCDF_YN:  Y returning TRUE
 Value for SMK_SOURCE:  'A'
 Value for SMK_SOURCE:  'A'
 Value for PROMPTFLAG:  N returning FALSE

 File "AREA" opened for input on unit:  98
 /home/amir/SMK_HOME//data/inventory/HEMI_108k/area.map.edgar.HEMI_108k.txt

 Value for AREA:  '/home/amir/SMK_HOME//data/inventory/HEMI_108k/area.map.edgar.HEMI_108k.txt'
 Value for AREA:  '/home/amir/SMK_HOME//data/inventory/HEMI_108k/area.map.edgar.HEMI_108k.txt'

 File "ASRC" opened for input on unit:  97
 /home/amir/SMK_HOME//data/inventory/HEMI_108k/edgarsrc.HEMI_108k.txt

 Value for IOAPI_CHECK_HEADERS not defined;returning default:   FALSE
  
 "AREA" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 6480000 rows, 1 cols, 1 lays, 4 vbles
 NetCDF ID:     65536  opened as READONLY            
 Time-independent data.
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/CO.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1087264 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/NH3.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1078304 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/NOX.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1087658 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/PM10.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1086698 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/PM2_5.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1086591 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/SO2.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1086050 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/VOC.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1086621 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/PMC.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 677872 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/CO.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1087264 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/NH3.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1078304 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/NOX.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1087658 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/PM10.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1086698 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/PM2_5.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1086591 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/SO2.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1086050 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/VOC.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 1086621 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
  
 "TMP_POL_FILE" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/inventory/HEMI_108k/edgar.HEMI_108k_dat/PMC.ncf"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name ""
 Dimensions: 677872 rows, 1 cols, 1 lays, 7 vbles
 NetCDF ID:    131072  opened as READONLY            
 Time-independent data.
 Closing file TMP_POL_FILE
 Reading source data from inventory file...
 Value for GRIDDESC:  '/home/amir/SMK_HOME//data/ge_dat/GRIDDESC'
 Value for GRIDDESC:  '/home/amir/SMK_HOME//data/ge_dat/GRIDDESC'

 File "GRIDDESC" opened for input on unit:  96
 /home/amir/SMK_HOME//data/ge_dat/GRIDDESC

 Value for IOAPI_GRIDNAME_1:  'MIDEAST'
 Value for IOAPI_GRIDNAME_1:  'MIDEAST'

 File "GRIDDESC" opened for input on unit:  96
 /home/amir/SMK_HOME//data/ge_dat/GRIDDESC

 NOTE: Grid settings initialized using MIDEAST          in  
      grid description file.
 NOTE: Output grid "MIDEAST" set; described as 
      No description available
 Value for IOAPI_GRIDNAME_1:  'MIDEAST'
 Value for IOAPI_GRIDNAME_1:  'MIDEAST'

WARNING: output file already exists: AGSUP
/home/amir/SMK_HOME//data/run_HEMI_108k/static/agsup.edgar.MIDEAST.HEMI_108k.txt

 File "AGSUP" opened for output on unit:  96
 /home/amir/SMK_HOME//data/run_HEMI_108k/static/agsup.edgar.MIDEAST.HEMI_108k.txt

 Generating gridding matrix...
  
 "GRIDMASK" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//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:    131072  opened as READONLY            
 Time-independent data.
  
 "GRID_CRO_2D" opened as OLD:READ-ONLY   
 File name "/home/amir/SMK_HOME//data/met/run_108km/GRIDCRO2D"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name "WRF_CMAQ_2WAY"
 Dimensions: 187 rows, 187 cols, 1 lays, 27 vbles
 NetCDF ID:    196608  opened as READONLY            
 Time-independent data.
 This file seems to use WMO-style "longitude" that violates ISO Standard 6709
 Number of coeffs   3666650
 
 Value for IOAPI_CHECK_HEADERS not defined;returning default:   FALSE
 Value for IOAPI_OFFSET_64 not defined;returning default:   TRUE
 Value for IOAPI_CFMETA not defined;returning default:   FALSE
 Value for IOAPI_CMAQMETA not defined; returning defaultval ':  'NONE'
 Value for IOAPI_CMAQMETA not defined; returning defaultval ':  'NONE'
 Value for IOAPI_SMOKEMETA not defined; returning defaultval ':  'NONE'
 Value for IOAPI_SMOKEMETA not defined; returning defaultval ':  'NONE'
 Value for IOAPI_TEXTMETA not defined; returning defaultval ':  'NONE'
 Value for IOAPI_TEXTMETA not defined; returning defaultval ':  'NONE'
  
 "AGMAT" opened as UNKNOWN(R-W)    
 File name "/home/amir/SMK_HOME//data/run_HEMI_108k/static/agmat.edgar.MIDEAST.HEMI_108k.ncf"
 File type SMATRX3 
 Execution ID "????????????????"
 Grid name "WRF_CMAQ_2WAY"
 Dimensions: 34969 rows, 3666650 cols, 1 lays, 1 vbles
 NetCDF ID:    262144  opened as READWRITE           
 Time-independent data.
 Value for IOAPI_LOG_WRITE not defined;returning default:   TRUE
 Record written to AGMAT
 GRIDDING-MATRIX statistics:
 Total number of coefficients    :   3666650  
 Max  number of sources per cell :       938  
 Min  number sources per cell > 0:        28 
 Mean number of sources per cell :    104.85
 
 --->> Normal Completion of program GRDMAT

I assume that this conflict results from the fact that I have not made the specific GRID_CRO_2D file for my case. In the preconfigured SMOKE’s EDGAR case the grid name in GRID_CRO_2D file is “WRF_CMAQ_2WAY”. So when I try to run the model, this grid name overwrites my grid name -which is indicated in my GRIDDESC as “MIDEAST”- in the AGMAT file.

As you probably know, the GRID_CRD_2D file is created by MCIP which is an interface program between WRF and CMAQ. GRID_CRO_2D input file with your output modeling domain holds the information SMOKE needs to correctly compute the spatial fractions for your domain based on the EDGAR domain.