# Error while time-shifting NHEMI\_201906c file

**URL:** <https://forum.cmascenter.org/t/error-while-time-shifting-nhemi-201906c-file/4659>\
**Category:** I/O API\
**Created:** [January 25, 2024, 1:19am UTC](https://forum.cmascenter.org/t/error-while-time-shifting-nhemi-201906c-file/4659 "2024-01-25T01:19:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![afernandez](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@afernandez](https://forum.cmascenter.org/u/afernandez)\
**Post date:** [January 25, 2024, 1:19am UTC](https://forum.cmascenter.org/t/error-while-time-shifting-nhemi-201906c-file/4659/1 "2024-01-25T01:19:48Z")

</div>

Hello,  
Trying to time-shift CCTM\_CONC\_v532\_intel18.0\_CMAQv53\_TS\_108NHEMI\_201906\_dailyav.nc is generating the following output/error:

> $ ./run\_tshift.sh
> 
> ```
> 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.8.1 of Sep 29 2021 09:36:14 $
> 
> Missing environment variable EXECUTION_ID
> 
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> 
> Program M3TSHIFT to copy a selected time period from a Models-3 file
> to a different time period in a different Models-3 file.
> 
> You need to have set environment variables for the input and output
> file logical names. You will be asked to select the time period to be
> copied and the start of the time period to receive the results.
> Note that RUNLEN=0 for single-step runs (a "fencepost" problem)
> 
> USAGE: m3tproc [INFILE OUTFILE] (and then answer the prompts).
> 
> See URL
> 
> https://www.cmascenter.org/ioapi/documentation/3.1/html/AA.html#tools
> 
> Program copyright (C) 1992-2002 MCNC, (C) 1995-2013 Carlie J. Coats, Jr.
> (C) 2002-2010 Baron Advanced Meteorological Systems, LLC., and
> (C) 2014-2016 UNC Institute for the Environment.
> Released under Version 2 of the GNU General Public License. See
> enclosed GPL.txt, or URL
> 
> https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
> 
> Comments and questions are welcome and can be sent to
> 
> Carlie J. Coats, Jr. carlie@jyarborough.com
> or
> UNC Institute for the Environment
> 100 Europa Dr., Suite 490 Rm 405
> Campus Box 1105
> Chapel Hill, NC 27599-1105
> 
> Program version:
> $Id: m3tshift.f90 117 2019-06-15 14:56:29Z coats $
> 
> Value for PROMPTFLAG not defined;returning default: TRUE
> Enter INPUT FILE name [INFILE] >> Value for IOAPI_CHECK_HEADERS not defined;returning default: FALSE
> 
> "INFILE" opened as OLD:READ-ONLY
> File name "/home/ubuntu/CMAQ/SEASONAL/CCTM_CONC_v532_intel18.0_CMAQv53_TS_108NHEMI_201906_dailyav.nc"
> File type GRDDED3
> Execution ID "????????????????"
> Grid name "108NHEMI"
> Dimensions: 187 rows, 187 cols, 44 lays, 260 vbles
> NetCDF ID: 65536 opened as READONLY
> Starting date and time 2019152:000000 (0:00:00 June 1, 2019)
> Timestep 240000 (24:00:00 hh:mm:ss)
> Maximum current record number 31
> Value for PROMPTFLAG not defined;returning default: TRUE
> Enter starting (source) date (YYYYDDD) for run [2019152] >>
> >>> RESPONSE ERROR <<<
> 
> Your response 2015289 not in the range 2019152 ... 9999999
> This is error 1 of 5 errors allowed
> Please try again.
> 
> Enter starting (source) date (YYYYDDD) for run [2019152] >>
> >>> RESPONSE ERROR <<<
> 
> Your response 120000 not in the range 2019152 ... 9999999
> This is error 2 of 5 errors allowed
> Please try again.
> 
> Enter starting (source) date (YYYYDDD) for run [2019152] >> Using response 2022289
> Enter starting (source) time (HHMMSS) for run [0] >> Using response 120000
> Enter target date (YYYYDDD) for run [2019152] >>
> >>> RESPONSE ERROR <<<
> 
> Your response ******* not in the range 0 ... 9999999
> This is error 1 of 5 errors allowed
> Please try again.
> 
> Enter target date (YYYYDDD) for run [2019152] >>
> >>> RESPONSE ERROR <<<
> 
> Your response ******* not in the range 0 ... 9999999
> This is error 2 of 5 errors allowed
> Please try again.
> 
> Enter target date (YYYYDDD) for run [2019152] >>
> >>> RESPONSE ERROR <<<
> 
> Did not understand your response
> This is error 3 of 5 errors allowed
> Please try again.
> 
> Enter target date (YYYYDDD) for run [2019152] >>
> *** ERROR ABORT in subroutine M3PROMPT
> END-OF-FILE encountered
> 
> ```

The error seems to be generated by m3tshift (this is why I’m posting it in the I/OAPI forum). The error did not occur when time-shifting CCTM\_CONC\_v53beta2\_intel17.0\_HEMIS\_cb6r3m\_ae7\_kmtbr\_m3dry\_2023\_quarterly\_av.nc.  
Thanks.

---

<div class="post-metadata">

**Author:** ![hogrefe.christian](https://avatars.discourse-cdn.com/v4/letter/h/74df32/32.png) [@hogrefe.christian](https://forum.cmascenter.org/u/hogrefe.christian)\
**Post date:** [January 25, 2024, 2:14pm UTC](https://forum.cmascenter.org/t/error-while-time-shifting-nhemi-201906c-file/4659/2 "2024-01-25T14:14:04Z")

</div>

Before running m3tools programs like m3tshift through a script, it is recommended to first run it interactively and respond to each prompt.

While you did not post your script so we cannot look closer at how it needs to be modified, it is clear from the error messages you posted that your script is not providing the correct input to the prompts issued by m3shift. Running m3tshift interactively, you’ll see that the sequence of prompts is 1) logical name of input file, 2) first date in the input file you want to shift FROM, 3) first time in the input file you want to shift FROM, 4) date you want the date selected under 2) to be shifted to (to be written to the output file), 5) time you want the date selected under 3) to be shifted to (to be written to the output file), 6) time step you want to be used in the output file, 7) number of time steps you want to be written to the output file, and 8) logical file name of the output file.

File CCTM\_CONC\_v532\_intel18.0\_CMAQv53\_TS\_108NHEMI\_201906\_dailyav.nc contains 30 daily values for June 2019 and has a start time of 0, so your response to 2) needs to fall between 2019152 and 2019181, and of course your number of desired time steps needs to be equal or less than 30 depending on your selection under 2).

---

<div class="post-metadata">

**Author:** ![afernandez](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@afernandez](https://forum.cmascenter.org/u/afernandez)\
**Post date:** [January 25, 2024, 5:27pm UTC](https://forum.cmascenter.org/t/error-while-time-shifting-nhemi-201906c-file/4659/3 "2024-01-25T17:27:32Z")

</div>

Hi Christian,  
You’re right. Yesterday evening I had completely forgotten that run\_tshift is not a part of the CMAQ official repository (somehow I incorrectly assumed that it had similar status as run\_icon or run\_bcon). Of course, the problem was M3TSHIFT not picking up the right dates and I now see that this is not done automatically but must be input manually in the script. With the due modification, it ran w/o problem.  
Thanks.  
P.S. Trying to use M3TSHIFT interactively does not work for me. Somehow, it always crops the name of the input file to 18 characters (don’t know why, maybe it’s the system configuration)

---

<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:** [January 25, 2024, 5:34pm UTC](https://forum.cmascenter.org/t/error-while-time-shifting-nhemi-201906c-file/4659/4 "2024-01-25T17:34:17Z")

</div>

> …always crops the name of the input file to 18 characters…

It’s not the system-configuration, it’s the system-guts.  
See [https://cjcoats.github.io/ioapi/LOGICALS.html](https://cjcoats.github.io/ioapi/LOGICALS.html)

---

<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:** [January 26, 2024, 1:27pm UTC](https://forum.cmascenter.org/t/error-while-time-shifting-nhemi-201906c-file/4659/5 "2024-01-26T13:27:00Z")

</div>

@afernandez The environment variable is restricted to 16 characters or less, but those environment variables can be set to a path+filename that is much longer than 16 characters. I’m not sure what the limit is for the length of the value of an environment variable, but I have never exceeded it.  
Running interactively, you need something like:  
`setenv INFILE /path/to/your/file/filename.nc`

Then you invoke the program interactively using  
`m3tshift $INFILE`

---

<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:** [January 26, 2024, 1:33pm UTC](https://forum.cmascenter.org/t/error-while-time-shifting-nhemi-201906c-file/4659/6 "2024-01-26T13:33:08Z")

</div>

POSIX specifies that you must support at least 512 (and allows the OS vendor to support more); the I/O API supports the usual Linux max of 65535. Such a large internal I/O API limit is very handy for routines like [`STRLIST()`](https://cjcoats.github.io/ioapi/LISTS.html)
