Closed jedwards4b closed 6 years ago
Also CESM-DEVELOPMENT issue 93 http://bugs.cgd.ucar.edu/show_bug.cgi?id=1951
The actually contents of this issue is the following:
Ben Sanderson reports on the following issue... (on 2014-03-17 20:03:09 MDT)
Hi all,
I’ve been hitting this strange bug over the last week that occasionally sets ocn_point to 1 in my land-based scam column, but I think I’ve found the problem - and I think it’s one which is general to SCM mode.
!--- start with wraparound ---
ni = 1
mind = abs(lscmlon - (lon(1,1)+360.0_r8))
do i=1,nxg
dist = abs(lscmlon - lon(i,1))
if (dist < mind) then
mind = dist
ni = i
endif
enddo
nj = -1
mind = 1.0e20
do j=1,nyg
dist = abs(scmlat - lat(1,j))
if (dist < mind) then
mind = dist
nj = j
endif
enddo
———————
The problem is, when the array varies jointly in latitude and longitude (like, for example the T31 greenland centered grid that I’m using), this doesn’t converge to the true minimum - it can be some distance off. My simulation for the Black Forest, Germany site at (50.1N,7.5E) was being placed in the North Sea at (52.8N,2.6E), and so the model was erroneously turning off CLM. My simulation in Siberia was even more dramatically misplaced into the middle of the Arctic ocean.
So, a complete search over the whole array appears to fix the problem:
————————— ni = 1 nj = 1
mind = 1.0e20
do i=1,nxg
do j=1,nyg
dist = abs(lscmlon - lon(i,j)) + abs(scmlat - lat(i,j))
if (dist < mind) then
mind = dist
ni = i
nj = j
endif
enddo
enddo
———————————
Hope this is of some help! Ben
In addition from https://github.com/CESM-Development/cime/issues/65 - the following additional information is provided:
After a quick review for re-implementation in datm8, it looks like shr_scam_getCloseLatLon doesn't handle the wraparound lon properly. it also may not reset lons to [0,360] if lon values are ever less than -360. these probably don't cause any serious problems but could be fixed quite easily too. it also assumes a 2d regular lat lon grid. this could also easily be extended to more general grids.
@jtruesdal @jedwards4b - should this be added to the cesm2 release? Is it reasonable to run SCAM on a displaced pole grid? I'm not sure what Ben was doing - but we should sort it out now as we reimplement scam within the CIME scripts.
Alerting @bogensch
Thanks Ben for your investigation and code mods. I think the deficiencies noted should be fixed. Now that SCAM functionality has been enhanced to act as a single column CESM I think the share code should return the proper column data for the supported grid types. If everyone's agreed I will be happy to put a PR together for this. I will touch base with Mariana and Jim regarding ideas for extending the code for more general grids.
@mvertens says this is completed.
Moved from CESM-DEVELOPMENT issue 65