How to Combine CCTM for all layers?

Dear all,
I’m using CMAQ-combine to process CMAQ output files, and I want to combine output all layers. In the Species definition file, I have changed ‘#layer 1’ to ‘!#layer 1’, but I only got 1 layer. How can I solve this problem?
Look forward to and thank you for your guidance.

Some information of the log file is shown as follows :
slight_smile: Missing environment variable EXECUTION_ID
API Started
Value for IOAPI_ISPH not defined; returning defaultval ': ‘20’
Value for IOAPI_ISPH not defined; returning defaultval ': ‘20’
WARNING IOAPI_ISPH not set in script, using 20 (WRF-ARW sphere)
Value for IOAPI_CHECK_HEADERS not defined;returning default: FALSE

 "INFILE1" opened as OLD:READ-ONLY   
 File name "/home/ltt/CMAQ/CMAQv5.3/data/chq202101-BEM3-03d/cctm/CCTM_DRYDEP_v533_gcc_chongqing_20210102.nc"
 File type GRDDED3 
 Execution ID "CMAQ_CCTMv533_ltt_20221109_150413_305590332"
 Grid name "chq202101-BEM3-0"
 Dimensions: 109 rows, 94 cols, 1 lays, 172 vbles
 NetCDF ID:     65536  opened as READONLY            
 Starting date and time  2021002:010000 (1:00:00   Jan. 2, 2021)
 Timestep                          010000 (1:00:00 hh:mm:ss)
 Maximum current record number        24
  
 "INFILE2" opened as OLD:READ-ONLY   
 File name "/home/ltt/CMAQ/CMAQv5.3/data/chq202101-BEM3-03d/cctm/CCTM_WETDEP1_v533_gcc_chongqing_20210102.nc"
 File type GRDDED3 
 Execution ID "CMAQ_CCTMv533_ltt_20221109_150413_305590332"
 Grid name "chq202101-BEM3-0"
 Dimensions: 109 rows, 94 cols, 1 lays, 141 vbles
 NetCDF ID:    131072  opened as READONLY            
 Starting date and time  2021002:010000 (1:00:00   Jan. 2, 2021)
 Timestep                          010000 (1:00:00 hh:mm:ss)
 Maximum current record number        24
  
 "INFILE3" opened as OLD:READ-ONLY   
 File name "/home/ltt/CMAQ/CMAQv5.3/data/chq202101-BEM3-03d/mcip/METCRO2D_2021002.nc"
 File type GRDDED3 
 Execution ID "mcip"
 Grid name "chq202101-BEM3_C"
 Dimensions: 109 rows, 94 cols, 1 lays, 35 vbles
 NetCDF ID:    196608  opened as READONLY            
 Starting date and time  2021002:000000 (0:00:00   Jan. 2, 2021)
 Timestep                          010000 (1:00:00 hh:mm:ss)
 Maximum current record number        25

WARNING File does not exist:
Value for GENSPEC: N returning FALSE
Value for ALLOW_BADVALUES not defined;returning default: FALSE

 Value for IOAPI_CHECK_HEADERS not defined;returning default:   FALSE
 
 >>--->> WARNING in subroutine OPEN3
 File already exists.
 
  
 "OUTFILE" opened as OLD:READ-WRITE  
 File name "/home/ltt/CMAQ/CMAQv5.3/data/chq202101-BEM3-03d/POST/COMBINE_DEP_v532_gcc_chq202101-BEM3-03d_20210102"
 File type GRDDED3 
 Execution ID "????????????????"
 Grid name "chq202101-BEM3-0"
 Dimensions: 109 rows, 94 cols, 1 lays, 102 vbles
 NetCDF ID:    262144  opened as READWRITE           
 Starting date and time  2021002:010000 (1:00:00   Jan. 2, 2021)
 Timestep                          010000 (1:00:00 hh:mm:ss)
 Maximum current record number        24

Processing starting at: 2021002 10000
ending at: 2021003 0

combine_log.txt (304.6 KB)
run_combine_daybyday.csh (6.6 KB)
SpecDef_cb6r3_ae6_aq.txt (15.4 KB)
SpecDef_Dep_cb6r3_ae6_aq.txt (9.4 KB)

Changing ‘#layer 1’ to ‘!#layer 1’ in the SpecDef file is necessary but not sufficient to obtain 3D output files from combine. The other requirement is for all input files to be 3D files and for the number of layers to match across all input files.

Changing ‘#layer 1’ to ‘!#layer 1’ merely instructs combine to use all layers from the input files (more precisely from the first input file which is used to define the grid structure of the output file, which is why it is important in this case for the number of layers to match across all input files), but if the input files only have 1 layer (as is the case for the example you posted, with DRYDEP, WETDEP1, and METCRO2D defined as inputs), the output will only have 1 layer, too.

As noted in the older thread in which you posted a related question, if you want to create a 3D file with concentrations (deposition is by definition a 2D variable, so there is no sense in trying to create a 3D deposition file, at least not using the traditional cartesian definition of 3D), you’ll need to update the run script to only define 3D files as input (i.e. CONC and METCRO3D, assuming your CONC files were created as 3D files with the number of layers matching METCRO3D, and potentially PMDIAG if you wrote it out as 3D file and the layers match, too) and also update the SpecDef file to only reference variables from these input files.

2 Likes

Dear @hogrefe.christian
Your suggestion is very useful to me. According to your guidance, the problem has been solved well. Thank you sincerely!
Ting

1 Like

could you share your run_cctm setting? I got the same problem after setting 3D output.

@hogrefe.christian I have tried to output all layer when running CCTM. However, when using comnbine.exe, I got variables with 34 layers, but the data in first hour of all variables have values and other hours are none.
run_combine.csh.txt (6.6 KB)
SpecDef_cb6r3_ae7_aq.txt (16.1 KB)
run_combine.log.txt (298.1 KB)

If you look at your log file, you’ll see that the expression
exp(118.87-24084/TEMP2[4]-6.025*log(TEMP2[4])) failed.

If you further check your log file, you’ll see that two of your input files (INFILE4 METCRO2D and INFILE5 GRIDCRO2D) have only 1 layer, not 34 layers. Therefore, computations invoking fields from those files will likely fail since values above layer 1 are undefined.

To successfully generate 3D output files, edit your SpecDef file and run script to only reference 3D input files and define equations only based on the variables present in these 3D files.