Skip to content

Commit

Permalink
Merge branch 'develop' into feature/calcanl-aero
Browse files Browse the repository at this point in the history
  • Loading branch information
CoryMartin-NOAA committed Apr 15, 2024
2 parents fcca4af + 68bc14d commit 487caf6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion modulefiles/gsiutils_jet.intel.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
help([[
]])

prepend_path("MODULEPATH", "/mnt/lfs4/HFIP/hfv3gfs/role.epic/spack-stack/spack-stack-1.6.0/envs/gsi-addon-dev/install/modulefiles/Core")
prepend_path("MODULEPATH", "/mnt/lfs4/HFIP/hfv3gfs/role.epic/spack-stack/spack-stack-1.6.0/envs/gsi-addon-dev-rocky8/install/modulefiles/Core")

local python_ver=os.getenv("python_ver") or "3.11.6"
local stack_intel_ver=os.getenv("stack_intel_ver") or "2021.5.0"
Expand Down
34 changes: 25 additions & 9 deletions src/netcdf_io/calc_analysis.fd/inc2anl.f90
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ subroutine add_increment(fcstvar, incvar)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
use vars_calc_analysis, only: fcstncfile, anlncfile, incr_file,&
nlat, nlon, nlev, anlfile, use_nemsio_anl, &
levpe, mype
levpe, mype, jedi
use module_ncio, only: Dataset, read_vardata, write_vardata, &
open_dataset, close_dataset, has_var
use nemsio_module
Expand All @@ -251,7 +251,8 @@ subroutine add_increment(fcstvar, incvar)
character(7), intent(in) :: fcstvar, incvar
! local variables
real, allocatable, dimension(:,:,:) :: work3d_bg
real, allocatable, dimension(:,:) :: work3d_inc
real, allocatable, dimension(:,:) :: work3d_inc_gsi
real, allocatable, dimension(:,:,:) :: work3d_inc_jedi
real, allocatable, dimension(:) :: work1d
integer :: j,jj,k,krev,iret
type(Dataset) :: incncfile
Expand All @@ -263,12 +264,22 @@ subroutine add_increment(fcstvar, incvar)
call read_vardata(fcstncfile, fcstvar, work3d_bg, nslice=k, slicedim=3)
! get increment
incncfile = open_dataset(incr_file, paropen=.true.)
call read_vardata(incncfile, trim(incvar)//"_inc", work3d_inc, nslice=k, slicedim=3)
! add increment to background
do j=1,nlat
jj=nlat+1-j ! increment is S->N, history files are N->S
work3d_bg(:,j,1) = work3d_bg(:,j,1) + work3d_inc(:,jj)
end do
! JEDI-derived increments have a time dimension, so read to appropriate array
if ( jedi ) then
call read_vardata(incncfile, trim(incvar)//"_inc", work3d_inc_jedi, nslice=k, slicedim=3)
! add increment to background
do j=1,nlat
jj=nlat+1-j ! increment is S->N, history files are N->S
work3d_bg(:,j,1) = work3d_bg(:,j,1) + work3d_inc_jedi(:,jj,1)
end do
else
call read_vardata(incncfile, trim(incvar)//"_inc", work3d_inc_gsi, nslice=k, slicedim=3)
! add increment to background
do j=1,nlat
jj=nlat+1-j ! increment is S->N, history files are N->S
work3d_bg(:,j,1) = work3d_bg(:,j,1) + work3d_inc_gsi(:,jj)
end do
end if
! write out analysis to file
if (use_nemsio_anl) then
allocate(work1d(nlat*nlon))
Expand All @@ -283,7 +294,12 @@ subroutine add_increment(fcstvar, incvar)
end if
end do
! clean up and close
deallocate(work3d_bg, work3d_inc)
if ( jedi ) then
deallocate(work3d_inc_jedi)
else
deallocate(work3d_inc_gsi)
end if
deallocate(work3d_bg)
call close_dataset(incncfile)
else
write(6,*) fcstvar, ' not in background file, skipping...'
Expand Down
7 changes: 4 additions & 3 deletions src/netcdf_io/calc_analysis.fd/init_calc_analysis.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine read_nml
!! read in namelist parameters from
!! calc_analysis.nml file in same directory
!! as executable
use vars_calc_analysis, only: anal_file, fcst_file, incr_file, aero_file, use_nemsio_anl, do_aero, fhr, mype, npes
use vars_calc_analysis, only: anal_file, fcst_file, incr_file, aero_file, use_nemsio_anl, do_aero, fhr, mype, npes, jedi
implicit none
! local variables to this subroutine
character(len=500) :: datapath = './'
Expand All @@ -26,11 +26,11 @@ subroutine read_nml
character(len=2) :: hrstr
integer, parameter :: lunit = 10
logical :: lexist = .false.
namelist /setup/ datapath, analysis_filename, firstguess_filename, increment_filename, aero_inc_filename, fhr, use_nemsio_anl, do_aero
namelist /setup/ datapath, analysis_filename, firstguess_filename, increment_filename, aero_inc_filename, fhr, use_nemsio_anl, do_aero, jedi

fhr = 6 ! default to 6 hour cycle only
use_nemsio_anl = .false. ! default to using netCDF for background and analysis
do_aero = .false. ! do we process the aerosol increments?
jedi = .false. ! default to GSI (not JEDI)

! read in the namelist
inquire(file='calc_analysis.nml', exist=lexist)
Expand Down Expand Up @@ -72,6 +72,7 @@ subroutine read_nml
else
write(6,*) 'writing analysis in netCDF format'
end if
write(6,*) 'Use JEDI format = ', jedi
end if

end subroutine read_nml
Expand Down
2 changes: 2 additions & 0 deletions src/netcdf_io/calc_analysis.fd/vars_calc_analysis.f90
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module vars_calc_analysis
public :: fhr
public :: mype, npes
public :: levpe
public :: jedi

character(len=500) :: anal_file, fcst_file, incr_file, aero_file
integer, dimension(7) :: idate, jdate
Expand All @@ -46,5 +47,6 @@ module vars_calc_analysis
integer, dimension(7) :: fhrs_pe
integer :: mype, npes
integer, allocatable, dimension(:) :: levpe
logical :: jedi

end module vars_calc_analysis

0 comments on commit 487caf6

Please sign in to comment.