Skip to content

Commit

Permalink
Change orientation check for ensemble. Force ensemble has the same or…
Browse files Browse the repository at this point in the history
…ientation as the control.

    -- Xu Lu & Xuguang Wang from OU. POC: [email protected]
  • Loading branch information
XuLu-NOAA committed Nov 8, 2023
1 parent c8620b1 commit 80a4867
Showing 1 changed file with 11 additions and 25 deletions.
36 changes: 11 additions & 25 deletions src/gsi/gsi_rfv3io_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr)
integer(i_kind) :: nio,nylen
integer(i_kind),allocatable :: gfile_loc_layout(:)
character(len=180) :: filename_layout
integer(i_kind) imiddle,jmiddle
integer(i_kind) imiddle,jmiddle,grid_ens_type_fv3_regional


iret=nf90_open(trim(grid_spec),nf90_nowrite,gfile_grid_spec)
Expand Down Expand Up @@ -635,33 +635,19 @@ subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr)
if(mype==0)write(6,*),'ny_layout_bens=',ny_layout_bens
if(mype==0)write(6,*),'ny_layout_eens=',ny_layout_eens

!
! need to decide the grid orientation of the FV regional model
!
! grid_type_fv3_regional = 0 : decide grid orientation based on
! grid_lat/grid_lon
! 1 : input is E-W N-S grid
! 2 : input is W-E S-N grid
!
if(grid_type_fv3_regional == 0) then
imiddle=nxens/2
jmiddle=nyens/2
if( (grid_latt(imiddle,1) < grid_latt(imiddle,nyens)) .and. &
(grid_lont(1,jmiddle) < grid_lont(nxens,jmiddle)) ) then
grid_type_fv3_regional = 2
else
grid_type_fv3_regional = 1
endif
imiddle=nxens/2
jmiddle=nyens/2
if( (grid_latt(imiddle,1) < grid_latt(imiddle,nyens)) .and. &
(grid_lont(1,jmiddle) < grid_lont(nxens,jmiddle)) ) then
grid_ens_type_fv3_regional = 2
else
grid_ens_type_fv3_regional = 1
endif
! check the grid type
if( grid_type_fv3_regional == 1 ) then
if(mype==0) write(6,*) 'FV3 regional input grid is E-W N-S grid'
grid_reverse_flag=.true. ! grid is revered comparing to usual map view
else if(grid_type_fv3_regional == 2) then
if(mype==0) write(6,*) 'FV3 regional input grid is W-E S-N grid'
grid_reverse_flag=.false. ! grid orientated just like we see on map view
if( grid_type_fv3_regional == grid_ens_type_fv3_regional ) then
if(mype==0) write(6,*) 'Ensemble has the same orientation as the control, Cool!'
else
write(6,*) 'Error: FV3 regional input grid is unknown grid'
write(6,*) 'Error! Ensemble has a different orientation as the control, Abort!'
call stop2(678)
endif
!
Expand Down

0 comments on commit 80a4867

Please sign in to comment.