How to change the MCIP rounding?

I was using BCON to prepare a simulation but ran into a problem as it (ICON does the smae) has rounded XORIG from -903,125 to 903,000. My guess is that the issue is originated by the lines:

     &         /10X, 'XORIG = ', 1PE14.0  (at opn_ic_file.F)
94280 FORMAT( 10X, 'XORIG1 = ', 1PE12.0, '   XORIG', I1, ' = ', 1PE12.0 ) (at m3_ck_ctms.F)

I was wondering if someone could confirm my diagnosis and suggest how to modify these lines.

No, to my knowledge, neither ICON nor BCON apply any rounding to projection parameters in their internal calculations. Instead, they check for consistency of these parameters across input files and the GRIDDESC file. In case inconsistencies are found, diagnostic messages are written to the log file / screen output. The Fortran FORMAT statements you copied (at least the second one from m3_ck_ctms.F) are used to format such diagnostic messages. The underlying problem likely is caused by inconsistencies in projection parameters.

Could you please post the full log file that shows the problem you are experiencing when running BCON and ICON?

I do not get any error. However, and when I dump the files generated by either ICON or BCON, the attribute XORIG is set to -903,000 (when it should be -903,125). YORIG is set up correctly to -637,500. It’s an odd error (never happened before). I just checked (should probably have done this earlier) and GRIDDESC also has the same issue, which maybe indicates that the rounding (or whatever we want to call it) might have been done by MCIP, not BCON/ICON as I originally interpreted.

' '
  2        37.000        47.000       -78.250       -78.250        42.150
' '
'CoordName'   -903000.000   -637500.000      4250.000      4250.000  425  300    1
' '

The lines causing the rounding are at setgriddefs.f90:

   IF ( ( gdtyp_gd == lamgrd3 ) .AND. ( wrf_lc_ref_lat > -900.0 ) ) THEN
      ! Force XORIG and YORIG to be even increments of 0.5*delta-X.
      xtemp = xorig_ctm / 500.0
      ytemp = yorig_ctm / 500.0
      xtemp = FLOAT(NINT(xtemp))
      ytemp = FLOAT(NINT(ytemp))
      xorig_ctm = xtemp * 500.0
      yorig_ctm = ytemp * 500.0

They cause XORIG and YORIG to round to multiples of 500 m. They can be either commented out or modified to either eliminate or modify the rounding, respectively.

Does commenting out those lines give you the desired result?

Hi @cgnolte,
Sorry as I had to be somewhere else and only had time to quote the lines. Yes, the lines can be commented out to prevent the rounding.
P.S. I changed the title of the thread to reflect the root of the issue more accurately.


Thank you for raising this issue. We have stumbled on the same problem in-house, and the lines of code that you identified will either be removed or modified to address this issue. In your case, I believe you can safely proceed by either commenting out or removing those lines, as they are not appropriate for your resolution.


1 Like