Skip to content

Commit

Permalink
Merge pull request #3363 from GEOS-ESM/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mathomp4 authored Jan 24, 2025
2 parents c41f37c + 142a615 commit 572a644
Show file tree
Hide file tree
Showing 23 changed files with 271 additions and 51 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Deprecated

## [2.53.0] - 2025-01-24

### Changed

- Updated ExtData so that if files are missing in a sequence the last value will be perisisted if one has not chosen `exact` option
- Update `components.yaml`
- `ESMA_env` v4.34.1
- Fix GEOSpyD module on GMAO Desktops

### Fixed

- Changes were made to add attributes to the subgrids (i.e. created by dividing the MPI subdomain into smaller subdomains equal to the number of OpenMP threads) such that the correct dimensions for the MPI subdomain could be retrieved from the subgrids where ever needed.

## [2.52.0] - 2025-01-17

### Added
Expand All @@ -31,7 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Changed `MAPL_ESMFRegridder` to require the dstMaskValues to be added as grid attribute to use fixed masking, fixes UFS issue
- Changed MAPL_ESMFRegridder to require the dstMaskValues to be added as grid attribute to use fixed masking, fixes UFS issue
- Increased formatting width of time index in ExtData2G diagnostic print
- Updated GitHub checkout action to use blobless clones
- Update CI to use Baselibs 7.29.0 by default
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif ()

project (
MAPL
VERSION 2.52.0
VERSION 2.53.0
LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF

# Set the possible values of build type for cmake-gui
Expand Down
35 changes: 8 additions & 27 deletions Tests/ExtDataRoot_GridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -677,12 +677,8 @@ subroutine CompareState(State1,State2,tol,rc)

integer :: status
integer :: i
real, pointer :: ptr3_1(:,:,:)
real, pointer :: ptr3_2(:,:,:)
real, pointer :: ptr2_1(:,:)
real, pointer :: ptr2_2(:,:)
real, pointer :: ptr1_1(:)
real, pointer :: ptr1_2(:)
real, pointer :: ptr1(:)
real, pointer :: ptr2(:)
integer :: itemcount,rank1,rank2
character(len=ESMF_MAXSTR), allocatable :: NameList(:)
logical, allocatable :: foundDiff(:)
Expand All @@ -706,25 +702,12 @@ subroutine CompareState(State1,State2,tol,rc)
exit
end if
_ASSERT(rank1==rank2,'needs informative message')
call assign_fptr(field1, ptr1, _RC)
call assign_fptr(field2, ptr2, _RC)
_ASSERT(size(ptr1)==size(ptr2),'needs informative message')
foundDiff(i)=.false.
if (rank1==1) then
call MAPL_GetPointer(state1,ptr1_1,trim(nameList(i)),_RC)
call MAPL_GetPointer(state2,ptr1_2,trim(nameList(i)),_RC)
if (any((ptr1_1-ptr1_2) > tol)) then
foundDiff(i) = .true.
end if
else if (rank1==2) then
call MAPL_GetPointer(state1,ptr2_1,trim(nameList(i)),_RC)
call MAPL_GetPointer(state2,ptr2_2,trim(nameList(i)),_RC)
if (any((ptr2_1-ptr2_2) > tol)) then
foundDiff(i) = .true.
end if
else if (rank1==3) then
call MAPL_GetPointer(state1,ptr3_1,trim(nameList(i)),_RC)
call MAPL_GetPointer(state2,ptr3_2,trim(nameList(i)),_RC)
if (any((ptr3_1-ptr3_2) > tol)) then
foundDiff(i) = .true.
end if
if (any(abs(ptr1-ptr2) > tol)) then
foundDiff(i) = .true.
end if
if (foundDiff(i)) then
_FAIL('found difference when compare state')
Expand All @@ -741,10 +724,8 @@ subroutine ForceAllocation(state,rc)

integer :: status

real, pointer :: ptr3d(:,:,:)
real, pointer :: ptr2d(:,:)
integer :: ii
integer :: itemcount,dims
integer :: itemcount
character(len=ESMF_MAXSTR), allocatable :: NameList(:)
type (ESMF_StateItem_Flag), allocatable :: itemTypeList(:)
type(ESMF_Field) :: Field
Expand Down
22 changes: 22 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/AGCM1.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
NX: 1
NY: 1

Root.GRID_TYPE: LatLon
Root.GRIDNAME: DC90x45-PC
Root.LM: 3
Root.IM_WORLD: 90
Root.JM_WORLD: 45
Root.POLE: 'PC'
Root.DATELINE: 'DC'

RUN_MODE: GenerateExports

EXPORT_STATE::
VAR1 , time , days , xy , c
::

FILL_DEF::
VAR1 time
::

REF_TIME: 20070927 000000
22 changes: 22 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/AGCM2.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
NX: 1
NY: 1

Root.GRID_TYPE: LatLon
Root.GRIDNAME: DC90x45-PC
Root.LM: 3
Root.IM_WORLD: 90
Root.JM_WORLD: 90
Root.POLE: 'PC'
Root.DATELINE: 'DC'

RUN_MODE: GenerateExports

EXPORT_STATE::
VAR1 , time , days , xy , c
::

FILL_DEF::
VAR1 time
::

REF_TIME: 20070927 000000
26 changes: 26 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/AGCM3.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
NX: 1
NY: 1

Root.GRID_TYPE: LatLon
Root.GRIDNAME: DC900x45-PC
Root.LM: 3
Root.IM_WORLD: 90
Root.JM_WORLD: 45
Root.POLE: 'PC'
Root.DATELINE: 'DC'

RUN_MODE: CompareImports

IMPORT_STATE::
VAR1 , time , days , xy , c
::

EXPORT_STATE::
VAR1 , time , days , xy , c
::

FILL_DEF::
VAR1 3.0
::

REF_TIME: 20080101 000000
5 changes: 5 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/CAP.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CASES::
CAP1.rc
CAP2.rc
CAP3.rc
::
8 changes: 8 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/CAP1.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ROOT_NAME: Root
ROOT_CF: AGCM1.rc
HIST_CF: HISTORY1.rc

BEG_DATE: 20070926 230000

JOB_SGMT: 00000004 000000
HEARTBEAT_DT: 3600
8 changes: 8 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/CAP2.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ROOT_NAME: Root
ROOT_CF: AGCM2.rc
HIST_CF: HISTORY2.rc

BEG_DATE: 20071001 210000

JOB_SGMT: 00000003 000000
HEARTBEAT_DT: 3600
9 changes: 9 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/CAP3.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ROOT_NAME: Root
ROOT_CF: AGCM3.rc
HIST_CF: HISTORY3.rc

BEG_DATE: 20070930 000000

JOB_SGMT: 00000001 120000
HEARTBEAT_DT: 3600

12 changes: 12 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/ExtData.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#CASE_SENSITIVE_VARIABLE_NAMES: .false.
Ext_AllowExtrap: .false.
Prefetch: .true.
DEBUG_LEVEL: 20

PrimaryExports%%
VAR2D NA 2008 N 0 none none VAR2D case1.nc4
%%


DerivedExports%%
%%
13 changes: 13 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/HISTORY1.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
GRID_LABELS:
::

COLLECTIONS: case1
::

case1.template: '%y4%m2%d2.nc4',
case1.format: 'CFIO',
case1.frequency: 240000,
#case1.duration: 000000,
case1.ref_time: 000000,
case1.fields: 'VAR1', 'Root',
::
13 changes: 13 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/HISTORY2.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
GRID_LABELS:
::

COLLECTIONS: case1
::

case1.template: '%y4%m2%d2.nc4',
case1.format: 'CFIO',
case1.frequency: 240000,
#case1.duration: 000000,
case1.ref_time: 000000,
case1.fields: 'VAR1', 'Root',
::
13 changes: 13 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/HISTORY3.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
GRID_LABELS:
::

COLLECTIONS:
::

case2.template: 'nc4',
case2.format: 'CFIO',
case2.frequency: 240000,
case2.duration: 000000,
case2.ref_time: 000000,
case2.fields: 'VAR2D', 'Root',
::
1 change: 1 addition & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test multiple datasets where an export uses both with with no extrapolation outside and crosses transition date
12 changes: 12 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case37/extdata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Collections:
fstream1: {template: "case1.%y4%m2%d2.nc4", valid_range: "2007-09-22/2007-09-30"}
fstream2: {template: "case2.%y4%m2%d2.nc4", valid_range: "2007-10-01/2007-10-08"}

Samplings:
s1:
time_interpolation: False

Exports:
VAR1:
- {starting: "2007-09-22", variable: VAR1, collection: fstream1, sample: s1, fail_on_missing_file: false}
- {starting: "2007-10-01", variable: VAR1, collection: fstream2, sample: s1, fail_on_missing_file: false}
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ case33
case34
case35
case36
case37
58 changes: 46 additions & 12 deletions base/Base/Base_Base_implementation.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1557,11 +1557,24 @@ module subroutine MAPL_GRID_INTERIOR(GRID,I1,IN,J1,JN)
integer :: gridRank
integer, allocatable :: localDeToDeMap(:)
integer :: rc
logical :: isPresent
integer :: global_grid_info(10)

i1=-1
j1=-1
in=-1
jn=-1

call ESMF_AttributeGet(grid, name="GLOBAL_GRID_INFO", isPresent=isPresent, _RC)
if (isPresent) then
call ESMF_AttributeGet(grid, name="GLOBAL_GRID_INFO", valueList=global_grid_info, _RC)
I1 = global_grid_info(7)
IN = global_grid_info(8)
j1 = global_grid_info(9)
JN = global_grid_info(10)
_RETURN(_SUCCESS)
end if

call ESMF_GridGet (GRID, dimCount=gridRank, distGrid=distGrid, _RC)
call ESMF_DistGridGet(distGRID, delayout=layout, _RC)
call ESMF_DELayoutGet(layout, deCount = nDEs, localDeCount=localDeCount,_RC)
Expand Down Expand Up @@ -2138,6 +2151,24 @@ module subroutine MAPL_GridGetInterior(GRID,I1,IN,J1,JN)
integer :: deId
integer :: gridRank
integer :: rc
logical :: isPresent
integer :: global_grid_info(10)

i1=-1
j1=-1
in=-1
jn=-1

call ESMF_AttributeGet(grid, name="GLOBAL_GRID_INFO", isPresent=isPresent, _RC)
if (isPresent) then
call ESMF_AttributeGet(grid, name="GLOBAL_GRID_INFO", valueList=global_grid_info, _RC)
I1 = global_grid_info(7)
IN = global_grid_info(8)
j1 = global_grid_info(9)
JN = global_grid_info(10)
_RETURN(_SUCCESS)
end if


call ESMF_GridGet (GRID, dimCount=gridRank, distGrid=distGrid, _RC)
call ESMF_DistGridGet(distGRID, delayout=layout, _RC)
Expand Down Expand Up @@ -2627,9 +2658,7 @@ module subroutine MAPL_GetHorzIJIndex(npts,II,JJ,lon,lat,lonR8,latR8,Grid, rc)
tmp_lats = latR8
end if

!AOO change tusing GridType atribute if (im_world*6==jm_world) then
call ESMF_AttributeGet(grid, name='GridType', value=grid_type, _RC)
if(trim(grid_type) == "Cubed-Sphere") then
if (im_world*6==jm_world) then

call MAPL_GetGlobalHorzIJIndex(npts, II, JJ, lon=lon, lat=lat, lonR8=lonR8, latR8=latR8, Grid=Grid, _RC)

Expand Down Expand Up @@ -2868,28 +2897,33 @@ function grid_is_ok(grid) result(OK)
type(ESMF_Grid), intent(inout) :: grid
logical :: OK
integer :: I1, I2, J1, J2, j
real(ESMF_KIND_R8), pointer :: corner_lons(:,:), corner_lats(:,:)
real(ESMF_KIND_R8), allocatable :: corner_lons(:,:), corner_lats(:,:)
real(ESMF_KIND_R8), allocatable :: lonRe(:), latRe(:)
real(ESMF_KIND_R8), allocatable :: accurate_lat(:), accurate_lon(:)
real(ESMF_KIND_R8) :: stretch_factor, target_lon, target_lat, shift0
real :: tolerance
integer :: local_dims(3)

tolerance = epsilon(1.0)
call MAPL_GridGetInterior(grid,I1,I2,J1,J2)
call MAPL_GridGet(grid, localCellCountPerDim=local_dims, _RC)
OK = .true.
! check the edge of face 1 along longitude
call ESMF_GridGetCoord(grid,localDE=0,coordDim=1,staggerloc=ESMF_STAGGERLOC_CORNER, &
farrayPtr=corner_lons, rc=status)
call ESMF_GridGetCoord(grid,localDE=0,coordDim=2,staggerloc=ESMF_STAGGERLOC_CORNER, &
farrayPtr=corner_lats, rc=status)
!call ESMF_GridGetCoord(grid,localDE=0,coordDim=1,staggerloc=ESMF_STAGGERLOC_CORNER, &
! farrayPtr=corner_lons, _RC)
!call ESMF_GridGetCoord(grid,localDE=0,coordDim=2,staggerloc=ESMF_STAGGERLOC_CORNER, &
! farrayPtr=corner_lats, _RC)
allocate(corner_lons(local_dims(1)+1, local_dims(2)+1))
allocate(corner_lats(local_dims(1)+1, local_dims(2)+1))
call MAPL_GridGetCorners(grid, corner_lons, corner_lats, _RC)


if ( I1 == 1 .and. J1 == 1 ) then
allocate(lonRe(j2-j1+1), latRe(j2-j1+1))
call MAPL_Reverse_Schmidt(grid, stretched, J2-J1+1, lonR8=corner_lons(1,:), &
latR8=corner_lats(1,:), lonRe=lonRe, latRe=latRe, _RC)
allocate(lonRe(local_dims(2)), latRe(local_dims(2)))
call MAPL_Reverse_Schmidt(grid, stretched, local_dims(2), lonR8=corner_lons(1,1:local_dims(2)), &
latR8=corner_lats(1,1:local_dims(2)), lonRe=lonRe, latRe=latRe, _RC)

allocate(accurate_lon(j2-j1+1), accurate_lat(j2-j1+1))
allocate(accurate_lon(local_dims(2)), accurate_lat(local_dims(2)))

shift0 = shift
if (stretched) shift0 = 0
Expand Down
Loading

0 comments on commit 572a644

Please sign in to comment.