# Error while using m3interp

**URL:** <https://forum.cmascenter.org/t/error-while-using-m3interp/1529>\
**Category:** I/O API\
**Created:** [May 29, 2020, 4:57am UTC](https://forum.cmascenter.org/t/error-while-using-m3interp/1529 "2020-05-29T04:57:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![skunwar](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@skunwar](https://forum.cmascenter.org/u/skunwar)\
**Post date:** [May 29, 2020, 4:57am UTC](https://forum.cmascenter.org/t/error-while-using-m3interp/1529/1 "2020-05-29T04:57:09Z")

</div>

Hi @cjcoats, I was wondering if you could check what could have caused the problem with using m3interp to interpolate 6-hr BC files to 3-hr BC files:

```
 "INFILE" opened as OLD:READ-ONLY
 File name "temp_2_file_with_remaining_time.ncf"
 File type BNDARY3
 Execution ID "????????????????"
 Grid name "12US2_CROSS"
 Dimensions: 246 rows, 396 cols, 34 lays, 53 vbles, 1 cells thick
 NetCDF ID: 65536 opened as READONLY
 Starting date and time 2014002:030000 (3:00:00 Jan. 2, 2014)
 Timestep 060000 (6:00:00 hh:mm:ss)
 Maximum current record number 37

 If you wish to copy time steps (keeping the output grid the
 same) instead of interpolating them to a new output grid,
 respond "SAME" to the prompt for output grid name.
 Otherwise, give the GRIDDESC name for the output grid.

 Value for PROMPTFLAG not defined;returning default: TRUE
 Enter output grid name, or "SAME" ["SAME"] >>
 Using default "SAME"
 Value for PROMPTFLAG not defined;returning default: TRUE
 Enter STARTING DATE for time step sequence [2014002] >>
 Using default 2014002
 Enter STARTING TIME for time step sequence [30000] >>
 Using default 30000
 Enter TIME STEP for time step sequence [60000] >>30000
 Using response 30000
 Enter NRECS for time step sequence [73] >>
 Using default 73
 Enter name for output data file ["OUTFILE"] >>
 Using default "OUTFILE"

 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'

 "OUTFILE" opened as UNKNOWN(R-W)
 File name "temp_3_file_with_remaining_time_in_3hr_intervals.ncf"
 File type BNDARY3
 Execution ID "????????????????"
 Grid name "12US2_CROSS"
 Dimensions: 246 rows, 396 cols, 34 lays, 53 vbles, 1 cells thick
 NetCDF ID: 131072 opened as READWRITE
 Starting date and time 2014002:030000 (3:00:00 Jan. 2, 2014)
 Timestep 030000 (3:00:00 hh:mm:ss)
 Maximum current record number 0

 Processing 2014002:030000

 >>--->> WARNING in subroutine M3INTERP:INTERP3
 Size error for NO from INFILE--REQ:3312144 ACT: 43792
 M3WARN: DTBUF 3:00:00 Jan. 2, 2014 (2014002:030000)

 *** ERROR ABORT in subroutine M3INTERP
 Failure reading variable "NO" from file "INFILE"
 Date and time 3:00:00 Jan. 2, 2014 (2014002:030000)

```

NO is the first variable in INFILE but I don’t know why it could not be read at the very first timestamp 2014002:30000

---

<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:** [May 29, 2020, 10:43am UTC](https://forum.cmascenter.org/t/error-while-using-m3interp/1529/2 "2020-05-29T10:43:18Z")

</div>

Curious.

`NSIZE1 = NCOLS1*NROWS1*NLAYS1` is calculated at line 258 of _m3interp.f_ and should be (according to your log) 3312144 at that point, and it is then being used at line 528 without having been changed – but INTERP3 is saying that it is 43792 inside the call at that line. I don’t understand how it could have been corrupted, but it seems to be…

---

<div class="post-metadata">

**Author:** ![skunwar](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@skunwar](https://forum.cmascenter.org/u/skunwar)\
**Post date:** [May 29, 2020, 2:17pm UTC](https://forum.cmascenter.org/t/error-while-using-m3interp/1529/3 "2020-05-29T14:17:33Z")

</div>

The BC file which I intend to interpolate has `PERIM = 1288` and `NLAYS = 34`, so `# of BC CELLS = PERIM*NLAYS=1288*34=43792`. The `NSIZE1=3312144` is for the 2D gridded file which the BC file ‘surrounds’ on the south, east, north and west.

---

<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:** [May 29, 2020, 4:28pm UTC](https://forum.cmascenter.org/t/error-while-using-m3interp/1529/4 "2020-05-29T16:28:07Z")

</div>

Congratulations! You’ve found a bug: in the past, _m3interp_ has always been used with gridded files, not with boundary-condition files, so this one has slipped past the testing.

It is now fixed and documented, and the fixes have been uploaded to both the GitHub and the CMAS web-sites.

– Carlie

---

<div class="post-metadata">

**Author:** ![skunwar](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@skunwar](https://forum.cmascenter.org/u/skunwar)\
**Post date:** [May 29, 2020, 8:24pm UTC](https://forum.cmascenter.org/t/error-while-using-m3interp/1529/5 "2020-05-29T20:24:54Z")

</div>

Thanks for updating! I am getting the same error though, with the new I/O API library installation using github clone!

```
 Program version:
 $Id:: m3interp.f 166 2020-05-29 15:55:46Z coats $

 Value for PROMPTFLAG not defined;returning default: TRUE
 Continue with program? (Y/N) [Y] >>
 Returning default value TRUE for query:
 "Continue with program?"

 Value for PROMPTFLAG not defined;returning default: TRUE
 Enter name for input synch file, or "NONE" [NONE] >>
 Enter name for input data file [INFILE] >>
 Value for IOAPI_CHECK_HEADERS not defined;returning default: FALSE

 "INFILE" opened as OLD:READ-ONLY
 File name "temp_2_file_with_remaining_time.ncf"
 File type BNDARY3
 Execution ID "????????????????"
 Grid name "12US2_CROSS"
 Dimensions: 246 rows, 396 cols, 34 lays, 53 vbles, 1 cells thick
 NetCDF ID: 65536 opened as READONLY
 Starting date and time 2014002:030000 (3:00:00 Jan. 2, 2014)
 Timestep 060000 (6:00:00 hh:mm:ss)
 Maximum current record number 37

 If you wish to copy time steps (keeping the output grid the
 same) instead of interpolating them to a new output grid,
 respond "SAME" to the prompt for output grid name.
 Otherwise, give the GRIDDESC name for the output grid.

 Value for PROMPTFLAG not defined;returning default: TRUE
 Enter output grid name, or "SAME" ["SAME"] >>
 Using default "SAME"
 Value for PROMPTFLAG not defined;returning default: TRUE
 Enter STARTING DATE for time step sequence [2014002] >>
 Using default 2014002
 Enter STARTING TIME for time step sequence [30000] >>
 Using default 30000
 Enter TIME STEP for time step sequence [60000] >>30000
 Using response 30000
 Enter NRECS for time step sequence [73] >>
 Using default 73
 Enter name for output data file ["OUTFILE"] >>
 Using default "OUTFILE"

 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'

 "OUTFILE" opened as UNKNOWN(R-W)
 File name "temp_3_file_with_remaining_time_in_3hr_intervals.ncf"
 File type BNDARY3
 Execution ID "????????????????"
 Grid name "12US2_CROSS"
 Dimensions: 246 rows, 396 cols, 34 lays, 53 vbles, 1 cells thick
 NetCDF ID: 131072 opened as READWRITE
 Starting date and time 2014002:030000 (3:00:00 Jan. 2, 2014)
 Timestep 030000 (3:00:00 hh:mm:ss)
 Maximum current record number 0

 Processing 2014002:030000

 >>--->> WARNING in subroutine M3INTERP:INTERP3
 Size error for NO from INFILE--REQ: 21896 ACT: 43792
 M3WARN: DTBUF 3:00:00 Jan. 2, 2014 (2014002:030000)

 *** ERROR ABORT in subroutine M3INTERP
 Failure reading variable "NO" from file "INFILE"
 Date and time 3:00:00 Jan. 2, 2014 (2014002:030000)

```

I am not sure why the error is showing!

---

<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:** [May 29, 2020, 9:05pm UTC](https://forum.cmascenter.org/t/error-while-using-m3interp/1529/6 "2020-05-29T21:05:25Z")

</div>

My bad. Quick fix:  
Line 264 should have  
`NSIZE1 = 2*N*NTHIK3D*NLAYS1`  
and line 333 should have  
`SIZE = 2*NTHIK3D*( NCOLS3D + NROWS3D + 2*NTHIK3D )`  
and re-build. Will fix the repositories tomorrow…

---

<div class="post-metadata">

**Author:** ![skunwar](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@skunwar](https://forum.cmascenter.org/u/skunwar)\
**Post date:** [May 29, 2020, 9:26pm UTC](https://forum.cmascenter.org/t/error-while-using-m3interp/1529/7 "2020-05-29T21:26:46Z")

</div>

Works now - thanks a lot for your prompt answers!
