diff --git a/CHANGELOG.md b/CHANGELOG.md index 28ae2b907005..7af4a49e7909 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Changed ### Fixed + +- Fixed bug with reading in cubed-sphere files that have the corners + ### Removed ## [2.3.3] - 2020-10-14 diff --git a/MAPL_cfio/ESMF_CFIOSdfMod.F90 b/MAPL_cfio/ESMF_CFIOSdfMod.F90 index b6e06563f88d..3f837d589d66 100644 --- a/MAPL_cfio/ESMF_CFIOSdfMod.F90 +++ b/MAPL_cfio/ESMF_CFIOSdfMod.F90 @@ -505,6 +505,8 @@ subroutine ESMF_CFIOSdfFileOpen (cfio, fmode, rc, expid, cyclic) if(vnameTemp == 'contacts') cycle if(vnameTemp == 'orientation') cycle if(vnameTemp == 'anchor') cycle + if(vnameTemp == 'corner_lons') cycle + if(vnameTemp == 'corner_lats') cycle end if if (nvDims .EQ. 1) cycle nVars = nVars + 1 @@ -528,6 +530,8 @@ subroutine ESMF_CFIOSdfFileOpen (cfio, fmode, rc, expid, cyclic) if (dimName(iv)=='nf') cycle if (dimName(iv)=='orientationStrLen') cycle if (dimName(iv)=='ncontact') cycle + if (dimName(iv)=='XCdim') cycle + if (dimName(iv)=='YCdim') cycle end if rtcode = NF90_INQ_VARID(fid,dimName(iv),varId) dimUnits(iv) = ' ' diff --git a/MAPL_cfio/ESMF_CFIOUtilMod.F90 b/MAPL_cfio/ESMF_CFIOUtilMod.F90 index ef01ad772277..57ca0e40bd06 100644 --- a/MAPL_cfio/ESMF_CFIOUtilMod.F90 +++ b/MAPL_cfio/ESMF_CFIOUtilMod.F90 @@ -495,12 +495,15 @@ subroutine CFIO_DimInquire (fid,im,jm,km,lm,nvars,ngatts,vdir,rc) integer tmpNvar logical :: cs_found integer :: vdir_ + integer :: found_xc, found_yc,vid ! Initialize variables surfaceOnly = .FALSE. stationFile = .false. vdir_ = -1 ! Assume 3D and same orientation + found_xc = 0 + found_yc = 0 ! Check FID here. @@ -534,7 +537,13 @@ subroutine CFIO_DimInquire (fid,im,jm,km,lm,nvars,ngatts,vdir,rc) tmpNvar = tmpNvar - 1 end if enddo - if (cs_found) tmpNvar = tmpNvar - 3 + if (cs_found) then + tmpNvar = tmpNvar - 3 + found_xc = NF90_INQ_VARID(fid,"corner_lons",vid) + if (found_xc ==0) tmpNvar = tmpNvar - 1 + found_yc = NF90_INQ_VARID(fid,"corner_lats",vid) + if (found_yc ==0) tmpNvar = tmpNvar - 1 + end if nvars = tmpNvar ! Extract dimension information @@ -550,7 +559,9 @@ subroutine CFIO_DimInquire (fid,im,jm,km,lm,nvars,ngatts,vdir,rc) end if if (trim(dimName) .eq. 'nv') cycle if (trim(dimName) .eq. 'nf') cycle - if (trim(dimName) .eq. 'ncontact') cycle + if (trim(dimName) .eq. 'ncontact') cycle + if (trim(dimName) .eq. 'XCdim') cycle + if (trim(dimName) .eq. 'YCdim') cycle if (trim(dimName) .eq. 'orientationStrLen') cycle rc = NF90_INQ_VARID (fid, dimName, dimId) @@ -602,6 +613,7 @@ subroutine CFIO_DimInquire (fid,im,jm,km,lm,nvars,ngatts,vdir,rc) enddo if (cs_found .and. nDims == 6) surfaceOnly = .TRUE. + if (cs_found .and. nDims == 8) surfaceOnly = .TRUE. if (nDims .EQ. 3 .and. .NOT. stationFile) then surfaceOnly = .TRUE. endif @@ -695,6 +707,8 @@ subroutine GetDateTimeVec ( fid, begDate, begTime, incVec, rc ) if (trim(dimName) .eq. 'nv') cycle if (trim(dimName) .eq. 'nf') cycle if (trim(dimName) .eq. 'ncontact') cycle + if (trim(dimName) .eq. 'XCdim') cycle + if (trim(dimName) .eq. 'YCdim') cycle if (trim(dimName) .eq. 'orientationStrLen') cycle rc = NF90_INQ_VARID (fid, dimName, dimId) @@ -890,6 +904,8 @@ subroutine GetBegDateTime ( fid, begDate, begTime, incSecs, rc ) if (dimName=='nf') cycle if (dimName=='orientationStrLen') cycle if (dimName=='ncontact') cycle + if (trim(dimName) .eq. 'XCdim') cycle + if (trim(dimName) .eq. 'YCdim') cycle rc = NF90_INQ_VARID (fid, dimName, dimId) if (err("GetBegDateTime: NF90_INQ_VARID failed",rc,-40) .NE. 0) return ! If it has the standard_name attribute, use that instead @@ -3316,6 +3332,8 @@ subroutine CFIO_GetVar ( fid, vname, yyyymmdd, hhmmss,& if (dimName=='nf') cycle if (dimName=='orientationStrLen') cycle if (dimName=='ncontact') cycle + if (trim(dimName) .eq. 'XCdim') cycle + if (trim(dimName) .eq. 'YCdim') cycle rc = NF90_INQ_VARID (fid, dimName, dimId) if (err("DimInqure: NF90_INQ_VARID failed",rc,-40) .NE. 0) return rc = NF90_GET_ATT(fid,dimId,'units',dimUnits)