# netCDF error in reading file

**URL:** <https://forum.cmascenter.org/t/netcdf-error-in-reading-file/4192>\
**Category:** CMAQ\
**Created:** [June 22, 2023, 7:01pm UTC](https://forum.cmascenter.org/t/netcdf-error-in-reading-file/4192 "2023-06-22T19:01:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![haohe.umcp](https://avatars.discourse-cdn.com/v4/letter/h/b19c9b/32.png) [@haohe.umcp](https://forum.cmascenter.org/u/haohe.umcp)\
**Post date:** [June 22, 2023, 7:01pm UTC](https://forum.cmascenter.org/t/netcdf-error-in-reading-file/4192/1 "2023-06-22T19:01:10Z")

</div>

```auto
Dear all, I'm running CMAQ v5.3.3 with gcc 9.4.0. The emissions are 2016 v1 12US1 with the 12US1 meteorology. The model stopped at reading the ocean file and point-source emissions (see the attached log file). I checked the files, they look reasonable. For instance, the ocean input file 12US1_surf.ncf was download from EPA ftp site. Any possible reason that CMAQ can not read these netCDF files? Thanks!

```

```auto
[CTM_LOG_001.v533_gcc_2016_CONUS_20151222.txt|attachment](upload://lktQvAWU5jgXqhETquootk1W1Cw.txt) (24.1 KB)

CMAQ v5.3.3, gcc 9.4.0

```

module list

```auto
1) hpcc/zaratan(default) 4) netcdf/gcc/9.4.0/openmpi/4.1.1/zen2/4.8.1
 2) gcc/9.4.0(default) 5) netcdf-fortran/gcc/9.4.0/openmpi/4.1.1/zen2/4.5.3
 3) openmpi/gcc/9.4.0/zen2/4.1.1 6) hdf5/gcc/9.4.0/openmpi/4.1.1/zen2/1.10.7

```

Place output from the above commands here.

```auto

```

---

<div class="post-metadata">

**Author:** ![lizadams](https://avatars.discourse-cdn.com/v4/letter/l/49beb7/32.png) [@lizadams](https://forum.cmascenter.org/u/lizadams)\
**Post date:** [June 22, 2023, 7:31pm UTC](https://forum.cmascenter.org/t/netcdf-error-in-reading-file/4192/2 "2023-06-22T19:31:36Z")

</div>

Hi Haohe,

I’ve increased the trust level for you, so that you can retry attaching your log file.

Thanks, Liz

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [June 22, 2023, 7:35pm UTC](https://forum.cmascenter.org/t/netcdf-error-in-reading-file/4192/3 "2023-06-22T19:35:06Z")

</div>

What do the commands _ncdump -h_ and _ncdump -k_ say about the files? and what netCDF error-number is reported? (You can find a list of these at [https://www.cmascenter.org/ioapi/documentation/all\_versions/html/ERRORS.html#ncf331](https://www.cmascenter.org/ioapi/documentation/all_versions/html/ERRORS.html#ncf331))

---

<div class="post-metadata">

**Author:** ![haohe.umcp](https://avatars.discourse-cdn.com/v4/letter/h/b19c9b/32.png) [@haohe.umcp](https://forum.cmascenter.org/u/haohe.umcp)\
**Post date:** [June 23, 2023, 1:59pm UTC](https://forum.cmascenter.org/t/netcdf-error-in-reading-file/4192/4 "2023-06-23T13:59:31Z")

</div>

Hi Liz, the nnetcdf error number is very helpful, thanks!

For the in-line emissions files, attached are the ncdump -h results. I didn’t find anything strange. The ncdump -k result is ‘classic’.  
[CTM\_LOG\_001.v533\_gcc\_2016\_CONUS\_20151222.txt](https://forum.cmascenter.org/uploads/short-url/lktQvAWU5jgXqhETquootk1W1Cw.txt) (24.1 KB)  
[inln\_ptnonipm.txt](https://forum.cmascenter.org/uploads/short-url/hIrVFKN02ots8ywfUCqLFNODgnz.txt) (20.4 KB)

For the 12US1\_surf.ncf file, below is the ncdump -h result. The error number is 40, meaning ‘coordinates out of range’. I downloaded the file from the EPA website, no sure why it has this problem.

netcdf \12US1\_surf {  
dimensions:  
TSTEP = 1 ;  
DATE-TIME = 2 ;  
LAY = 1 ;  
VAR = 2 ;  
ROW = 299 ;  
COL = 459 ;  
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 " ;  
float OPEN(TSTEP, LAY, ROW, COL) ;  
OPEN:long\_name = "OPEN " ;  
OPEN:units = "UNKNOWN " ;  
OPEN:var\_desc = "OPEN " ;  
float SURF(TSTEP, LAY, ROW, COL) ;  
SURF:long\_name = "SURF " ;  
SURF:units = "UNKNOWN " ;  
SURF:var\_desc = "SURF " ;

// global attributes:  
:IOAPI\_VERSION = "Id: @(#) ioapi library version 3.0 " ;  
:EXEC\_ID = "??? " ;  
:FTYPE = 1 ;  
:CDATE = 2010067 ;  
:CTIME = 155535 ;  
:WDATE = 2010067 ;  
:WTIME = 155535 ;  
:SDATE = 0 ;  
:STIME = 0 ;  
:TSTEP = 0 ;  
:NTHIK = 1 ;  
:NCOLS = 459 ;  
:NROWS = 299 ;  
:NLAYS = 1 ;  
:NVARS = 2 ;  
:GDTYP = 2 ;  
:P\_ALP = 33. ;  
:P\_BET = 45. ;  
:P\_GAM = -97. ;  
:XCENT = -97. ;  
:YCENT = 40. ;  
:XORIG = -2556000. ;  
:YORIG = -1728000. ;  
:XCELL = 12000. ;  
:YCELL = 12000. ;  
:VGTYP = 1 ;  
:VGTOP = 100.f ;  
:VGLVLS = 1.f, 0.f ;  
:GDNAM = "12US1\_459X299 " ;  
:UPNAM = "CONVERT " ;  
:VAR-LIST = "OPEN SURF " ;  
:VAR-LIST = "OPEN SURF " ;  
:FILEDESC = " $  
:HISTORY = “” ;  
}

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [June 23, 2023, 2:10pm UTC](https://forum.cmascenter.org/t/netcdf-error-in-reading-file/4192/5 "2023-06-23T14:10:33Z")

</div>

Have another look at the log-messages from opening these files, and at the date&time requested:

> ```
> "STK_EMIS_001" opened as OLD:READ-ONLY   
> ...
> Starting date and time 2015340:000000 (0:00:00 Dec. 6, 2015)
> Timestep 010000 (1:00:00 hh:mm:ss)
> Maximum current record number 25
> 
> ```

contains 25 hours of data starting Dec. 6, 2015

> ```
> "STK_EMIS_002" opened as OLD:READ-ONLY   
> ...
> Starting date and time 2015356:000000 (0:00:00 Dec. 22, 2015)
> Timestep 010000 (1:00:00 hh:mm:ss)
> Maximum current record number 25
> 
> ```

contains 25 hours of data starting Dec. 22, 2015. which is the date&time of the read-failure:

> ```
> >>--->> WARNING in subroutine RDTFLAG
> Error reading netCDF time step flag for STK_EMIS_001
> M3WARN: DTBUF 0:00:00 Dec. 22, 2015 (2015356:000000)
> 
> ```

Oops!

---

<div class="post-metadata">

**Author:** ![haohe.umcp](https://avatars.discourse-cdn.com/v4/letter/h/b19c9b/32.png) [@haohe.umcp](https://forum.cmascenter.org/u/haohe.umcp)\
**Post date:** [June 23, 2023, 3:22pm UTC](https://forum.cmascenter.org/t/netcdf-error-in-reading-file/4192/6 "2023-06-23T15:22:47Z")

</div>

I understand it. SMOKE only generate few days of ptnonimp files to represent the whole month. Then the run script read ‘smk\_merge\_dates\_201512.txt’ file (attached at the end) to match the files. Here is my run script code:

setenv STK\_EMIS\_001 IN\_PTpath/ptnonipm/inln\_mole\_ptnonipm\_{mwdss\_Y}_${STKCASEE}.ncf setenv STK\_EMIS\_002 IN\_PTpath/ptegu/inln\_mole\_ptegu\_{YYYYMMDD}_${STKCASEE}.ncf  
setenv STK\_EMIS\_003 IN\_PTpath/othpt/inln\_mole\_othpt\_{mwdss\_N}\_${STKCASEE}.ncf

I have used this type of similar script for lots of runs. I don’t know why this time it does not work.

login-2.zaratan.umd.edu{haohe}290: cat smk\_merge\_dates\_201512.txt  
Date, aveday\_N, aveday\_Y, mwdss\_N, mwdss\_Y, week\_N, week\_Y, all  
20151201, 20151206, 20151206, 20151206, 20151206, 20151208, 20151208, 20151201  
20151202, 20151206, 20151206, 20151206, 20151206, 20151209, 20151209, 20151202  
20151203, 20151206, 20151206, 20151210, 20151210, 20151210, 20151210, 20151203  
20151204, 20151206, 20151206, 20151211, 20151211, 20151211, 20151211, 20151204  
20151205, 20151206, 20151206, 20151205, 20151205, 20151205, 20151205, 20151205  
20151206, 20151206, 20151206, 20151206, 20151206, 20151206, 20151206, 20151206  
20151207, 20151206, 20151206, 20151206, 20151206, 20151207, 20151207, 20151207  
20151208, 20151206, 20151206, 20151206, 20151206, 20151208, 20151208, 20151208  
20151209, 20151206, 20151206, 20151206, 20151206, 20151209, 20151209, 20151209  
20151210, 20151206, 20151206, 20151210, 20151210, 20151210, 20151210, 20151210  
20151211, 20151206, 20151206, 20151211, 20151211, 20151211, 20151211, 20151211  
20151212, 20151206, 20151206, 20151205, 20151205, 20151205, 20151205, 20151212  
20151213, 20151206, 20151206, 20151206, 20151206, 20151206, 20151206, 20151213  
20151214, 20151206, 20151206, 20151206, 20151206, 20151207, 20151207, 20151214  
20151215, 20151206, 20151206, 20151206, 20151206, 20151208, 20151208, 20151215  
20151216, 20151206, 20151206, 20151206, 20151206, 20151209, 20151209, 20151216  
20151217, 20151206, 20151206, 20151210, 20151210, 20151210, 20151210, 20151217  
20151218, 20151206, 20151206, 20151211, 20151211, 20151211, 20151211, 20151218  
20151219, 20151206, 20151206, 20151205, 20151205, 20151205, 20151205, 20151219  
20151220, 20151206, 20151206, 20151206, 20151206, 20151206, 20151206, 20151220  
20151221, 20151206, 20151206, 20151206, 20151206, 20151207, 20151207, 20151221  
20151222, 20151206, 20151206, 20151206, 20151206, 20151208, 20151208, 20151222  
20151223, 20151206, 20151206, 20151206, 20151206, 20151209, 20151209, 20151223  
20151224, 20151206, 20151224, 20151210, 20151224, 20151210, 20151224, 20151224  
20151225, 20151206, 20151225, 20151211, 20151225, 20151211, 20151225, 20151225  
20151226, 20151206, 20151226, 20151205, 20151226, 20151205, 20151226, 20151226  
20151227, 20151206, 20151206, 20151206, 20151206, 20151206, 20151206, 20151227  
20151228, 20151206, 20151206, 20151206, 20151206, 20151207, 20151207, 20151228  
20151229, 20151206, 20151206, 20151206, 20151206, 20151208, 20151208, 20151229  
20151230, 20151206, 20151206, 20151206, 20151206, 20151209, 20151209, 20151230  
20151231, 20151206, 20151206, 20151210, 20151210, 20151210, 20151210, 20151231

---

<div class="post-metadata">

**Author:** ![cgnolte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.cmascenter.org/cgnolte/32/53_2.png) [@cgnolte](https://forum.cmascenter.org/u/cgnolte)\
**Post date:** [June 23, 2023, 4:21pm UTC](https://forum.cmascenter.org/t/netcdf-error-in-reading-file/4192/7 "2023-06-23T16:21:04Z")

</div>

The ptnonipm point source sector uses representative days. There is an environment variable `STK_EM_SYM_DATE_001` that should be set to T for the ptnonipm sector (assuming PT\_NONEGU is point source sector #1).

See the discussion around `STK_EM_SYM_DATE` in section 6.9.1 of the [User Guide](https://github.com/USEPA/CMAQ/blob/main/DOCS/Users_Guide/CMAQ_UG_ch06_model_configuration_options.md#inline-stream-offline).

---

<div class="post-metadata">

**Author:** ![haohe.umcp](https://avatars.discourse-cdn.com/v4/letter/h/b19c9b/32.png) [@haohe.umcp](https://forum.cmascenter.org/u/haohe.umcp)\
**Post date:** [June 23, 2023, 4:36pm UTC](https://forum.cmascenter.org/t/netcdf-error-in-reading-file/4192/8 "2023-06-23T16:36:53Z")

</div>

That fixed the problem! Thanks a lot.
