Skip to content

Data_override:: Issue with reading the grid file in data_override when using 0:180:-180:0 grids #1537

Closed
@uramirez8707

Description

@uramirez8707

Describe the bug
Grid files that have longitude to ranges from 0 to 180 then -180 to 0 are not being read correctly by data_override when using "OCN" and "ICE" grids.

The code gets here:

if(trim(mod_name) == 'ocn' .OR. trim(mod_name) == 'ice') then
do j = jsc, jec
do i = isc, iec
lon(i,j) = (tmpx(i*2-1,j*2-1)+tmpx(i*2+1,j*2-1)+tmpx(i*2+1,j*2+1)+tmpx(i*2-1,j*2+1))*0.25_lkind
lat(i,j) = (tmpy(i*2-1,j*2-1)+tmpy(i*2+1,j*2-1)+tmpy(i*2+1,j*2+1)+tmpy(i*2-1,j*2+1))*0.25_lkind
end do
end do

At the dateline, it will use values around -180 and 180 and average those which will cause bad longitudes.
You can see the issue in this file:
ncview /gpfs/f5/gfdl_f/scratch/Uriel.Ramirez/REGIONAL_MODEL/FMS/build/test_fms/data_override/LineOfWeirdness_Test /grid_read_in_ocn.nc

MOM6 seems to use the centroids when it reads its grid:
https://github.com/NOAA-GFDL/MOM6/blob/8ecb2603119b8c9d4dee9ee6b174e1864415d1cc/src/initialization/MOM_grid_initialize.F90#L220-L222

To Reproduce
This Test reproduces the error:
https://github.com/uramirez8707/FMS/blob/LineOfWeirdnessTest/test_fms/data_override/test_data_override_LOW.F90

image

The data files to run it can be found here:
/gpfs/f5/scratch/Uriel.Ramirez/gfdl_f/REGIONAL_MODEL/FMS/build/test_fms/data_override/LineOfWeirdness_Test

Expected behavior
The grid file should be read correctly by data override. We should either:

  1. Read the centroids from the file directly
  2. Add logic to the averaging to deal with this corner case
  3. Model components can pass in their own lat/lon to use by data_override

System Environment
This happens in any system

Additional context
This was seen by @theresa-morrison and @kshedstrom

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions