ISAM SA_ACONC output error

Hello all,

I am running CMAQ ISAM, to do source apportionment study. My CMAQ_MASK file has 9 tags. The problem is the Initial Condition contributes exactly the same as all of my 9 source regions in the SA outputs.

My isam_control setting:

TAG CLASSES |OZONE,NITRATE,VOC

TAG NAME |GR1
REGION(S) |NA_1
EMIS STREAM(S) |GRIDDED_EMIS

TAG NAME |GR2
REGION(S) |NA_2
EMIS STREAM(S) |GRIDDED_EMIS

TAG NAME |GR3
REGION(S) |NA_3
EMIS STREAM(S) |GRIDDED_EMIS

TAG NAME |GR4
REGION(S) |NA_4
EMIS STREAM(S) |GRIDDED_EMIS

TAG NAME |GR5
REGION(S) |NA_5
EMIS STREAM(S) |GRIDDED_EMIS

TAG NAME |GR6
REGION(S) |NA_6
EMIS STREAM(S) |GRIDDED_EMIS

TAG NAME |GR7
REGION(S) |NA_7
EMIS STREAM(S) |GRIDDED_EMIS

TAG NAME |GR8
REGION(S) |NA_8
EMIS STREAM(S) |GRIDDED_EMIS

TAG NAME |GR9
REGION(S) |NA_9
EMIS STREAM(S) |GRIDDED_EMIS

Thank you.

hello,
I want to know how to generate CMAQ_MASK files.

Hello Yukui,

could you please provide some more details on the behavior you are observing? Which species are you looking at? How many days have you simulated, and does the relative magnitude of the IC tag vs. the source region tags change over time? Does the IC tag have the same magnitude as the sum of the region tags or are all tags (region tags and IC tag) identical? Does the behavior of the BC tag look reasonable?

As noted in other forum posts discussing ISAM (e.g. here and here), we want to make sure you are aware of this Known Issue with CMAQ-ISAMv5.3.1 predictions of secondary gas species. A bugfix release (v5.3.2) is expected soon that will address this issue.

Here is a link with metadata on 2 example CMAQ mask files (US states and NOAA climate regions): https://dataverse.unc.edu/dataset.xhtml?persistentId=doi:10.15139/S3/XDYYB9

Here is a link to a README text file describing how these files were created: https://drive.google.com/file/d/1bgbMyiFZMYP68zIm9iLFO36bwVY5fw_o/view

1 Like

Hello Hogrefe,

I am looking at ozone source appointment. I have run half month dara. The IC tag do change over time. IC tag has the same magnitude as each region tag. So all region tags are identical and they are also the same as IC tag. The BC tag looks reasonable.

Thanks.

Christian Hogrefe via CMAS CENTER FORUM <cmas@discoursemail.com>äŗŽ2020幓7꜈9ę—„ å‘Ø四09:19写道ļ¼š

Hello Yukui,

thanks for providing this additional information. To confirm, O3_ICON = O3_GR1 = O3_GR2 = ā€¦ O3_GR9 in your SA_ACONC and SA_CONC output files across all grid cells and output time steps?

If you created your own CMAQ_MASK file, can you please post the header of that file and images showing the coverage of all 9 regions? Or are you using the NOAA climate region file posted on the CMAS data warehouse?

Thanks,

Christian

Thank you Christian. In my SA_ACONC and SA_CONC output files across all grid cells and output time steps, the data do shows O3_ICON = O3_GR1 = O3_GR2 = ā€¦ O3_GR9.

I create my own CMAQ_MASK file. The header of my CMAQ_MASK file is :slight_smile:
file global attributes:
IOAPI_VERSION : ioapi-3.2: Id: init3.F90 120 2019-06-21 14:18:20Z coats
EXEC_ID : ???

  FTYPE : 1
  CDATE : 2020119
  CTIME : 531
  WDATE : 2020119
  WTIME : 531
  SDATE : 0
  STIME : 0
  TSTEP : 0
  NTHIK : 1
  NCOLS : 396
  NROWS : 246
  NLAYS : 1
  NVARS : 9
  GDTYP : 2
  P_ALP :   33
  P_BET :   45
  P_GAM :  -97
  XCENT :  -97
  YCENT :   40
  XORIG : -2412000
  YORIG : -1620000
  XCELL : 12000
  YCELL : 12000
  VGTYP : 7
  VGTOP : 5000
  VGLVLS : (  1, 0.9975 )
  GDNAM : GRIDOUT_12US2_CR
  UPNAM : M3MERGE
  VAR-LIST : NA_1            NA_2            NA_3            NA_4

NA_5 NA_6 NA_7 NA_8 NA_9

  FILEDESC : US EPA COMMUNITY MULTISCALE AIR QUALITY MODEL
               METEOROLOGY-CHEMISTRY INTERFACE PROCESSOR
  HISTORY :

dimensions:
TSTEP = 1
DATE-TIME = 2
LAY = 1
VAR = 9
ROW = 246
COL = 396
variables:
integer TFLAG ( TSTEP, VAR, DATE-TIME )
units : <YYYYDDD,HHMMSS>
long_name : TFLAG
var_desc : Timestep-valid flags: (1) YYYYDDD or (2) HHMMSS

  integer NA_1 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_1
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  integer NA_2 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_2
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  integer NA_3 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_3
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  integer NA_4 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_4
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  integer NA_5 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_5
     units :        none
     var_desc :     1==mask region, 0==outside-mask region



  integer NA_6 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_6
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  integer NA_7 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_7
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  integer NA_8 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_8
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  integer NA_9 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_9
     units :        none
     var_desc :     1==mask region, 0==outside-mask region

There is only one grid cell in each of my region.




Hi Yukui,

thanks for this additional information.

While I donā€™t know if this causes your problem, the variables used to indicate the region masks should be of type real to represent fractions between 0 and 1, not integers. I donā€™t know how type conversions are handled when a variable is declared as real in CMAQ but defined as integer in the I/OAPI input file, but you might want to modify your CMAQ_MASK file to store NA_1, NA_2, etc. as real values and try again.

Similarly, I noticed that some of the file attributes in your file (e.g. P_ALP, P_BET etc.) appear to show integer rather than real values, assuming that what you posted is the output of ncdump. I donā€™t know if you used the I/O API Fortran library to generate the file, but if you did, that portion of the file header would typically look this:

            :P_ALP = 33. ;
            :P_BET = 45. ;
            :P_GAM = -97. ;
            :XCENT = -97. ;
            :YCENT = 40. ;
            :XORIG = -2556000. ;
            :YORIG = -1728000. ;
            :XCELL = 12000. ;
            :YCELL = 12000. ;
            :VGTYP = -9999 ;
            :VGTOP = -9.e+36f ;
            :VGLVLS = 0.f, 0.f ;

Christian

I donā€™t know how type conversions are handled when a variable is declared as real in CMAQ but defined as integer in the I/OAPI input file

There are no conversions: what you will get is bit-patterns 0 or 1, being interpreted as REALs ā€“ which means either REAL zero or REAL denormal, respectively.

Thanks for the information Christian and cjcoats. I used ioapi m3mask to made my CMAQ_MASK file. But according to m3mask, " Reads ASCII mask-data, specified by a file MASKDATA with lines containing either the columns and rows or the latitudes and longitudes, respectively, for the mask being specified, with one line per grid cell, and creates a GRIDDED output file MASKFILE , on the grid specified by LLFILE . MASKFILE contains one INTEGER variable MASK " The output of the m3mask variable is integer. And I donā€™t know how to convert the variable type of the file. Would you give me some suggestions? Thank you.

Here is one thing you could try, but Iā€™ll add two disclaimers:

  • I have not tried this myself
  • Generally, the safest way to manipulate I/O API files would be with the I/O API Fortran interface, i.e. read in the NA_1, NA_2, ā€¦ NA_9 variables with READ3 into integer arrays, copy them to real arrays, define a new file where the variables are M3REAL, and then write them out to this new file using WRITE3
  1. Use ncdump to create a text file, i.e. ncdump CMAQ_MASK >! CMAQ_MASK.cdl
  2. Use a text editor to open CMAQ_MASK.cdl and edit the variable descriptions for NA_1, NA_2, etc. from integer to float, i.e. change ā€œinteger NA_1ā€ to ā€œfloat NA_1ā€, ā€œinteger NA_2ā€ to ā€œfloat NA_2ā€, etc.
  3. Use ncgen with the edited text file to create a new CMAQ_MASK file, i.e. ncgen -o CMAQ_MASK_NEW CMAQ_MASK.cdl where CMAQ_MASK.cdl is the edited text file

Hi Yukui,
I had succcessfully run CMAQ_ISAM with CMAQ_MASK file.
My ASCII file came from shpfile and transformed by ArcGIS.Then I used fortran with IOAPI interface to create the CMAQ_MASK file as:

And hereā€™s my variable descriptions:

C.W.Huang

Thanks hogrefe.christian, cjcoats, C.W.Huang. I follow hogrefe.christianā€™s suggestion and recreate my CMAQ_MASK file. The header of my CMAQ_MASK file:
filename: MASKFILE_MERGE_US_NEW
path: MASKFILE_MERGE_US_NEW.nc
file global attributes:
IOAPI_VERSION : ioapi-3.2: Id: init3.F90 120 2019-06-21 14:18:20Z coats
EXEC_ID : ???

  FTYPE : 1
  CDATE : 2020119
  CTIME : 531
  WDATE : 2020119
  WTIME : 531
  SDATE : 0
  STIME : 0
  TSTEP : 0
  NTHIK : 1
  NCOLS : 396
  NROWS : 246
  NLAYS : 1
  NVARS : 9
  GDTYP : 2
  P_ALP :   33
  P_BET :   45
  P_GAM :  -97
  XCENT :  -97
  YCENT :   40
  XORIG : -2412000
  YORIG : -1620000
  XCELL : 12000
  YCELL : 12000
  VGTYP : 7
  VGTOP : 5000
  VGLVLS : (  1, 0.9975 )
  GDNAM : GRIDOUT_12US2_CR
  UPNAM : M3MERGE
  VAR-LIST : NA_1            NA_2            NA_3            NA_4

NA_5 NA_6 NA_7 NA_8 NA_9

  FILEDESC : US EPA COMMUNITY MULTISCALE AIR QUALITY MODEL
               METEOROLOGY-CHEMISTRY INTERFACE PROCESSOR

ā€¦skipping one line
HISTORY :
dimensions:
TSTEP = 1
DATE-TIME = 2
LAY = 1
VAR = 9
ROW = 246
COL = 396
variables:
integer TFLAG ( TSTEP, VAR, DATE-TIME )
units : <YYYYDDD,HHMMSS>
long_name : TFLAG
var_desc : Timestep-valid flags: (1) YYYYDDD or (2) HHMMSS

  float NA_1 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_1
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  float NA_2 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_2
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  float NA_3 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_3
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  float NA_4 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_4
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  float NA_5 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_5
     units :        none
     var_desc :     1==mask region, 0==outside-mask region

ā€¦skipping one line
float NA_6 ( TSTEP, LAY, ROW, COL )
long_name : NA_6
units : none
var_desc : 1==mask region, 0==outside-mask region

  float NA_7 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_7
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  float NA_8 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_8
     units :        none
     var_desc :     1==mask region, 0==outside-mask region


  float NA_9 ( TSTEP, LAY, ROW, COL )
     long_name :    NA_9
     units :        none
     var_desc :     1==mask region, 0==outside-mask region

But it seems when it run for nearly one month. My CMAQ_MASK file changed. I want to see the head of the MASK file. But seems I cannot.

[yul18051@cn01 IWDW_data]$ ncl

Copyright Ā© 1995-2014 - All Rights Reserved

University Corporation for Atmospheric Research

NCAR Command Language Version 6.2.1

The use of this software is governed by a License Agreement.

See http://www.ncl.ucar.edu/ for more details.

ncl 0> f = addfile(ā€œMASKFILE_MERGE_US_NEW.ncā€,ā€œrā€)

fatal:[ā€œFileSupport.cā€:3605]:_NclFindFileExt: Requested file <MASKFILE_MERGE_US_NEW.nc> or <MASKFILE_MERGE_US_NEW> does not exist.

Would it change the CMAQ_MASK file when running ISAM? I donā€™t get the result I expect, neither. My source apportionment result should be in high SA conc. near the source grid and low SA conc. away from the source grid. But itā€™s not. Would you help me to find out the problem? Would it be the reason the ISAM run may change my CMAQ_MASK file or Would it be the reason my source region is only one grid cell and one grid cell is too small to do the source apportionment?

Thank you.

Hi Yukui,

thank you for reporting back. I have a few comments and questions:

  • No, CMAQ ISAM should not, and in our experience does not, alter the CMAQ_MASK file in any way since it is treated as input file. If something in the run script removed the file from the system after running for nearly a month, CMAQ ISAM should crash. If the file still exists on the system and CMAQ ISAM can find and use it, ncl should be able to open it, too. Can you view the file with ncdump, and if so, does the header look different from what you had created?

  • In your previous run, you reported that in ā€œSA_ACONC and SA_CONC output files across all grid cells and output time steps, the data do shows O3_ICON = O3_GR1 = O3_GR2 = ā€¦ O3_GR9ā€. For the new run, you report that ā€œI donā€™t get the result I expect, neither. My source apportionment result should be in high SA conc. near the source grid and low SA conc. away from the source grid. But itā€™s notā€. Could you provide more details on the patterns you are seeing in your new run? Is it still the same behavior as in your old runs, or something different? Are the different tags still identical or do they show at least some small differences? In general, defining a source region thatā€™s a single grid cell should not be a problem, but the current code may have limitations that obscure the signal from such isolated emission sources.

Thank you Hogrefe.Christian. The result is not totally identical. But after running for one month, it seems very close or even identical again. At first, the result is much more reasonable even itā€™s still not like what I expect.
My expectation is

  1. ![image|549x500] (upload://tr3XD9ri6YyIFs5oa8i9IOkUsX1.png)

  2. But my result is

Thanks. Is the first image you posted based on some inert tracer result with a source in the grid cell you defined as ISAM region?

To test whether the unexpected patterns happen because of limitations with the current ISAM code as it relates to secondary gas phase species or persisting problems with the CMAQ_MASK file, you could re-do these simulations with changing the ā€œtag classā€ from ā€œOZONEā€ to ā€œECā€ in your isam_control.txt file. For this primary species, the limitations of the current code should be less pronounced when applied to a very small source region such as yours.

We do hope to release the updated CMAQ ISAM code within the next month or so, but unfortunately I cannot provide a definitive timeline at the moment.

Thank you Hogrefe.Christian. The expected is the CAMx OSAT run result I have with the same source apportionment run setting. I will try to do ā€œtag classā€ as ā€œECā€. Thanks.

Hello YukuiLi, I recently learned how to make GRIDMASK files. I successfully generated the nc file with the M3MASK tool, but I am now very puzzled that the generated nc file has a variable in value, and the variable is the default MASK. What can I use How to change the variable name. There is only one variable in the script generated by running the script once, and there are many variables in your file. How is this generated?This is the header information of the nc file I generated

@YukuiLi - It looks like you reposted this question, and it was answered on the following issue. CMAQV5.3 ISAM Region not found