Skip to content

Commit

Permalink
Update chgres_cube to read either form of the surface
Browse files Browse the repository at this point in the history
climo fixed files - i.e., C96 or C96.mx050.

Fixes ufs-community#867.
  • Loading branch information
GeorgeGayno-NOAA committed Dec 7, 2023
1 parent 6072450 commit 8fba6e8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sorc/chgres_cube.fd/program_setup.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module program_setup
character(len=500), public :: sfc_files_input_grid(6) = "NULL" !< File names containing input surface data. Not used for 'grib2' input type.
character(len=500), public :: vcoord_file_target_grid = "NULL" !< Vertical coordinate definition file.
character(len=500), public :: thomp_mp_climo_file= "NULL" !< Path/name to the Thompson MP climatology file.
character(len=6), public :: cres_target_grid = "NULL" !< Target grid resolution, i.e., C768.
character(len=15), public :: cres_target_grid = "NULL" !< Target grid resolution, i.e., C768.
character(len=500), public :: atm_weight_file="NULL" !< File containing pre-computed weights to horizontally interpolate atmospheric fields.
character(len=25), public :: input_type="restart" !< Input data type:
!! - "restart" for fv3 tiled warm restart
Expand Down Expand Up @@ -215,17 +215,17 @@ subroutine read_setup_namelist(filename)
orog_dir_input_grid = trim(orog_dir_input_grid) // '/'

!-------------------------------------------------------------------------
! Determine CRES of target grid from the name of the mosaic file.
! Determine CRES of target grid from the name of the orography file.
!-------------------------------------------------------------------------

is = index(mosaic_file_target_grid, "/", .true.)
ie = index(mosaic_file_target_grid, "mosaic") - 1
is = 1
ie = index(orog_files_target_grid(1), "_oro_") - 1

if (is == 0 .or. ie == 0) then
call error_handler("CANT DETERMINE CRES FROM MOSAIC FILE.", 1)
if (ie == 0) then
call error_handler("CANT DETERMINE CRES FROM OROG FILE.", 1)
endif

cres_target_grid = mosaic_file_target_grid(is+1:ie-1)
cres_target_grid = orog_files_target_grid(1)(is:ie)

if (.not. convert_sfc .and. .not. convert_atm) then
call error_handler("MUST CONVERT EITHER AN ATM OR SFC FILE.", 1)
Expand Down

0 comments on commit 8fba6e8

Please sign in to comment.