From 9de5986aa0482beb9e9491078aa8a0d5f21c2d1b Mon Sep 17 00:00:00 2001 From: "andrew.eichmann" Date: Wed, 1 Dec 2021 18:22:56 +0000 Subject: [PATCH 1/7] GitHub Issue NOAA-EMC/GSI#259. Add assimilated flag to observations in osense file. --- src/enkf/enkf.f90 | 21 +++++++++++++++++++-- src/enkf/enkf_obs_sensitivity.f90 | 8 +++++++- src/enkf/enkf_obsmod.f90 | 4 ++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/enkf/enkf.f90 b/src/enkf/enkf.f90 index adf9921e9d..c117e4ba56 100644 --- a/src/enkf/enkf.f90 +++ b/src/enkf/enkf.f90 @@ -123,7 +123,7 @@ module enkf obtype, oberrvarmean, numobspersat, deltapredx, biaspreds,& oberrvar_orig, probgrosserr, prpgerr,& corrlengthsq,lnsigl,obtimel,obloclat,obloclon,obpress,stattype,& - anal_ob,anal_ob_post + anal_ob,anal_ob_post,assimltd_flag use constants, only: pi, one, zero use params, only: sprd_tol, paoverpb_thresh, datapath, nanals,& iassim_order,sortinc,deterministic,numiter,nlevs,& @@ -153,7 +153,8 @@ subroutine enkf_update() ! local variables. integer(i_kind) nob,nob1,nob2,nob3,npob,nf,nf2,ii,nobx,nskip,& - niter,i,nrej,npt,nuse,ncount,ncount_check,nb,np + niter,i,nrej,npt,nuse,ncount,ncount_check,nb,np,& + nuseconvoz,nusesat,nobs_convoz integer(i_kind) indxens1(nanals),indxens2(nanals) integer(i_kind) indxens1_modens(nanals*neigv),indxens2_modens(nanals*neigv) real(r_single) hxpost(nanals),hxprior(nanals),hxinc(nanals),& @@ -757,17 +758,31 @@ subroutine enkf_update() tend = mpi_wtime() if (nproc .eq. 0) then write(6,8003) niter,'timing on proc',nproc,' = ',tend-tbegin,t2,t3,t4,t5,t6,nrej + allocate(assimltd_flag(nobstot)) + assimltd_flag = 99999 if (iassim_order == 2) then ncount_check = ncount else ncount_check = nobstot endif nuse = 0; covl_fact = 0. + nuseconvoz=0; nusesat = 0 + nobs_convoz = nobs_conv + nobs_oz do nob1=1,ncount_check nob = indxassim(nob1) if (iskip(nob) .ne. 1) then covl_fact = covl_fact + sqrt(corrlengthsq(nob)/corrlengthsq_orig(nob)) nuse = nuse + 1 + assimltd_flag(nob) = 1 + if (nob .le. nobs_convoz) then + nuseconvoz = nuseconvoz +1 + else if (nob .gt. nobs_convoz) then + nusesat = nusesat + 1 + else + print *,'nob ', nob ,' falling through' + endif + else + assimltd_flag(nob) = 0 endif enddo nskip = nobstot-nuse @@ -776,6 +791,8 @@ subroutine enkf_update() if (covl_fact < 0.99) print *,'mean covl_fact = ',covl_fact if (nskip > 0) print *,nskip,' out of',nobstot,'obs skipped,',nuse,' used' if (nsame > 0) print *,nsame,' out of', nobstot-nskip,' same lat/long' + if (nuseconvoz > 0 ) print *,nuseconvoz,' out of',nobs_conv + nobs_oz ,'convobs used' + if (nusesat > 0 ) print *,nusesat ,' out of',nobs_sat ,'satobs used' if (nrej > 0) print *,nrej,' obs rejected by varqc' endif 8003 format(i2,1x,a14,1x,i5,1x,a3,6(f7.2,1x),i4) diff --git a/src/enkf/enkf_obs_sensitivity.f90 b/src/enkf/enkf_obs_sensitivity.f90 index afa2e242e8..6c37936f31 100644 --- a/src/enkf/enkf_obs_sensitivity.f90 +++ b/src/enkf/enkf_obs_sensitivity.f90 @@ -45,7 +45,7 @@ module enkf_obs_sensitivity obloclon,obpress,indxsat,oberrvar,stattype,obtime,ob, & ensmean_ob,ensmean_obnobc,obsprd_prior,obfit_prior, & oberrvar_orig,biaspreds,anal_ob_post,nobstot,lnsigl, & - corrlengthsq,obtimel,oblnp,obloc + corrlengthsq,obtimel,oblnp,obloc ,assimltd_flag use convinfo, only: convinfo_read,init_convinfo use ozinfo, only: ozinfo_read,init_oz use radinfo, only: radinfo_read,jpch_rad,nusis,nuchan,npred @@ -91,6 +91,7 @@ module enkf_obs_sensitivity integer(i_kind) :: stattype ! Observation type character(len=20) :: obtype ! Observation element / Satellite name integer(i_kind) :: indxsat ! Satellite index (channel) + integer(i_kind) :: assimltd_flag ! is assimilated? flag real(r_single) :: osense_kin ! Observation sensitivity (kinetic energy) [J/kg] real(r_single) :: osense_dry ! Observation sensitivity (Dry total energy) [J/kg] real(r_single) :: osense_moist ! Observation sensitivity (Moist total energy) [J/kg] @@ -215,6 +216,7 @@ subroutine read_ob_sens allocate(stattype(nobstot)) allocate(obtype(nobstot)) allocate(indxsat(nobs_sat)) + allocate(assimltd_flag(nobstot)) allocate(biaspreds(npred+1,nobs_sat)) allocate(tmpanal_ob(nanals)) allocate(tmpbiaspreds(npred+1)) @@ -235,6 +237,7 @@ subroutine read_ob_sens oberrvar_orig(nob) = real(indata%oberrvar_orig,r_kind) stattype(nob) = indata%stattype obtype(nob) = indata%obtype + assimltd_flag(nob) = indata%assimltd_flag if(nproc == 0) anal_ob_post(1:nanals,nob) = real(tmpanal_ob(1:nanals),r_kind) end do ! Read loop over satellite radiance observations @@ -256,6 +259,7 @@ subroutine read_ob_sens stattype(nob) = indata%stattype obtype(nob) = indata%obtype indxsat(nn) = indata%indxsat + assimltd_flag(nob) = indata%assimltd_flag if(nproc == 0) anal_ob_post(1:nanals,nob) = real(tmpanal_ob(1:nanals),r_kind) biaspreds(1:npred+1,nn) = real(tmpbiaspreds(1:npred+1),r_kind) end do @@ -430,6 +434,7 @@ subroutine print_ob_sens outdata%stattype = stattype(nob) outdata%obtype = obtype(nob) outdata%indxsat = 0 + outdata%assimltd_flag = assimltd_flag(nob) if(efsoi_flag) then outdata%osense_kin = real(obsense_kin(nob),r_single) outdata%osense_dry = real(obsense_dry(nob),r_single) @@ -500,6 +505,7 @@ subroutine print_ob_sens outdata%stattype = stattype(nob) outdata%obtype = obtype(nob) outdata%indxsat = nchan + outdata%assimltd_flag = assimltd_flag(nob) tmpbiaspreds(1:npred+1) = real(biaspreds(1:npred+1,nn),r_single) if(efsoi_flag) then outdata%osense_kin = real(obsense_kin(nob),r_single) diff --git a/src/enkf/enkf_obsmod.f90 b/src/enkf/enkf_obsmod.f90 index 72e196d61e..3a1bbe4363 100644 --- a/src/enkf/enkf_obsmod.f90 +++ b/src/enkf/enkf_obsmod.f90 @@ -152,6 +152,9 @@ module enkf_obsmod ! ob-space posterior ensemble, needed for EFSOI real(r_single),public,allocatable, dimension(:,:) :: anal_ob_post ! Fortran pointer +! is the observation assimilated? logical would be preferable, but that confuses +! Python +integer(i_kind),public,allocatable, dimension(:) :: assimltd_flag ! Fortran pointer contains @@ -466,6 +469,7 @@ subroutine obsmod_cleanup() if (allocated(prpgerr)) deallocate(prpgerr) if (allocated(diagused)) deallocate(diagused) if (allocated(anal_ob_post)) deallocate(anal_ob_post) +if (allocated(assimltd_flag)) deallocate(assimltd_flag) ! free shared memory segement, fortran pointer to that memory. nullify(anal_ob) call MPI_Barrier(mpi_comm_world,ierr) From 244d5dafa5aa26a4516ba655ce4110b77b3fa0ac Mon Sep 17 00:00:00 2001 From: jswhit2 Date: Fri, 7 Jan 2022 16:07:21 +0000 Subject: [PATCH 2/7] Github issue #277: merge recent updates and bug fixes in EnKF --- src/enkf/controlvec.f90 | 48 +++- src/enkf/enkf_obsmod.f90 | 9 +- src/enkf/gridio_gfs.f90 | 73 +++-- src/enkf/letkf.f90 | 123 +++++++-- src/enkf/loadbal.f90 | 2 +- src/enkf/mpi_readobs.f90 | 13 +- src/enkf/params.f90 | 18 +- src/enkf/readconvobs.f90 | 6 +- src/enkf/readozobs.f90 | 4 +- src/enkf/readsatobs.f90 | 4 +- src/gsi/gsi_4dvar.f90 | 5 +- src/gsi/gsimod.F90 | 7 +- src/gsi/hybrid_ensemble_isotropic.F90 | 8 +- src/gsi/hybrid_ensemble_parameters.f90 | 8 +- .../fv3_interface.f90 | 22 ++ .../gfs_ncio_interface.f90 | 6 + .../namelist_def.f90 | 8 +- .../calc_increment_ncio.f90 | 42 ++- .../getsigensmeanp_smooth.fd/CMakeLists.txt | 1 + .../src/recenterens_ncio.fd/CMakeLists.txt | 10 + .../recenterens_ncio.fd/recenterens_ncio.f90 | 183 +++++++++++++ .../recenterncio_hybgain.f90 | 251 +++++++++++++----- .../gfs/src/recentersigp.fd/recentersigp.f90 | 13 +- .../calc_analysis.fd/init_calc_analysis.f90 | 8 +- 24 files changed, 701 insertions(+), 171 deletions(-) create mode 100644 util/EnKF/gfs/src/recenterens_ncio.fd/CMakeLists.txt create mode 100644 util/EnKF/gfs/src/recenterens_ncio.fd/recenterens_ncio.f90 diff --git a/src/enkf/controlvec.f90 b/src/enkf/controlvec.f90 index ddd9ded945..b8b62e3b72 100644 --- a/src/enkf/controlvec.f90 +++ b/src/enkf/controlvec.f90 @@ -53,7 +53,7 @@ module controlvec use params, only: nlevs, nbackgrounds, fgfileprefixes, reducedgrid, & nanals, pseudo_rh, use_qsatensmean, nlons, nlats,& nanals_per_iotask, ntasks_io, nanal1, nanal2, & - fgsfcfileprefixes, paranc, write_fv3_incr + fgsfcfileprefixes, paranc, write_fv3_incr, write_ensmean use kinds, only: r_kind, i_kind, r_double, r_single use mpeu_util, only: gettablesize, gettable, getindex use constants, only: max_varname_length @@ -291,13 +291,14 @@ subroutine write_control(no_inflate_flag) real(r_double) :: t1,t2 integer(i_kind) :: nb, nvar, ne integer(i_kind) :: q_ind, ierr -real(r_single), allocatable, dimension(:,:) :: grdin_mean, grdin_mean_tmp +real(r_single), allocatable, dimension(:,:) :: grdin_mean_tmp +real(r_single), allocatable, dimension(:,:,:,:) :: grdin_mean if (nproc <= ntasks_io-1) then allocate(grdin_mean_tmp(npts,ncdim)) if (nproc == 0) then - allocate(grdin_mean(npts,ncdim)) + allocate(grdin_mean(npts,ncdim,nbackgrounds,1)) grdin_mean = 0_r_single t1 = mpi_wtime() endif @@ -311,27 +312,24 @@ subroutine write_control(no_inflate_flag) do ne=1,nanals_per_iotask call mpi_reduce(grdin(:,:,nb,ne), grdin_mean_tmp, npts*ncdim, mpi_real4,& mpi_sum,0,mpi_comm_io,ierr) - if (nproc == 0) grdin_mean = grdin_mean + grdin_mean_tmp + if (nproc == 0) grdin_mean(:,:,nb,1) = grdin_mean(:,:,nb,1) + grdin_mean_tmp enddo ! print out ens mean increment info if (nproc == 0) then - grdin_mean = grdin_mean/real(nanals) + grdin_mean(:,:,nb,1) = grdin_mean(:,:,nb,1)/real(nanals) do nvar=1,nc3d write(6,100) trim(cvars3d(nvar)), & - minval(grdin_mean(:,clevels(nvar-1)+1:clevels(nvar))), & - maxval(grdin_mean(:,clevels(nvar-1)+1:clevels(nvar))) + minval(grdin_mean(:,clevels(nvar-1)+1:clevels(nvar),nb,1)), & + maxval(grdin_mean(:,clevels(nvar-1)+1:clevels(nvar),nb,1)) enddo do nvar=1,nc2d write(6,100) trim(cvars2d(nvar)), & - minval(grdin_mean(:,clevels(nc3d) + nvar)), & - maxval(grdin_mean(:,clevels(nc3d) + nvar)) + minval(grdin_mean(:,clevels(nc3d) + nvar,nb,1)), & + maxval(grdin_mean(:,clevels(nc3d) + nvar,nb,1)) enddo endif enddo 100 format('ens. mean anal. increment min/max ',a,2x,g19.12,2x,g19.12) - if (nproc == 0) then - deallocate(grdin_mean) - endif deallocate(grdin_mean_tmp) q_ind = getindex(cvars3d, 'q') @@ -353,6 +351,14 @@ subroutine write_control(no_inflate_flag) enddo enddo endif + if (nproc == 0 .and. write_ensmean) then + ! write_ensmean implies use_qsatensmean + do nb=1,nbackgrounds + ! re-scale normalized spfh with sat. sphf of ensmean first guess + grdin_mean(:,(q_ind-1)*nlevs+1:q_ind*nlevs,nb,1) = & + grdin_mean(:,(q_ind-1)*nlevs+1:q_ind*nlevs,nb,1)*qsatmean(:,:,nb) + enddo + endif end if if (.not. paranc) then if (write_fv3_incr) then @@ -361,6 +367,15 @@ subroutine write_control(no_inflate_flag) call writegriddata(nanal1(nproc),nanal2(nproc),cvars3d,cvars2d,nc3d,nc2d,clevels,ncdim,grdin,no_inflate_flag) end if if (nproc == 0) then + if (write_ensmean) then + ! also write out ens mean on root task. + if (write_fv3_incr) then + call writeincrement(0,0,cvars3d,cvars2d,nc3d,nc2d,clevels,ncdim,grdin_mean,no_inflate_flag) + else + call writegriddata(0,0,cvars3d,cvars2d,nc3d,nc2d,clevels,ncdim,grdin_mean,no_inflate_flag) + end if + endif + deallocate(grdin_mean) t2 = mpi_wtime() print *,'time in write_control on root',t2-t1,'secs' endif @@ -375,6 +390,15 @@ subroutine write_control(no_inflate_flag) call writegriddata_pnc(cvars3d,cvars2d,nc3d,nc2d,clevels,ncdim,grdin,no_inflate_flag) end if if (nproc == 0) then + ! also write out ens mean on root task + if (write_ensmean) then ! FIXME use parallel IO to write ensmean + if (write_fv3_incr) then + call writeincrement(0,0,cvars3d,cvars2d,nc3d,nc2d,clevels,ncdim,grdin_mean,no_inflate_flag) + else + call writegriddata(0,0,cvars3d,cvars2d,nc3d,nc2d,clevels,ncdim,grdin_mean,no_inflate_flag) + end if + endif + deallocate(grdin_mean) t2 = mpi_wtime() print *,'time in write_control on root',t2-t1,'secs' endif diff --git a/src/enkf/enkf_obsmod.f90 b/src/enkf/enkf_obsmod.f90 index 72e196d61e..d9ab492e73 100644 --- a/src/enkf/enkf_obsmod.f90 +++ b/src/enkf/enkf_obsmod.f90 @@ -105,7 +105,7 @@ module enkf_obsmod use kinds, only : r_kind, r_double, i_kind, r_single use constants, only: zero, one, deg2rad, rad2deg, rd, cp, pi use params, only: & - datestring,datapath,sprd_tol,nanals,saterrfact, & + letkf_flag,nobsl_max,datestring,datapath,sprd_tol,nanals,saterrfact, & lnsigcutoffnh, lnsigcutoffsh, lnsigcutofftr, corrlengthnh,& corrlengthtr, corrlengthsh, obtimelnh, obtimeltr, obtimelsh,& lnsigcutoffsatnh, lnsigcutoffsatsh, lnsigcutoffsattr,& @@ -204,6 +204,13 @@ subroutine readobs() if (nproc == 0) then print *,'max time in mpireadobs = ',tdiffmax print *,'total number of obs ',nobstot + print *,'min/max obtime ',minval(obtime),maxval(obtime) +endif +! if nobsl_max set for LETKF, and the total number of obs < nobsl_max, +! reset nobsl_max to -1 +if (letkf_flag .and. nobsl_max > 0 .and. nobstot < nobsl_max) then + if (nproc == 0) print *,'resetting nobsl_max to -1' + nobsl_max=-1 endif allocate(obfit_prior(nobstot)) ! screen out some obs by setting ob error to a very large number diff --git a/src/enkf/gridio_gfs.f90 b/src/enkf/gridio_gfs.f90 index 58ceff78a6..8a6bd12507 100644 --- a/src/enkf/gridio_gfs.f90 +++ b/src/enkf/gridio_gfs.f90 @@ -333,14 +333,19 @@ subroutine readgriddata_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,ntimes, & if (iope==0) then do k=1,nlevs - krev = nlevs-k+1 - ! layer pressure from phillips vertical interolation + ! pressure at bottom of layer interface (for gps jacobian, see prsltmp in setupbend.f90) + if (prse_ind > 0) then + ug(:) = pressi(:,k) + call copytogrdin(ug,pslg(:,k)) + ! Jacobian for gps in pressure is saved in different units in GSI; need to + ! multiply pressure by 0.1 + grdin(:,levels(prse_ind-1)+k,nb,ne) = 0.1*pslg(:,k) + endif + ! layer pressure from phillips vertical interolation (used for qsat + ! calculation) ug(:) = ((pressi(:,k)**kap1-pressi(:,k+1)**kap1)/& (kap1*(pressi(:,k)-pressi(:,k+1))))**kapr call copytogrdin(ug,pslg(:,k)) - ! Jacobian for gps in pressure is saved in different units in GSI; need to - ! multiply pressure by 0.1 - if (prse_ind > 0) grdin(:,levels(prse_ind-1)+k,nb,ne) = 0.1*pslg(:,k) end do if (pseudo_rh) then call genqsat1(q,qsat(:,:,nb,ne),pslg,tv,ice,npts,nlevs) @@ -952,15 +957,19 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes, ! compute saturation q. do k=1,nlevs - ! layer pressure from phillips vertical interolation + ! pressure at bottom of layer interface (for gps jacobian, see prsltmp in setupbend.f90) + if (prse_ind > 0) then + ug(:) = pressi(:,k) + call copytogrdin(ug,pslg(:,k)) + ! Jacobian for gps in pressure is saved in different units in GSI; need to + ! multiply pressure by 0.1 + grdin(:,levels(prse_ind-1)+k,nb,ne) = 0.1*pslg(:,k) + endif + ! layer pressure from phillips vertical interolation (used for qsat + ! calculation) ug(:) = ((pressi(:,k)**kap1-pressi(:,k+1)**kap1)/& (kap1*(pressi(:,k)-pressi(:,k+1))))**kapr - call copytogrdin(ug,pslg(:,k)) - ! Jacobian for gps in pressure is saved in different units in GSI; need to - ! multiply pressure by 0.1 - if (prse_ind > 0) grdin(:,levels(prse_ind-1)+k,nb,ne) = 0.1*pslg(:,k) - end do if (pseudo_rh) then call genqsat1(q,qsat(:,:,nb,ne),pslg,tv,ice,npts,nlevs) @@ -1115,7 +1124,9 @@ subroutine writegriddata_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,grdin,no_inflate_ ! need to distribute grdin to all PEs in this subcommunicator ! bring all the subdomains back to the main PE call mpi_barrier(iocomms(mem_pe(nproc)), iret) - call mpi_bcast(grdin,npts*ndim*nbackgrounds, mpi_real4, 0, iocomms(mem_pe(nproc)), iret) + do nb=1,nbackgrounds + call mpi_bcast(grdin(1,1,nb,1),npts*ndim, mpi_real4, 0, iocomms(mem_pe(nproc)), iret) + enddo ! loop through times and do the read ne = 1 @@ -1838,7 +1849,7 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,grdin,n write_attribute, quantize_data, has_var, has_attr use constants, only: grav use params, only: nbackgrounds,anlfileprefixes,fgfileprefixes,reducedgrid,& - nccompress + nccompress,write_ensmean implicit none integer, intent(in) :: nanal1,nanal2 @@ -1906,12 +1917,17 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,grdin,n write(charnanal,'(i3.3)') nanal backgroundloop: do nb=1,nbackgrounds - if(no_inflate_flag) then - filenameout = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"nimem"//charnanal + if (nanal == 0 .and. write_ensmean) then + filenamein = trim(adjustl(datapath))//trim(adjustl(fgfileprefixes(nb)))//"ensmean" + filenameout = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"ensmean" else - filenameout = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"mem"//charnanal - end if - filenamein = trim(adjustl(datapath))//trim(adjustl(fgfileprefixes(nb)))//"mem"//charnanal + if(no_inflate_flag) then + filenameout = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"nimem"//charnanal + else + filenameout = trim(adjustl(datapath))//trim(adjustl(anlfileprefixes(nb)))//"mem"//charnanal + end if + filenamein = trim(adjustl(datapath))//trim(adjustl(fgfileprefixes(nb)))//"mem"//charnanal + endif if (use_gfs_nemsio) then clip = tiny(vg(1)) @@ -3289,7 +3305,7 @@ end subroutine writegriddata subroutine writeincrement(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,grdin,no_inflate_flag) use netcdf use params, only: nbackgrounds,incfileprefixes,fgfileprefixes,reducedgrid,& - datestring,nhr_anal + datestring,nhr_anal,write_ensmean use constants, only: grav use mpi use module_fv3gfs_ncio, only: Dataset, Variable, Dimension, open_dataset,& @@ -3354,12 +3370,17 @@ subroutine writeincrement(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,grdin, write(charnanal,'(i3.3)') nanal backgroundloop: do nb=1,nbackgrounds - if(no_inflate_flag) then - filenameout = trim(adjustl(datapath))//trim(adjustl(incfileprefixes(nb)))//"nimem"//charnanal + if (nanal == 0 .and. write_ensmean) then + filenameout = trim(adjustl(datapath))//trim(adjustl(incfileprefixes(nb)))//"ensmean" + filenamein = trim(adjustl(datapath))//trim(adjustl(fgfileprefixes(nb)))//"ensmean" else - filenameout = trim(adjustl(datapath))//trim(adjustl(incfileprefixes(nb)))//"mem"//charnanal - end if - filenamein = trim(adjustl(datapath))//trim(adjustl(fgfileprefixes(nb)))//"mem"//charnanal + if(no_inflate_flag) then + filenameout = trim(adjustl(datapath))//trim(adjustl(incfileprefixes(nb)))//"nimem"//charnanal + else + filenameout = trim(adjustl(datapath))//trim(adjustl(incfileprefixes(nb)))//"mem"//charnanal + end if + filenamein = trim(adjustl(datapath))//trim(adjustl(fgfileprefixes(nb)))//"mem"//charnanal + endif ! create the output netCDF increment file call nccheck_incr(nf90_create(path=trim(filenameout), cmode=nf90_netcdf4, ncid=ncid_out)) @@ -3773,7 +3794,9 @@ subroutine writeincrement_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,grdin,no_inflate ! need to distribute grdin to all PEs in this subcommunicator ! bring all the subdomains back to the main PE call mpi_barrier(iocomms(mem_pe(nproc)), iret) - call mpi_bcast(grdin,npts*ndim*nbackgrounds, mpi_real4, 0, iocomms(mem_pe(nproc)), iret) + do nb=1,nbackgrounds + call mpi_bcast(grdin(1,1,nb,1),npts*ndim, mpi_real4, 0, iocomms(mem_pe(nproc)), iret) + enddo ! loop through times and do the read ne = 1 diff --git a/src/enkf/letkf.f90 b/src/enkf/letkf.f90 index 0f04739392..9b74cecd75 100644 --- a/src/enkf/letkf.f90 +++ b/src/enkf/letkf.f90 @@ -107,13 +107,13 @@ module letkf numobspersat, biaspreds, corrlengthsq,& probgrosserr, prpgerr, obtype, obpress,& lnsigl, anal_ob, anal_ob_modens, obloclat, obloclon, stattype -use constants, only: pi, one, zero, rad2deg, deg2rad +use constants, only: pi, one, zero, rad2deg, deg2rad, rearth use params, only: sprd_tol, datapath, nanals, iseed_perturbed_obs,& iassim_order,sortinc,deterministic,nlevs,& zhuberleft,zhuberright,varqc,lupd_satbiasc,huber,letkf_novlocal,& lupd_obspace_serial,corrlengthnh,corrlengthtr,corrlengthsh,& getkf,getkf_inflation,denkf,nbackgrounds,nobsl_max,& - neigv,vlocal_evecs,dfs_sort + neigv,vlocal_evecs,dfs_sort,mincorrlength_fact use gridinfo, only: nlevs_pres,lonsgrd,latsgrd,logp,npts,gridloc use kdtree2_module, only: kdtree2, kdtree2_create, kdtree2_destroy, & kdtree2_result, kdtree2_n_nearest, kdtree2_r_nearest @@ -135,13 +135,16 @@ subroutine letkf_update() integer(i_kind) nob,nf,nanal,nens,& i,nlev,nrej,npt,nn,nnmax,ierr integer(i_kind) nobsl, ngrd1, nobsl2, nthreads, nb, & - nobslocal_min,nobslocal_max, & - nobslocal_minall,nobslocal_maxall + nobslocal_mean,nobslocal_min,nobslocal_max, & + nobslocal_meanall,nobslocal_minall,nobslocal_maxall +real(r_single) robslocal_mean,robslocal_min,robslocal_max,re, & + robslocal_meanall,robslocal_minall,robslocal_maxall,& + coslatslocal_meanall, coslatslocal_mean, coslat integer(i_kind),allocatable,dimension(:) :: oindex -real(r_single) :: deglat, dist, corrsq, oberrfact, trpa, trpa_raw +real(r_single) :: deglat, dist, corrsq, trpa, trpa_raw, maxdfs real(r_double) :: t1,t2,t3,t4,t5,tbegin,tend,tmin,tmax,tmean real(r_kind) r_nanals,r_nanalsm1 -real(r_kind) normdepart, pnge, width +real(r_kind) normdepart, pnge, width, mincorrlength_factsq real(r_kind),dimension(nobstot):: oberrvaruse real(r_kind) vdist real(r_kind) corrlength @@ -152,7 +155,7 @@ subroutine letkf_update() real(r_single),allocatable,dimension(:,:,:) :: ens_tmp real(r_single),allocatable,dimension(:,:) :: wts_ensperts,pa real(r_single),allocatable,dimension(:) :: dfs,wts_ensmean -real(r_kind),allocatable,dimension(:) :: rdiag,rloc +real(r_kind),allocatable,dimension(:) :: rdiag,rloc,robs_local,coslats_local real(r_single),allocatable,dimension(:) :: dep ! kdtree stuff type(kdtree2_result),dimension(:),allocatable :: sresults @@ -160,6 +163,7 @@ subroutine letkf_update() real(r_kind) eps eps = epsilon(0.0_r_single) ! real(4) machine precision +re = rearth/1.e3_r_single !$omp parallel nthreads = omp_get_num_threads() @@ -170,6 +174,7 @@ subroutine letkf_update() ! define a few frequently used parameters r_nanals=one/float(nanals) r_nanalsm1=one/float(nanals-1) +mincorrlength_factsq = mincorrlength_fact**2 kdobs=associated(kdtree_obs2) if (.not. kdobs .and. nproc .eq. 0) then @@ -258,17 +263,34 @@ subroutine letkf_update() t4 = zero t5 = zero tbegin = mpi_wtime() + nobslocal_max = -999 nobslocal_min = nobstot +nobslocal_mean = 0 +allocate(robs_local(npts_max)) +robs_local = 0 +if (nobsl_max > 0) then + allocate(coslats_local(npts_max)) + coslats_local = 0 +endif ! Update ensemble on model grid. ! Loop for each horizontal grid points on this task. -!$omp parallel do schedule(dynamic) private(npt,nob,nobsl, & -!$omp nobsl2,oberrfact,ngrd1,corrlength,ens_tmp, & -!$omp nf,vdist,obens,indxassim,indxob, & +!$omp parallel do schedule(dynamic) default(none) private(npt,nob,nobsl, & +!$omp nobsl2,ngrd1,corrlength,ens_tmp,coslat, & +!$omp nf,vdist,obens,indxassim,indxob,maxdfs, & !$omp nn,hxens,wts_ensmean,dfs,rdiag,dep,rloc,i, & -!$omp oindex,deglat,dist,corrsq,nb,sresults, & -!$omp wts_ensperts,pa,trpa,trpa_raw) & +!$omp oindex,deglat,dist,corrsq,nb,nlev,nanal,sresults, & +!$omp wts_ensperts,pa,trpa,trpa_raw) shared(anal_ob, & +!$omp anal_ob_modens,anal_chunk,obsprd_post,obsprd_prior, & +!$omp oberrvar,oberrvaruse,nobsl_max,grdloc_chunk, & +!$omp obloc,corrlengthnh,corrlengthsh,corrlengthtr,& +!$omp vlocal_evecs,vlocal,oblnp,lnp_chunk,lnsigl,corrlengthsq,& +!$omp getkf,denkf,getkf_inflation,ensmean_chunk,ob,ensmean_ob, & +!$omp nproc,numptsperproc,nnmax,r_nanalsm1,kdtree_obs2,kdobs, & +!$omp mincorrlength_factsq,robs_local,coslats_local, & +!$omp lupd_obspace_serial,eps,dfs_sort,nanals,index_pres,& +!$omp neigv,nlevs,lonsgrd,latsgrd,nobstot,nens,ncdim,nbackgrounds,indxproc,rad2deg) & !$omp reduction(+:t1,t2,t3,t4,t5) & !$omp reduction(max:nobslocal_max) & !$omp reduction(min:nobslocal_min) @@ -279,6 +301,7 @@ subroutine letkf_update() ! find obs close to this grid point (using kdtree) ngrd1=indxproc(nproc+1,npt) deglat = latsgrd(ngrd1)*rad2deg + coslat = cos(latsgrd(ngrd1)) corrlength=latval(deglat,corrlengthnh,corrlengthtr,corrlengthsh) corrsq = corrlength**2 allocate(sresults(nobstot)) @@ -304,29 +327,26 @@ subroutine letkf_update() allocate(indxob(nobstot)) ! calculate integrated 1-DFS for each ob in local volume nobsl = 0 + maxdfs = -9.9e31 do nob=1,nobstot rloc(nob) = sum((obloc(:,nob)-grdloc_chunk(:,npt))**2,1) - dist = sqrt(rloc(nob)/corrlengthsq(nob)) + dist = sqrt(rloc(nob)/corrsq) if (dist < 1.0 - eps .and. & oberrvaruse(nob) < 1.e10_r_single) then nobsl = nobsl + 1 indxob(nobsl) = nob - oberrfact = taper(dist) - if (lupd_obspace_serial) then - ! use updated ensemble in ob space to estimate DFS - !dfs(nobsl) = obsprd_post(nob)/obsprd_prior(nob) - ! weight by distance to analysis point - dfs(nobsl) = oberrfact*obsprd_post(nob)/obsprd_prior(nob) - else - ! estimate DFS assuming each ob assimilated independently, one - ! at a time. - ! 1-DFS = HP_aH^T/HP_bH^T = R/(HP_bH^T + R) - dfs(nobsl) = (oberrvaruse(nob)/oberrfact)/((oberrvar(nob)/oberrfact)+obsprd_prior(nob)) - endif + ! use updated ensemble in ob space to compute DFS + ! DFS = Tr(R**-1*HPaHT) = dy_a/dy_o see eqn 4 in Liu et al 2009 + ! https://rmets.onlinelibrary.wiley.com/doi/epdf/10.1002/qj.511 + dfs(nobsl) = obsprd_post(nob)/oberrvaruse(nob) + ! use spread reduction instead. + !dfs(nobsl) = obsprd_post(nob)/obsprd_prior(nob) + !if (dfs(nobsl) > maxdfs) maxdfs = dfs(nobsl) endif enddo - ! sort on 1-DFS + ! sort on max(DFS)-DFS allocate(indxassim(nobsl)) + dfs = maxdfs-dfs call quicksort(nobsl,dfs(1:nobsl),indxassim) nobsl2 = min(nobsl_max,nobsl) do nob=1,nobsl2 @@ -345,7 +365,6 @@ subroutine letkf_update() else ! brute force search call find_localobs(grdloc_chunk(:,npt),obloc,corrsq,nobstot,nobsl_max,sresults,nobsl) - nobsl_max = nobsl endif !if (nproc == 0 .and. npt == 1) then ! do nob=1,nobsl @@ -372,6 +391,12 @@ subroutine letkf_update() if (allocated(ens_tmp)) deallocate(ens_tmp) cycle grdloop endif + if (nobsl_max > 0) then + robs_local(npt) = sqrt(sresults(nobsl)%dis) + coslats_local(npt) = coslat + else + robs_local(npt) = nobsl + endif ! Loop through vertical levels (nnmax=1 if no vertical localization) verloop: do nn=1,nnmax @@ -390,7 +415,20 @@ subroutine letkf_update() else vdist = zero endif - dist = sqrt(sresults(nob)%dis/corrlengthsq(nf)+vdist*vdist) + if (nobsl_max > 0 .and. corrlength < 0) then + ! if corrlength<0, set R localization scale to be max distance to find nobsl_max obs + ! (unless max distance is > abs(corrlength) or < abs(corrlength)/10) + if (sresults(nobsl)%dis > corrsq) then + dist = sqrt(sresults(nob)%dis/corrsq+vdist*vdist) + else if (sresults(nobsl)%dis < corrsq*mincorrlength_factsq) then + dist = sqrt(sresults(nob)%dis/(corrsq/mincorrlength_factsq)+vdist*vdist) + else + dist = sqrt(sresults(nob)%dis/sresults(nobsl)%dis+vdist*vdist) + endif + else + ! set R localization scale to specificed distance + dist = sqrt(sresults(nob)%dis/corrsq+vdist*vdist) + endif if (dist >= one) cycle rloc(nobsl2)=taper(dist) oindex(nobsl2)=nf @@ -490,7 +528,9 @@ subroutine letkf_update() ! make sure posterior perturbations still have zero mean. ! (roundoff errors can accumulate) -!$omp parallel do schedule(dynamic) private(npt,nb,i) +!$omp parallel do schedule(dynamic) default(none) private(npt,nb,i) & +!$omp shared(anal_chunk,r_nanals,nanals,& +!$omp npts_max,nbackgrounds,ncdim) do npt=1,npts_max do nb=1,nbackgrounds do i=1,ncdim @@ -529,10 +569,35 @@ subroutine letkf_update() call mpi_reduce(t5,tmin,1,mpi_real8,mpi_min,0,mpi_comm_world,ierr) call mpi_reduce(t5,tmax,1,mpi_real8,mpi_max,0,mpi_comm_world,ierr) if (nproc .eq. 0) print *,',min/max/mean t5 = ',tmin,tmax,tmean + +if (nobsl_max > 0) then + ! compute and print min/max/mean search radius to find nobsl_max + robslocal_mean = sum(robs_local*coslats_local)/numptsperproc(nproc+1) + coslatslocal_mean = sum(coslats_local)/numptsperproc(nproc+1) + robslocal_min = minval(robs_local(1:numptsperproc(nproc+1))) + robslocal_max = maxval(robs_local(1:numptsperproc(nproc+1))) + call mpi_reduce(robslocal_max,robslocal_maxall,1,mpi_real4,mpi_max,0,mpi_comm_world,ierr) + call mpi_reduce(robslocal_min,robslocal_minall,1,mpi_real4,mpi_min,0,mpi_comm_world,ierr) + call mpi_reduce(robslocal_mean,robslocal_meanall,1,mpi_real4,mpi_sum,0,mpi_comm_world,ierr) + call mpi_reduce(coslatslocal_mean,coslatslocal_meanall,1,mpi_real4,mpi_sum,0,mpi_comm_world,ierr) + if (nproc == 0) print *,'min/max/mean distance searched for local obs',re*robslocal_minall,re*robslocal_maxall,re*robslocal_meanall/coslatslocal_meanall + deallocate(coslats_local) +else + ! compute and print min/max/mean number of obs found within search radius + nobslocal_mean = nint(sum(robs_local)/numptsperproc(nproc+1)) + nobslocal_min = minval(robs_local(1:numptsperproc(nproc+1))) + nobslocal_max = maxval(robs_local(1:numptsperproc(nproc+1))) + call mpi_reduce(nobslocal_max,nobslocal_maxall,1,mpi_integer,mpi_max,0,mpi_comm_world,ierr) + call mpi_reduce(nobslocal_min,nobslocal_minall,1,mpi_integer,mpi_min,0,mpi_comm_world,ierr) + call mpi_reduce(nobslocal_mean,nobslocal_meanall,1,mpi_integer,mpi_sum,0,mpi_comm_world,ierr) + if (nproc == 0) print *,'min/max/mean number of obs in local volume',nobslocal_minall,nobslocal_maxall,nint(nobslocal_meanall/float(numproc)) +endif call mpi_reduce(nobslocal_max,nobslocal_maxall,1,mpi_integer,mpi_max,0,mpi_comm_world,ierr) call mpi_reduce(nobslocal_min,nobslocal_minall,1,mpi_integer,mpi_max,0,mpi_comm_world,ierr) if (nproc == 0) print *,'min/max number of obs in local volume',nobslocal_minall,nobslocal_maxall + if (nrej > 0 .and. nproc == 0) print *, nrej,' obs rejected by varqc' +deallocate(robs_local) if (allocated(ens_tmp)) deallocate(ens_tmp) diff --git a/src/enkf/loadbal.f90 b/src/enkf/loadbal.f90 index 595ef20277..ff99bc0736 100644 --- a/src/enkf/loadbal.f90 +++ b/src/enkf/loadbal.f90 @@ -383,7 +383,7 @@ subroutine scatter_chunks ! allocate array to hold pieces of state vector on each proc. allocate(anal_chunk(nanals,npts_max,ncdim,nbackgrounds)) -if (nproc == 0) print *,'anal_chunk size = ',size(anal_chunk) +if (nproc == 0) print *,'anal_chunk size = ',size(anal_chunk,kind=8) allocate(anal_chunk_prior(nanals,npts_max,ncdim,nbackgrounds)) allocate(ensmean_chunk(npts_max,ncdim,nbackgrounds)) diff --git a/src/enkf/mpi_readobs.f90 b/src/enkf/mpi_readobs.f90 index bca5d7c715..e48f5a1804 100644 --- a/src/enkf/mpi_readobs.f90 +++ b/src/enkf/mpi_readobs.f90 @@ -250,7 +250,18 @@ subroutine mpi_getobs(obspath, datestring, nobs_conv, nobs_oz, nobs_sat, nobs_to ! exchange obs prior ensemble members across all tasks to fully populate shared ! memory array pointer on each node. if (nproc_shm == 0) then - call mpi_allreduce(mpi_in_place,anal_ob,nanals*nobs_tot,mpi_real4,mpi_sum,mpi_comm_shmemroot,ierr) + if (real(nanals)*real(nobs_tot) < 2**32/2. - 1) then + call mpi_allreduce(mpi_in_place,anal_ob,nanals*nobs_tot,mpi_real4,mpi_sum,mpi_comm_shmemroot,ierr) + else + ! count won't fit in 32-bit integer and mpi_allreduce doesn't handle + ! 64 bit counts. Split up into smaller chunks. + mem_ob = 0. + do na=1,nanals + mem_ob(:) = anal_ob(na,:) + call mpi_allreduce(mpi_in_place,mem_ob,nobs_tot,mpi_real4,mpi_sum,mpi_comm_shmemroot,ierr) + anal_ob(na,:) = mem_ob(:) + enddo + endif !print *,nproc,'min/max anal_ob',minval(anal_ob),maxval(anal_ob) if (neigv > 0) then mem_ob_modens = 0. diff --git a/src/enkf/params.f90 b/src/enkf/params.f90 index 6a3a977f56..e46bfa195b 100644 --- a/src/enkf/params.f90 +++ b/src/enkf/params.f90 @@ -115,6 +115,9 @@ module params real(r_single),public :: covinflatemax,covinflatemin,smoothparm,biasvar real(r_single),public :: corrlengthnh,corrlengthtr,corrlengthsh real(r_single),public :: obtimelnh,obtimeltr,obtimelsh +! factor for minimum allowed horiz cov length scale +! to apply for LETKF when corrlengthnh,tr,sh < 0 and nobsl_max > 0 +real(r_single),public :: mincorrlength_fact = 0.1 real(r_single),public :: zhuberleft,zhuberright real(r_single),public :: lnsigcutoffnh,lnsigcutofftr,lnsigcutoffsh,& lnsigcutoffsatnh,lnsigcutoffsattr,lnsigcutoffsatsh,& @@ -129,7 +132,10 @@ module params real(r_single),public :: tar_minlat,tar_maxlat,tar_minlon,tar_maxlon real(r_single),public :: covl_minfact, covl_efold -real(r_single),public :: covinflatenh,covinflatesh,covinflatetr,lnsigcovinfcutoff +real(r_single),public :: covinflatenh=0 +real(r_single),public :: covinflatetr=0 +real(r_single),public :: covinflatesh=0 +real(r_single),public :: lnsigcovinfcutoff ! if npefiles=0, diag files are read (concatenated pe* files written by gsi) ! if npefiles>0, npefiles+1 pe* files read directly ! the pe* files are assumed to be located in /gsitmp_mem### @@ -245,10 +251,12 @@ module params ! for writing increments logical,public :: write_fv3_incr = .false. character(len=12),dimension(10),public :: incvars_to_zero='NONE' !just picking 10 arbitrarily +! write ensemble mean analysis (or analysis increment) +logical,public :: write_ensmean = .false. namelist /nam_enkf/datestring,datapath,iassim_order,nvars,& covinflatemax,covinflatemin,deterministic,sortinc,& - corrlengthnh,corrlengthtr,corrlengthsh,& + mincorrlength_fact,corrlengthnh,corrlengthtr,corrlengthsh,& varqc,huber,nlons,nlats,smoothparm,use_qsatensmean,& readin_localization, zhuberleft,zhuberright,& obtimelnh,obtimeltr,obtimelsh,reducedgrid,& @@ -273,7 +281,7 @@ module params eft,wmoist,adrate,andataname,& gdatehr,datehr,& tar_minlat,tar_maxlat,tar_minlon,tar_maxlon,tar_minlev,tar_maxlev,& - fv3_native, paranc, nccompress, write_fv3_incr,incvars_to_zero, & + fv3_native, paranc, nccompress, write_fv3_incr,incvars_to_zero,write_ensmean, & corrlengthrdrnh,corrlengthrdrsh,corrlengthrdrtr,& lnsigcutoffrdrnh,lnsigcutoffrdrsh,lnsigcutoffrdrtr,& l_use_enkf_directZDA @@ -664,6 +672,10 @@ subroutine read_namelist() letkf_flag) then print *,'warning: no time localization in LETKF!' endif + if ((write_ensmean .and. pseudo_rh) .and. .not. use_qsatensmean) then + print *,'write_ensmean=T requires use_qsatensmean=T when pseudo_rh=T' + call stop2(19) + endif print *, trim(adjustl(datapath)) diff --git a/src/enkf/readconvobs.f90 b/src/enkf/readconvobs.f90 index 8c0f7ea958..e1977298a6 100644 --- a/src/enkf/readconvobs.f90 +++ b/src/enkf/readconvobs.f90 @@ -335,8 +335,8 @@ subroutine get_num_convobs_nc(obspath,datestring,num_obs_tot,num_obs_totdiag,id) errorlimit2=errorlimit2_obs - if (obtype == 'gps' ) then - if (GPS_Type(i)==1) errorlimit2=errorlimit2_bnd + if (obtype == 'gps') then + if (GPS_Type(i)==1) errorlimit2=errorlimit2_bnd endif ! for q, normalize by qsatges @@ -664,7 +664,7 @@ subroutine get_convobs_data_nc(obspath, datestring, nobs_max, nobs_maxdiag, & do i = 1, nobs nobdiag = nobdiag + 1 ! special handling for error limits for GPS bend angle - if (obtype == 'gps' ) then + if (obtype == 'gps') then if (GPS_Type(i)==1) errorlimit2=errorlimit2_bnd endif diff --git a/src/enkf/readozobs.f90 b/src/enkf/readozobs.f90 index efd79b1c8c..efebb00855 100644 --- a/src/enkf/readozobs.f90 +++ b/src/enkf/readozobs.f90 @@ -926,7 +926,7 @@ end subroutine write_ozobs_data_bin subroutine write_ozobs_data_nc(obspath, datestring, nobs_max, nobs_maxdiag, & x_fit, x_sprd, x_used, id, gesid) use netcdf, only: nf90_inq_dimid, nf90_open, nf90_close, NF90_NETCDF4, & - nf90_inquire_dimension, NF90_WRITE, nf90_create, nf90_def_dim + nf90_inquire_dimension, NF90_WRITE, NF90_NOWRITE, nf90_create, nf90_def_dim use ncdw_climsg, only: nclayer_check use constants, only: r_missing @@ -972,7 +972,7 @@ subroutine write_ozobs_data_nc(obspath, datestring, nobs_max, nobs_maxdiag, & inquire(file=obsfile,exist=fexist) if (.not. fexist) cycle peloop - call nclayer_check(nf90_open(obsfile, NF90_WRITE, iunit)) + call nclayer_check(nf90_open(obsfile, NF90_NOWRITE, iunit)) call nclayer_check(nf90_inq_dimid(iunit, "nobs", nobsid)) call nclayer_check(nf90_inquire_dimension(iunit, nobsid, len = nobs)) call nclayer_check(nf90_close(iunit)) diff --git a/src/enkf/readsatobs.f90 b/src/enkf/readsatobs.f90 index 44923d2c38..df0534fc90 100644 --- a/src/enkf/readsatobs.f90 +++ b/src/enkf/readsatobs.f90 @@ -1260,7 +1260,7 @@ end subroutine write_satobs_data_bin subroutine write_satobs_data_nc(obspath, datestring, nobs_max, nobs_maxdiag, & x_fit, x_sprd, x_used, id, gesid) use netcdf, only: nf90_inq_dimid, nf90_open, nf90_close, NF90_NETCDF4, & - nf90_inquire_dimension, NF90_WRITE, nf90_create, nf90_def_dim + nf90_inquire_dimension, NF90_WRITE, NF90_NOWRITE, nf90_create, nf90_def_dim use ncdw_climsg, only: nclayer_check use radinfo, only: iuse_rad,nusis,jpch_rad @@ -1326,7 +1326,7 @@ subroutine write_satobs_data_nc(obspath, datestring, nobs_max, nobs_maxdiag, & if (.not. fexist) cycle peloop - call nclayer_check(nf90_open(obsfile, NF90_WRITE, iunit)) + call nclayer_check(nf90_open(obsfile, NF90_NOWRITE, iunit)) call nclayer_check(nf90_inq_dimid(iunit, "nobs", nobsid)) call nclayer_check(nf90_inquire_dimension(iunit, nobsid, len = nobs)) call nclayer_check(nf90_close(iunit)) diff --git a/src/gsi/gsi_4dvar.f90 b/src/gsi/gsi_4dvar.f90 index d955bd57d1..e4038dc9ba 100644 --- a/src/gsi/gsi_4dvar.f90 +++ b/src/gsi/gsi_4dvar.f90 @@ -435,8 +435,9 @@ subroutine time_4dvar(idate,step4d) integer(i_kind),intent(in ) :: idate ! Date (yyyymmddhh) real(r_kind) ,intent( out) :: step4d ! Time since start of 4D-Var window (hours) -integer(i_kind) iyr,imo,idy,ihr,nmin_obs,nhrobs,nhrbgn,nhroff +integer(i_kind) iyr,imo,idy,ihr,nmin_obs integer(i_kind),dimension(5) :: idate5 +real(r_kind) nhroff,nhrbgn,nhrobs ihr=idate iyr=ihr/1000000 @@ -457,7 +458,7 @@ subroutine time_4dvar(idate,step4d) end if nhrobs=nmin_obs*r60inv -nhrbgn=NINT(real(iwinbgn,r_kind)*r60inv) +nhrbgn=real(iwinbgn,r_kind)*r60inv nhroff=nhrobs-nhrbgn step4d=real(nhroff,r_kind) diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index 1c8b73841f..0c39ffb04d 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -145,7 +145,7 @@ module gsimod n_ens,nlon_ens,nlat_ens,jcap_ens,jcap_ens_test,oz_univ_static,& regional_ensemble_option,fv3sar_ensemble_opt,merge_two_grid_ensperts, & full_ensemble,pseudo_hybens,pwgtflg,& - beta_s0,s_ens_h,s_ens_v,init_hybrid_ensemble_parameters,& + beta_s0,beta_e0,s_ens_h,s_ens_v,init_hybrid_ensemble_parameters,& readin_localization,write_ens_sprd,eqspace_ensgrid,grid_ratio_ens,& readin_beta,use_localization_grid,use_gfs_ens,q_hyb_ens,i_en_perts_io, & l_ens_in_diff_time,ensemble_path,ens_fast_read,sst_staticB @@ -1268,6 +1268,9 @@ module gsimod ! beta_s(:) = beta_s0 , vertically varying weights given to static B ; ! beta_e(:) = 1 - beta_s0 , vertically varying weights given ensemble derived covariance. ! If (readin_beta) then beta_s and beta_e are read from a file and beta_s0 is not used. +! beta_e0 - default weight given to ensemble background error covariance +! (if .not. readin_beta). if beta_e0<0, then it is set to +! 1.-beta_s0 (this is the default) ! s_ens_h - homogeneous isotropic horizontal ensemble localization scale (km) ! s_ens_v - vertical localization scale (grid units for now) ! s_ens_h, s_ens_v, and beta_s0 are tunable parameters. @@ -1312,7 +1315,7 @@ module gsimod ! namelist/hybrid_ensemble/l_hyb_ens,uv_hyb_ens,q_hyb_ens,aniso_a_en,generate_ens,n_ens,nlon_ens,nlat_ens,jcap_ens,& pseudo_hybens,merge_two_grid_ensperts,regional_ensemble_option,fv3sar_bg_opt,fv3sar_ensemble_opt,full_ensemble,pwgtflg,& - jcap_ens_test,beta_s0,s_ens_h,s_ens_v,readin_localization,eqspace_ensgrid,readin_beta,& + jcap_ens_test,beta_s0,beta_e0,s_ens_h,s_ens_v,readin_localization,eqspace_ensgrid,readin_beta,& grid_ratio_ens, & oz_univ_static,write_ens_sprd,use_localization_grid,use_gfs_ens, & i_en_perts_io,l_ens_in_diff_time,ensemble_path,ens_fast_read,sst_staticB diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index e0a6e3fd1f..23a21cd8e5 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -4001,7 +4001,7 @@ subroutine hybens_localization_setup use gfs_stratosphere, only: use_gfs_stratosphere,blend_rm use hybrid_ensemble_parameters, only: grd_ens,jcap_ens,n_ens,grd_loc,sp_loc,& nval_lenz_en,regional_ensemble_option - use hybrid_ensemble_parameters, only: readin_beta,beta_s,beta_e,beta_s0,sqrt_beta_s,sqrt_beta_e + use hybrid_ensemble_parameters, only: readin_beta,beta_s,beta_e,beta_s0,beta_e0,sqrt_beta_s,sqrt_beta_e use hybrid_ensemble_parameters, only: readin_localization,create_hybens_localization_parameters, & vvlocal,s_ens_h,s_ens_hv,s_ens_v,s_ens_vv use gsi_io, only: verbose @@ -4067,7 +4067,11 @@ subroutine hybens_localization_setup if ( .not. readin_beta ) then ! assign all levels to same value, sum = 1.0 beta_s = beta_s0 - beta_e = one - beta_s0 + if (beta_e0 < 0) then + beta_e = one - beta_s0 + else + beta_e = beta_e0 + endif endif if ( regional_ensemble_option == 2 .and. use_gfs_stratosphere .and. .not. readin_beta ) then diff --git a/src/gsi/hybrid_ensemble_parameters.f90 b/src/gsi/hybrid_ensemble_parameters.f90 index 9ea28c9ee8..61723bbc65 100644 --- a/src/gsi/hybrid_ensemble_parameters.f90 +++ b/src/gsi/hybrid_ensemble_parameters.f90 @@ -87,6 +87,9 @@ module hybrid_ensemble_parameters ! relative weight given to static background B when (readin_beta=.false.) ! when (readin_beta=.true.), the vertical weighting parameters are read from a file, ! instead of being defined based on beta_s0 namelist or default value. +! beta_e0 - default weight given to ensemble background error covariance +! (if .not. readin_beta). if beta_e0<0, then it is set to +! 1.-beta_s0 (this is the default) ! s_ens_h: horizontal localization correlation length (units of km), default = 2828.0 ! s_ens_v: vertical localization correlation length (grid units), default = 30.0 ! generate_ens: if .true., generate ensemble perturbations internally as random samples of background B. @@ -255,7 +258,7 @@ module hybrid_ensemble_parameters ! set passed variables to public public :: generate_ens,n_ens,nlon_ens,nlat_ens,jcap_ens,jcap_ens_test,l_hyb_ens,& s_ens_h,oz_univ_static,vvlocal - public :: uv_hyb_ens,q_hyb_ens,s_ens_v,beta_s0,aniso_a_en,s_ens_hv,s_ens_vv + public :: uv_hyb_ens,q_hyb_ens,s_ens_v,beta_s0,beta_e0,aniso_a_en,s_ens_hv,s_ens_vv public :: readin_beta,beta_s,beta_e public :: readin_localization public :: eqspace_ensgrid,grid_ratio_ens @@ -309,7 +312,7 @@ module hybrid_ensemble_parameters logical ens_fast_read integer(i_kind) i_en_perts_io integer(i_kind) n_ens,nlon_ens,nlat_ens,jcap_ens,jcap_ens_test - real(r_kind) beta_s0,s_ens_h,s_ens_v,grid_ratio_ens + real(r_kind) beta_s0,beta_e0,s_ens_h,s_ens_v,grid_ratio_ens type(sub2grid_info),save :: grd_ens,grd_loc,grd_sploc,grd_anl,grd_e1,grd_a1 type(spec_vars),save :: sp_ens,sp_loc type(egrid2agrid_parm),save :: p_e2a,p_sploc2ens @@ -401,6 +404,7 @@ subroutine init_hybrid_ensemble_parameters jcap_ens_test=0 nlon_ens=0 beta_s0=one + beta_e0=-one grid_ratio_ens=one s_ens_h = 2828._r_kind ! km (this was optimal value in ! Wang, X.,D. M. Barker, C. Snyder, and T. M. Hamill, 2008: A hybrid diff --git a/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/fv3_interface.f90 b/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/fv3_interface.f90 index 2eb31b836e..e4e4a466cd 100644 --- a/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/fv3_interface.f90 +++ b/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/fv3_interface.f90 @@ -133,6 +133,7 @@ subroutine fv3_calc_increment(mype) integer :: j, k ! loop indices within a variable integer :: ivar !! loop index over variables in input_vars & output_vars + real :: taper ! Formats for print statements: 100 format(A,': ',A) @@ -185,6 +186,9 @@ subroutine fv3_calc_increment(mype) an_grid%ilev(k) = real(k) an_grid%hyai(k) = real(k) an_grid%hybi(k) = real(k) + an_grid%ak(k) = meta_ncio%vcoord(k,1) + an_grid%bk(k) = meta_ncio%vcoord(k,2) + an_grid%ck(k) = 0 end do nzp1_init ! Deallocate entire grid. @@ -240,8 +244,26 @@ subroutine fv3_calc_increment(mype) ! Subtract and write an_grid%var3d = an_grid%var3d - fg_grid%var3d + if (mype == 0) print *,trim(input_vars(ivar)),minval(an_grid%var3d),maxval(an_grid%var3d) endif zero_or_read + ! taper humidity, microphysics increments in stratosphere + if (taper_strat .and. (trim(input_vars(ivar)) == 'spfh' .or. & + trim(input_vars(ivar)) == 'icmr' .or. & + trim(input_vars(ivar)) == 'clwmr')) then + if (mype == 0) print *,'k,ak,bk,taper,min/max increment for ',trim(input_vars(ivar)) + do k=1,an_grid%nz + taper = 1.0 + if (k < an_grid%nz/2 .and. (an_grid%ak(k) <= ak_bot .and. an_grid%ak(k) >= ak_top)) then + taper = (an_grid%ak(k) - ak_top)/(ak_bot - ak_top) + else if (an_grid%bk(k) .eq. 0. .and. an_grid%ak(k) < ak_top) then + taper = 0. + endif + an_grid%var3d(:,:,k) = an_grid%var3d(:,:,k)*taper + if (mype == 0) print *,k,an_grid%ak(k),an_grid%bk(k),taper,minval(an_grid%var3d(:,:,k)),maxval(an_grid%var3d(:,:,k)) + enddo + endif + call fv3_netcdf_write_var3d(ncdat,output_vars(ivar),an_grid%var3d) enddo var_loop diff --git a/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/gfs_ncio_interface.f90 b/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/gfs_ncio_interface.f90 index 4d3d07236b..ddabc66a40 100644 --- a/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/gfs_ncio_interface.f90 +++ b/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/gfs_ncio_interface.f90 @@ -137,6 +137,8 @@ subroutine gfs_ncio_initialize(meta_ncio,filename) allocate(meta_ncio%lon(meta_ncio%dimx*meta_ncio%dimy)) if (.not. allocated(meta_ncio%lat)) & allocate(meta_ncio%lat(meta_ncio%dimx*meta_ncio%dimy)) + if (.not. allocated(meta_ncio%vcoord)) & + allocate(meta_ncio%vcoord(meta_ncio%dimz+1,2)) call read_vardata(gfile,'lon', tmp2d) meta_ncio%lon = reshape(tmp2d, (/meta_ncio%dimx*meta_ncio%dimy/)) call read_vardata(gfile,'lat', tmp2d) @@ -148,6 +150,10 @@ subroutine gfs_ncio_initialize(meta_ncio,filename) meta_ncio%idvm=1 meta_ncio%ntrac = 8 meta_ncio%ncldt = 5 + call read_attribute(gfile,'ak',tmp1d) + meta_ncio%vcoord(:,1) = tmp1d(:) + call read_attribute(gfile,'bk',tmp1d) + meta_ncio%vcoord(:,2) = tmp1d(:) call read_vardata(gfile,'time',tmp1d) meta_ncio%fhour = nint(tmp1d(1)) diff --git a/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/namelist_def.f90 b/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/namelist_def.f90 index 4f20d219e9..c0ebc34e7e 100644 --- a/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/namelist_def.f90 +++ b/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/namelist_def.f90 @@ -8,7 +8,7 @@ module namelist_def public :: analysis_filename, firstguess_filename, increment_filename public :: datapath public :: debug - public :: do_icmr + public :: do_icmr, taper_strat, ak_bot, ak_top public :: incvars_to_zero public :: read_namelist public :: write_namelist @@ -26,9 +26,13 @@ module namelist_def character(len=12) :: incvars_to_zero(max_vars) = 'NONE' logical :: do_icmr = .false. + logical :: taper_strat = .false. + ! damp humidity increments between these two levels if taper_strat=T + real :: ak_bot = 10000. ! units Pa + real :: ak_top = 5000. namelist /setup/ datapath, analysis_filename, firstguess_filename, increment_filename, & - nens, debug, imp_physics + nens, debug, imp_physics, ak_top, ak_bot, taper_strat namelist /zeroinc/ incvars_to_zero contains diff --git a/util/EnKF/gfs/src/calc_increment_ncio.fd/calc_increment_ncio.f90 b/util/EnKF/gfs/src/calc_increment_ncio.fd/calc_increment_ncio.f90 index dd14663ef5..4928a62e6c 100755 --- a/util/EnKF/gfs/src/calc_increment_ncio.fd/calc_increment_ncio.f90 +++ b/util/EnKF/gfs/src/calc_increment_ncio.fd/calc_increment_ncio.f90 @@ -21,6 +21,14 @@ PROGRAM calc_increment_ncio ! 4th command line arg is logical for controlling whether microphysics ! increment is computed. +! 5th command line arg is logical for controlling whether delz +! increment should be computed +! 6th command line arg is logical for controlling whether humidity +! and microphysics vars should be tapered to zero in stratosphere. +! The vertical profile of the taper is controlled by ak_top and ak_bot. + +! If delp and/or delz are not in the background history files, then +! their increments are inferred (from ps, T and humidity increments). ! ! attributes: ! language: f95 @@ -48,21 +56,24 @@ PROGRAM calc_increment_ncio real, allocatable, dimension(:,:) :: values_2d_fg,values_2d_anal,values_2d_inc,& ps_fg, ps_anal real, allocatable, dimension(:,:,:) :: values_3d_fg,values_3d_anal,values_3d_inc,& - q_fg, q_anal, tmp_fg, tmp_anal, delzb, delza + taper_vert,q_fg, q_anal, tmp_fg, tmp_anal, delzb, delza type(Dataset) :: dset_anal,dset_fg type(Dimension) :: londim,latdim,levdim integer, dimension(3) :: dimid_3d integer, dimension(1) :: dimid_1d integer varid_lon,varid_lat,varid_lev,varid_ilev,varid_hyai,varid_hybi,& dimid_lon,dimid_lat,dimid_lev,dimid_ilev,ncfileid,ncstatus - logical :: no_mpinc, no_delzinc, has_dpres, has_delz + logical :: no_mpinc, no_delzinc, has_dpres, has_delz, taper_strat character(len=10) :: bufchar - real rd,rv,fv,grav + real rd,rv,fv,grav,ak_bot,ak_top rd = 2.8705e+2 rv = 4.6150e+2 fv = rv/rd-1. ! used in virtual temperature equation grav = 9.80665 + ! damp humidity increments between these two levels if taper_strat=T + ak_bot = 10000. ! units Pa + ak_top = 5000. call getarg(1,filename_fg) ! first guess ncio file call getarg(2,filename_anal) ! analysis ncio file @@ -71,6 +82,8 @@ PROGRAM calc_increment_ncio read(bufchar,'(L)') no_mpinc ! if T, no microphysics increments computed call getarg(5, bufchar) read(bufchar,'(L)') no_delzinc ! if T, no delz increments computed + call getarg(6, bufchar) + read(bufchar,'(L)') taper_strat ! if T, taper sphum,liq_wat,ice_wat in strat write(6,*)'CALC_INCREMENT_NCIO:' write(6,*)'filename_fg=',trim(filename_fg) @@ -78,6 +91,7 @@ PROGRAM calc_increment_ncio write(6,*)'filename_inc=',trim(filename_inc) write(6,*)'no_mpinc',no_mpinc write(6,*)'no_delzinc',no_delzinc + write(6,*)'taper_strat',taper_strat dset_fg = open_dataset(trim(filename_fg),errcode=iret) if (iret .ne. 0) then @@ -259,6 +273,7 @@ PROGRAM calc_increment_ncio ! ps increment. allocate(values_2d_inc(nlons,nlats)) + allocate(taper_vert(nlons,nlats,nlevs)) allocate(values_3d_inc(nlons,nlats,nlevs)) do nvar=1,dset_fg%nvars ndims = dset_fg%variables(nvar)%ndims @@ -269,6 +284,19 @@ PROGRAM calc_increment_ncio values_2d_inc(:,nlats:1:-1) = values_2d_anal - values_2d_fg endif enddo + ! taper function for humidity, ice and liq water increments. + taper_vert=1. + if (taper_strat) print *,'profile to taper strat humid inc (k,ak,bk,taper):' + do k=1,nlevs + if (k < nlevs/2 .and. (ak(k) <= ak_bot .and. ak(k) >= ak_top)) then + taper_vert(:,:,k)= (ak(k) - ak_top)/(ak_bot - ak_top) + else if (bk(k) .eq. 0. .and. ak(k) < ak_top) then + taper_vert(:,:,k) = 0. + endif + if (taper_strat) then + print *,k,ak(k),bk(k),taper_vert(1,1,k) + endif + enddo do nvar=1,dset_fg%nvars ndims = dset_fg%variables(nvar)%ndims @@ -302,7 +330,13 @@ PROGRAM calc_increment_ncio call read_vardata(dset_fg,trim(dset_fg%variables(nvar)%name),values_3d_fg) call read_vardata(dset_anal,trim(dset_fg%variables(nvar)%name),values_3d_anal) ! increment (flip lats) - values_3d_inc(:,nlats:1:-1,:) = values_3d_anal - values_3d_fg + if (taper_strat .and. (trim(ncvarname) .eq. 'sphum_inc' .or. & + trim(ncvarname) .eq. 'liq_wat_inc' .or. & + trim(ncvarname) .eq. 'ice_wat_inc')) then + values_3d_inc(:,nlats:1:-1,:) = taper_vert*(values_3d_anal - values_3d_fg) + else + values_3d_inc(:,nlats:1:-1,:) = values_3d_anal - values_3d_fg + endif call write_ncdata3d(values_3d_inc,ncvarname,nlons,nlats,nlevs,ncfileid,dimid_3d) endif endif ! ndims == 4 diff --git a/util/EnKF/gfs/src/getsigensmeanp_smooth.fd/CMakeLists.txt b/util/EnKF/gfs/src/getsigensmeanp_smooth.fd/CMakeLists.txt index 08ab0defdf..ce102ee833 100644 --- a/util/EnKF/gfs/src/getsigensmeanp_smooth.fd/CMakeLists.txt +++ b/util/EnKF/gfs/src/getsigensmeanp_smooth.fd/CMakeLists.txt @@ -9,4 +9,5 @@ if(BUILD_UTIL) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) include_directories( ${NEMSIOINC} ${SIGIOINC} ${NETCDF_INCLUDE_DIRS} ${FV3GFS_NCIO_INCS}) target_link_libraries( getsigensmeanp_smooth.x ${FV3GFS_NCIO_LIBRARIES} ${BACIO_LIBRARY} ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${SIGIO_LIBRARY} ${W3NCO_4_LIBRARY} ${SP_4_LIBRARY} ${MPI_Fortran_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES}) + endif() diff --git a/util/EnKF/gfs/src/recenterens_ncio.fd/CMakeLists.txt b/util/EnKF/gfs/src/recenterens_ncio.fd/CMakeLists.txt new file mode 100644 index 0000000000..7e347146f2 --- /dev/null +++ b/util/EnKF/gfs/src/recenterens_ncio.fd/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.6) +if(BUILD_UTIL) + file(GLOB LOCAL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.f90) + set_source_files_properties( ${LOCAL_SRC} PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) + add_executable(recenterens_ncio.x ${LOCAL_SRC} ) + set_target_properties( recenterens_ncio.x PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) + SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) + include_directories( ${NETCDF_INCLUDES} ${FV3GFS_NCIO_INCS}) + target_link_libraries( recenterens_ncio.x ${FV3GFS_NCIO_LIBRARIES} ${W3NCO_4_LIBRARY} ${MPI_Fortran_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES}) +endif() diff --git a/util/EnKF/gfs/src/recenterens_ncio.fd/recenterens_ncio.f90 b/util/EnKF/gfs/src/recenterens_ncio.fd/recenterens_ncio.f90 new file mode 100644 index 0000000000..6afbb572eb --- /dev/null +++ b/util/EnKF/gfs/src/recenterens_ncio.fd/recenterens_ncio.f90 @@ -0,0 +1,183 @@ +program recenterens_ncio +!$$$ main program documentation block +! +! program: recenterens_ncio recenter +! +! prgmmr: whitaker org: esrl/psd date: 2009-02-23 +! +! abstract: Read ensemble from netcdf history files, +! remove mean specified from another file, add a +! new mean specified from a third file, and write +! out result to a fourth file. 'Partial' recentering +! by weighting old and new means. +! +! program history log: +! 2020-11-04 Initial version. +! +! usage: +! input files: +! +! output files: +! +! attributes: +! language: f95 +! +! +!$$$ + + use module_fv3gfs_ncio, only: open_dataset, create_dataset, read_attribute, & + Dataset, Dimension, close_dataset, has_attr, has_var, & + read_vardata, write_attribute, write_vardata, & + get_dim, quantize_data + + implicit none + + include "mpif.h" + + real,parameter:: zero=0.0_4 + + logical:: quantize + character(len=500) filename_meani,filename_meano,filenamein,filenameout + character(len=3) charnanal, charwgt_ensmean, charwgt_control + character(len=4) charnin + integer iret,mype,mype1,npe,nanals,ierr, iwgt_ensmean, iwgt_control + integer:: latb,lonb,levs,nbits,nvar,ndims + real(4),allocatable, dimension(:,:) :: values_2d, values_2d_i, values_2d_mi,& + values_2d_mo + real(4),allocatable, dimension(:,:,:) :: values_3d, values_3d_i, values_3d_mi,& + values_3d_mo + real(4) compress_err, rwgt_control, rwgt_ensmean + + type(Dataset) :: dseti,dseto,dsetmi,dsetmo + type(Dimension) :: londim,latdim,levdim + +! Initialize mpi + call MPI_Init(ierr) + +! mype is process number, npe is total number of processes. + call MPI_Comm_rank(MPI_COMM_WORLD,mype,ierr) + call MPI_Comm_size(MPI_COMM_WORLD,npe,ierr) + + if (mype==0) call w3tagb('RECENTERENS_NCIO',2011,0319,0055,'NP25') + +! read data from this file + call getarg(1,filenamein) ! increment or analysis + +! subtract this mean + call getarg(2,filename_meani) ! mean increment or analysis + +! then add to this mean + call getarg(3,filename_meano) ! new mean analysis + +! and put in this file. + call getarg(4,filenameout) ! new increment of analysis + +! how many ensemble members to process + call getarg(5,charnin) + read(charnin,'(i4)') nanals + +! weight given to original ens mean + call getarg(6,charwgt_ensmean) + read(charwgt_ensmean,'(i3)') iwgt_ensmean + rwgt_ensmean = iwgt_ensmean/100. + +! weight given to new ens mean + call getarg(7,charwgt_control) + read(charwgt_control,'(i3)') iwgt_control + rwgt_control = iwgt_control/100. + + if (mype==0) then + write(6,*)'RECENTERENS_NCIO: PROCESS ',nanals,' ENSEMBLE MEMBERS' + write(6,*)'filenamein=',trim(filenamein) + write(6,*)'filename_meani=',trim(filename_meani) + write(6,*)'filename_meano=',trim(filename_meano) + write(6,*)'filenameout=',trim(filenameout) + write(6,*)'rwgt_ensmean,rwgt_control=',rwgt_ensmean,rwgt_control + endif + + mype1 = mype+1 + if (mype1 <= nanals) then + + dsetmi = open_dataset(filename_meani,errcode=iret) + + londim = get_dim(dsetmi,'grid_xt'); lonb = londim%len + latdim = get_dim(dsetmi,'grid_yt'); latb = latdim%len + levdim = get_dim(dsetmi,'pfull'); levs = levdim%len + write(charnanal,'(i3.3)') mype1 + dsetmo = open_dataset(filename_meano) + dseti = open_dataset(trim(filenamein)//"_mem"//charnanal) + dseto = create_dataset(trim(filenameout)//"_mem"//charnanal, dseti, copy_vardata=.true.) + do nvar=1,dseti%nvars + ndims = dseti%variables(nvar)%ndims + if (ndims > 2) then + if (ndims == 3 .and. trim(dseti%variables(nvar)%name) /= 'hgtsfc') then + ! pressfc + if (mype == 0) print *,'recentering ',& + trim(dseti%variables(nvar)%name) + call read_vardata(dseti,trim(dseti%variables(nvar)%name),values_2d_i) + call read_vardata(dsetmi,trim(dseti%variables(nvar)%name),values_2d_mi) + call read_vardata(dsetmo,trim(dseti%variables(nvar)%name),values_2d_mo) + values_2d = values_2d_i - values_2d_mi + rwgt_ensmean*values_2d_mi + rwgt_control*values_2d_mo + if (has_attr(dseti, 'nbits', trim(dseti%variables(nvar)%name))) then + call read_attribute(dseti, 'nbits', nbits, & + trim(dseti%variables(nvar)%name)) + quantize = .true. + if (nbits < 1) quantize = .false. + else + quantize = .false. + endif + if (quantize) then + values_2d_mi = values_2d + call quantize_data(values_2d_mi, values_2d, nbits, compress_err) + call write_attribute(dseto,& + 'max_abs_compression_error',compress_err,trim(dseti%variables(nvar)%name)) + endif + call write_vardata(dseto,trim(dseti%variables(nvar)%name),values_2d) + else if (ndims == 4) then + if (mype == 0) print *,'recentering ',& + trim(dseti%variables(nvar)%name) + call read_vardata(dseti,trim(dseti%variables(nvar)%name),values_3d_i) + call read_vardata(dsetmi,trim(dseti%variables(nvar)%name),values_3d_mi) + call read_vardata(dsetmo,trim(dseti%variables(nvar)%name),values_3d_mo) + values_3d = values_3d_i - values_3d_mi + rwgt_ensmean*values_3d_mi + rwgt_control*values_3d_mo + if (has_attr(dseti, 'nbits', trim(dseti%variables(nvar)%name))) then + call read_attribute(dseti, 'nbits', nbits, & + trim(dseti%variables(nvar)%name)) + quantize = .true. + if (nbits < 1) quantize = .false. + else + quantize = .false. + endif + if (quantize) then + values_3d_mi = values_3d + call quantize_data(values_3d_mi, values_3d, nbits, compress_err) + call write_attribute(dseto,& + 'max_abs_compression_error',compress_err,trim(dseti%variables(nvar)%name)) + endif + call write_vardata(dseto,trim(dseti%variables(nvar)%name),values_3d) + endif + endif ! ndims > 2 + enddo ! nvars + + deallocate(values_2d,values_2d_i,values_2d_mi,values_2d_mo) + deallocate(values_3d,values_3d_i,values_3d_mi,values_3d_mo) + call close_dataset(dsetmi) + call close_dataset(dsetmo) + call close_dataset(dseti) + call close_dataset(dseto) + +! Jump here if more mpi processors than files to process + else + write (6,*) 'no files to process for mpi task = ',mype + end if ! end if mype + + call MPI_Barrier(MPI_COMM_WORLD,ierr) + + if (mype==0) call w3tage('RECENTERENS_NCIO') + + call MPI_Finalize(ierr) + if (mype .eq. 0 .and. ierr .ne. 0) then + print *, 'MPI_Finalize error status = ',ierr + end if + +END program recenterens_ncio diff --git a/util/EnKF/gfs/src/recenterncio_hybgain.fd/recenterncio_hybgain.f90 b/util/EnKF/gfs/src/recenterncio_hybgain.fd/recenterncio_hybgain.f90 index aa063b66d4..5ab94f071c 100644 --- a/util/EnKF/gfs/src/recenterncio_hybgain.fd/recenterncio_hybgain.f90 +++ b/util/EnKF/gfs/src/recenterncio_hybgain.fd/recenterncio_hybgain.f90 @@ -6,7 +6,8 @@ program recenterncio_hybgain ! prgmmr: whitaker org: esrl/psd date: 2009-02-23 ! ! abstract: Recenter ensemble analysis files about new -! mean, computed from blended 3DVar and EnKF increments. +! mean, computed from blended 3DVar and EnKF increments +! (optionally applying RTPS inflation). ! ! program history log: ! 2019-02-10 Initial version. @@ -35,20 +36,23 @@ program recenterncio_hybgain external :: MPI_Init, MPI_Comm_rank, MPI_Comm_size, w3tagb, MPI_Abort,& MPI_Barrier, w3tage, MPI_Finalize - character*500 filename_fg,filename_varanal,filename_enkfanal,filenamein,& - filenameout,filename_anal,filename + character*500 filename_varfg,filename_varanal,filename_enkfanal,filenamein,& + filename_enkffg,filenameout,filename_anal,filename,filename_fsprd,filename_asprd character*3 charnanal character(len=4) charnin - integer mype,mype1,npe,nanals,iret,ialpha,ibeta + integer mype,mype1,npe,nanals,iret,ialpha,ibeta,irtps,i,j,k integer:: nlats,nlons,nlevs,nvar,ndims,nbits - real alpha,beta - real(4),allocatable,dimension(:,:) :: values_2d_varanal,values_2d_enkfanal,values_2d_fg,values_2d_anal,& - values_2d_tmp, values_2d - real(4),allocatable,dimension(:,:,:) :: values_3d_varanal,values_3d_enkfanal,values_3d_fg,values_3d_anal,& - values_3d_tmp, values_3d + real alpha,beta,rtps,infmin,infmax,clip + real(4),allocatable,dimension(:,:) :: values_2d_varanal,values_2d_enkfanal,& + values_2d_varfg,values_2d_enkffg,values_2d_anal,& + values_2d,asprd_2d,fsprd_2d,inf_2d,values_2d_tmp + real(4),allocatable,dimension(:,:,:) :: values_3d_varanal,values_3d_enkfanal,& + values_3d_varfg,values_3d_enkffg,values_3d_anal,& + values_3d,asprd_3d,fsprd_3d,inf_3d,values_3d_tmp real(4) compress_err - type(Dataset) :: dseti,dseto,dset_anal,dset_fg,dset_varanal,dset_enkfanal + type(Dataset) :: dseti,dseto,dset_blendanal,dset_varfg,dset_varanal,dset_enkffg,dset_enkfanal,dset_asprd,dset_fsprd type(Dimension) :: londim,latdim,levdim + logical cliptracers,tracer ! Initialize mpi call MPI_Init(iret) @@ -59,66 +63,103 @@ program recenterncio_hybgain if (mype==0) call w3tagb('RECENTERNCIO_HYBGAIN',2011,0319,0055,'NP25') - call getarg(1,filename_fg) ! first guess ensmean background netcdf file + call getarg(1,filename_varfg) ! first guess 3dvar netcdf file call getarg(2,filename_varanal) ! 3dvar analysis - call getarg(3,filename_enkfanal) ! enkf mean analysis - call getarg(4,filename_anal) ! blended analysis (to recenter ensemble around) - call getarg(5,filenamein) ! prefix for input ens member files (append _mem###) - call getarg(6,filenameout) ! prefix for output ens member files (append _mem###) + call getarg(3,filename_enkffg) ! first guess enkf netcdf file + call getarg(4,filename_enkfanal) ! enkf mean analysis + call getarg(5,filename_anal) ! blended analysis (to recenter ensemble around) + call getarg(6,filenamein) ! prefix for input ens member files (append _mem###) + call getarg(7,filenameout) ! prefix for output ens member files (append _mem###) ! blending coefficients - call getarg(7,charnin) + call getarg(8,charnin) read(charnin,'(i4)') ialpha ! wt for varanal (3dvar) alpha = ialpha/1000. - call getarg(8,charnin) + call getarg(9,charnin) read(charnin,'(i4)') ibeta ! wt for enkfanal (enkf) beta = ibeta/1000. -! new_anal = fg + alpha*(varanal-fg) + beta(enkfanal-fg) -! = (1.-alpha-beta)*fg + alpha*varanal + beta*enkfanal + call getarg(10,charnin) + read(charnin,'(i4)') irtps ! rtps relaxation coeff + rtps = irtps/1000. +! new_anal = fg + alpha*(varanal-fg) + beta*(enkfanal-fg) ! how many ensemble members to process - call getarg(9,charnin) + call getarg(11,charnin) read(charnin,'(i4)') nanals + if (rtps > 0) then + call getarg(13,filename_fsprd) ! first guess ensemble spread + call getarg(14,filename_asprd) ! analysis ensemble spread + endif + + infmin=1.0; infmax=10. + clip = tiny(rtps) if (mype==0) then write(6,*)'RECENTERNCIO_HYBGAIN: PROCESS ',nanals,' ENSEMBLE MEMBERS' - write(6,*)'ens mean background in ',trim(filename_fg) + write(6,*)'3dvar background in ',trim(filename_varfg) + write(6,*)'EnKF background in ',trim(filename_enkffg) write(6,*)'3dvar analysis in ',trim(filename_varanal) write(6,*)'EnKF mean analysis in ',trim(filename_enkfanal) write(6,*)'Blended mean analysis to be written to ',trim(filename_anal) write(6,*)'Prefix for member input files ',trim(filenamein) write(6,*)'Prefix for member output files ',trim(filenameout) - write(6,*)'3dvar weight, EnKF weight =',alpha,beta + write(6,*)'3dvar weight, EnKF weight, RTPS relaxation =',alpha,beta,rtps + if (rtps > 0) then + write(6,*)'ens spread background in ',trim(filename_fsprd) + write(6,*)'ens spread posterior in ',trim(filename_asprd) + endif endif mype1 = mype+1 if (mype1 <= nanals) then - dset_fg = open_dataset(filename_fg,errcode=iret) + dset_varfg = open_dataset(filename_varfg,errcode=iret) if (iret == 0 ) then - if (mype == 0) write(6,*)'Read netcdf ',trim(filename_fg) - londim = get_dim(dset_fg,'grid_xt'); nlons = londim%len - latdim = get_dim(dset_fg,'grid_yt'); nlats = latdim%len - levdim = get_dim(dset_fg,'pfull'); nlevs = levdim%len + if (mype == 0) write(6,*)'Read netcdf ',trim(filename_varfg) + londim = get_dim(dset_varfg,'grid_xt'); nlons = londim%len + latdim = get_dim(dset_varfg,'grid_yt'); nlats = latdim%len + levdim = get_dim(dset_varfg,'pfull'); nlevs = levdim%len if (mype == 0) write(6,*)' nlons=',nlons,' nlats=',nlats,' nlevs=',nlevs else - write(6,*) 'error opening ',trim(filename_fg) + write(6,*) 'error opening ',trim(filename_varfg) call MPI_Abort(MPI_COMM_WORLD,98,iret) stop endif - ! readin in 3dvar, enkf analyses, plus ens mean background, blend + ! read in 3dvar, enkf analyses and backgrounds, blend increments + if (alpha > 0) then dset_varanal = open_dataset(filename_varanal,errcode=iret) if (iret /= 0) then print *,'error opening ',trim(filename_varanal) call MPI_Abort(MPI_COMM_WORLD,98,iret) stop endif + endif dset_enkfanal = open_dataset(filename_enkfanal,errcode=iret) if (iret /= 0) then print *,'error opening ',trim(filename_enkfanal) call MPI_Abort(MPI_COMM_WORLD,98,iret) stop endif - if (mype == 0) then - dset_anal = create_dataset(filename_anal, dset_enkfanal, & + dset_enkffg = open_dataset(filename_enkffg,errcode=iret) + if (iret /= 0) then + print *,'error opening ',trim(filename_enkffg) + call MPI_Abort(MPI_COMM_WORLD,98,iret) + stop + endif + if (rtps > 0) then + dset_fsprd = open_dataset(filename_fsprd,errcode=iret) + if (iret /= 0) then + print *,'error opening ',trim(filename_fsprd) + call MPI_Abort(MPI_COMM_WORLD,98,iret) + stop + endif + dset_asprd = open_dataset(filename_asprd,errcode=iret) + if (iret /= 0) then + print *,'error opening ',trim(filename_asprd) + call MPI_Abort(MPI_COMM_WORLD,98,iret) + stop + endif + endif + if (mype == 0 .and. alpha > 0) then + dset_blendanal = create_dataset(filename_anal, dset_enkfanal, & copy_vardata=.true., errcode=iret) if (iret /= 0) then print *,'error opening ',trim(filename_anal) @@ -142,88 +183,151 @@ program recenterncio_hybgain call MPI_Abort(MPI_COMM_WORLD,98,iret) stop endif + allocate(inf_2d(nlons,nlats),fsprd_2d(nlons,nlats),asprd_2d(nlons,nlats)) + allocate(inf_3d(nlons,nlats,nlevs),fsprd_3d(nlons,nlats,nlevs),asprd_3d(nlons,nlats,nlevs)) - do nvar=1,dset_fg%nvars - ndims = dset_fg%variables(nvar)%ndims + do nvar=1,dset_varfg%nvars + ndims = dset_varfg%variables(nvar)%ndims + if (trim(dset_varfg%variables(nvar)%name) == 'spfh' .or. & + trim(dset_varfg%variables(nvar)%name) == 'o3mr' .or. & + trim(dset_varfg%variables(nvar)%name) == 'clwmr' .or. & + trim(dset_varfg%variables(nvar)%name) == 'icmr') then + tracer = .true. + else + tracer = .false. + endif if (ndims > 2) then - if (ndims == 3 .and. trim(dset_fg%variables(nvar)%name) /= 'hgtsfc') then + if (ndims == 3 .and. trim(dset_varfg%variables(nvar)%name) /= 'hgtsfc') then ! pressfc - call read_vardata(dset_fg,trim(dset_fg%variables(nvar)%name),values_2d_fg) - call read_vardata(dset_varanal,trim(dset_fg%variables(nvar)%name),values_2d_varanal) - call read_vardata(dset_enkfanal,trim(dset_fg%variables(nvar)%name),values_2d_enkfanal) - call read_vardata(dseti,trim(dset_fg%variables(nvar)%name),values_2d) + call read_vardata(dset_varfg,trim(dset_varfg%variables(nvar)%name),values_2d_varfg) + call read_vardata(dset_enkffg,trim(dset_enkffg%variables(nvar)%name),values_2d_enkffg) + if (alpha>0) call read_vardata(dset_varanal,trim(dset_varfg%variables(nvar)%name),values_2d_varanal) + call read_vardata(dset_enkfanal,trim(dset_enkffg%variables(nvar)%name),values_2d_enkfanal) + call read_vardata(dseti,trim(dset_enkffg%variables(nvar)%name),values_2d) ! blended analysis - values_2d_anal = (1.-alpha-beta)*values_2d_fg + & - alpha*values_2d_varanal + & - beta*values_2d_enkfanal + values_2d_anal = values_2d_enkffg + beta*(values_2d_enkfanal-values_2d_enkffg) + if (alpha > 0) & + values_2d_anal = values_2d_anal + alpha*(values_2d_varanal-values_2d_varfg) ! recentered ensemble member - values_2d = values_2d - values_2d_enkfanal + values_2d_anal - if (has_attr(dset_fg, 'nbits', trim(dset_fg%variables(nvar)%name))) then - call read_attribute(dset_fg, 'nbits', nbits, & - trim(dset_fg%variables(nvar)%name),errcode=iret) + if (rtps > 0) then ! RTPS inflation + call read_vardata(dset_fsprd,trim(dset_enkffg%variables(nvar)%name),fsprd_2d) + call read_vardata(dset_asprd,trim(dset_enkffg%variables(nvar)%name),asprd_2d) + fsprd_2d = max(fsprd_2d,tiny(fsprd_2d)) + asprd_2d = max(asprd_2d,tiny(asprd_2d)) + inf_2d = rtps*((fsprd_2d-asprd_2d)/asprd_2d) + 1.0 + do j=1,nlats + do i=1,nlons + inf_2d(i,j) = max(infmin,min(inf_2d(i,j),infmax)) + enddo + enddo + values_2d = inf_2d*(values_2d - values_2d_enkfanal) + values_2d_anal + if (mype == 0) & + print *,'min/max ',trim(dset_enkffg%variables(nvar)%name),& + ' inflation = ',minval(inf_2d),maxval(inf_2d) + else + values_2d = values_2d - values_2d_enkfanal + values_2d_anal + endif + if (has_attr(dset_enkffg, 'nbits', trim(dset_enkffg%variables(nvar)%name))) then + call read_attribute(dset_enkffg, 'nbits', nbits, & + trim(dset_enkffg%variables(nvar)%name),errcode=iret) else iret = 1 endif - if (mype == 0) then ! write out blended analysis on root task + if (mype == 0 .and. alpha > 0) then ! write out blended analysis on root task if (iret == 0 .and. nbits > 0) then values_2d_tmp = values_2d_anal call quantize_data(values_2d_tmp, values_2d_anal, nbits, compress_err) - call write_attribute(dset_anal,& - 'max_abs_compression_error',compress_err,trim(dset_fg%variables(nvar)%name)) + call write_attribute(dset_blendanal,& + 'max_abs_compression_error',compress_err,trim(dset_enkffg%variables(nvar)%name)) endif - call write_vardata(dset_anal,trim(dset_fg%variables(nvar)%name),values_2d_anal) + call write_vardata(dset_blendanal,trim(dset_enkffg%variables(nvar)%name),values_2d_anal) endif if (iret == 0 .and. nbits > 0) then values_2d_tmp = values_2d call quantize_data(values_2d_tmp, values_2d, nbits, compress_err) call write_attribute(dseto,& - 'max_abs_compression_error',compress_err,trim(dset_fg%variables(nvar)%name)) + 'max_abs_compression_error',compress_err,trim(dset_enkffg%variables(nvar)%name)) endif - call write_vardata(dseto,trim(dset_fg%variables(nvar)%name),values_2d) + if (tracer) then + if (cliptracers) where (values_2d < clip) values_2d = clip + if (mype == 0) & + print *,'clipping ',trim(dset_enkffg%variables(nvar)%name) + endif + call write_vardata(dseto,trim(dset_enkffg%variables(nvar)%name),values_2d) else if (ndims == 4) then - call read_vardata(dset_fg,trim(dset_fg%variables(nvar)%name),values_3d_fg) - call read_vardata(dset_varanal,trim(dset_fg%variables(nvar)%name),values_3d_varanal) - call read_vardata(dset_enkfanal,trim(dset_fg%variables(nvar)%name),values_3d_enkfanal) - call read_vardata(dseti,trim(dset_fg%variables(nvar)%name),values_3d) + call read_vardata(dset_varfg,trim(dset_varfg%variables(nvar)%name),values_3d_varfg) + call read_vardata(dset_enkffg,trim(dset_enkffg%variables(nvar)%name),values_3d_enkffg) + if (alpha>0) call read_vardata(dset_varanal,trim(dset_varfg%variables(nvar)%name),values_3d_varanal) + call read_vardata(dset_enkfanal,trim(dset_enkffg%variables(nvar)%name),values_3d_enkfanal) + call read_vardata(dseti,trim(dset_enkffg%variables(nvar)%name),values_3d) ! blended analysis - values_3d_anal = (1.-alpha-beta)*values_3d_fg + & - alpha*values_3d_varanal + & - beta*values_3d_enkfanal + values_3d_anal = values_3d_enkffg + beta*(values_3d_enkfanal-values_3d_enkffg) + if (alpha > 0) & + values_3d_anal = values_3d_anal + alpha*(values_3d_varanal-values_3d_varfg) ! recentered ensemble member - values_3d = values_3d - values_3d_enkfanal + values_3d_anal - if (has_attr(dset_fg, 'nbits', trim(dset_fg%variables(nvar)%name))) then - call read_attribute(dset_fg, 'nbits', nbits, & - trim(dset_fg%variables(nvar)%name),errcode=iret) + if (rtps > 0) then ! RTPS inflation + call read_vardata(dset_fsprd,trim(dset_enkffg%variables(nvar)%name),fsprd_3d) + call read_vardata(dset_asprd,trim(dset_enkffg%variables(nvar)%name),asprd_3d) + fsprd_3d = max(fsprd_3d,tiny(fsprd_3d)) + asprd_3d = max(asprd_3d,tiny(asprd_3d)) + inf_3d = rtps*((fsprd_3d-asprd_3d)/asprd_3d) + 1.0 + do k=1,nlevs + do j=1,nlats + do i=1,nlons + inf_3d(i,j,k) = max(infmin,min(inf_3d(i,j,k),infmax)) + enddo + enddo + enddo + values_3d = inf_3d*(values_3d - values_3d_enkfanal) + values_3d_anal + if (mype == 0) & + print *,'min/max ',trim(dset_enkffg%variables(nvar)%name),& + ' inflation = ',minval(inf_3d),maxval(inf_3d) + else + values_3d = values_3d - values_3d_enkfanal + values_3d_anal + endif + if (has_attr(dset_enkffg, 'nbits', trim(dset_enkffg%variables(nvar)%name))) then + call read_attribute(dset_enkffg, 'nbits', nbits, & + trim(dset_enkffg%variables(nvar)%name),errcode=iret) else iret = 1 endif - if (mype == 0) then ! write out blended analysis on root task + if (mype == 0 .and. alpha > 0) then ! write out blended analysis on root task if (iret == 0 .and. nbits > 0) then values_3d_tmp = values_3d_anal call quantize_data(values_3d_tmp, values_3d_anal, nbits, compress_err) - call write_attribute(dset_anal,& - 'max_abs_compression_error',compress_err,trim(dset_fg%variables(nvar)%name)) + call write_attribute(dset_blendanal,& + 'max_abs_compression_error',compress_err,trim(dset_enkffg%variables(nvar)%name)) endif - call write_vardata(dset_anal,trim(dset_fg%variables(nvar)%name),values_3d_anal) + call write_vardata(dset_blendanal,trim(dset_enkffg%variables(nvar)%name),values_3d_anal) endif if (iret == 0 .and. nbits > 0) then values_3d_tmp = values_3d call quantize_data(values_3d_tmp, values_3d, nbits, compress_err) call write_attribute(dseto,& - 'max_abs_compression_error',compress_err,trim(dset_fg%variables(nvar)%name)) + 'max_abs_compression_error',compress_err,trim(dset_enkffg%variables(nvar)%name)) + endif + if (tracer) then + if (cliptracers) where (values_3d < clip) values_3d = clip + if (mype == 0) & + print *,'clipping ',trim(dset_enkffg%variables(nvar)%name) endif - call write_vardata(dseto,trim(dset_fg%variables(nvar)%name),values_3d) + call write_vardata(dseto,trim(dset_enkffg%variables(nvar)%name),values_3d) endif endif ! ndims > 2 enddo ! nvars - if (mype == 0) call close_dataset(dset_anal) + if (mype == 0 .and. alpha > 0) call close_dataset(dset_blendanal) call close_dataset(dseti) call close_dataset(dseto) - call close_dataset(dset_fg) - call close_dataset(dset_varanal) + call close_dataset(dset_enkffg) + call close_dataset(dset_varfg) + if (alpha > 0) call close_dataset(dset_varanal) call close_dataset(dset_enkfanal) + if (rtps > 0) then + call close_dataset(dset_fsprd) + call close_dataset(dset_asprd) + endif write(6,*)'task mype=',mype,' process ',trim(filenameout)//"_mem"//charnanal,' iret=',iret ! Jump here if more mpi processors than files to process @@ -232,9 +336,12 @@ program recenterncio_hybgain end if ! end if mype 100 continue + deallocate(asprd_2d,asprd_3d) + deallocate(fsprd_2d,fsprd_3d) + deallocate(inf_2d,inf_3d) call MPI_Barrier(MPI_COMM_WORLD,iret) - if (mype==0) call w3tage('RECENTERSIGP_HYBGAIN') + if (mype==0) call w3tage('RECENTERSIGP_HYBGAIN2') call MPI_Finalize(iret) if (mype == 0 .and. iret /= 0) then diff --git a/util/EnKF/gfs/src/recentersigp.fd/recentersigp.f90 b/util/EnKF/gfs/src/recentersigp.fd/recentersigp.f90 index bc01dbd984..321845bf35 100644 --- a/util/EnKF/gfs/src/recentersigp.fd/recentersigp.f90 +++ b/util/EnKF/gfs/src/recentersigp.fd/recentersigp.f90 @@ -82,23 +82,23 @@ program recentersigp NSIGO=61 ! read data from this file - call getarg(1,filenamein) + call getarg(1,filenamein) ! increment or analysis ! subtract this mean - call getarg(2,filename_meani) + call getarg(2,filename_meani) ! mean increment or analysis ! then add to this mean - call getarg(3,filename_meano) + call getarg(3,filename_meano) ! new mean analysis ! and put in this file. - call getarg(4,filenameout) + call getarg(4,filenameout) ! new increment of analysis ! how many ensemble members to process call getarg(5,charnin) read(charnin,'(i4)') nanals ! option for increment, read in ens mean guess - call getarg(6,filename_meang) + call getarg(6,filename_meang) ! background ens mean fcst if (mype==0) then @@ -294,6 +294,9 @@ program recentersigp end select values_3d(:,:,:) = zero do j=1,latb +! updated member increment = original member increment - background ens mean - original +! mean increment + gsi control analysis +! = original member increment + gsi control analysis - enkf mean analysis values_3d(:,j,:) = values_3d_i(:,j,:) - values_3d_mb(:,latb-j+1,:) - values_3d_mi(:,j,:) + values_3d_anl(:,latb-j+1,:) end do if (should_zero_increments_for(trim(dseti%variables(nvar)%name))) values_3d = zero diff --git a/util/netcdf_io/calc_analysis.fd/init_calc_analysis.f90 b/util/netcdf_io/calc_analysis.fd/init_calc_analysis.f90 index 2d7c922da7..bd65f08849 100644 --- a/util/netcdf_io/calc_analysis.fd/init_calc_analysis.f90 +++ b/util/netcdf_io/calc_analysis.fd/init_calc_analysis.f90 @@ -41,16 +41,22 @@ subroutine read_nml stop 99 end if + if (fhr > 0) then write(hrstr,'(I0.2)') fhr anal_file = trim(adjustl(datapath)) // '/' // trim(adjustl(analysis_filename)) // '.' // hrstr fcst_file = trim(adjustl(datapath)) // '/' // trim(adjustl(firstguess_filename)) // '.' // hrstr incr_file = trim(adjustl(datapath)) // '/' // trim(adjustl(increment_filename)) // '.' // hrstr + else + anal_file = trim(adjustl(datapath)) // '/' // trim(adjustl(analysis_filename)) + fcst_file = trim(adjustl(datapath)) // '/' // trim(adjustl(firstguess_filename)) + incr_file = trim(adjustl(datapath)) // '/' // trim(adjustl(increment_filename)) + endif if (mype == 0) then write(6,*) 'Analysis File = ', trim(anal_file) write(6,*) 'First Guess File = ', trim(fcst_file) write(6,*) 'Increment File = ', trim(incr_file) - write(6,*) 'Forecast Hour = ', fhr + if (fhr > 0) write(6,*) 'Forecast Hour = ', fhr write(6,*) 'Number of PEs = ', npes write(6,*) 'input guess file and increment file should be in netCDF format' if (use_nemsio_anl) then From 63963a9fc95670289f866c2ef11a6402ca591e17 Mon Sep 17 00:00:00 2001 From: "edward.safford" Date: Tue, 11 Jan 2022 13:19:44 +0000 Subject: [PATCH 3/7] Github issue #265, MinMon maintenance update. Completes #265. --- util/Minimization_Monitor/MinMon_install.pl | 31 +- .../data_xtrct/ush/MinMon_CP.sh | 128 +++++ .../data_xtrct/ush/MinMon_DE.sh | 177 +++---- .../data_xtrct/ush/RunMM_DE.sh | 209 -------- .../data_xtrct/ush/find_cycle.pl | 10 +- .../data_xtrct/ush/onprod.sh | 22 - .../data_xtrct/ush/run_cp_v16rt1.sh | 54 --- .../data_xtrct/ush/run_gdas_DE.sh | 37 -- .../data_xtrct/ush/run_gfs_DE.sh | 36 -- .../data_xtrct/ush/run_script.sh | 71 --- .../data_xtrct/ush/run_v16rt1.sh | 60 --- util/Minimization_Monitor/get_hostname.pl | 3 + .../image_gen/ush/MinMon_Plt.sh | 271 +++++------ .../image_gen/ush/nu_make_archive.sh | 204 -------- .../image_gen/ush/onprod.sh | 22 - .../image_gen/ush/pen_data_map.xml | 16 - .../image_gen/ush/query_data_map.pl | 73 --- .../image_gen/ush/run_gdas_IG.sh | 48 -- .../image_gen/ush/run_gfs_IG.sh | 48 -- .../image_gen/ush/run_script.sh | 70 --- .../image_gen/ush/run_v16rt1_IG.sh | 61 --- .../image_gen/ush/update_ctl_tdef.sh | 3 - .../image_gen/ush/update_ctl_xdef.sh | 93 ---- .../image_gen/ush/update_data_map.pl | 61 --- .../gdas.v1.0.0/driver/test_jgdas_vminmon.sh | 76 --- .../driver/test_jgdas_vminmon_hera.sh | 74 --- .../driver/test_jgdas_vminmon_theia.sh | 81 ---- .../nwprod/gdas.v1.0.0/parm/gdas_minmon.parm | 21 - .../gdas/driver/test_jgdas_vminmon_hera.sh | 54 +++ .../gdas/driver/test_jgdas_vminmon_wcoss2.sh | 62 +++ .../driver/test_jgdas_vminmon_wcoss_c.sh} | 33 +- .../driver/test_jgdas_vminmon_wcoss_d.sh | 21 +- .../fix/gdas_minmon_cost.txt | 0 .../fix/gdas_minmon_gnorm.txt | 0 .../jobs/JGDAS_ATMOS_VMINMON | 15 +- .../scripts/exgdas_atmos_vminmon.sh | 9 +- .../gfs.v1.0.0/driver/test_jgfs_vminmon.sh | 77 --- .../driver/test_jgfs_vminmon_theia.sh | 81 ---- .../nwprod/gfs.v1.0.0/parm/gfs_minmon.parm | 16 - .../driver/test_jgfs_vminmon_hera.sh | 47 +- .../gfs/driver/test_jgfs_vminmon_wcoss2.sh | 71 +++ .../driver/test_jgfs_vminmon_wcoss_c.sh} | 35 +- .../driver/test_jgfs_vminmon_wcoss_d.sh | 21 +- .../fix/gfs_minmon_cost.txt | 0 .../fix/gfs_minmon_gnorm.txt | 0 .../jobs/JGFS_ATMOS_VMINMON | 23 +- .../scripts/exgfs_atmos_vminmon.sh | 0 .../ush/minmon_xtrct_costs.pl | 233 --------- .../ush/minmon_xtrct_gnorms.pl | 446 ------------------ .../ush/minmon_xtrct_reduct.pl | 92 ---- .../ush/minmon_xtrct_costs.pl | 21 +- .../ush/minmon_xtrct_gnorms.pl | 31 +- .../ush/minmon_xtrct_reduct.pl | 24 +- .../driver/test_nam_minmon.sh | 0 .../fix/nam_minmon_cost.txt | 0 .../fix/nam_minmon_gnorm.txt | 0 .../jobs/JNAM_MINMON | 0 .../parm/nam_minmon.parm | 0 .../scripts/exnam_vrfminmon.sh.ecf | 0 util/Minimization_Monitor/parm/MinMon.ver | 15 - util/Minimization_Monitor/parm/MinMon_config | 65 ++- .../parm/MinMon_user_settings | 10 +- 62 files changed, 685 insertions(+), 2877 deletions(-) create mode 100755 util/Minimization_Monitor/data_xtrct/ush/MinMon_CP.sh delete mode 100755 util/Minimization_Monitor/data_xtrct/ush/RunMM_DE.sh delete mode 100755 util/Minimization_Monitor/data_xtrct/ush/onprod.sh delete mode 100755 util/Minimization_Monitor/data_xtrct/ush/run_cp_v16rt1.sh delete mode 100755 util/Minimization_Monitor/data_xtrct/ush/run_gdas_DE.sh delete mode 100755 util/Minimization_Monitor/data_xtrct/ush/run_gfs_DE.sh delete mode 100755 util/Minimization_Monitor/data_xtrct/ush/run_script.sh delete mode 100755 util/Minimization_Monitor/data_xtrct/ush/run_v16rt1.sh delete mode 100755 util/Minimization_Monitor/image_gen/ush/nu_make_archive.sh delete mode 100755 util/Minimization_Monitor/image_gen/ush/onprod.sh delete mode 100644 util/Minimization_Monitor/image_gen/ush/pen_data_map.xml delete mode 100755 util/Minimization_Monitor/image_gen/ush/query_data_map.pl delete mode 100755 util/Minimization_Monitor/image_gen/ush/run_gdas_IG.sh delete mode 100755 util/Minimization_Monitor/image_gen/ush/run_gfs_IG.sh delete mode 100755 util/Minimization_Monitor/image_gen/ush/run_script.sh delete mode 100755 util/Minimization_Monitor/image_gen/ush/run_v16rt1_IG.sh delete mode 100755 util/Minimization_Monitor/image_gen/ush/update_ctl_xdef.sh delete mode 100755 util/Minimization_Monitor/image_gen/ush/update_data_map.pl delete mode 100755 util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon.sh delete mode 100755 util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_hera.sh delete mode 100755 util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_theia.sh delete mode 100644 util/Minimization_Monitor/nwprod/gdas.v1.0.0/parm/gdas_minmon.parm create mode 100755 util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_hera.sh create mode 100755 util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_wcoss2.sh rename util/Minimization_Monitor/nwprod/{gdas.v1.0.0/driver/test_jgdas_vminmon_cray.sh => gdas/driver/test_jgdas_vminmon_wcoss_c.sh} (57%) rename util/Minimization_Monitor/nwprod/{gdas.v1.0.0 => gdas}/driver/test_jgdas_vminmon_wcoss_d.sh (80%) rename util/Minimization_Monitor/nwprod/{gdas.v1.0.0 => gdas}/fix/gdas_minmon_cost.txt (100%) rename util/Minimization_Monitor/nwprod/{gdas.v1.0.0 => gdas}/fix/gdas_minmon_gnorm.txt (100%) rename util/Minimization_Monitor/nwprod/{gdas.v1.0.0 => gdas}/jobs/JGDAS_ATMOS_VMINMON (84%) rename util/Minimization_Monitor/nwprod/{gdas.v1.0.0 => gdas}/scripts/exgdas_atmos_vminmon.sh (91%) delete mode 100755 util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon.sh delete mode 100755 util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_theia.sh delete mode 100644 util/Minimization_Monitor/nwprod/gfs.v1.0.0/parm/gfs_minmon.parm rename util/Minimization_Monitor/nwprod/{gfs.v1.0.0 => gfs}/driver/test_jgfs_vminmon_hera.sh (60%) create mode 100755 util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_wcoss2.sh rename util/Minimization_Monitor/nwprod/{gfs.v1.0.0/driver/test_jgfs_vminmon_cray.sh => gfs/driver/test_jgfs_vminmon_wcoss_c.sh} (57%) rename util/Minimization_Monitor/nwprod/{gfs.v1.0.0 => gfs}/driver/test_jgfs_vminmon_wcoss_d.sh (79%) rename util/Minimization_Monitor/nwprod/{gfs.v1.0.0 => gfs}/fix/gfs_minmon_cost.txt (100%) rename util/Minimization_Monitor/nwprod/{gfs.v1.0.0 => gfs}/fix/gfs_minmon_gnorm.txt (100%) rename util/Minimization_Monitor/nwprod/{gfs.v1.0.0 => gfs}/jobs/JGFS_ATMOS_VMINMON (78%) rename util/Minimization_Monitor/nwprod/{gfs.v1.0.0 => gfs}/scripts/exgfs_atmos_vminmon.sh (100%) delete mode 100755 util/Minimization_Monitor/nwprod/minmon_shared.v1.0.0/ush/minmon_xtrct_costs.pl delete mode 100755 util/Minimization_Monitor/nwprod/minmon_shared.v1.0.0/ush/minmon_xtrct_gnorms.pl delete mode 100755 util/Minimization_Monitor/nwprod/minmon_shared.v1.0.0/ush/minmon_xtrct_reduct.pl rename util/Minimization_Monitor/nwprod/{minmon_shared.v1.0.1 => minmon_shared}/ush/minmon_xtrct_costs.pl (92%) rename util/Minimization_Monitor/nwprod/{minmon_shared.v1.0.1 => minmon_shared}/ush/minmon_xtrct_gnorms.pl (95%) rename util/Minimization_Monitor/nwprod/{minmon_shared.v1.0.1 => minmon_shared}/ush/minmon_xtrct_reduct.pl (78%) rename util/Minimization_Monitor/nwprod/{nam_minmon.v1.0.0 => nam_minmon}/driver/test_nam_minmon.sh (100%) rename util/Minimization_Monitor/nwprod/{nam_minmon.v1.0.0 => nam_minmon}/fix/nam_minmon_cost.txt (100%) rename util/Minimization_Monitor/nwprod/{nam_minmon.v1.0.0 => nam_minmon}/fix/nam_minmon_gnorm.txt (100%) rename util/Minimization_Monitor/nwprod/{nam_minmon.v1.0.0 => nam_minmon}/jobs/JNAM_MINMON (100%) rename util/Minimization_Monitor/nwprod/{nam_minmon.v1.0.0 => nam_minmon}/parm/nam_minmon.parm (100%) rename util/Minimization_Monitor/nwprod/{nam_minmon.v1.0.0 => nam_minmon}/scripts/exnam_vrfminmon.sh.ecf (100%) delete mode 100644 util/Minimization_Monitor/parm/MinMon.ver diff --git a/util/Minimization_Monitor/MinMon_install.pl b/util/Minimization_Monitor/MinMon_install.pl index d4d35597b9..10ee6b200d 100755 --- a/util/Minimization_Monitor/MinMon_install.pl +++ b/util/Minimization_Monitor/MinMon_install.pl @@ -5,8 +5,8 @@ # # This script makes sets all configuration definitions # and calls the makeall.sh script to build all the necessary -# executables. This script works for wcoss, wcoss_d, cray, and -# hera. +# executables. This script works for wcoss, wcoss_d, cray, hera, +# and wcoss2. # #------------------------------------------------------------------- @@ -16,7 +16,7 @@ my $machine = `/usr/bin/perl get_hostname.pl`; my $my_machine="export MY_MACHINE=$machine"; - if( $machine ne "hera" && $machine ne "wcoss" && + if( $machine ne "hera" && $machine ne "wcoss" && $machine ne "wcoss2" && $machine ne "wcoss_d" && $machine ne "cray" ) { die( "ERROR --- Unrecognized machine hostname, $machine. Exiting now...\n" ); } @@ -61,6 +61,9 @@ elsif( $machine eq "wcoss_d" ){ $tankdir = "/gpfs/dell2/emc/modeling/noscrub/$user_name/nbns"; } + elsif( $machine eq "wcoss2" ){ + $tankdir = "/lfs/h2/emc/da/noscrub/$user_name/nbns"; + } else { $tankdir = "/global/save/$user_name/nbns"; } @@ -148,6 +151,10 @@ $my_ptmp="export MY_PTMP=\${MY_PTMP:-/gpfs/dell2/ptmp/$user_name}"; $my_stmp="export MY_STMP=\${MY_STMP:-/gpfs/dell2/stmp/$user_name}"; } + elsif( $machine eq "wcoss2" ) { + $my_ptmp="export MY_PTMP=\${MY_PTMP:-/lfs/h2/emc/ptmp/$user_name}"; + $my_stmp="export MY_STMP=\${MY_STMP:-/lfs/h2/emc/stmp/$user_name}"; + } elsif( $machine eq "hera" ) { $ptmp = "/scratch2/NCEPDEV/stmp3/${user_name}"; print "Please specify PTMP location. This is used for temporary work space.\n"; @@ -185,8 +192,6 @@ print "\n\n"; sleep( 1 ); -# $my_ptmp="export MY_PTMP=\${MY_PTMP:-/scratch2/NCEPDEV/stmp3/${user_name}}"; -# $my_stmp="export MY_STMP=\${MY_STMP:-/scratch2/NCEPDEV/stmp1/${user_name}}"; } # @@ -232,7 +237,7 @@ # # Web directory # - my $webdir = "/home/people/emc/www/htdocs/gmb/gdas/radiance/${webuser}/gsi_stat/pngs"; + my $webdir = "/home/people/emc/www/htdocs/gmb/gdas/gsi_stat/pngs"; print "Please specify the top level web site directory $server.\n"; print " Return to accept default directory location or enter new location.\n"; print " \n"; @@ -306,7 +311,13 @@ # # project definition # - my $project = "GDAS-T2O"; + my $project = "GDAS-DEV"; + if( $machine eq "wcoss_d" ) { + $project = "GFS-DEV"; + } elsif( $machine eq "cray" ){ + $project = "GDAS-T2O" + } + my $my_project = ""; if( $machine eq "hera" ) { @@ -333,6 +344,9 @@ # job queue definition # my $job_queue = "dev_shared"; + if( $machine eq "wcoss2" ) { + $job_queue = "dev"; + } my $my_job_queue = ""; if( $machine eq "hera" ) { @@ -348,6 +362,7 @@ if( length($new_queue ) > 0 ) { $job_queue = $new_queue; } + $my_job_queue="export JOB_QUEUE=\${JOB_QUEUE:-$job_queue}"; print "my_job_queue = $my_job_queue\n"; print "\n\n"; @@ -369,7 +384,7 @@ elsif( $_ =~ "export PROJECT" ){ print $out "$my_project\n"; } - elsif( $line =~ "export JOB_QUEUE" ){ + elsif( $_ =~ "export JOB_QUEUE" ){ print $out "$my_job_queue\n"; } else { diff --git a/util/Minimization_Monitor/data_xtrct/ush/MinMon_CP.sh b/util/Minimization_Monitor/data_xtrct/ush/MinMon_CP.sh new file mode 100755 index 0000000000..ef048e451b --- /dev/null +++ b/util/Minimization_Monitor/data_xtrct/ush/MinMon_CP.sh @@ -0,0 +1,128 @@ +#!/bin/bash + +# MinMon data copy script + +#-------------------------------------------------------------------- +# usage +#-------------------------------------------------------------------- +function usage { + echo "Usage: MinMon_CP.sh suffix [-p|--pdate pdate -r|--run gdas|gfs]" + echo " Suffix is the indentifier for this data source." + echo " -p | --pdate yyyymmddcc to specify the cycle to be processed" + echo " if unspecified the last available date will be processed" + echo " -r | --run the gdas|gfs run to be processed" + echo " use only if data in TANKdir stores both runs" + echo " -d | --data base location of minmon data without any" + echo " date-dependent subdirectories" + echo " " +} + +#-------------------------------------------------------------------- +# MinMon_DE.sh begins here +#-------------------------------------------------------------------- + +set -x + +nargs=$# +if [[ $nargs -lt 1 || $nargs -gt 7 ]]; then + usage + exit 1 +fi + +#----------------------------------------------- +# Process command line arguments +# +while [[ $# -ge 1 ]] +do + key="$1" + echo $key + + case $key in + -p|--pdate) + pdate="$2" + shift # past argument + ;; + -r|--run) + run="$2" + shift # past argument + ;; + -d|--data) # base location of minmon data + data="$2" + shift # past argument + ;; + *) + #any unspecified key is MINMON_SUFFIX + export MINMON_SUFFIX=$key + ;; + esac + + shift +done + +if [[ $data = "" ]]; then + data=/gpfs/dell1/nco/ops/com/gfs/prod +fi + +if [[ $run = "" ]]; then + run=gdas +fi + +#----------------------------------- +# source config and settings files +# +this_dir=`dirname $0` +top_parm=${this_dir}/../../parm + +minmon_config=${minmon_config:-${top_parm}/MinMon_config} +if [[ ! -e ${minmon_config} ]]; then + echo "Unable to locate ${minmon_config} file" + exit 3 +fi + +. ${minmon_config} +if [[ $? -ne 0 ]]; then + echo "Error detected while sourcing ${minmon_config} file" + exit $? +fi + + +minmon_user_settings=${minmon_user_settings:-${top_parm}/MinMon_user_settings} +if [[ ! -e ${minmon_user_settings} ]]; then + echo "Unable to locate ${minmon_user_settings} file" + exit 4 +fi + +. ${minmon_user_settings} +if [[ $? -ne 0 ]]; then + echo "Error detected while sourcing ${minmon_user_settings} file" + exit $? +fi + + +tank=${M_TANKverf}/stats/${MINMON_SUFFIX} + +echo NDATE = $NDATE +if [[ $pdate = "" ]]; then + ldate=`${this_dir}/find_cycle.pl --cyc 1 --dir ${tank} --run ${run}` + echo ldate = $ldate + pdate=`${NDATE} +06 $ldate` +fi + +echo pdate = $pdate + +pdy=`echo $pdate|cut -c1-8` +cyc=`echo $pdate|cut -c9-10` + +data_loc=${data}/${run}.${pdy}/${cyc}/atmos/minmon +tank=${tank}/${run}.${pdy}/${cyc}/minmon +mkdir -p ${tank} + +if [[ ! -d ${data_loc} ]]; then + echo "Unable to copy, ${data_loc} not found" + exit 5 +fi + +cp ${data_loc}/*${pdate}* ${tank}/. +cp ${data_loc}/gnorm_data.txt ${tank}/. + + diff --git a/util/Minimization_Monitor/data_xtrct/ush/MinMon_DE.sh b/util/Minimization_Monitor/data_xtrct/ush/MinMon_DE.sh index fbf82bc5bb..51b3d3885e 100755 --- a/util/Minimization_Monitor/data_xtrct/ush/MinMon_DE.sh +++ b/util/Minimization_Monitor/data_xtrct/ush/MinMon_DE.sh @@ -1,4 +1,4 @@ -#!/bin/ksh +#!/bin/bash # MinMon data extraction script @@ -12,6 +12,8 @@ function usage { echo " if unspecified the last available date will be processed" echo " -r | --run the gdas|gfs run to be processed" echo " use only if data in TANKdir stores both runs" + echo " -c | --comin the base directory to the gsistat files" + echo " This does not include any date-derived subdirectories." echo " " } @@ -22,7 +24,7 @@ function usage { set -x nargs=$# -if [[ $nargs -lt 1 || $nargs -gt 5 ]]; then +if [[ $nargs -lt 1 || $nargs -gt 7 ]]; then usage exit 1 fi @@ -31,7 +33,6 @@ fi #----------------------------------------------- # Process command line arguments # -RUN=gdas while [[ $# -ge 1 ]] do @@ -47,6 +48,10 @@ do RUN="$2" shift # past argument ;; + -c|--comin) # comin is base location of dir with gsistat files + COMIN="$2" + shift # past argument + ;; *) #any unspecified key is MINMON_SUFFIX export MINMON_SUFFIX=$key @@ -56,62 +61,52 @@ do shift done +#---------------------------- +# set defaults for arguments +# +if [[ $RUN = "" ]]; then + RUN=gdas +fi export RUN=$RUN -this_dir=`dirname $0` - - -if [[ $COMOUT = "" ]]; then - export RUN_ENVIR="dev" -else - export RUN_ENVIR="para" +if [[ $COMIN = "" ]]; then + COMIN=/gpfs/dell1/nco/ops/com/gfs/prod fi echo MINMON_SUFFIX = $MINMON_SUFFIX -echo RUN_ENVIR = $RUN_ENVIR +echo RUN = $RUN +echo COMIN = $COMIN -top_parm=${this_dir}/../../parm -minmon_version_file=${minmon_version:-${top_parm}/MinMon.ver} -if [[ -s ${minmon_version_file} ]]; then - . ${minmon_version_file} - echo "able to source ${minmon_version_file}" -else - echo "Unable to source ${minmon_version_file} file" - exit 2 -fi +#----------------------------------- +# source config and settings files +# +this_dir=`dirname $0` +top_parm=${this_dir}/../../parm -echo "MINMON_CONFIG = $MINMON_CONFIG" minmon_config=${minmon_config:-${top_parm}/MinMon_config} -if [[ -s ${minmon_config} ]]; then - . ${minmon_config} - echo "able to source ${minmon_config}" -else - echo "Unable to source ${minmon_config} file" +if [[ ! -e ${minmon_config} ]]; then + echo "Unable to locate ${minmon_config} file" exit 3 fi +. ${minmon_config} +if [[ $? -ne 0 ]]; then + echo "Error detected while sourcing ${minmon_config} file" + exit $? +fi + minmon_user_settings=${minmon_user_settings:-${top_parm}/MinMon_user_settings} -if [[ -s ${minmon_user_settings} ]]; then - . ${minmon_user_settings} - echo "able to source ${minmon_user_settings}" -else - echo "Unable to source ${minmon_user_settings} file" +if [[ ! -e ${minmon_user_settings} ]]; then + echo "Unable to locate ${minmon_user_settings} file" exit 4 fi - -#-------------------------------------------------------------------- -# Check setting of RUN_ONLY_ON_DEV and possible abort if on prod and -# not permitted to run there. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${M_DE_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi +. ${minmon_user_settings} +if [[ $? -ne 0 ]]; then + echo "Error detected while sourcing ${minmon_user_settings} file" + exit $? fi @@ -119,29 +114,20 @@ if [[ ${RUN} = "gdas" ]]; then export HOMEgfs=${HOMEgdas} fi -########################################## -# expand M_TANKverf for this MINMON_SUFFIX -########################################## NEWtank=${M_TANKverf}/stats/${MINMON_SUFFIX} if [[ $GLB_AREA -eq 0 ]]; then NEWtank=${M_TANKverf}/stats/regional/${MINMON_SUFFIX} fi -export M_TANKverf=$NEWtank -echo "M_TANKverf = $M_TANKverf" - - -############################################################## +#--------------------------------------------------------- # Determine next cycle -# If PDATE wasn't an argument then call find_cycle.pl -# to determine the last processed cycle, and set PDATE to -# the next cycle +# If PDATE wasn't supplied as an argument then call +# find_cycle.pl to determine the last processed cycle, +# and set PDATE to the next cycle # -# NOTE: Need to make gdas the default value to $run -############################################################## if [[ ${#PDATE} -le 0 ]]; then echo "PDATE not specified: setting PDATE using last cycle" - date=`${M_DE_SCRIPTS}/find_cycle.pl --run gdas --cyc 1 --dir ${M_TANKverf}` + date=`${M_DE_SCRIPTS}/find_cycle.pl --run $RUN --cyc 1 --dir ${NEWtank}` export PDATE=`$NDATE +6 $date` else echo "PDATE was specified: $PDATE" @@ -149,7 +135,36 @@ fi export PDY=`echo $PDATE|cut -c1-8` export cyc=`echo $PDATE|cut -c9-10` -echo "PDY, cyc = $PDY, $cyc " + +prev_cycle=`$NDATE -6 $PDATE` +p_pdy=`echo $prev_cycle|cut -c1-8` +p_cyc=`echo $prev_cycle|cut -c9-10` + +#-------------------------------- +# expand M_TANKverf and define +# M_TANKverfM1 (previous cycle) +# +export M_TANKverf=${NEWtank}/${RUN}.${PDY}/${cyc}/minmon +export M_TANKverfM1=${NEWtank}/${RUN}.${p_pdy}/${p_cyc}/minmon + +#----------------------------------------- +# Expand COMIN with date specific subdirs +# +comin_base=${COMIN} +COMIN=${comin_base}/${RUN}.${PDY}/${cyc}/atmos +if [[ ! -d $COMIN ]]; then + COMIN=${comin_base}/${RUN}.${PDY}/${cyc} + if [[ ! -d $COMIN ]]; then + COMIN=${comin_base}/${RUN}.${PDY} + fi +fi +export COMIN=$COMIN + +export gsistat=${COMIN}/${RUN}.t${cyc}z.gsistat +if [[ ! -e $gsistat ]]; then + echo "Unable to locate $gsistat, exiting MinMon_DE.sh" + exit 5 +fi if [[ ! -d ${LOGdir} ]]; then @@ -157,53 +172,51 @@ if [[ ! -d ${LOGdir} ]]; then fi lfile=${LOGdir}/DE.${PDY}.${cyc} -export pid=${pid:-$$} -export jlogfile=${lfile}.o${pid} -export m_jlogfile="${lfile}.log" -echo "m_jlogfile = $m_jlogfile" - -############################################################# +export logfile="${lfile}.log" +echo "logfile = $logfile" +if [[ -e $logfile ]]; then + rm -f $logfile +fi export job=${job:-DE.${RUN}} -export jobid=${jobid:-${job}.${PDY}.${pid}} -export envir=prod export DATAROOT=${DATA_IN:-${WORKDIR}} export COMROOT=${COMROOT:-/com2} - -echo "MY_MACHINE = $MY_MACHINE" - +export jobid=${jobid:-${job}.${PDY}.${pid}} jobname=minmon_de_${MINMON_SUFFIX} -rm -f $m_jlogfile +if [[ $RUN = "gfs" ]]; then + jobfile=${jobfile:-${HOMEgfs}/jobs/JGFS_ATMOS_VMINMON} +else + jobfile=${jobfile:-${HOMEgdas}/jobs/JGDAS_ATMOS_VMINMON} +fi +echo "MY_MACHINE = $MY_MACHINE" echo "SUB = $SUB" echo "JOB_QUEUE = $JOB_QUEUE" echo "PROJECT = $PROJECT" echo "jobname = $jobname" +echo "jobfile = $jobfile" -if [[ $GLB_AREA -eq 0 ]]; then - jobfile=${jobfile:-${HOMEnam}/jobs/JNAM_VMINMON} -else - if [[ $RUN = "gfs" ]]; then - jobfile=${jobfile:-${HOMEgfs}/jobs/JGFS_VMINMON} - else - jobfile=${jobfile:-${HOMEgdas}/jobs/JGDAS_VMINMON} - fi -fi -if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" ]]; then - $SUB -P $PROJECT -q $JOB_QUEUE -o ${m_jlogfile} -M 50 -R affinity[core] -W 0:10 -J ${jobname} $jobfile +if [[ $MY_MACHINE = "wcoss_d" ]]; then + $SUB -P $PROJECT -q $JOB_QUEUE -o ${logfile} -M 50 \ + -R affinity[core] -W 0:10 -J ${jobname} $jobfile elif [[ $MY_MACHINE = "cray" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o ${m_jlogfile} -M 80 -R "select[mem>80] rusage[mem=80]" -W 0:10 -J ${jobname} $jobfile + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 80 \ + -R "select[mem>80] rusage[mem=80]" -W 0:10 -J ${jobname} $jobfile elif [[ $MY_MACHINE = "hera" ]]; then $SUB --account=${ACCOUNT} --time=05 -J ${job} -D . \ - -o ${LOGdir}/DE.${PDY}.${cyc}.log \ + -o ${logfile} \ --ntasks=1 --mem=5g \ ${jobfile} +elif [[ $MY_MACHINE = "wcoss2" ]]; then + $SUB -e ${logfile} -N gdas_vminmon -q ${JOB_QUEUE} -V \ + -l select=1:mem=400M -l walltime=05:00 -A GFS-DEV \ + ${jobfile} fi diff --git a/util/Minimization_Monitor/data_xtrct/ush/RunMM_DE.sh b/util/Minimization_Monitor/data_xtrct/ush/RunMM_DE.sh deleted file mode 100755 index f043214cd4..0000000000 --- a/util/Minimization_Monitor/data_xtrct/ush/RunMM_DE.sh +++ /dev/null @@ -1,209 +0,0 @@ -#!/bin/sh - -#-------------------------------------------------------------------- -# RunMM_DE.sh -# -# Run the MinMon_DE script in a loop from start to end date or -# from start to end of available data. -# -# This script will run the MinMOn data extraction for a given source -# in a loop. The loop can be: -# 1) from the last proceessed date until the available gsistat -# data is exhausted, -# 2) from the input start date until available data is exhausted, -# 3) from the start to the stop date. -# -# -# NOTE: for the moment the script only runs as 3) above. Start and -# end dates must both be specified. -#-------------------------------------------------------------------- - -function usage { - echo "Usage: RunMM_DE.sh suffix [start_date] [end_date]" - echo " File name for RunCopy.sh can be full or relative path" - echo " Suffix is the indentifier for this data source." - echo " Start_date is the optional starting cycle to process (YYYYMMDDHH format)." - echo " End_date is the optional ending cycle to process (YYYYMMDDHH format)." -} - -set -ax -echo start RunMM_DE.sh - - -nargs=$# -if [[ $nargs -lt 3 ]]; then - usage - exit 1 -fi - -this_file=`basename $0` -this_dir=`dirname $0` - -SUFFIX=$1 -START_DATE=$2 -END_DATE=$3 - -echo SUFFIX = $SUFFIX -echo START_DATE = $START_DATE -echo END_DATE = $END_DATE - -#-------------------------------------------------------------------- -# Set environment variables -#-------------------------------------------------------------------- -top_parm=${this_dir}/../../parm -export MINMON_VERSION=${MINMON_VERSION:-${top_parm}/MinMon.ver} -if [[ -s ${MINMON_VERSION} ]]; then - echo "sourcing $MINMON_VERSION" - . ${MINMON_VERSION} -else - echo "Unable to source ${MINMON_VERSION} file" - exit 2 -fi - -export MINMON_CONFIG=${MINMON_CONFIG:-${top_parm}/MinMon_config} -if [[ -s ${MINMON_CONFIG} ]]; then - echo "sourcing $MINMON_CONFIG" - . ${MINMON_CONFIG} -else - echo "Unable to source ${MINMON_CONFIG} file" - exit 3 -fi - -export MINMON_USER_SETTINGS=${MINMON_USER_SETTINGS:-${top_parm}/MinMon_user_settings} -if [[ -s ${MINMON_USER_SETTINGS} ]]; then - echo "sourcing $MINMON_USER_SETTINGS" - . ${MINMON_USER_SETTINGS} -else - echo "Unable to source ${MINMON_USER_SETTINGS} file" - exit 4 -fi - -#-------------------------------------------------------------------- -# Check setting of RUN_ONLY_ON_DEV and possible abort if on prod and -# not permitted to run there. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${M_DE_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - - -#----------------------------------------------------------------------------- -# If start and end dates were specified, confirm the start is before end date. -# NOTE: Start date = end date will result in one cycle (start date) running. -#----------------------------------------------------------------------------- -start_len=`echo ${#START_DATE}` -end_len=`echo ${#END_DATE}` -echo "start, end len = $start_len, $end_len" - -if [[ ${start_len} -gt 0 && ${end_len} -gt 0 ]]; then - if [[ $START_DATE -gt $END_DATE ]]; then - echo ERROR -- start date is greater then end date : $START_DATE $END_DATE - exit 11 - fi -fi - - -#-------------------------------------------------------------------- -# If we have a START_DATE then use it, otherwise use the last entry -# in a ${SUFFIX}_minmon.YYYYMMDD/${SUFFIX}.gnorm_data.txt file to -# determine the last date processed. -#-------------------------------------------------------------------- -start_len=`echo ${#START_DATE}` -verf_dir="${TANKverf}/stats/${SUFFIX}" - -if [[ ${start_len} -le 0 ]]; then - pdate=`${M_DE_SCRIPTS}/find_cycle.pl --run gdas --cyc 1 --dir ${verf_dir}` - pdate_len=`echo ${#pdate}` - if [[ ${pdate_len} -ne 10 ]]; then - exit 12 - fi - START_DATE=`${NDATE} +06 $pdate` -fi - -cdate=$START_DATE -echo "start date = $START_DATE" - -mkdir -p $LOGdir -##-------------------------------------------------------------------- -## Run in a loop until END_DATE is processed, or an error occurs, or -## we run out of data. -##-------------------------------------------------------------------- -done=0 -ctr=0 -while [[ $done -eq 0 ]]; do - - #-------------------------------------------------------------------- - # Check for running jobs - #-------------------------------------------------------------------- - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" ]]; then - running=`bjobs -l | grep minmon_de_${SUFFIX} | wc -l` - elif [[ $MY_MACHINE = "hera" ]]; then - running=`qstat -u $LOGNAME | grep minmon_de_${SUFFIX} | wc -l` - fi - - if [[ $running -ne 0 ]]; then - #---------------------------------------------------- - # sleep or time-out after 30 tries. - #---------------------------------------------------- - ctr=$(( $ctr + 1 )) - if [[ $ctr -le 30 ]]; then - echo sleeping..... - sleep 60 - else - done=1 - fi - else - - #----------------------------------------------------------------- - # Run the MinMon_DE.sh script - #----------------------------------------------------------------- - log_file=${LOGdir}/MinMon_DE_${SUFFIX}_${cdate}.log - err_file=${LOGdir}/MinMon_DE_${SUFFIX}_${cdate}.err - - echo Processing ${cdate} - # need a switch for glb and rgn - ${M_DE_SCRIPTS}/MinMon_DE.sh ${SUFFIX} dev ${cdate} 1>${log_file} 2>${err_file} - - #----------------------------------------------------------------- - # done is true (1) if the copy_script produced an error code, or - # we're at END_DATE - # - # NOTE: gonna have to do some work to get the correct $rc; this - # job gets submitted to the queue so I'm going to have to dig - # through the log file to find the RC. Alternately, if no END - # is specified, I could calculate that up front. - #----------------------------------------------------------------- -# sleep 60 -# PDY=`echo $cdate|cut -c1-8` -# cyc=`echo $cdate|cut -c9-10` -# logfile="${m_jlogfile}${SUFFIX}.${PDY}.${cyc}.log" -# rc=`grep "exit value" ${logfile} | tail -1 | gawk '{split($0,a," "); print a[6]}'` -# rc_len=`echo ${#rc}` - -# echo "rc = $rc" - -# if [[ $rc -ne 0 ]]; then -# done=1 - if [[ $cdate -eq $END_DATE ]]; then -# elif [[ $cdate -eq $END_DATE ]]; then - done=1 -# elif [[ $rc_len -eq 0 ]]; then -# done=1 - else - #-------------------------------------------------------------- - # If not done advance the cdate to the next cycle - #-------------------------------------------------------------- - cdate=`${NDATE} +06 $cdate` - ctr=0 - fi - fi - -done - - -echo "end RunMM_DE.sh" -exit diff --git a/util/Minimization_Monitor/data_xtrct/ush/find_cycle.pl b/util/Minimization_Monitor/data_xtrct/ush/find_cycle.pl index 46ace9315e..f146f1dbe9 100755 --- a/util/Minimization_Monitor/data_xtrct/ush/find_cycle.pl +++ b/util/Minimization_Monitor/data_xtrct/ush/find_cycle.pl @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#!/usr/bin/env perl #----------------------------------------------------------------------- # find_cycle.pl @@ -148,8 +148,9 @@ $hr_ctr = $hr_ctr - 1; $newdir = "${dirpath}/${sortmm[$ctr]}/${hrs[$hr_ctr]}/${lcm}"; -# print " newdir = $newdir \n"; - + if( ! -d $newdir ){ + $newdir = "${dirpath}/${sortmm[$ctr]}"; + } if( -d $newdir ) { opendir DIR, $newdir or die "Cannot open the current directory: $!"; @@ -197,13 +198,10 @@ } while $hr_ctr > 0 && $found_cycle == 0; -# print " found_cycle, ctr, end_ctr = $found_cycle, $ctr, $end_ctr \n"; if( $cyc == 0 && $ctr >= $end_ctr ){ -# print " exiting from if\n"; $exit_flag = 1; } elsif( $cyc == 1 && $ctr <= $end_ctr ){ -# print " exiting from elsif\n"; $exit_flag = 1; } diff --git a/util/Minimization_Monitor/data_xtrct/ush/onprod.sh b/util/Minimization_Monitor/data_xtrct/ush/onprod.sh deleted file mode 100755 index b709651389..0000000000 --- a/util/Minimization_Monitor/data_xtrct/ush/onprod.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# -# Check to determine if this maching is currently -# the production machine. -# -# Return values: -# 1 = prod -# 0 = dev -# - iamprod=0 - machine=`hostname | cut -c1` - if [[ -e /etc/prod ]]; then - prod=`cat /etc/prod | cut -c1` - - if [[ $machine = $prod ]]; then - iamprod=1 - fi - fi - - echo $iamprod - exit diff --git a/util/Minimization_Monitor/data_xtrct/ush/run_cp_v16rt1.sh b/util/Minimization_Monitor/data_xtrct/ush/run_cp_v16rt1.sh deleted file mode 100755 index ca5b2e0d72..0000000000 --- a/util/Minimization_Monitor/data_xtrct/ush/run_cp_v16rt1.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -#package=MinMon -package=ProdGSI/util/Minimization_Monitor - -net=v16rt1 -run=gdas - -echo "user = $USER" - -export KEEPDATA=YES -export DO_ERROR_RPT=1 -export MAIL_TO="" -export MAIL_CC="" - -scripts=/gpfs/dell2/emc/modeling/noscrub/${USER}/${package}/data_xtrct/ush -echo "scripts = $scripts" - -shell=bash -source /usrx/local/prod/lmod/lmod/init/${shell} - -MODULEPATH=/usrx/local/prod/lmod/lmod/modulefiles/Core:/usrx/local/prod/modulefiles/core_third:/usrx/local/prod/modulefiles/defs:/gpfs/dell1/nco/ops/nwprod/modulefiles/core_prod:/usrx/local/dev/modulefiles - -module purge -module load ips/18.0.1.163 -module load metplus/2.1 -module load prod_util/1.1.2 - -echo NDATE = $NDATE - - - -tank=~/nbns/stats/${net} - -ldate=`${scripts}/find_cycle.pl --cyc 1 --dir ${tank} --run ${run}` -echo ldate = $ldate -pdate=`${NDATE} +06 $ldate` -#pdate=2019070100 - -echo pdate = $pdate - -pdy=`echo $pdate|cut -c1-8` -cyc=`echo $pdate|cut -c9-10` - -data_loc=/gpfs/dell2/emc/modeling/noscrub/emc.glopara/monitor/minmon/stats/${net}/${run}.${pdy} -#echo data_loc = $data_loc - -tank=${tank}/${run}.${pdy}/${cyc}/minmon -mkdir -p ${tank} - -cp ${data_loc}/*${pdate}* ${tank}/. -cp ${data_loc}/gnorm_data.txt ${tank}/. - - diff --git a/util/Minimization_Monitor/data_xtrct/ush/run_gdas_DE.sh b/util/Minimization_Monitor/data_xtrct/ush/run_gdas_DE.sh deleted file mode 100755 index faf309c805..0000000000 --- a/util/Minimization_Monitor/data_xtrct/ush/run_gdas_DE.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -ch=`hostname | cut -c1` - -#package=MinMon -package=ProdGSI/util/Minimization_Monitor - -suffix=GFS -net=gfs -export RUN=gdas - -scripts=/gpfs/dell2/emc/modeling/noscrub/${USER}/${package}/data_xtrct/ush -export jobfile=/gpfs/dell2/emc/modeling/noscrub/${USER}/${package}/nwprod/gdas.v1.0.0/jobs/JGDAS_VMINMON - - -NDATE=/gpfs/dell1/nco/ops/nwprod/prod_util.v1.1.0/exec/ips/ndate - -tank=~/nbns/stats/${suffix} -ldate=`${scripts}/find_cycle.pl ${suffix} --cyc 1 --dir ${tank} --run ${RUN}` - -export PDATE=`${NDATE} +06 $ldate` -#export PDATE=2019083018 - -export PDY=`echo $PDATE|cut -c1-8` -export cyc=`echo $PDATE|cut -c9-10` - - -export COMIN=/gpfs/dell1/nco/ops/com/${net}/prod/${RUN}.${PDY}/${cyc} -export gsistat=${COMIN}/${RUN}.t${cyc}z.gsistat - -tank=~/nbns/stats/${suffix} -logdir=/gpfs/dell2/ptmp/Edward.Safford/logs/${suffix}/${RUN}/minmon - -echo PDATE = $PDATE -echo gsistat = $gsistat - -${scripts}/MinMon_DE.sh ${suffix} --pdate ${PDATE} --run ${RUN} 1>$logdir/MinMon_DE.log 2>$logdir/MinMon_DE.err diff --git a/util/Minimization_Monitor/data_xtrct/ush/run_gfs_DE.sh b/util/Minimization_Monitor/data_xtrct/ush/run_gfs_DE.sh deleted file mode 100755 index dfe7fb6ea3..0000000000 --- a/util/Minimization_Monitor/data_xtrct/ush/run_gfs_DE.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - - -#package=MinMon -package=ProdGSI/util/Minimization_Monitor - -suffix=GFS -net=gfs -export RUN=gfs - -scripts=/gpfs/dell2/emc/modeling/noscrub/${USER}/${package}/data_xtrct/ush -export jobfile=/gpfs/dell2/emc/modeling/noscrub/${USER}/${package}/nwprod/gfs.v1.0.0/jobs/JGFS_VMINMON - - -NDATE=/gpfs/dell1/nco/ops/nwprod/prod_util.v1.1.0/exec/ips/ndate - -tank=~/nbns/stats/${suffix} -ldate=`${scripts}/find_cycle.pl ${suffix} --cyc 1 --dir ${tank} --run ${RUN}` - -export PDATE=`${NDATE} +06 $ldate` -#export PDATE=2019083018 - -export PDY=`echo $PDATE|cut -c1-8` -export cyc=`echo $PDATE|cut -c9-10` - - -export COMIN=/gpfs/dell1/nco/ops/com/${net}/prod/${RUN}.${PDY}/${cyc} -export gsistat=${COMIN}/${RUN}.t${cyc}z.gsistat - -tank=~/nbns/stats/${suffix} -logdir=/gpfs/dell2/ptmp/Edward.Safford/logs/${suffix}/${RUN}/minmon - -echo PDATE = $PDATE -echo gsistat = $gsistat - -${scripts}/MinMon_DE.sh ${suffix} --pdate ${PDATE} --run ${RUN} 1>$logdir/MinMon_DE.log 2>$logdir/MinMon_DE.err diff --git a/util/Minimization_Monitor/data_xtrct/ush/run_script.sh b/util/Minimization_Monitor/data_xtrct/ush/run_script.sh deleted file mode 100755 index b794b57976..0000000000 --- a/util/Minimization_Monitor/data_xtrct/ush/run_script.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/ksh - -#---------------------------------------------------------------------- -# -# This is a generic data extraction leader script. -# -# The MinMon_DE.sh script may be called directly, or this script, -# which calls MinMon_DE.sh can be used to overwrite specific -# values in MinMon_DE.sh and/or parm files. -# -# Set MINMON_SUFFIX, RUN to match your data source and run -# value. -# -# COMIN is the location of the gsistat file repository, which -# contains the specific $RUN.$PDATE subdirectories. -# -# Use pdate to run a specific cycle. If commented out then the -# M_TANKverf directory will be examined and the pdate will -# be the last cycle run + 6 hrs. -# -#---------------------------------------------------------------------- - -MINMON_SUFFIX=testmm -RUN=gfs -COMIN=/scratch1/NCEPDEV/da/Edward.Safford/noscrub/test_data - -#pdate=2016030700 - - -#---------------------------------------------------------------------- -# No changes should be necessary below this point. -#---------------------------------------------------------------------- - -. ../../parm/MinMon.ver -. ../../parm/MinMon_config - -if [[ $RUN == "gfs" ]]; then - export jobfile=${HOMEgfs}/jobs/JGFS_VMINMON -else - export jobfile=${HOMEgdas}/jobs/JGDAS_VMINMON -fi - -echo NDATE = $NDATE - -echo "LOGdir = ${LOGdir}" -if [[ ! -e ${LOGdir} ]]; then - mkdir -p ${LOGdir} -fi - -if [[ $pdate == "" ]]; then - ldate=`${M_DE_SCRIPTS}/find_cycle.pl --dir ${M_TANKverf}/stats/${MINMON_SUFFIX} --cyc 1 --run ${RUN}` - pdate=`${NDATE} +06 $ldate` -fi - -pdy=`echo $pdate|cut -c1-8` -cyc=`echo $pdate|cut -c9-10` - -export gsistat=${COMIN}/${RUN}.${pdy}/${cyc}/${RUN}.t${cyc}z.gsistat - -if [[ ! -e $gsistat ]]; then - echo " unable to locate $gsistat" -fi - -echo pdate = $pdate -echo gsistat = $gsistat - - -${M_DE_SCRIPTS}/MinMon_DE.sh ${MINMON_SUFFIX} -p ${pdate} -r ${RUN} \ - 1>$LOGdir/MinMon_DE.log 2>$LOGdir/MinMon_DE.err - - diff --git a/util/Minimization_Monitor/data_xtrct/ush/run_v16rt1.sh b/util/Minimization_Monitor/data_xtrct/ush/run_v16rt1.sh deleted file mode 100755 index 842f150d01..0000000000 --- a/util/Minimization_Monitor/data_xtrct/ush/run_v16rt1.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh - -idev=`cat /etc/dev | cut -c1` -iprod=`cat /etc/prod | cut -c1` - -package=MinMon -#package=ProdGSI/util/Minimization_Monitor -suffix=v16rt1 -export run=gdas - -echo "user = $USER" - -export KEEPDATA=YES -export DO_ERROR_RPT=1 -export MAIL_TO="" -export MAIL_CC="" - -scripts=/gpfs/dell2/emc/modeling/noscrub/${USER}/${package}/data_xtrct/ush -echo "scripts = $scripts" - -export jobfile=/gpfs/dell2/emc/modeling/noscrub/${USER}/${package}/nwprod/gdas.v1.0.0/jobs/JGDAS_VMINMON -echo "jobfile = $jobfile" - -shell=sh -source /usrx/local/prod/lmod/lmod/init/${shell} - -MODULEPATH=/usrx/local/prod/lmod/lmod/modulefiles/Core:/usrx/local/prod/modulefiles/core_third:/usrx/local/prod/modulefiles/defs:/gpfs/dell1/nco/ops/nwprod/modulefiles/core_prod:/usrx/local/dev/modulefiles - -module purge -module load ips/18.0.1.163 -module load metplus/2.1 -module load lsf -module load prod_util/1.1.2 - -echo NDATE = $NDATE - -#export COMIN=/gpfs/hps3/emc/global/noscrub/emc.glopara/archive/prfv3rt1 -export COMIN=/gpfs/dell2/emc/modeling/noscrub/emc.glopara/archive/v16rt1 - -tank=~/nbns/stats/${suffix} -logdir=/gpfs/dell2/ptmp/Edward.Safford/logs/${suffix}/${run}/minmon - -ldate=`${scripts}/find_cycle.pl --cyc 1 --dir ${tank} --run ${run}` -echo ldate = $ldate -export PDATE=`${NDATE} +06 $ldate` -#PDATE=2019082806 - -export PDY=`echo $PDATE|cut -c1-8` -export cyc=`echo $PDATE|cut -c9-10` - -#module unload prod_util - -export gsistat=${COMIN}/gsistat.${run}.${PDATE} - -echo PDATE = $PDATE -echo gsistat = $gsistat - -${scripts}/MinMon_DE.sh ${suffix} --pdate ${PDATE} 1>$logdir/MinMon_DE.log 2>$logdir/MinMon_DE.err - - diff --git a/util/Minimization_Monitor/get_hostname.pl b/util/Minimization_Monitor/get_hostname.pl index 47f782d675..56df214223 100755 --- a/util/Minimization_Monitor/get_hostname.pl +++ b/util/Minimization_Monitor/get_hostname.pl @@ -28,6 +28,9 @@ if( $host =~ /hfe/ ) { $machine = "hera"; } + elsif( $host =~ /clogin0/ || $host =~ /dlogin0/ ) { + $machine = "wcoss2"; + } elsif( $host =~ /login/ ) { $machine = "cray"; } diff --git a/util/Minimization_Monitor/image_gen/ush/MinMon_Plt.sh b/util/Minimization_Monitor/image_gen/ush/MinMon_Plt.sh index aa942e65d3..e08edc8c70 100755 --- a/util/Minimization_Monitor/image_gen/ush/MinMon_Plt.sh +++ b/util/Minimization_Monitor/image_gen/ush/MinMon_Plt.sh @@ -13,6 +13,7 @@ function usage { echo " " } + echo start MinMonPlt.sh nargs=$# @@ -21,7 +22,6 @@ if [[ $nargs -lt 1 || $nargs -gt 5 ]]; then exit 1 fi -RUN=gdas while [[ $# -ge 1 ]] do key="$1" @@ -45,56 +45,52 @@ do shift done +if [[ ${#MINMON_SUFFIX} -le 0 ]]; then + echo "No suffix supplied, unable to proceed" + exit 2 +fi + if [[ ${#RUN} -le 0 ]]; then export RUN=gdas fi +run_suffix=${MINMON_SUFFIX}_${RUN} echo "MINMON_SUFFIX = $MINMON_SUFFIX" echo "PDATE = $PDATE" echo "RUN = $RUN" - -if [[ ${#RUN} -gt 0 ]]; then - run_suffix=${MINMON_SUFFIX}_${RUN} -else - run_suffix=${MINMON_SUFFIX} -fi - +#---------------------------------------- +# source config, and user_settings files +#---------------------------------------- this_dir=`dirname $0` - -#-------------------------------------------------- -# source verison, config, and user_settings files -#-------------------------------------------------- top_parm=${this_dir}/../../parm -minmon_version_file=${minmon_version:-${top_parm}/MinMon.ver} -if [[ -s ${minmon_version_file} ]]; then - . ${minmon_version_file} - echo "able to source ${minmon_version_file}" -else - echo "Unable to source ${minmon_version_file} file" - exit 2 -fi - minmon_config=${minmon_config:-${top_parm}/MinMon_config} -if [[ -s ${minmon_config} ]]; then - . ${minmon_config} - echo "able to source ${minmon_config}" -else - echo "Unable to source ${minmon_config} file" +if [[ ! -e ${minmon_config} ]]; then + echo "Unable to locate ${minmon_config} file" exit 3 fi +. ${minmon_config} +if [[ $? -ne 0 ]]; then + echo "Error detected while sourcing ${minmon_config} file" + exit $? +fi + + minmon_user_settings=${minmon_user_settings:-${top_parm}/MinMon_user_settings} -if [[ -s ${minmon_user_settings} ]]; then - . ${minmon_user_settings} - echo "able to source ${minmon_user_settings}" -else - echo "Unable to source ${minmon_user_settings} file" +if [[ ! -e ${minmon_user_settings} ]]; then + echo "Unable to locate ${minmon_user_settings} file" exit 4 fi +. ${minmon_user_settings} +if [[ $? -ne 0 ]]; then + echo "Error detected while sourcing ${minmon_user_settings} file" + exit $? +fi + #-------------------------------------------------------------------- # Specify TANKDIR for this suffix @@ -106,14 +102,44 @@ else fi #-------------------------------------------------------------------- -# If PDATE wasn't specified as an argument then plot the last -# available cycle. +# Determine cycle to plot. Exit if cycle is > last available +# data. +# +# PDATE can be set one of 3 ways. This is the order of priority: +# +# 1. Specified via command line argument +# 2. Read from ${TANKimg}/last_plot_time file and advanced +# one cycle. +# 3. Using the last available cycle for which there is +# data in ${TANKDIR}. +# +# If option 2 has been used the ${IMGNDIR}/last_plot_time file +# will be updated with ${PDATE} if the plot is able to run. #-------------------------------------------------------------------- -if [[ ${#PDATE} -le 0 ]]; then - echo "PDATE not specified: setting PDATE using last cycle" - export PDATE=`${M_IG_SCRIPTS}/find_cycle.pl --cyc 1 --dir ${TANKDIR}` + +echo "MIN_IMGN_TANKDIR = ${MIN_IMGN_TANKDIR}" +last_plot_time=${MIN_IMGN_TANKDIR}/${RUN}/minmon/last_plot_time +echo "last_plot_time file = ${last_plot_time}" + +latest_data=`${M_IG_SCRIPTS}/find_cycle.pl --cyc 1 --dir ${TANKDIR} --run ${RUN}` + +if [[ ${PDATE} = "" ]]; then + if [[ -e ${last_plot_time} ]]; then + echo " USING last_plot_time file" + last_plot=`cat ${last_plot_time}` + PDATE=`$NDATE +6 ${last_plot}` + else + echo " USING find_cycle file" + PDATE=${latest_data} + fi +fi + + +if [[ ${PDATE} -gt ${latest_data} ]]; then + echo " Unable to plot, pdate is > latest_data, ${PDATE}, ${latest_data}" + exit 5 else - echo "PDATE was specified: $PDATE" + echo " OK to plot" fi @@ -133,6 +159,7 @@ if [[ ! -d $WORKDIR ]]; then fi cd $WORKDIR + #-------------------------------------------------------------------- # Copy gnorm_data.txt file to WORKDIR. #-------------------------------------------------------------------- @@ -215,70 +242,49 @@ while [[ $cdate -le $edate ]]; do cdate=$adate done -#-------------------------------------------------------------------- -# Main processing loop. -# Run extract_all_gnorms.pl script and generate single cycle plot. -# -# RM this loop or add an optional end date to the args list and -# process each date in turn. -# -# And alternate plot method might be to simply plot the last -# available cycle if no PDATE is included. Could use find_cycle.pl -# to find the last one and done. -# -# Also should an attempt to plot a date for which there is no data -# produce an error exit? I think so. -#-------------------------------------------------------------------- -not_done=1 -ctr=0 + area=glb if [[ $GLB_AREA -eq 0 ]]; then area=rgn fi -while [ $not_done -eq 1 ] && [ $ctr -le 20 ]; do - - #----------------------------------------------------------------- - # copy over the control files and update the tdef lines - # according to the $suffix - #----------------------------------------------------------------- - if [[ ! -e ${WORKDIR}/allgnorm.ctl ]]; then - cp ${M_IG_GRDS}/${area}_allgnorm.ctl ${WORKDIR}/orig_allgnorm.ctl - cp ${WORKDIR}/orig_allgnorm.ctl ${WORKDIR}/allgnorm.ctl - fi +#----------------------------------------------------------------- +# copy over the control files and update the tdef lines +# according to the $suffix +#----------------------------------------------------------------- +if [[ ! -e ${WORKDIR}/allgnorm.ctl ]]; then + cp ${M_IG_GRDS}/${area}_allgnorm.ctl ${WORKDIR}/orig_allgnorm.ctl + cp ${WORKDIR}/orig_allgnorm.ctl ${WORKDIR}/allgnorm.ctl +fi - if [[ ! -e ${WORKDIR}/reduction.ctl ]]; then - cp ${M_IG_GRDS}/${area}_reduction.ctl ${WORKDIR}/reduction.ctl +if [[ ! -e ${WORKDIR}/reduction.ctl ]]; then + cp ${M_IG_GRDS}/${area}_reduction.ctl ${WORKDIR}/reduction.ctl + if [[ ${RUN} = "gfs" ]]; then + gfs_xdef="xdef 152 linear 1.0 1.0" + sed -i "/xdef/c ${gfs_xdef}" reduction.ctl fi +fi - # - # update the tdef line in the ctl files - # - bdate=`$NDATE -168 $PDATE` - ${M_IG_SCRIPTS}/update_ctl_tdef.sh ${WORKDIR}/allgnorm.ctl ${bdate} - ${M_IG_SCRIPTS}/update_ctl_tdef.sh ${WORKDIR}/reduction.ctl ${bdate} +#--------------------------------------- +# update the tdef line in the ctl files +#--------------------------------------- +bdate=`$NDATE -168 $PDATE` +${M_IG_SCRIPTS}/update_ctl_tdef.sh ${WORKDIR}/allgnorm.ctl ${bdate} +${M_IG_SCRIPTS}/update_ctl_tdef.sh ${WORKDIR}/reduction.ctl ${bdate} - ####################### - # Q: does NDAS really use 101 instead of 102? That can't be somehow.... - ####################### - -# if [[ $MINMON_SUFFIX = "RAP" ]]; then -# ${M_IG_SCRIPTS}/update_ctl_xdef.sh ${WORKDIR}/allgnorm.ctl 102 -# fi - - #----------------------------------------------------------------- - # Copy the plot script and build the plot driver script - #----------------------------------------------------------------- - if [[ ! -e ${WORKDIR}/plot_gnorms.gs ]]; then - cp ${M_IG_GRDS}/plot_gnorms.gs ${WORKDIR}/. - fi - if [[ ! -e ${WORKDIR}/plot_reduction.gs ]]; then - cp ${M_IG_GRDS}/plot_reduction.gs ${WORKDIR}/. - fi - if [[ ! -e ${WORKDIR}/plot_4_gnorms.gs ]]; then - cp ${M_IG_GRDS}/plot_4_gnorms.gs ${WORKDIR}/. - fi +#----------------------------------------------------------------- +# Copy the plot script and build the plot driver script +#----------------------------------------------------------------- +if [[ ! -e ${WORKDIR}/plot_gnorms.gs ]]; then + cp ${M_IG_GRDS}/plot_gnorms.gs ${WORKDIR}/. +fi +if [[ ! -e ${WORKDIR}/plot_reduction.gs ]]; then + cp ${M_IG_GRDS}/plot_reduction.gs ${WORKDIR}/. +fi +if [[ ! -e ${WORKDIR}/plot_4_gnorms.gs ]]; then + cp ${M_IG_GRDS}/plot_4_gnorms.gs ${WORKDIR}/. +fi cat << EOF >${PDATE}_plot_gnorms.gs @@ -299,33 +305,24 @@ cat << EOF >${PDATE}_plot_4_gnorms.gs 'quit' EOF +#----------------------------------------------------------------- +# Run the plot driver script and move the image into ./tmp +#----------------------------------------------------------------- +GRADS=`which grads` - #----------------------------------------------------------------- - # Run the plot driver script and move the image into ./tmp - #----------------------------------------------------------------- - GRADS=`which grads` - - $TIMEX $GRADS -blc "run ${PDATE}_plot_gnorms.gs" - $TIMEX $GRADS -blc "run ${PDATE}_plot_reduction.gs" - $TIMEX $GRADS -blc "run ${PDATE}_plot_4_gnorms.gs" - - if [[ ! -d ${WORKDIR}/tmp ]]; then - mkdir ${WORKDIR}/tmp - fi - mv *.png tmp/. - - #----------------------------------------------------------------- - # copy the modified gnorm_data.txt file to tmp - #----------------------------------------------------------------- - cp gnorm_data.txt tmp/${run_suffix}.gnorm_data.txt +$TIMEX $GRADS -blc "run ${PDATE}_plot_gnorms.gs" +$TIMEX $GRADS -blc "run ${PDATE}_plot_reduction.gs" +$TIMEX $GRADS -blc "run ${PDATE}_plot_4_gnorms.gs" - - ctr=`expr $ctr + 1` -done +if [[ ! -d ${WORKDIR}/tmp ]]; then + mkdir ${WORKDIR}/tmp +fi +mv *.png tmp/. #----------------------------------------------------------------- -# copy all cost files to tmp +# copy the modified gnorm_data.txt and cost files to tmp #----------------------------------------------------------------- +cp gnorm_data.txt tmp/${run_suffix}.gnorm_data.txt cp *cost*.txt tmp/. #-------------------------------------------------------------------- @@ -337,6 +334,12 @@ if [[ ${DO_ERROR_RPT} -eq 1 ]]; then err_msg=${TANKDIR}/${RUN}.${pdy}/${cyc}/minmon/${PDATE}.errmsg.txt + if [[ $MAIL_CC == "" ]]; then + if [[ -e /u/Edward.Safford/bin/get_cc_list.pl ]]; then + MAIL_CC=`/u/Edward.Safford/bin/get_cc_list.pl --nr ${run_suffix} --mon MinMon` + fi + fi + if [[ -e $err_msg ]]; then err_rpt="./err_rpt.txt" `cat $err_msg > $err_rpt` @@ -358,33 +361,33 @@ if [[ ${DO_ERROR_RPT} -eq 1 ]]; then fi #-------------------------------------------------------------------- -# Push the image & txt files over to the server +# Push the image & txt files over to the server +# or move files to $MIN_IMGN_TANKDIR #-------------------------------------------------------------------- - if [[ ${MY_MACHINE} = "wcoss" || ${MY_MACHINE} = "cray" || \ - ${MY_MACHINE} = "wcoss_d" ]]; then - cd ./tmp - $RSYNC -ave ssh --exclude *.ctl* ./ \ - ${WEBUSER}@${WEBSERVER}:${WEBDIR}/$run_suffix/ - fi - - if [[ ! -d ${MIN_IMGN_TANKDIR} ]]; then - mkdir -p ${MIN_IMGN_TANKDIR} +cd ./tmp +if [[ ${MY_MACHINE} = "wcoss" || ${MY_MACHINE} = "cray" || \ + ${MY_MACHINE} = "wcoss_d" || ${MY_MACHINE} = "wcoss2" ]]; then + $RSYNC -ave ssh --exclude *.ctl* ./ \ + ${WEBUSER}@${WEBSERVER}:${WEBDIR}/$run_suffix/ +else + img_dir=${MIN_IMGN_TANKDIR}/${RUN}/minmon + if [[ ! -d ${img_dir} ]]; then + mkdir -p ${img_dir} fi - - cd ./tmp - cp *.png ${MIN_IMGN_TANKDIR} + mv * ${img_dir}/. +fi #-------------------------------------------------------------------- -# Call nu_make_archive.sh to write archive files to hpss and -# update the prod machine with any missing M_TANKDIR directories. +# Update the last_plot_time file if found #-------------------------------------------------------------------- -# if [[ ${DO_ARCHIVE} -eq 1 ]]; then -# ${M_IG_SCRIPTS}/nu_make_archive.sh -# fi +if [[ -e ${last_plot_time} ]]; then + echo "update last_plot_time file" + echo ${PDATE} > ${last_plot_time} +fi -#cd ${WORKDIR} -#cd .. -#rm -rf ${WORKDIR} +cd ${WORKDIR} +cd .. +rm -rf ${WORKDIR} echo "end MinMonPlt.sh" exit diff --git a/util/Minimization_Monitor/image_gen/ush/nu_make_archive.sh b/util/Minimization_Monitor/image_gen/ush/nu_make_archive.sh deleted file mode 100755 index d136a2c47b..0000000000 --- a/util/Minimization_Monitor/image_gen/ush/nu_make_archive.sh +++ /dev/null @@ -1,204 +0,0 @@ -#! /bin/ksh - -#------------------------------------------------------------------ -# -# nu_make_archive.sh -# -# Archive the data files (*.ieee_d) to HPSS. -# -# Note that only full days are archived, so if running for the -# 00, 06, or 12z cycles the previous day will be archived. If -# PDATE = yyyymmdd18 then today (PDATE) will be last day archived. -#------------------------------------------------------------------ -set -ax -export list=$listvar - -#-------------------------------------------------------------------- -# Run config files to load environment variables, -# set default plot conditions -#-------------------------------------------------------------------- -##TESTING BRACKET BEGIN -#PDATE=2015101412 -#SUFFIX=GDAS - -#this_dir=`pwd` -#top_parm=${this_dir}/../../parm -# -#export MINMON_VERSION=${MINMON_VERSION:-${top_parm}/MinMon.ver} -#if [[ -s ${MINMON_VERSION} ]]; then -# . ${MINMON_VERSION} -#else -# echo "Unable to source ${MINMON_VERSION} file" -# exit 2 -#fi - -#export MINMON_CONFIG=${MINMON_CONFIG:-${top_parm}/MinMon_config} -# -#if [[ -s ${MINMON_CONFIG} ]]; then -# . ${MINMON_CONFIG} -#else -# echo "Unable to source ${MINMON_CONFIG}" -# exit -#fi -# -#MINMON_USER_SETTINGS=${MINMON_USER_SETTINGS:-${top_parm}/MinMon_user_settings} -#if [[ -s ${MINMON_USER_SETTINGS} ]]; then -# . ${MINMON_USER_SETTINGS} -#else -# echo "Unable to source ${MINMON_USER_SETTINGS}" -# exit -#fi -##TESTING BRACKET END - - -#------------------------------------------------------------------ -# Determine last full day capable of archiving. -#------------------------------------------------------------------ -CYCLE=`echo $PDATE|cut -c9-10` -if [[ ${CYCLE} = "18" ]]; then - LASTARCH=$PDATE -else - LASTARCH=`$NDATE -24 $PDATE` -fi - -LAST_DAY=`echo $LASTARCH|cut -c1-8` -echo LAST_DAY = $LAST_DAY - -#------------------------------------------------------------------ -# Determine the last archived date for this source. -#------------------------------------------------------------------ -shell=ksh -. /usrx/local/Modules/default/init/${shell} -`module load hpss` - -## -## Need better reference here! -hpss2yr="/NCEPDEV/emc-da/2year" -if [[ $MINMON_SUFFIX = "GDAS" ]]; then - HPSSDIR="${hpss2yr}/${LOGNAME}/nbns/stats/GDAS" -elif [[ $MINMON_SUFFIX = "GFS" ]]; then - HPSSDIR="${hpss2yr}/${LOGNAME}/nbns/stats/GFS" -elif [[ $MINMON_SUFFIX = "4devb" ]]; then - HPSSDIR="${hpss2yr}/${LOGNAME}/nbns/stats/4devb" -elif [[ $MINMON_SUFFIX = "NDAS" ]]; then - HPSSDIR="${hpss2yr}/${LOGNAME}/nbns/stats/regional/NDAS" -elif [[ $MINMON_SUFFIX = "RAP" ]]; then - HPSSDIR="${hpss2yr}/${LOGNAME}/nbns/stats/regional/RAP" -fi - -HTAR="/usrx/local/hpss/htar" -M_TANKDIR=${M_TANKverf}/stats/${MINMON_SUFFIX} -TDATE=$LASTARCH -TDAY=`echo $TDATE|cut -c1-8` -tar_cnt=0 -cntr=0 -max_list=0 -while [[ -d ${M_TANKDIR}/minmon.$TDAY && $max_list -lt 5 && $cntr -lt 31 ]]; do - - tar_cnt=$( $HTAR -tf ${HPSSDIR}/minmon.${TDAY}.tar | wc -l ) - echo "tar_cnt = $tar_cnt" - - if [[ $tar_cnt -lt 5 ]] then - echo "adding $TDAY to list" - tar_list="$tar_list $TDAY" - ((max_list=max_list+1)) - fi - - TDATE=`$NDATE -24 $TDATE` - TDAY=`echo $TDATE|cut -c1-8` - - ((cntr=cntr+1)) -done - -echo "tar_list = $tar_list" - -#------------------------------------------------------------------ -# Archive tar_list to hpss and the $ARCHIVE_DIR -#------------------------------------------------------------------ - -for tar_date in ${tar_list}; do - - $HTAR -cvf ${HPSSDIR}/minmon.${tar_date}.tar ${M_TANKDIR}/minmon.${tar_date} - -done - - - -#------------------------------------------------------------------ -#------------------------------------------------------------------ -# Add new directories to the prod machine -#------------------------------------------------------------------ -#------------------------------------------------------------------ -if [[ $MY_MACHINE = "wcoss" ]]; then - - #------------------------------------------------------------------ - # Generate lists of directories locally and on the prod machine - #------------------------------------------------------------------ - PROD=`cat /etc/prod` - dev_dirs=`ls -d1 $M_TANKDIR/minmon*` - prod_dirs=`ssh $LOGNAME@$PROD "ls -d1 $M_TANKDIR/minmon*"` - - #------------------------------------------------------------------ - # Throw out anything later than LASTARCH in dev_dirs so we don't - # end up with a partial directory on the prod machine. - #------------------------------------------------------------------ - nu_devdirs="" - for tdir in ${dev_dirs}; do - if [[ $tdir != "info" ]]; then - test_date=`echo $tdir | gawk -F. '{print $NF}'` - echo test_date=$test_date - if [[ $test_date -le $LAST_DAY ]]; then - nu_devdirs="$nu_devdirs $tdir" - fi - fi - done - echo nu_devdirs = $nu_devdirs - dev_dirs=$nu_devdirs - - #------------------------------------------------------------------ - # Compare dev_dirs and prod_dirs. Generate a list of any missing - # directories in prod_dirs. - #------------------------------------------------------------------ - xfer_list="" - for tdir in ${dev_dirs}; do - test=`echo $prod_dirs | grep $tdir` - if [[ $test = "" ]]; then - xfer_list="$xfer_list $tdir" - fi - done - echo "xfer_list = $xfer_list" - - #------------------------------------------------------------------ - # For all entries in the xfer_list tar the directory, copy it to - # the prod machine, unpack it, rm both copies of the tar file - #------------------------------------------------------------------ - home=`pwd` - cd $M_TANKDIR - - for tdir in ${xfer_list}; do -# tarfile="$tdir.tar" - mmdir=`echo $tdir | gawk -F/ '{print $NF}'` - tarfile=${mmdir}.tar - - tar -cvf ${tarfile} ${mmdir} - scp ./$tarfile ${LOGNAME}@${PROD}:${M_TANKDIR}/$tarfile - - ssh ${LOGNAME}@${PROD} "cd $M_TANKDIR && tar -xvf ./$tarfile && rm -f ./$tarfile" - rm ./$tarfile - done - cd $home - - #------------------------------------------------------------------ - # Remove any directories in $M_TANKDIR in excess of 120 - #------------------------------------------------------------------ - total=`ls -d1 ${M_TANKDIR}/minmon.* | wc -l` - ((extra=total-121)) - - if [[ $extra -gt 0 ]]; then - `ls -d1 ${M_TANKDIR}/minmon.* | head -n $extra | xargs rm -rf` - fi - -fi - -exit - diff --git a/util/Minimization_Monitor/image_gen/ush/onprod.sh b/util/Minimization_Monitor/image_gen/ush/onprod.sh deleted file mode 100755 index b709651389..0000000000 --- a/util/Minimization_Monitor/image_gen/ush/onprod.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# -# Check to determine if this maching is currently -# the production machine. -# -# Return values: -# 1 = prod -# 0 = dev -# - iamprod=0 - machine=`hostname | cut -c1` - if [[ -e /etc/prod ]]; then - prod=`cat /etc/prod | cut -c1` - - if [[ $machine = $prod ]]; then - iamprod=1 - fi - fi - - echo $iamprod - exit diff --git a/util/Minimization_Monitor/image_gen/ush/pen_data_map.xml b/util/Minimization_Monitor/image_gen/ush/pen_data_map.xml deleted file mode 100644 index 501ea916ea..0000000000 --- a/util/Minimization_Monitor/image_gen/ush/pen_data_map.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - glb - /com/gfs/prod - - - /u/${LOGNAME}/nbns/stats - 1 - - - glb - 1 - 2016030706 - - diff --git a/util/Minimization_Monitor/image_gen/ush/query_data_map.pl b/util/Minimization_Monitor/image_gen/ush/query_data_map.pl deleted file mode 100755 index 8800eccbae..0000000000 --- a/util/Minimization_Monitor/image_gen/ush/query_data_map.pl +++ /dev/null @@ -1,73 +0,0 @@ -#! /usr/bin/perl - -#------------------------------------------------------------------- -# query_data_map.pl -# -# This script returns a requested field from the data_map.xml file. -# It takes three items as input: -# 1. data_map.xml file name (full or relative path) -# 2. suffix identifying the data source (an element in the -# data_map.xml file) -# 3. requested field, one of the xml child elements of the -# suffix element. -# -# If the xml element associated with the suffix does not have the -# requested field defined, then the default_global or -# default_regional element's corresponding field will be used. The -# default is default_global, but if the suffix contains an area of -# "rgn" then the regional_default element will be used. -# -# The contents of that field are echoed to stdout for the calling -# script to access. If the field is empty or missing nothing -# will be returned. The calling script should verify a value has -# been returned before use. -# -#------------------------------------------------------------------- - use strict; - use warnings; - use XML::LibXML; - - if( $#ARGV < 2 ) { - exit - } - - my $dmfile = $ARGV[0]; - my $source = $ARGV[1]; - my $field = $ARGV[2]; - my $default="global_default"; - use XML::LibXML; - - my $parser = XML::LibXML->new(); - my $doc = $parser->parse_file($dmfile); - -# Print the contents of the field if it's found in source. -# If the field is not found in source then use the default element -# and output it's value for the requested field. - - my @srcs = $doc->findnodes("/opt/$source"); - if( @srcs <= 0 ) { - @srcs = $doc->findnodes("/opt/$default"); - } - - if ( @srcs > 0 ) { - - my $src = $srcs[0]; - my($answer) = $src->findnodes("./$field"); - my($area) = $src->findnodes("./area"); - my $src_area = $area->to_literal; - - if( $answer ) { - print $answer->to_literal; - } - else { - if( $src_area eq "rgn" ) { - $default = "regional_default"; - } - my($def_src) = $src->findnodes("/opt/$default"); - my($def_answer) = $def_src->findnodes("./$field"); - if( $def_answer ) { - print $def_answer->to_literal; - } - } - } - diff --git a/util/Minimization_Monitor/image_gen/ush/run_gdas_IG.sh b/util/Minimization_Monitor/image_gen/ush/run_gdas_IG.sh deleted file mode 100755 index 51f2da85c0..0000000000 --- a/util/Minimization_Monitor/image_gen/ush/run_gdas_IG.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -set -ax - -#package=MinMon -package=ProdGSI/util/Minimization_Monitor - -suffix=GFS -run=gdas - -NDATE=/gpfs/dell1/nco/ops/nwprod/prod_util.v1.1.0/exec/ips/ndate -echo NDATE = $NDATE -ch=`hostname | cut -c1` - -scripts=/gpfs/dell2/emc/modeling/noscrub/${LOGNAME}/${package}/image_gen/ush -ptmp=/gpfs/dell2/ptmp/Edward.Safford - -export DO_ARCHIVE=0 -export JOB_QUEUE=dev_shared -export DO_ERROR_RPT=1 - -export MAIL_CC="russ.treadon@noaa.gov, andrew.collard@noaa.gov" -export MAIL_TO="edward.safford@noaa.gov" - -data_map=${scripts}/pen_data_map.xml - -tankdir=/u/Edward.Safford/nbns/stats/${suffix} - -imgdate=`${scripts}/query_data_map.pl ${data_map} ${suffix}_${run} imgdate` -idate=`$NDATE +6 $imgdate` -PDY=`echo $idate | cut -c1-8` -cyc=`echo $idate | cut -c9-10` - -prodate=`${scripts}/find_cycle.pl --run $run --cyc 1 --dir ${tankdir}` -echo "imgdate, prodate = $imgdate, $prodate" -if [[ $idate -le $prodate ]]; then - - echo " firing MinMon_Plt.sh" - ${scripts}/MinMon_Plt.sh ${suffix} -p $idate -r $run \ - 1>${ptmp}/logs/${suffix}/${run}/minmon/IG.${run}.${PDY}.${cyc}.log \ - 2>${ptmp}/logs/${suffix}/${run}/minmon/IG.${run}.${PDY}.${cyc}.err - - rc=`${scripts}/update_data_map.pl ${data_map} ${suffix}_${run} imgdate ${idate}` - -fi - - -exit diff --git a/util/Minimization_Monitor/image_gen/ush/run_gfs_IG.sh b/util/Minimization_Monitor/image_gen/ush/run_gfs_IG.sh deleted file mode 100755 index 70b90b2335..0000000000 --- a/util/Minimization_Monitor/image_gen/ush/run_gfs_IG.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -set -ax - -#package=MinMon -package=ProdGSI/util/Minimization_Monitor - -suffix=GFS -run=gfs - -NDATE=/gpfs/dell1/nco/ops/nwprod/prod_util.v1.1.0/exec/ips/ndate -echo NDATE = $NDATE -ch=`hostname | cut -c1` - -scripts=/gpfs/dell2/emc/modeling/noscrub/${LOGNAME}/${package}/image_gen/ush -ptmp=/gpfs/dell2/ptmp/Edward.Safford - -export DO_ARCHIVE=0 -export JOB_QUEUE=dev_shared -export DO_ERROR_RPT=1 - -export MAIL_CC="russ.treadon@noaa.gov, andrew.collard@noaa.gov" -export MAIL_TO="edward.safford@noaa.gov" - -data_map=${scripts}/pen_data_map.xml - -tankdir=/u/Edward.Safford/nbns/stats/${suffix} - -imgdate=`${scripts}/query_data_map.pl ${data_map} ${suffix}_${run} imgdate` -idate=`$NDATE +6 $imgdate` -PDY=`echo $idate | cut -c1-8` -cyc=`echo $idate | cut -c9-10` - -prodate=`${scripts}/find_cycle.pl --run $run --cyc 1 --dir ${tankdir}` -echo "imgdate, prodate = $imgdate, $prodate" -if [[ $idate -le $prodate ]]; then - - echo " firing MinMon_Plt.sh" - ${scripts}/MinMon_Plt.sh ${suffix} -p $idate -r $run \ - 1>${ptmp}/logs/${suffix}/${run}/minmon/IG.${run}.${PDY}.${cyc}.log \ - 2>${ptmp}/logs/${suffix}/${run}/minmon/IG.${run}.${PDY}.${cyc}.err - - rc=`${scripts}/update_data_map.pl ${data_map} ${suffix}_${run} imgdate ${idate}` - -fi - - -exit diff --git a/util/Minimization_Monitor/image_gen/ush/run_script.sh b/util/Minimization_Monitor/image_gen/ush/run_script.sh deleted file mode 100755 index d55bd586c8..0000000000 --- a/util/Minimization_Monitor/image_gen/ush/run_script.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh - -#---------------------------------------------------------------------- -# -# This is a generic image generation leader script. -# The MinMon_Plt.sh script may be called directly or this script -# may be used to override specific default values in the parm files -# and/or MinMon_Plt.sh script. -# -# MINMON_SUFFIX corresponds to the $NET value -# -# RUN is either gfs or gdas -# -# MAIL_CC list is used if warnings messages are set to on. -# -# idate, if set, will override the next value in the local -# pen_data_map.xml file. -#---------------------------------------------------------------------- - -MINMON_SUFFIX=testmm -RUN=gfs - -#export MAIL_CC= -#idate= - - -#---------------------------------------------------------------------- -# no changes should be necessary below this point. -#---------------------------------------------------------------------- -. ../../parm/MinMon.ver -. ../../parm/MinMon_config - -if [[ $idate == "" ]]; then - data_map=${M_IG_SCRIPTS}/pen_data_map.xml - - imgdate=`${M_IG_SCRIPTS}/query_data_map.pl \ - ${data_map} ${MINMON_SUFFIX}_${RUN} imgdate` - echo "imgdate = $imgdate" - - - idate=`$NDATE +6 $imgdate` -fi - -pdy=`echo $idate | cut -c1-8` -cyc=`echo $idate | cut -c9-10` -echo "idate = $idate" - -echo "tank = ${M_TANKverf}/stats/${MINMON_SUFFIX}" - -prodate=`${M_IG_SCRIPTS}/find_cycle.pl \ - --dir ${M_TANKverf}/stats/${MINMON_SUFFIX} \ - --cyc 1 --run ${RUN}` - -echo "imgdate, prodate = $imgdate, $prodate" - - -if [[ $idate -le $prodate ]]; then - - echo " firing MinMon_Plt.sh" - ${M_IG_SCRIPTS}/MinMon_Plt.sh ${MINMON_SUFFIX} -p $idate -r $RUN \ - 1>${LOGdir}/IG.${run}.${PDY}.${cyc}.log \ - 2>${LOGdir}/IG.${run}.${PDY}.${cyc}.err - - rc=`${M_IG_SCRIPTS}/update_data_map.pl ${data_map} \ - ${MINMON_SUFFIX}_${RUN} imgdate ${idate}` - -fi - - -exit diff --git a/util/Minimization_Monitor/image_gen/ush/run_v16rt1_IG.sh b/util/Minimization_Monitor/image_gen/ush/run_v16rt1_IG.sh deleted file mode 100755 index 5df811a0e1..0000000000 --- a/util/Minimization_Monitor/image_gen/ush/run_v16rt1_IG.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -package=MinMon -#package=ProdGSI/util/Minimization_Monitor - -suffix=v16rt1 -run=gdas - -idev=`cat /etc/dev | cut -c1` -iprod=`cat /etc/prod | cut -c1` - - shell=sh - source /usrx/local/prod/lmod/lmod/init/${shell} - - export MODULEPATH=/usrx/local/prod/lmod/lmod/modulefiles/Core:/usrx/local/prod/modulefiles/core_third:/usrx/local/prod/modulefiles/defs:/gpfs/dell1/nco/ops/nwprod/modulefiles/core_prod:/usrx/local/dev/modulefiles - module load ips/18.0.1.163 - module load metplus/2.1 - module load lsf/10.1 - module load prod_util/1.1.2 - module load GrADS/2.2.0 - -echo NDATE = $NDATE -ch=`hostname | cut -c1` - -#scripts=/gpfs/${ch}d2/emc/da/noscrub/${LOGNAME}/${package}/image_gen/ush -scripts=/gpfs/dell2/emc/modeling/noscrub/${LOGNAME}/${package}/image_gen/ush - -#export NDATE=/gpfs/hps/nco/ops/nwprod/prod_util.v1.0.14/exec/ndate -export DO_ARCHIVE=0 -export JOB_QUEUE=dev_shared -export DO_ERROR_RPT=1 - -export MAIL_CC="russ.treadon@noaa.gov, andrew.collard@noaa.gov" -export MAIL_TO="edward.safford@noaa.gov" - -data_map=${scripts}/pen_data_map.xml - -tankdir=/u/Edward.Safford/nbns/stats/${suffix} - -imgdate=`${scripts}/query_data_map.pl ${data_map} ${suffix}_${run} imgdate` -idate=`$NDATE +6 $imgdate` -PDY=`echo $idate | cut -c1-8` -cyc=`echo $idate | cut -c9-10` - -ptmp=/gpfs/dell2/ptmp/Edward.Safford - -prodate=`${scripts}/find_cycle.pl --run gdas --cyc 1 --dir ${tankdir}` -echo "imgdate, prodate = $imgdate, $prodate" -if [[ $idate -le $prodate ]]; then - - echo " firing MinMon_Plt.sh" - ${scripts}/MinMon_Plt.sh ${suffix} -p $idate -r $run \ - 1>${ptmp}/logs/${suffix}/${run}/minmon/IG.${run}.${PDY}.${cyc}.log \ - 2>${ptmp}/logs/${suffix}/${run}/minmon/IG.${run}.${PDY}.${cyc}.err - - rc=`${scripts}/update_data_map.pl ${data_map} ${suffix}_${run} imgdate ${idate}` - -fi - - -exit diff --git a/util/Minimization_Monitor/image_gen/ush/update_ctl_tdef.sh b/util/Minimization_Monitor/image_gen/ush/update_ctl_tdef.sh index 2355d13f51..76216cf7cf 100755 --- a/util/Minimization_Monitor/image_gen/ush/update_ctl_tdef.sh +++ b/util/Minimization_Monitor/image_gen/ush/update_ctl_tdef.sh @@ -109,15 +109,12 @@ function usage { tdef=`echo $line | gawk '{print $1}'` if [[ $tdef == "tdef" ]]; then -# echo "found tdef" -# echo "$line" v2=`echo $line | gawk '{print $2}'` v3=`echo $line | gawk '{print $3}'` v5=`echo $line | gawk '{print $5}'` ndate="${ihh}Z${idd}${smon}${iyy}" newline="${tdef} ${v2} ${v3} ${ndate} ${v5}" -# echo "$newline" echo "$newline" >> $tmp_file found_tdef=1 else diff --git a/util/Minimization_Monitor/image_gen/ush/update_ctl_xdef.sh b/util/Minimization_Monitor/image_gen/ush/update_ctl_xdef.sh deleted file mode 100755 index ce9a8efc91..0000000000 --- a/util/Minimization_Monitor/image_gen/ush/update_ctl_xdef.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/ksh - -#------------------------------------------------------------- -# -# update_ctl_xdef.sh -# -# Update the xdef line (iteration definition) in a given control -# file. -# -#------------------------------------------------------------- - -function usage { - echo "Usage: update_ctl_xdef.sh control_file_path_and_name num_iters" -} - - -#------------------------------------------------------------- -# check for correct usage and assign cmd line vars -# - echo "enter update_ctl_xdef.sh" - - if [[ $# -lt 2 ]]; then - usage - exit 1 - fi - - ctl_file=$1 - num_iters=$2 - -# iyy=`echo $datestr | cut -c1-4` -# imm=`echo $datestr | cut -c5-6` -# idd=`echo $datestr | cut -c7-8` -# ihh=`echo $datestr | cut -c9-10` -# -# echo year = $iyy -# echo month= $imm -# echo day = $idd -# echo hour = $ihh - -#------------------------------------------------------------- -# validate ctr_file -# - if [[ ! -s $ctl_file ]]; then - echo $ctl_file not found - exit -1 - fi - -#------------------------------------------------------------- -# Construct tmp_file from ctl_file name (minus any full or -# relative path) -# - - ctl_base=`basename ${ctl_file}` - ctl_dir=`dirname ${ctl_file}` - - tmp_file="${ctl_dir}/tmp_${ctl_base}" - echo "tmp_file = ${tmp_file}" - - if [[ -s $tmp_file ]]; then - rm -f $tmp_file - fi - - found_xdef=0 - while read line; do - - xdef=`echo $line | gawk '{print $1}'` - - if [[ $xdef == "xdef" ]]; then -# echo "found xdef" -# echo "$line" - v3=`echo $line | gawk '{print $3}'` - v4=`echo $line | gawk '{print $4}'` - v5=`echo $line | gawk '{print $5}'` - - newline="${xdef} ${num_iters} ${v3} ${v4} ${v5}" -# echo "$newline" - echo "$newline" >> $tmp_file - found_xdef=1 - else - echo "$line" >> $tmp_file - fi - - done < "$ctl_file" - - if [[ $found_xdef -eq 1 ]]; then - cp -f $tmp_file $ctl_file - rm -f $tmp_file - else - echo "ERROR tdef not found, no update to $ctl_base done" - fi - - echo "exit update_ctl_xdef.sh" -exit diff --git a/util/Minimization_Monitor/image_gen/ush/update_data_map.pl b/util/Minimization_Monitor/image_gen/ush/update_data_map.pl deleted file mode 100755 index 57225465fd..0000000000 --- a/util/Minimization_Monitor/image_gen/ush/update_data_map.pl +++ /dev/null @@ -1,61 +0,0 @@ -#! /usr/bin/perl - -#------------------------------------------------------------------- -# update_data_map.pl -# -# This script updates a requested field in the data_map.xml file. If -# the requested field does not exist in but the parent node (suffix) -# is found then the requested field and value are added to the -# data_map.xml file. -# -# Calling sequence: -# >> update_data_map.pl ./path/to/data_map.xml suffix req_field new_val -# -# 1. data_map.xml file (full or relative path) -# 2. suffix identifying the data source (an element in the -# data_map.xml file) -# 3. requested field, one of the xml child elements of the -# suffix element. -# 4. new value for the requested field -# -# Return codes (sent to stdout): -# 0 update was successful -# 1 the suffix and/or field was not found. -# -# Note: Calling scripts generally assign a variable value to -# output from this script. If diagnostic print messages -# are left uncommented then results will become undefined. -#------------------------------------------------------------------- - use strict; - use warnings; - use XML::LibXML; - - my $dmfile = $ARGV[0]; - my $source = $ARGV[1]; - my $field = $ARGV[2]; - my $value = $ARGV[3]; - my $rc = "1"; - - my $parser = XML::LibXML->new(); - my $doc = $parser->parse_file($dmfile); - - my $query = "//$source/$field/text()"; - - my($node) = $doc->findnodes($query); - - if( $node ) { - $node->setData("$value" ); - $doc->toFile( $dmfile ); - $rc = "0"; - } - else { - my $new_query = "//$source"; - my ($src_node) = $doc->findnodes($new_query); - $src_node->appendTextChild( "$field", "$value" ); - $doc->toFile( $dmfile ); - $rc = "0"; - } - - print "$rc"; - - diff --git a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon.sh b/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon.sh deleted file mode 100755 index 916c57d0ee..0000000000 --- a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/ksh - -#BSUB -o gdas_vminmon.o%J -#BSUB -e gdas_vminmon.o%J -#BSUB -J gdas_vminmon -#BSUB -q dev_shared -#BSUB -n 1 -#BSUB -R affinity[core] -#BSUB -M 80 -#BSUB -W 00:05 -#BSUB -a poe -#BSUB -P GFS-T2O - -set -x - -export PDATE=${PDATE:-2018011112} - -############################################################# -# Specify whether the run is production or development -############################################################# -export PDY=`echo $PDATE | cut -c1-8` -export cyc=`echo $PDATE | cut -c9-10` -export job=gdas_vminmon.${cyc} -export pid=${pid:-$$} -export jobid=${job}.${pid} -export envir=para -id=`hostname | cut -c1` -export DATAROOT=${DATAROOT:-/gpfs/${id}d2/emc/da/noscrub/Edward.Safford/test_data} -export COMROOT=${COMROOT:-/ptmpp1/$LOGNAME/com} - - -############################################################# -# Specify versions -############################################################# -export gdas_ver=v14.1.0 -export global_shared_ver=v14.1.0 -export gdas_minmon_ver=v1.0.0 -export minmon_shared_ver=v1.0.1 - - -############################################################# -# Load modules -############################################################# -. /usrx/local/Modules/3.2.9/init/ksh -module use /nwprod2/modulefiles -module load prod_util -#module load util_shared - -module list - - -############################################################# -# WCOSS environment settings -############################################################# -export POE=YES - - -############################################################# -# Set user specific variables -############################################################# -export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon_gdas} -export NWTEST=${NWTEST:-/da/noscrub/${LOGNAME}/ProdGSI/util/Minimization_Monitor/nwprod} -export HOMEgdas=${NWTEST}/gdas.${gdas_minmon_ver} -export JOBGLOBAL=${HOMEgdas}/jobs -export HOMEminmon=${NWTEST}/minmon_shared.${minmon_shared_ver} -export COM_IN=${COM_IN:-${DATAROOT}} -export M_TANKverf=${COMROOT}/${MINMON_SUFFIX} - - -############################################################# -# Execute job -############################################################# -$JOBGLOBAL/JGDAS_VMINMON - -exit - diff --git a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_hera.sh b/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_hera.sh deleted file mode 100755 index 39c8127199..0000000000 --- a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_hera.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/ksh - -#SBATCH -o gdas_verfrad.o%j -#SBATCH -J gdas_verfrad -#SBATCH --ntasks=1 --mem=5g -#SBATCH --time=20 -#SBATCH --account=fv3-cpu -#SBATCH -D . - -set -x - -export PDATE=${PDATE:-2018070418} - - -############################################################# -# Specify whether the run is production or development -############################################################# -export PDY=`echo $PDATE | cut -c1-8` -export cyc=`echo $PDATE | cut -c9-10` -export job=gdas_vminmon.${cyc} -export pid=${pid:-$$} -export jobid=${job}.${pid} -export envir=para -export DATAROOT=${DATAROOT:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/test_data} -export COMROOT=${COMROOT:-/scratch2/NCEPDEV/stmp3/$LOGNAME/com} -export STMP_USER=${STMP_USER:-/scratch2/NCEPDEV/stmp3/$LOGNAME} - - -############################################################# -# Specify versions -############################################################# -export gdas_ver=v1.0.0 -export global_shared_ver=v1.0.1 - -############################################################# -# Add nwpara tools to path -############################################################# -#NWPROD=${NWPROD:-/scratch4/NCEPDEV/global/save/glopara/nwpara/util} -#NWPRODush=${NWPRODush:=${NWPROD}/ush} -#NWPRODexec=${NWPRODexec:=${NWPROD}/exec} -#export PATH=${PATH}:${NWPRODush}:${NWPRODexec} - - -############################################################# -# Set user specific variables -############################################################# -export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon} - -export NWTEST=${NWTEST:-/scratch1/NCEPDEV/da/${LOGNAME}/noscrub/ProdGSI/util/Minimization_Monitor/nwprod} -export HOMEgdas=${HOMEgdas:-${NWTEST}/gdas.${gdas_ver}} -export HOMEgfs=${HOMEgfs:-${HOMEgdas}} -export JOBGLOBAL=${HOMEgdas}/jobs -export HOMEminmon=${HOMEminmon:-${NWTEST}/minmon_shared.${global_shared_ver}} -export COM_IN=${COM_IN:-${DATAROOT}} -export M_TANKverf=${M_TANKverf:-${COMROOT}/${MINMON_SUFFIX}} -export M_FIXgdas=${M_FIXgdas:-${HOMEgdas}/fix} - -####################################################################### -# theia specific hacks for no prod_utils module (ndate) -####################################################################### -export MY_MACHINE=hera -export NDATE=/home/Edward.Safford/bin/ndate - -export PERL5LIB="/usr/lib64/perl5:/usr/share/perl5" -export VERBOSE=YES -export KEEPDATA=YES - -############################################################# -# Execute job -############################################################# -$JOBGLOBAL/JGDAS_VMINMON - -exit - diff --git a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_theia.sh b/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_theia.sh deleted file mode 100755 index 118ad3656f..0000000000 --- a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_theia.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/ksh - -#PBS -o gdas_vminmon.log -#PBS -e gdas_vminmon.err -#PBS -N gdas_vminmon -#PBS -A glbss -#PBS -l procs=1,walltime=0:05:00 -#PBS -V - -set -x - -export PDATE=${PDATE:-2016030712} - - -############################################################# -# Specify whether the run is production or development -############################################################# -export PDY=`echo $PDATE | cut -c1-8` -export cyc=`echo $PDATE | cut -c9-10` -export job=gdas_vminmon.${cyc} -export pid=${pid:-$$} -export jobid=${job}.${pid} -export envir=para -export DATAROOT=${DATAROOT:-/scratch4/NCEPDEV/da/noscrub/Edward.Safford/test_data} -export COMROOT=${COMROOT:-/scratch4/NCEPDEV/stmp3/$LOGNAME/com} -export STMP_USER=${STMP_USER:-/scratch4/NCEPDEV/stmp3/$LOGNAME} - - -############################################################# -# Specify versions -############################################################# -export gdas_ver=v1.0.0 -export global_shared_ver=v1.0.1 - -############################################################# -# Add nwpara tools to path -############################################################# -NWPROD=${NWPROD:-/scratch4/NCEPDEV/global/save/glopara/nwpara/util} -NWPRODush=${NWPRODush:=${NWPROD}/ush} -NWPRODexec=${NWPRODexec:=${NWPROD}/exec} -export PATH=${PATH}:${NWPRODush}:${NWPRODexec} - - -############################################################# -# Set user specific variables -############################################################# -export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon} -#export NWTEST=${NWTEST:-/scratch4/NCEPDEV/da/noscrub/${LOGNAME}/gfs_q3fy17} -export NWTEST=${NWTEST:-/scratch4/NCEPDEV/da/noscrub/${LOGNAME}/ProdGSI/util/Minimization_Monitor/nwprod} -export HOMEgdas=${HOMEgdas:-${NWTEST}/gdas.${gdas_ver}} -export JOBGLOBAL=${HOMEgdas}/jobs -export HOMEminmon=${HOMEminmon:-${NWTEST}/minmon_shared.${global_shared_ver}} -export COM_IN=${COM_IN:-${DATAROOT}} -export M_TANKverf=${M_TANKverf:-${COMROOT}/${MINMON_SUFFIX}} - -####################################################################### -# theia specific hacks for no prod_utils module & no setpdy.sh script -####################################################################### -export MY_MACHINE=theia -NDATE=~/bin/ndate -prevday=`$NDATE -24 $PDATE` -export PDYm1=`echo $prevday | cut -c1-8` -ln -s ${NWPRODush}/startmsg.sh ${STMP_USER}/startmsg -ln -s ${NWPRODush}/postmsg.sh ${STMP_USER}/postmsg -ln -s ${NWPRODush}/prep_step.sh ${STMP_USER}/prep_step -ln -s ${NWPRODush}/err_chk.sh ${STMP_USER}/err_chk -export PATH=$PATH:${STMP_USER} -export utilscript=${utilscript:-${NWPRODush}} # err_chk calls postmsg.sh - # directly so need to override - # utilscript location - -export PERL5LIB="/usr/lib64/perl5:/usr/share/perl5" - - -############################################################# -# Execute job -############################################################# -$JOBGLOBAL/JGDAS_VMINMON - -exit - diff --git a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/parm/gdas_minmon.parm b/util/Minimization_Monitor/nwprod/gdas.v1.0.0/parm/gdas_minmon.parm deleted file mode 100644 index eabeea8030..0000000000 --- a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/parm/gdas_minmon.parm +++ /dev/null @@ -1,21 +0,0 @@ -##################################### -# specify minmon shared version -##################################### - - - -##################################### -# specify minmon_shared location -##################################### - - - - - - -##################################### -# utilities -##################################### -export COMPRESS=${COMPRESS:-gzip} -export UNCOMPRESS=${UNCOMPRESS:-gunzip} - diff --git a/util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_hera.sh b/util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_hera.sh new file mode 100755 index 0000000000..995647490e --- /dev/null +++ b/util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_hera.sh @@ -0,0 +1,54 @@ +#!/bin/ksh + +#SBATCH -o gdas_verfrad.o%j +#SBATCH -J gdas_verfrad +#SBATCH --ntasks=1 --mem=5g +#SBATCH --time=20 +#SBATCH --account=fv3-cpu +#SBATCH -D . + +set -x + +export PDATE=${PDATE:-2021122818} + +####################################################################### +# hera specific hacks for no prod_utils module (ndate) +####################################################################### +export MY_MACHINE=hera +export NDATE=/home/Edward.Safford/bin/ndate + +export PERL5LIB="/usr/lib64/perl5:/usr/share/perl5" +export VERBOSE=YES +export KEEPDATA=YES + + +####################################################################### +# set necessary vars for data extraction J-job +####################################################################### +export PDY=`echo $PDATE | cut -c1-8` +export cyc=`echo $PDATE | cut -c9-10` +export job=gdas_vminmon.${cyc} +export pid=${pid:-$$} +export jobid=${job}.${pid} +export envir=para +export DATAROOT=${DATAROOT:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/test_data} +export COMROOT=${COMROOT:-/scratch2/NCEPDEV/stmp3/$LOGNAME/com} +export STMP_USER=${STMP_USER:-/scratch2/NCEPDEV/stmp3/$LOGNAME} + +export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon} + +export NWTEST=${NWTEST:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/GSI/util/Minimization_Monitor/nwprod} +export HOMEgdas=${HOMEgdas:-${NWTEST}/gdas} +export HOMEgfs=${HOMEgfs:-${HOMEgdas}} +export JOBGLOBAL=${HOMEgdas}/jobs +export HOMEminmon=${HOMEminmon:-${NWTEST}/minmon_shared} +export COM_IN=${COM_IN:-${DATAROOT}} +export M_FIXgdas=${M_FIXgdas:-${HOMEgdas}/fix} + +############################################################# +# Execute job +############################################################# +$JOBGLOBAL/JGDAS_ATMOS_VMINMON + +exit + diff --git a/util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_wcoss2.sh b/util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_wcoss2.sh new file mode 100755 index 0000000000..19dc94c540 --- /dev/null +++ b/util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_wcoss2.sh @@ -0,0 +1,62 @@ +#!/bin/ksh -l + +#PBS -o gdas_vminmon.out +#PBS -e gdas_vminmon.err +#PBS -N gdas_vminmon +#PBS -q dev +#PBS -l select=1:mem=400M +#PBS -l walltime=05:00 +#PBS -A GFS-DEV + + +set -ax + +export PDATE=${PDATE:-2021082306} + +############################################################# +# Specify whether the run is production or development +############################################################# +export PDY=`echo $PDATE | cut -c1-8` +export cyc=`echo $PDATE | cut -c9-10` +export job=gdas_vminmon.${cyc} +export pid=${pid:-$$} +export jobid=${job}.${pid} +export envir=para + +export DATAROOT=${DATAROOT:-/lfs/h1/ops/canned/com/gfs/v16.2} +export DATA=${DATA:-/lfs/h2/emc/stmp/Edward.Safford} +export COMROOT=${COMROOT:-/lfs/h2/emc/ptmp/Edward.Safford/com} + + +############################################################# +# Load modules +############################################################# +module load prod_util/2.0.10 +module load util_shared/1.4.0 +module load perl/5.32.0 + +module list + + +############################################################# +# Set user specific variables +############################################################# +export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon_gdas} +export NWTEST=${NWTEST:-/lfs/h2/emc/da/noscrub/Edward.Safford/git/gsi/GSI/util/Minimization_Monitor/nwprod} +export HOMEgdas=${NWTEST}/gdas +export HOMEgfs=${HOMEgfs:-${HOMEgdas}} + +export JOBGLOBAL=${HOMEgdas}/jobs +export HOMEminmon=${NWTEST}/minmon_shared + +export COM_IN=${COM_IN:-${DATAROOT}} +export M_TANKverf=${COMROOT}/${MINMON_SUFFIX} +export M_FIXgdas=${HOMEgdas}/fix + +############################################################# +# Execute job +############################################################# +$JOBGLOBAL/JGDAS_ATMOS_VMINMON + +exit + diff --git a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_cray.sh b/util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_wcoss_c.sh similarity index 57% rename from util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_cray.sh rename to util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_wcoss_c.sh index f9c1b46b35..d958184fa6 100755 --- a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_cray.sh +++ b/util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_wcoss_c.sh @@ -11,7 +11,7 @@ set -x -export PDATE=${PDATE:-2017111312} +export PDATE=${PDATE:-2022010406} ############################################################# # Specify whether the run is production or development @@ -24,15 +24,6 @@ export jobid=${job}.${pid} export envir=para -############################################################# -# Specify versions -############################################################# -#export gdas_ver=v14.1.0 -#export global_shared_ver=v14.1.0 -export gdas_ver=v1.0.0 -export minmon_shared_ver=v1.0.1 - - ############################################################# # Load modules ############################################################# @@ -44,30 +35,26 @@ module load pm5 module list -############################################################# -# WCOSS environment settings -############################################################# -export POE=YES - - ############################################################# # Set user specific variables ############################################################# -export DATAROOT=${DATAROOT:-/gpfs/hps3/emc/da/noscrub/$LOGNAME/test_data} -export COMROOT=${COMROOT:-/gpfs/hps2/ptmp/$LOGNAME/com} +export DATAROOT=/gpfs/hps3/emc/da/noscrub/$LOGNAME/test_data +export COMROOT=/gpfs/hps2/ptmp/$LOGNAME/com export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon_gdas} -export NWTEST=${NWTEST:-/gpfs/hps3/emc/da/noscrub/${LOGNAME}/ProdGSI/util/Minimization_Monitor/nwprod} -export HOMEgdas=${NWTEST}/gdas.${gdas_ver} +export NWTEST=/gpfs/hps3/emc/da/noscrub/Edward.Safford/GSI/util/Minimization_Monitor/nwprod +export HOMEgdas=${NWTEST}/gdas +export M_FIXgdas=${M_FIXgdas:-${HOMEgdas}/fix} export JOBGLOBAL=${HOMEgdas}/jobs -export HOMEminmon=${NWTEST}/minmon_shared.${minmon_shared_ver} +export HOMEgfs=${HOMEgfs:-${HOMEgdas}} +export HOMEminmon=${NWTEST}/minmon_shared export COM_IN=${DATAROOT} -export M_TANKverf=${M_TANKverf:-${COMROOT}/${MINMON_SUFFIX}} +export M_TANKverf=${COMROOT}/${MINMON_SUFFIX} export CYCLE_INTERVAL=${CYCLE_INTERVAL:-6} ############################################################# # Execute job ############################################################# -$JOBGLOBAL/JGDAS_VMINMON +$JOBGLOBAL/JGDAS_ATMOS_VMINMON exit diff --git a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_wcoss_d.sh b/util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_wcoss_d.sh similarity index 80% rename from util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_wcoss_d.sh rename to util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_wcoss_d.sh index 0d6943d976..f3aef842a4 100755 --- a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/driver/test_jgdas_vminmon_wcoss_d.sh +++ b/util/Minimization_Monitor/nwprod/gdas/driver/test_jgdas_vminmon_wcoss_d.sh @@ -8,11 +8,11 @@ #BSUB -R affinity[core] #BSUB -M 80 #BSUB -W 00:05 -#BSUB -P GFS-T2O +#BSUB -P GFS-DEV set -ax -export PDATE=${PDATE:-2018011118} +export PDATE=${PDATE:-2018011112} ############################################################# # Specify whether the run is production or development @@ -28,15 +28,6 @@ export DATAROOT=${DATAROOT:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/test export COMROOT=${COMROOT:-/gpfs/dell2/ptmp/Edward.Safford/com} -############################################################# -# Specify versions -############################################################# -export gdas_ver=v14.1.0 -export global_shared_ver=v14.1.0 -export gdas_minmon_ver=v1.0.0 -export minmon_shared_ver=v1.0.1 - - ############################################################# # Load modules ############################################################# @@ -63,12 +54,12 @@ export minmon_shared_ver=v1.0.1 # Set user specific variables ############################################################# export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon_gdas} -export NWTEST=${NWTEST:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/ProdGSI/util/Minimization_Monitor/nwprod} -export HOMEgdas=${NWTEST}/gdas.${gdas_minmon_ver} +export NWTEST=${NWTEST:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/GSI/util/Minimization_Monitor/nwprod} +export HOMEgdas=${NWTEST}/gdas export HOMEgfs=${HOMEgfs:-${HOMEgdas}} export JOBGLOBAL=${HOMEgdas}/jobs -export HOMEminmon=${NWTEST}/minmon_shared.${minmon_shared_ver} +export HOMEminmon=${NWTEST}/minmon_shared export COM_IN=${COM_IN:-${DATAROOT}} export M_TANKverf=${COMROOT}/${MINMON_SUFFIX} @@ -77,7 +68,7 @@ export M_FIXgdas=${HOMEgdas}/fix ############################################################# # Execute job ############################################################# -$JOBGLOBAL/JGDAS_VMINMON +$JOBGLOBAL/JGDAS_ATMOS_VMINMON exit diff --git a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/fix/gdas_minmon_cost.txt b/util/Minimization_Monitor/nwprod/gdas/fix/gdas_minmon_cost.txt similarity index 100% rename from util/Minimization_Monitor/nwprod/gdas.v1.0.0/fix/gdas_minmon_cost.txt rename to util/Minimization_Monitor/nwprod/gdas/fix/gdas_minmon_cost.txt diff --git a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/fix/gdas_minmon_gnorm.txt b/util/Minimization_Monitor/nwprod/gdas/fix/gdas_minmon_gnorm.txt similarity index 100% rename from util/Minimization_Monitor/nwprod/gdas.v1.0.0/fix/gdas_minmon_gnorm.txt rename to util/Minimization_Monitor/nwprod/gdas/fix/gdas_minmon_gnorm.txt diff --git a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/jobs/JGDAS_ATMOS_VMINMON b/util/Minimization_Monitor/nwprod/gdas/jobs/JGDAS_ATMOS_VMINMON similarity index 84% rename from util/Minimization_Monitor/nwprod/gdas.v1.0.0/jobs/JGDAS_ATMOS_VMINMON rename to util/Minimization_Monitor/nwprod/gdas/jobs/JGDAS_ATMOS_VMINMON index 2e0ffac0fd..407ddb5826 100755 --- a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/jobs/JGDAS_ATMOS_VMINMON +++ b/util/Minimization_Monitor/nwprod/gdas/jobs/JGDAS_ATMOS_VMINMON @@ -44,15 +44,6 @@ export EXECminmon=${EXECminmon:-$HOMEminmon/exec} export USHminmon=${USHminmon:-$HOMEminmon/ush} -############################################# -# Run setpdy and initialize PDY variables -############################################# -if [[ $MY_MACHINE != "hera" ]]; then - export cycle=t${cyc}z - setpdy.sh - . ./PDY -fi - ############################################# # determine PDY and cyc for previous cycle ############################################# @@ -69,10 +60,8 @@ export p_cyc=`echo ${cdate} | cut -c9-10` ############################################# export COM_IN=${COM_IN:-${COMROOT}/${NET}/${envir}} -M_TANKverf=${M_TANKverf:-${COM_IN}} -M_TANKverfM0=${M_TANKverfM0:-${M_TANKverf}/${RUN}.${PDY}/${cyc}/$COMPONENT/minmon} -export M_TANKverfM1=${M_TANKverfM1:-${M_TANKverf}/${RUN}.${P_PDY}/${p_cyc}/$COMPONENT/minmon} -export M_TANKverf=$M_TANKverfM0 +export M_TANKverf=${M_TANKverf:-${COM_IN}/${RUN}.${PDY}/${cyc}/${COMPONENT}/minmon} +export M_TANKverfM1=${M_TANKverfM1:-${COM_IN}/${RUN}.${P_PDY}/${p_cyc}/${COMPONENT}/minmon} export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}/${cyc}/$COMPONENT} diff --git a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/scripts/exgdas_atmos_vminmon.sh b/util/Minimization_Monitor/nwprod/gdas/scripts/exgdas_atmos_vminmon.sh similarity index 91% rename from util/Minimization_Monitor/nwprod/gdas.v1.0.0/scripts/exgdas_atmos_vminmon.sh rename to util/Minimization_Monitor/nwprod/gdas/scripts/exgdas_atmos_vminmon.sh index 1fa612cbfe..f5087e41d5 100755 --- a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/scripts/exgdas_atmos_vminmon.sh +++ b/util/Minimization_Monitor/nwprod/gdas/scripts/exgdas_atmos_vminmon.sh @@ -74,10 +74,15 @@ if [[ -s ${gsistat} ]]; then data_available=1 - #------------------------------------------------------------------ + #----------------------------------------------------------------------- # Copy the $MINMON_SUFFIX.gnorm_data.txt file to the working directory # It's ok if it doesn't exist; we'll create a new one if needed. - #------------------------------------------------------------------ + # + # Note: The logic below is to accomodate two different data storage + # methods. Some parallels (and formerly ops) dump all MinMon data for + # a given day in the same directory (if condition). Ops now separates + # data into ${cyc} subdirectories (elif condition). + #----------------------------------------------------------------------- if [[ -s ${M_TANKverf}/gnorm_data.txt ]]; then $NCP ${M_TANKverf}/gnorm_data.txt gnorm_data.txt elif [[ -s ${M_TANKverfM1}/gnorm_data.txt ]]; then diff --git a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon.sh b/util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon.sh deleted file mode 100755 index 384e25cee3..0000000000 --- a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/ksh - -#BSUB -o gfs_vminmon.o%J -#BSUB -e gfs_vminmon.o%J -#BSUB -J gfs_vminmon -#BSUB -q dev_shared -#BSUB -n 1 -#BSUB -R affinity[core] -#BSUB -M 80 -#BSUB -W 00:05 -#BSUB -a poe -#BSUB -P GFS-T2O - -set -x - -export PDATE=${PDATE:-2016030812} - -############################################################# -# Specify whether the run is production or development -############################################################# -export PDY=`echo $PDATE | cut -c1-8` -export cyc=`echo $PDATE | cut -c9-10` -export job=gfs_vminmon.${cyc} -export pid=${pid:-$$} -export jobid=${job}.${pid} -export envir=para -export Z=${Z:-gz} -me=`hostname | cut -c1` -export DATAROOT=${DATAROOT:-/gpfs/${me}d2/emc/da/noscrub/$LOGNAME/test_data} -export COMROOT=${COMROOT:-/ptmpp1/$LOGNAME/com} - - -############################################################# -# Specify versions -############################################################# -export gfs_ver=v14.1.0 -export global_shared_ver=v14.1.0 -export gfs_minmon_ver=v1.0.0 -export minmon_shared_ver=v1.0.1 - - -############################################################# -# Load modules -############################################################# -. /usrx/local/Modules/3.2.9/init/ksh -module use /nwprod2/modulefiles -module load prod_util -#module load util_shared - -module list - - -############################################################# -# WCOSS environment settings -############################################################# -export POE=YES - - -############################################################# -# Set user specific variables -############################################################# -export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon_gfs} -export NWTEST=${NWTEST:-/da/noscrub/${LOGNAME}/ProdGSI/util/Minimization_Monitor/nwprod} -export HOMEgfs=${HOMEgfs:-${NWTEST}/gfs.${gfs_minmon_ver}} -export JOBGLOBAL=${JOBGLOBAL:-${HOMEgfs}/jobs} -export HOMEminmon=${HOMEminmon:-${NWTEST}/minmon_shared.${minmon_shared_ver}} -export COM_IN=${COM_IN:-${DATAROOT}} -export M_TANKverf=${M_TANKverf:-${COMROOT}/${MINMON_SUFFIX}} - - -############################################################# -# Execute job -############################################################# -$JOBGLOBAL/JGFS_VMINMON - -exit - diff --git a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_theia.sh b/util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_theia.sh deleted file mode 100755 index 4ff005ceaf..0000000000 --- a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_theia.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/ksh - -#PBS -o gfs_vminmon.log -#PBS -e gfs_vminmon.err -#PBS -N gfs_vminmon -#PBS -A glbss -#PBS -l procs=1,walltime=0:05:00 -#PBS -V - -set -x - -export PDATE=${PDATE:-2016030706} - - -############################################################# -# Specify whether the run is production or development -############################################################# -export PDY=`echo $PDATE | cut -c1-8` -export cyc=`echo $PDATE | cut -c9-10` -export job=gfs_vminmon.${cyc} -export pid=${pid:-$$} -export jobid=${job}.${pid} -export envir=para -export DATAROOT=${DATAROOT:-/scratch4/NCEPDEV/da/noscrub/Edward.Safford/test_data} -export COMROOT=${COMROOT:-/scratch4/NCEPDEV/stmp3/$LOGNAME/com} -export STMP_USER=${STMP_USER:-/scratch4/NCEPDEV/stmp3/$LOGNAME} - - -############################################################# -# Specify versions -############################################################# -export gfs_ver=v1.0.0 -export global_shared_ver=v1.0.1 - -############################################################# -# Add nwpara tools to path -############################################################# -NWPROD=${NWPROD:-/scratch4/NCEPDEV/global/save/glopara/nwpara/util} -NWPRODush=${NWPRODush:=${NWPROD}/ush} -NWPRODexec=${NWPRODexec:=${NWPROD}/exec} -export PATH=${PATH}:${NWPRODush}:${NWPRODexec} - - -############################################################# -# Set user specific variables -############################################################# -export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon_gfs} -#export NWTEST=${NWTEST:-/scratch4/NCEPDEV/da/noscrub/${LOGNAME}/gfs_q3fy17} -export NWTEST=${NWTEST:-/scratch4/NCEPDEV/da/noscrub/${LOGNAME}/ProdGSI/util/Minimization_Monitor/nwprod} -export HOMEgfs=${HOMEgfs:-${NWTEST}/gfs.${gfs_ver}} -export JOBGLOBAL=${HOMEgfs}/jobs -export HOMEminmon=${HOMEminmon:-${NWTEST}/minmon_shared.${global_shared_ver}} -export COM_IN=${COM_IN:-${DATAROOT}} -export M_TANKverf=${M_TANKverf:-${COMROOT}/${MINMON_SUFFIX}} - -####################################################################### -# theia specific hacks for no prod_utils module & no setpdy.sh script -####################################################################### -export MY_MACHINE=theia -NDATE=~/bin/ndate -prevday=`$NDATE -24 $PDATE` -export PDYm1=`echo $prevday | cut -c1-8` -ln -s ${NWPRODush}/startmsg.sh ${STMP_USER}/startmsg -ln -s ${NWPRODush}/postmsg.sh ${STMP_USER}/postmsg -ln -s ${NWPRODush}/prep_step.sh ${STMP_USER}/prep_step -ln -s ${NWPRODush}/err_chk.sh ${STMP_USER}/err_chk -export PATH=$PATH:${STMP_USER} -export utilscript=${utilscript:-${NWPRODush}} # err_chk calls postmsg.sh - # directly so need to override - # utilscript location - -export PERL5LIB="/usr/lib64/perl5:/usr/share/perl5" - - -############################################################# -# Execute job -############################################################# -$JOBGLOBAL/JGFS_VMINMON - -exit - diff --git a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/parm/gfs_minmon.parm b/util/Minimization_Monitor/nwprod/gfs.v1.0.0/parm/gfs_minmon.parm deleted file mode 100644 index f65e1cdb83..0000000000 --- a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/parm/gfs_minmon.parm +++ /dev/null @@ -1,16 +0,0 @@ -##################################### -# specify minmon shared version -##################################### - - -##################################### -# specify minmon_shared location -##################################### - - -##################################### -# utilities -##################################### -export COMPRESS=${COMPRESS:-gzip} -export UNCOMPRESS=${UNCOMPRESS:-gunzip} - diff --git a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_hera.sh b/util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_hera.sh similarity index 60% rename from util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_hera.sh rename to util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_hera.sh index 0ffa2810a2..8a7f5f75c7 100755 --- a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_hera.sh +++ b/util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_hera.sh @@ -9,57 +9,46 @@ set -x -export PDATE=${PDATE:-2016030706} +export PDATE=${PDATE:-2021122806} + +####################################################################### +# hera specific hacks for no prod_utils module (ndate) +####################################################################### +export MY_MACHINE=hera +export NDATE=/home/Edward.Safford/bin/ndate + +export PERL5LIB="/usr/lib64/perl5:/usr/share/perl5" +export VERBOSE=YES +export KEEPDATA=YES ############################################################# -# Specify whether the run is production or development +# Set necssary vars for j-job ############################################################# export PDY=`echo $PDATE | cut -c1-8` export cyc=`echo $PDATE | cut -c9-10` export job=gfs_vminmon.${cyc} export pid=${pid:-$$} export jobid=${job}.${pid} -export envir=para + export DATAROOT=${DATAROOT:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/test_data} export COMROOT=${COMROOT:-/scratch2/NCEPDEV/stmp3/$LOGNAME/com} export STMP_USER=${STMP_USER:-/scratch2/NCEPDEV/stmp3/$LOGNAME} - -############################################################# -# Specify versions -############################################################# -export gfs_ver=v1.0.0 -export global_shared_ver=v1.0.1 - - -############################################################# -# Set user specific variables -############################################################# export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon} -export NWTEST=${NWTEST:-/scratch1/NCEPDEV/da/${LOGNAME}/noscrub/ProdGSI/util/Minimization_Monitor/nwprod} -export HOMEgfs=${HOMEgfs:-${NWTEST}/gfs.${gfs_ver}} +export NWTEST=${NWTEST:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/GSI/util/Minimization_Monitor/nwprod} +export HOMEgfs=${HOMEgfs:-${NWTEST}/gfs} export JOBGLOBAL=${HOMEgfs}/jobs -export HOMEminmon=${HOMEminmon:-${NWTEST}/minmon_shared.${global_shared_ver}} +export HOMEminmon=${HOMEminmon:-${NWTEST}/minmon_shared} export COM_IN=${COM_IN:-${DATAROOT}} -export M_TANKverf=${M_TANKverf:-${COMROOT}/${MINMON_SUFFIX}} +#export M_TANKverf=${M_TANKverf:-${COMROOT}/${MINMON_SUFFIX}} export M_FIXgfs=${M_FIXgfs:-${HOMEgfs}/fix} -####################################################################### -# theia specific hacks for no prod_utils module (ndate) -####################################################################### -export MY_MACHINE=hera -export NDATE=/home/Edward.Safford/bin/ndate - -export PERL5LIB="/usr/lib64/perl5:/usr/share/perl5" -export VERBOSE=YES -export KEEPDATA=YES - ############################################################# # Execute job ############################################################# -$JOBGLOBAL/JGFS_VMINMON +$JOBGLOBAL/JGFS_ATMOS_VMINMON exit diff --git a/util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_wcoss2.sh b/util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_wcoss2.sh new file mode 100755 index 0000000000..9046d80dd3 --- /dev/null +++ b/util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_wcoss2.sh @@ -0,0 +1,71 @@ +#!/bin/ksh -l + +#PBS -o gfs_vminmon.out +#PBS -e gfs_vminmon.err +#PBS -N gfs_vminmon +#PBS -q dev +#PBS -l select=1:mem=400M +#PBS -l walltime=05:00 +#PBS -A GFS-DEV + + +set -ax + +export PDATE=${PDATE:-2021082306} + +############################################################# +# Specify whether the run is production or development +############################################################# +export PDY=`echo $PDATE | cut -c1-8` +export cyc=`echo $PDATE | cut -c9-10` +export job=gfs_vminmon.${cyc} +export pid=${pid:-$$} +export jobid=${job}.${pid} +export envir=para + +export DATAROOT=${DATAROOT:-/lfs/h1/ops/canned/com/gfs/v16.2} +export DATA=${DATA:-/lfs/h2/emc/stmp/Edward.Safford} +export COMROOT=${COMROOT:-/lfs/h2/emc/ptmp/Edward.Safford/com} + + +############################################################# +# Specify versions +############################################################# +#export gfs_ver=v16.2.0 +#export global_shared_ver=v16.2.0 +#export gfs_minmon_ver=v1.0.0 +#export minmon_shared_ver=v1.0.1 + + +############################################################# +# Load modules +############################################################# +module load prod_util/2.0.10 +module load util_shared/1.4.0 +module load perl/5.32.0 + +module list + + +############################################################# +# Set user specific variables +############################################################# +export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon_gfs} +export NWTEST=${NWTEST:-/lfs/h2/emc/da/noscrub/Edward.Safford/git/gsi/GSI/util/Minimization_Monitor/nwprod} +export HOMEgfs=${NWTEST}/gfs +#export HOMEgfs=${HOMEgfs:-${HOMEgdas}} + +export JOBGLOBAL=${HOMEgfs}/jobs +export HOMEminmon=${NWTEST}/minmon_shared + +export COM_IN=${COM_IN:-${DATAROOT}} +export M_TANKverf=${COMROOT}/${MINMON_SUFFIX} +export M_FIXgfs=${HOMEgfs}/fix + +############################################################# +# Execute job +############################################################# +$JOBGLOBAL/JGFS_ATMOS_VMINMON + +exit + diff --git a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_cray.sh b/util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_wcoss_c.sh similarity index 57% rename from util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_cray.sh rename to util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_wcoss_c.sh index 35f48f3b1b..d8eb4723de 100755 --- a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_cray.sh +++ b/util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_wcoss_c.sh @@ -11,7 +11,7 @@ set -x -export PDATE=${PDATE:-2016030712} +export PDATE=${PDATE:-2022010406} ############################################################# # Specify whether the run is production or development @@ -21,54 +21,37 @@ export cyc=`echo $PDATE | cut -c9-10` export job=gfs_vminmon.${cyc} export pid=${pid:-$$} export jobid=${job}.${pid} -export envir=para - - -############################################################# -# Specify versions -############################################################# -export gfs_ver=v14.1.0 -export global_shared_ver=v14.1.0 -export gfs_minmon_ver=v1.0.0 -export minmon_shared_ver=v1.0.1 ############################################################# # Load modules ############################################################# . $MODULESHOME/init/ksh - module load prod_util -#module load prod_envir module load pm5 module list -############################################################# -# WCOSS environment settings -############################################################# -export POE=YES - - ############################################################# # Set user specific variables ############################################################# export DATAROOT=${DATAROOT:-/gpfs/hps3/emc/da/noscrub/$LOGNAME/test_data} -export COMROOT=${COMROOT:-/gpfs/hps2/ptmp/$LOGNAME/com} +export COMROOT=/gpfs/hps2/ptmp/$LOGNAME/com export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon_gfs} -export NWTEST=${NWTEST:-/gpfs/hps3/emc/da/noscrub/${LOGNAME}/ProdGSI/util/Minimization_Monitor/nwprod} -export HOMEgfs=${NWTEST}/gfs.${gfs_minmon_ver} +export NWTEST=${NWTEST:-/gpfs/hps3/emc/da/noscrub/Edward.Safford/GSI/util/Minimization_Monitor/nwprod} +export HOMEgfs=${NWTEST}/gfs +export M_FIXgfs=${HOMEgfs}/fix export JOBGLOBAL=${HOMEgfs}/jobs -export HOMEminmon=${NWTEST}/minmon_shared.${minmon_shared_ver} -export COM_IN=${COM_IN:-${DATAROOT}} -export M_TANKverf=${M_TANKverf:-${COMROOT}/${MINMON_SUFFIX}} +export HOMEminmon=${NWTEST}/minmon_shared +export COM_IN=${DATAROOT} +export M_TANKverf=${COMROOT}/${MINMON_SUFFIX} ############################################################# # Execute job ############################################################# -$JOBGLOBAL/JGFS_VMINMON +$JOBGLOBAL/JGFS_ATMOS_VMINMON exit diff --git a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_wcoss_d.sh b/util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_wcoss_d.sh similarity index 79% rename from util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_wcoss_d.sh rename to util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_wcoss_d.sh index 52dbc0cf14..101cf62548 100755 --- a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/driver/test_jgfs_vminmon_wcoss_d.sh +++ b/util/Minimization_Monitor/nwprod/gfs/driver/test_jgfs_vminmon_wcoss_d.sh @@ -8,11 +8,11 @@ #BSUB -R affinity[core] #BSUB -M 80 #BSUB -W 00:05 -#BSUB -P GFS-T2O +#BSUB -P GFS-DEV set -ax -export PDATE=${PDATE:-2018011118} +export PDATE=${PDATE:-2018011112} ############################################################# # Specify whether the run is production or development @@ -28,15 +28,6 @@ export DATAROOT=${DATAROOT:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/test export COMROOT=${COMROOT:-/gpfs/dell2/ptmp/Edward.Safford/com} -############################################################# -# Specify versions -############################################################# -export gdas_ver=v14.1.0 -export global_shared_ver=v14.1.0 -export gfs_minmon_ver=v1.0.0 -export minmon_shared_ver=v1.0.1 - - ############################################################# # Load modules ############################################################# @@ -63,11 +54,11 @@ export minmon_shared_ver=v1.0.1 # Set user specific variables ############################################################# export MINMON_SUFFIX=${MINMON_SUFFIX:-testminmon_gfs} -export NWTEST=${NWTEST:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/ProdGSI/util/Minimization_Monitor/nwprod} -export HOMEgfs=${NWTEST}/gfs.${gfs_minmon_ver} +export NWTEST=${NWTEST:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/GSI/util/Minimization_Monitor/nwprod} +export HOMEgfs=${NWTEST}/gfs export JOBGLOBAL=${HOMEgfs}/jobs -export HOMEminmon=${NWTEST}/minmon_shared.${minmon_shared_ver} +export HOMEminmon=${NWTEST}/minmon_shared export COM_IN=${COM_IN:-${DATAROOT}} export M_TANKverf=${COMROOT}/${MINMON_SUFFIX} @@ -76,7 +67,7 @@ export M_FIXgfs=${HOMEgfs}/fix ############################################################# # Execute job ############################################################# -$JOBGLOBAL/JGFS_VMINMON +$JOBGLOBAL/JGFS_ATMOS_VMINMON exit diff --git a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/fix/gfs_minmon_cost.txt b/util/Minimization_Monitor/nwprod/gfs/fix/gfs_minmon_cost.txt similarity index 100% rename from util/Minimization_Monitor/nwprod/gfs.v1.0.0/fix/gfs_minmon_cost.txt rename to util/Minimization_Monitor/nwprod/gfs/fix/gfs_minmon_cost.txt diff --git a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/fix/gfs_minmon_gnorm.txt b/util/Minimization_Monitor/nwprod/gfs/fix/gfs_minmon_gnorm.txt similarity index 100% rename from util/Minimization_Monitor/nwprod/gfs.v1.0.0/fix/gfs_minmon_gnorm.txt rename to util/Minimization_Monitor/nwprod/gfs/fix/gfs_minmon_gnorm.txt diff --git a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/jobs/JGFS_ATMOS_VMINMON b/util/Minimization_Monitor/nwprod/gfs/jobs/JGFS_ATMOS_VMINMON similarity index 78% rename from util/Minimization_Monitor/nwprod/gfs.v1.0.0/jobs/JGFS_ATMOS_VMINMON rename to util/Minimization_Monitor/nwprod/gfs/jobs/JGFS_ATMOS_VMINMON index a0d3503ef3..df0485b208 100755 --- a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/jobs/JGFS_ATMOS_VMINMON +++ b/util/Minimization_Monitor/nwprod/gfs/jobs/JGFS_ATMOS_VMINMON @@ -35,7 +35,6 @@ export m_job=${m_job:-${MINMON_SUFFIX}_mmDE} # Specify Package Areas ############################################## export HOMEgfs=${HOMEgfs:-${NWROOT}/gfs.${gfs_ver}} -#export PARMmon=${PARMmon:-$HOMEgfs/parm/mon} export SCRgfs=${SCRgfs:-$HOMEgfs/scripts} export M_FIXgfs=${M_FIXgfs:-$HOMEgfs/fix/product} @@ -43,20 +42,6 @@ export HOMEminmon=${HOMEminmon:-${HOMEgfs}} export EXECminmon=${EXECminmon:-$HOMEminmon/exec} export USHminmon=${USHminmon:-$HOMEminmon/ush} -################################### -# source the parm file -################################### -#. ${PARMmon}/da_mon.parm - - -############################################# -# Run setpdy and initialize PDY variables -############################################# -if [[ $MY_MACHINE != "hera" ]]; then - export cycle=t${cyc}z - setpdy.sh - . ./PDY -fi ############################################# # determine PDY and cyc for previous cycle @@ -72,14 +57,10 @@ export p_cyc=`echo ${cdate} | cut -c9-10` ############################################# # TANKverf - WHERE OUTPUT DATA WILL RESIDE ############################################# -TANK_USE_RUN=${TANK_USE_RUN:-1} - export COM_IN=${COM_IN:-${COMROOT}/${NET}/${envir}} -M_TANKverf=${M_TANKverf:-${COM_IN}} -M_TANKverfM0=${M_TANKverfM0:-${M_TANKverf}/${RUN}.${PDY}/${cyc}/$COMPONENT/minmon} -export M_TANKverfM1=${M_TANKverfM1:-${M_TANKverf}/${RUN}.${P_PDY}/${p_cyc}/$COMPONENT/minmon} -export M_TANKverf=$M_TANKverfM0 +M_TANKverf=${M_TANKverf:-${COM_IN}/${RUN}.${PDY}/${cyc}/${COMPONENT}/minmon} +export M_TANKverfM1=${M_TANKverfM1:-${COM_IN}/${RUN}.${P_PDY}/${p_cyc}/${COMPONENT}/minmon} export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}/${cyc}/$COMPONENT} diff --git a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/scripts/exgfs_atmos_vminmon.sh b/util/Minimization_Monitor/nwprod/gfs/scripts/exgfs_atmos_vminmon.sh similarity index 100% rename from util/Minimization_Monitor/nwprod/gfs.v1.0.0/scripts/exgfs_atmos_vminmon.sh rename to util/Minimization_Monitor/nwprod/gfs/scripts/exgfs_atmos_vminmon.sh diff --git a/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.0/ush/minmon_xtrct_costs.pl b/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.0/ush/minmon_xtrct_costs.pl deleted file mode 100755 index 10ebf67979..0000000000 --- a/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.0/ush/minmon_xtrct_costs.pl +++ /dev/null @@ -1,233 +0,0 @@ -#! /usr/bin/perl - -#--------------------------------------------------------------------------- -# minmon_xtrct_costs.pl -# -# Extract cost data from gsistat file and load into cost -# and cost term files. -#--------------------------------------------------------------------------- - -use strict; -use warnings; - -#---------------------------------------------- -# subroutine to trim white space from strings -#---------------------------------------------- -sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s }; - - -#--------------------------- -# -# Main routine begins here -# -#--------------------------- - -if ($#ARGV != 4 ) { - print "usage: minmon_xtrct_costs.pl SUFFIX PDY cyc infile jlogfile\n"; - exit; -} -my $suffix = $ARGV[0]; - -my $pdy = $ARGV[1]; -my $cyc = $ARGV[2]; -my $infile = $ARGV[3]; -my $jlogfile = $ARGV[4]; - -#-------------------------------------------------- -my $scr = "minmon_xtrct_costs.pl"; -my $msg = $scr . " HAS STARTED"; - -my @msgcmd = ("postmsg", $jlogfile, $msg); -system( @msgcmd ) == 0 - or die "system @msgcmd failed: $?"; -#-------------------------------------------------- - -my $rc = 0; -my $cdate = sprintf '%s%s', $pdy, $cyc; - -if( (-e $infile) ) { - - my $found_cost = 0; - my $found_costterms = 0; - my @cost_array; - my @jb_array; - my @jo_array; - my @jc_array; - my @jl_array; - my @term_array; - my @all_cost_terms; - - my $cost_target; - my $cost_number; - my $costterms_target; - my $jb_number = 5; - my $jo_number = 6; - my $jc_number = 7; - my $jl_number = 8; - -# my $FIXminmon = $ENV{"FIXminmon"}; - my $costfile = $ENV{"mm_costfile"}; -# my $costfile = sprintf '%s', "./minmon_cost.txt"; - - if( (-e $costfile) ) { - open( COSTFILE, "<${costfile}" ) or die "Can't open ${costfile}: $!\n"; - my $line; - - while( $line = ) { - if( $line =~ /cost_target/ ) { - my @termsline = split( /:/, $line ); - $cost_target = $termsline[1]; - } elsif( $line =~ /cost_number/ ) { - my @termsline = split( /:/, $line ); - $cost_number = $termsline[1]; - } elsif( $line =~ /costterms_target/ ){ - my @termsline = split( /:/, $line ); - $costterms_target = $termsline[1]; - } - } - close( COSTFILE ); - } else { - $rc = 2; - } - - #------------------------------------------------------------------------ - # Open the infile and search for the $costterms_target and $cost_target - # strings. If found, parse out the cost information and push into - # holding arrays. - #------------------------------------------------------------------------ - if( $rc == 0 ) { - open( INFILE, "<${infile}" ) or die "Can't open ${infile}: $!\n"; - - my $line; - my $term_ctr=0; - - while( $line = ) { - if( $line =~ /$costterms_target/ ) { - my @termsline = split( / +/, $line ); - push( @jb_array, $termsline[$jb_number] ); - push( @jo_array, $termsline[$jo_number] ); - push( @jc_array, $termsline[$jc_number] ); - push( @jl_array, $termsline[$jl_number] ); - } - - if( $line =~ /$cost_target/ ) { - my @costline = split( / +/, $line ); - push( @cost_array, $costline[$cost_number] ); - } - - if( $term_ctr > 0 ) { - my @termline = split( / +/, $line ); - - if ( $term_ctr < 10 ) { - push( @term_array, trim($termline[1]) ); - push( @term_array, trim($termline[2]) ); - push( @term_array, trim($termline[3]) ); - $term_ctr++; - } else { - push( @term_array, trim($termline[1]) ); - push( @term_array, trim($termline[2]) ); - $term_ctr = 0; - } - - }elsif ( $line =~ "J=" && $line !~ "EJ=" ) { - my @termline = split( / +/, $line ); - push( @term_array, trim($termline[2]) ); - push( @term_array, trim($termline[3]) ); - push( @term_array, trim($termline[4]) ); - $term_ctr = 1; - } - } - - close( INFILE ); - - - #---------------------------------------------- - # move cost_array into all_costs by iteration - #---------------------------------------------- - my @all_costs; - for my $i (0 .. $#cost_array) { - my $iterline = sprintf ' %d,%e,%e,%e,%e,%e%s', - $i, $cost_array[$i], $jb_array[$i], $jo_array[$i], - $jc_array[$i], $jl_array[$i], "\n"; - - push( @all_costs, $iterline ); - } - - #--------------------------------------------------- - # move term_array into all_cost_terms by iteration - #--------------------------------------------------- - if( @term_array > 0 ) { - my $nterms = 32; - my $max_iter = ($#term_array+1)/$nterms; - my $niter = $max_iter -1; - - for my $iter (0 .. $niter ) { - my $step = $iter * $nterms; - my $iterline = sprintf '%d, %e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e%s', - $iter, $term_array[$step], $term_array[$step+1], $term_array[$step+2], - $term_array[$step+3], $term_array[$step+4], $term_array[$step+5], - $term_array[$step+6], $term_array[$step+7], $term_array[$step+8], - $term_array[$step+9], $term_array[$step+10], $term_array[$step+11], - $term_array[$step+12], $term_array[$step+13], $term_array[$step+14], - $term_array[$step+15], $term_array[$step+16], $term_array[$step+17], - $term_array[$step+18], $term_array[$step+19], $term_array[$step+20], - $term_array[$step+21], $term_array[$step+22], $term_array[$step+23], - $term_array[$step+24], $term_array[$step+25], $term_array[$step+26], - $term_array[$step+27], $term_array[$step+28], $term_array[$step+29], - $term_array[$step+30], $term_array[$step+31], "\n"; - push( @all_cost_terms, $iterline ); - } - } - - #------------------------------------------ - # write all_costs array to costs.txt file - #------------------------------------------ - my $filename2 = "${cdate}.costs.txt"; - if( @all_costs > 0 ) { - open( OUTFILE, ">$filename2" ) or die "Can't open ${filename2}: $!\n"; - print OUTFILE @all_costs; - close( OUTFILE ); - } - - #----------------------------------------------------- - # write all_cost_terms array to costs_terms.txt file - #----------------------------------------------------- - my $filename3 = "${cdate}.cost_terms.txt"; - if( @all_cost_terms > 0 ) { - open( OUTFILE, ">$filename3" ) or die "Can't open ${filename3}: $!\n"; - print OUTFILE @all_cost_terms; - close( OUTFILE ); - } - - #-------------------------- - # move files to $M_TANKverf - #-------------------------- - my $tankdir = $ENV{"M_TANKverf"}; - if(! -d $tankdir) { - system( "mkdir -p $tankdir" ); - } - - if( -e $filename2 ) { - my $newfile2 = "${tankdir}/${filename2}"; - system("cp -f $filename2 $newfile2"); - } - if( -e $filename3 ) { - my $newfile3 = "${tankdir}/${filename3}"; - system("cp -f $filename3 $newfile3"); - } - - } # $rc still == 0 after reading gmon_cost.txt -} -else { # $infile does not exist - $rc = 1; -} - -#-------------------------------------------------- -$msg = $scr . " HAS ENDED"; -@msgcmd = ("postmsg", $jlogfile, $msg); -system( @msgcmd ) == 0 - or die "system @msgcmd failed: $?"; -#-------------------------------------------------- - -print "$rc \n" - diff --git a/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.0/ush/minmon_xtrct_gnorms.pl b/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.0/ush/minmon_xtrct_gnorms.pl deleted file mode 100755 index 0f4d5deb2d..0000000000 --- a/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.0/ush/minmon_xtrct_gnorms.pl +++ /dev/null @@ -1,446 +0,0 @@ -#! /usr/bin/perl - -use strict; -use warnings; -use List::MoreUtils 'true'; -use List::MoreUtils 'first_index'; -use List::MoreUtils 'last_index'; - -#--------------------------------------------------------------------------- -# minmon_xtrct_gnorms.pl -# -# Update the gnorm_data.txt file with data from a new cycle. Add -# this new data to the last line of the gnorm_data.txt file. -# -# Note: If the gnorm_data.txt file does not exist, it will be created. -# -# The gnorm_data.txt file is used plotted directly by the javascript on -# the GSI stats page. -#--------------------------------------------------------------------------- -sub updateGnormData { - my $cycle = $_[0]; - my $igrad = $_[1]; - my $fgnorm = $_[2]; - my $avg_gnorm = $_[3]; - my $min_gnorm = $_[4]; - my $max_gnorm = $_[5]; - my $suffix = $_[6]; - - my $rc = 0; - my @filearray; - - my $gdfile = "gnorm_data.txt"; - - my $outfile = "new_gnorm_data.txt"; - my $yr = substr( $cycle, 0, 4); - my $mon = substr( $cycle, 4, 2); - my $day = substr( $cycle, 6, 2); - my $hr = substr( $cycle, 8, 2); - - my $newln = sprintf ' %04d,%02d,%02d,%02d,%e,%e,%e,%e,%e%s', - $yr, $mon, $day, $hr, $igrad, $fgnorm, - $avg_gnorm, $min_gnorm, $max_gnorm, "\n"; - - # - # attempt to locate the latest $gdfile and copy it locally - # - - #if( ! -e $gdfile ) { - # if( $hr -eq "00" ) - #} - - if( -e $gdfile ) { - open( INFILE, "<${gdfile}" ) or die "Can't open ${gdfile}: $!\n"; - - @filearray = ; - -# This is the mechanism that limits the data to 30 days worth. Should I -# keep it or let the transfer script(s) truncate? 6/12/16 -- I'm going to keep -# it. I can add this as a later change once I add a user mechanism to vary the -# amount of data plotted (on the fly). - - while( $#filearray > 119 ) { # 30 days worth of data = 120 cycles - shift( @filearray ); - } - close( INFILE ); - } - - # Here is the problem Russ encountered after re-running the MinMon: - # If the cycle time in $newln is the same as an existing record in - # *.gnorm_data.txt then we end up with 2+ rows for the same cycle time. - # In that case $newln should replace the first existing line - # in @filearray and all other lines that might match should be deleted. - # Else when the cycle time doesn't already exist (the expected condition) - # it should be pushed into @filearray. - - # algorithm: - # ========= - # Establish $count of matches on "$yr,$mon,$day,$hr" - # if $count > 0 - # while $count > 1 - # get last_index and remove with splice - # replace first_index with $newln - # else - # push $newln - # - my $srch_strng = "$yr,$mon,$day,$hr"; - my $count = true { /$srch_strng/ } @filearray; - - if( $count > 0 ) { - while( $count > 1 ) { - my $l_index = last_index { /$srch_strng/ } @filearray; - splice @filearray, $l_index, 1; - $count = true { /$srch_strng/ } @filearray; - } - my $f_index = first_index { /$srch_strng/ } @filearray; - splice @filearray, $f_index, 1, $newln; - } - else { - push( @filearray, $newln ); - } - - open( OUTFILE, ">$outfile" ) or die "Can't open ${$outfile}: $!\n"; - print OUTFILE @filearray; - close( OUTFILE ); - - system("cp -f $outfile $gdfile"); - -} - -#--------------------------------------------------------------------------- -# makeErrMsg -# -# Apply a gross check on the final value of the gnorm for a specific -# cycle. If the final_gnorm value is greater than the gross_check value -# then put that in the error message file. Also check for resets or a -# premature halt, and journal those events to the error message file too. -# -# Note to self: reset_iter array is passed by reference -#--------------------------------------------------------------------------- -sub makeErrMsg { - my $suffix = $_[0]; - my $cycle = $_[1]; - my $final_gnorm = $_[2]; - my $stop_flag = $_[3]; - my $stop_iter = $_[4]; - my $reset_flag = $_[5]; - my $reset_iter = $_[6]; #reset iteration array - my $infile = $_[7]; - my $gross_check = $_[8]; - - my $mail_msg =""; - my $out_file = "${suffix}.${cycle}.errmsg.txt"; - - - if( $stop_flag > 0 ) { - my $stop_msg = " Gnorm check detected premature iteration stop: suffix = $suffix, cycle = $cycle, iteration = $stop_iter"; - $mail_msg .= $stop_msg; - } - - if( $reset_flag > 0 ) { - my $ctr=0; - my $reset_msg = "\n Gnorm check detected $reset_flag reset(s): suffix = $suffix, cycle = $cycle"; - $mail_msg .= $reset_msg; - $mail_msg .= "\n"; - $mail_msg .= " Reset(s) detected in iteration(s): @{$reset_iter}[$ctr] \n"; - - my $arr_size = @{$reset_iter}; - for( $ctr=1; $ctr < $arr_size; $ctr++ ) { - $mail_msg .= " @{$reset_iter}[$ctr]\n"; - } - } - - if( $final_gnorm >= $gross_check ){ - my $gnorm_msg = " Final gnorm gross check failure: suffix = $suffix, cycle = $cycle, final gnorm = $final_gnorm "; - - $mail_msg .= $gnorm_msg; - } - - if( length $mail_msg > 0 ){ - my $file_msg = " File source for report is: $infile"; - $mail_msg .= $file_msg; - } - - if( length $mail_msg > 0 ){ - my $mail_link = "http://www.emc.ncep.noaa.gov/gmb/gdas/radiance/esafford/gsi_stat/index.html?src=$suffix&typ=gnorm&cyc=$cycle"; - open( OUTFILE, ">$out_file" ) or die "Can't open ${$out_file}: $!\n"; - print OUTFILE $mail_msg; - print OUTFILE "\n\n $mail_link"; - close( OUTFILE ); - } -} - - -#--------------------------------------------------------------------------- -# -# Main routine begins here -# -#--------------------------------------------------------------------------- - -if ($#ARGV != 4 ) { - print "usage: minmon_xtrct_gnorms.pl SUFFIX pdy cyc infile jlogfile\n"; - exit; -} - - -my $suffix = $ARGV[0]; -my $pdy = $ARGV[1]; -my $cyc = $ARGV[2]; -my $infile = $ARGV[3]; -my $jlogfile = $ARGV[4]; - -#-------------------------------------------------- -my $scr = "minmon_xtrct_gnorms.pl"; -my $msg = $scr . " HAS STARTED"; - -my @msgcmd = ("postmsg", $jlogfile, $msg); -#system( @msgcmd ) == 0 -# or die "system @msgcmd failed: $?"; - -#-------------------------------------------------- - - -my $igrad_target; -my $igrad_number; -my $gnorm_target; -my $gnorm_number; -my $expected_gnorms; -my $gross_check_val; - -my $rc = 0; -my $cdate = sprintf '%s%s', $pdy, $cyc; - -#my $FIXminmon = $ENV{"FIXminmon"}; -my $gnormfile = $ENV{"mm_gnormfile"}; -#my $gnormfile = sprintf '%s', "./minmon_gnorm.txt"; - - -if( (-e $gnormfile) ) { - open( GNORMFILE, "<${gnormfile}" ) or die "Can't open ${gnormfile}: $!\n"; - my $line; - - while( $line = ) { - if( $line =~ /igrad_target/ ) { - my @termsline = split( /:/, $line ); - $igrad_target = $termsline[1]; - } elsif( $line =~ /igrad_number/ ) { - my @termsline = split( /:/, $line ); - $igrad_number = $termsline[1]; - } elsif( $line =~ /gnorm_target/ ){ - my @termsline = split( /:/, $line ); - $gnorm_target = $termsline[1]; - } elsif( $line =~ /gnorm_number/ ){ - my @termsline = split( /:/, $line ); - $gnorm_number = $termsline[1]; - } elsif( $line =~ /expected_gnorms/ ){ - my @termsline = split( /:/, $line ); - $expected_gnorms = $termsline[1]; - } elsif( $line =~ /gross_check_val/ ){ - my @termsline = split( /:/, $line ); - $gross_check_val = $termsline[1]; - } - } - close( GNORMFILE ); -} else { - $rc = 4; -} - -if( $rc == 0 ) { - if( (-e $infile) ) { - open( INFILE, "<${infile}" ) or die "Can't open ${infile}: $!\n"; - - my $found_grad = 0; - my $final_gnorm = 0.0; - my $igrad = 0.0; - my $header = 4; - my $header2 = 0; - my @gnorm_array; - my @last_10_gnorm; - - my $reset_flag = 0; - my $stop_flag = 0; - my $warn_str = "WARNING"; - my $stop_str = "Stopping"; - my $stop_iter = ""; - my $reset_str = "Reset"; - my @reset_iter; # reset iteration array - - my $stop_iter_flag = 0; - my $reset_iter_flag = 0; - my $line; - while( $line = ) { - - ############################################## - # if the reset_iter_flag is 1 then record the - # current outer & inner iteration number - ############################################## - if( $reset_iter_flag == 1 ) { - if( $line =~ /${gnorm_target}/ ){ - my @iterline = split( / +/, $line ); - my $iter_str = $iterline[9] . "," . $iterline[10]; - push( @reset_iter, $iter_str); - $reset_iter_flag = 0; - } - } - - - if( $found_grad == 0 ) { - if( $line =~ /${igrad_target}/ ) { - my @gradline = split( / +/, $line ); - - $igrad = $gradline[$igrad_number]; - $found_grad = 1; - } - } - - if( $line =~ /$gnorm_target/ ) { - my @gnormline = split( / +/, $line ); - push( @gnorm_array, $gnormline[$gnorm_number] ); - } - - if( $line =~ /${warn_str}/ ) { - if( $line =~ /${stop_str}/ ) { - $stop_flag++; - $stop_iter_flag=1; - } - elsif( $line =~ /${reset_str}/ ){ - $reset_flag++; - $reset_iter_flag = 1; - } - } - - } - close( INFILE ); - - ######################################################################## - # If the stop_flag is >0 then record the last outer & inner - # iteration number. The trick is that it's the last iteration in the - # log file and we just passed it when we hit the stop warning message, - # so we have to reopen the file and get the last iteration number. - ######################################################################## - if( $stop_flag > 0 ) { - open( INFILE, "<${infile}" ) or die "Can't open ${infile}: $!\n"; - - my @lines = reverse ; - foreach $line (@lines) { - if( $line =~ /${gnorm_target}/ ){ - my @iterline = split( / +/, $line ); - $stop_iter = $iterline[9] . "," . $iterline[10]; - last; - } - } - close( INFILE ); - } - - - my @all_gnorm = @gnorm_array; - - ############################################################################## - ## - ## If the iterations were halted due to error then the @all_gnorm array won't - ## be the expected size. In that case we need to pad the array out with - ## RMISS values so GrADS won't choke when it tries to read the data file. - ## - ## Note that we're padding @all_gnorm. The @gnorm_array is examined below - ## and we don't want to pad that and mess up the min/max calculation. - ## - ############################################################################### - my $arr_size = @all_gnorm; - - if( $arr_size < $expected_gnorms ) { - for( my $ctr = $arr_size; $ctr < $expected_gnorms; $ctr++ ) { - push( @all_gnorm, -999.0 ); - } - } - - my $sum_10_gnorm = 0.0; - my $min_gnorm = 9999999.0; - my $max_gnorm = -9999999.0; - my $avg_gnorm = 0.0; - - for( my $ctr = 9; $ctr >= 0; $ctr-- ) { - my $new_gnorm = pop( @gnorm_array ); - $sum_10_gnorm = $sum_10_gnorm + $new_gnorm; - if( $new_gnorm > $max_gnorm ) { - $max_gnorm = $new_gnorm; - } - if( $new_gnorm < $min_gnorm ) { - $min_gnorm = $new_gnorm; - } - if( $ctr == 9 ) { - $final_gnorm = $new_gnorm; - } - } - - $avg_gnorm = $sum_10_gnorm / 10; - - - ##################################################################### - # Update the gnorm_data.txt file with information on the - # initial gradient, final gnorm, and avg/min/max for the last 10 - # iterations. - ##################################################################### - updateGnormData( $cdate,$igrad,$final_gnorm,$avg_gnorm,$min_gnorm,$max_gnorm,$suffix ); - - - ##################################################################### - # Call makeErrMsg to build the error message file to record any - # abnormalities in the minimization. This file can be mailed by - # a calling script. - ##################################################################### - makeErrMsg( $suffix, $cdate, $final_gnorm, $stop_flag, $stop_iter, $reset_flag, \@reset_iter, $infile, $gross_check_val ); - - - ######################################################### - # write to GrADS ready output data file - # - # Note: this uses pack to achieve the same results as - # an unformatted binary Fortran file. - ######################################################### - my $filename2 = "${cdate}.gnorms.ieee_d"; - - open( OUTFILE, ">$filename2" ) or die "Can't open ${filename2}: $!\n"; - binmode OUTFILE; - - print OUTFILE pack( 'f*', @all_gnorm); - - close( OUTFILE ); - - #-------------------------- - # move files to $M_TANKverf - #-------------------------- - my $tankdir = $ENV{"M_TANKverf"}; - print "M_TANKverf = $tankdir \n"; - if(! -d $tankdir) { - system( "mkdir -p $tankdir" ); - } - - if( -e $filename2 ) { - system("cp -f $filename2 ${tankdir}/."); - } - - my $gdfile = "gnorm_data.txt"; - if( -e $gdfile ) { - system("cp -f $gdfile ${tankdir}/."); - } - - my $errmsg = "${cdate}.errmsg.txt"; - if( -e $errmsg ) { - system("cp -f $errmsg ${tankdir}/."); - } - - } # $rc still == 0 after reading gmon_gnorm.txt - -}else { # $infile does not exist - $rc = 3; -} - -#-------------------------------------------------- -$msg = $scr . " HAS ENDED"; -@msgcmd = ("postmsg", $jlogfile, $msg); -#system( @msgcmd ) == 0 -# or die "system @msgcmd failed: $?"; -#-------------------------------------------------- - -print "$rc \n" - diff --git a/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.0/ush/minmon_xtrct_reduct.pl b/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.0/ush/minmon_xtrct_reduct.pl deleted file mode 100755 index 4dd6b118a1..0000000000 --- a/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.0/ush/minmon_xtrct_reduct.pl +++ /dev/null @@ -1,92 +0,0 @@ -#! /usr/bin/perl -use strict; - -#--------------------------------------------------------------------------- -# minmon_xtrct_reduct.pl -# -# Extract the reduction stats for a GSI minimization run and store in -# reduction.ieee_d files ready for GrADS use. -#--------------------------------------------------------------------------- - -if ($#ARGV != 4 ) { - print "usage: minmon_xtrct_reduct.pl SUFFIX pdy cyc infile jlogfile\n"; - print " suffix is data source identifier\n"; - print " pdy is YYYYMMDD of the cycle to be processed\n"; - print " cyc is HH of the cycle to be processed\n"; - print " infile is the data file containing the reduction stats\n"; - print " jlogfile is the job log file\n"; - exit; -} -my $suffix = $ARGV[0]; -my $pdy = $ARGV[1]; -my $cyc = $ARGV[2]; -my $infile = $ARGV[3]; -my $jlogfile = $ARGV[4]; - -#-------------------------------------------------- -my $scr = "minmon_xtrct_reduct.pl"; -my $msg = $scr . " HAS STARTED"; - -my @msgcmd = ("postmsg", $jlogfile, $msg); -system( @msgcmd ) == 0 - or die "system @msgcmd failed: $?"; -#-------------------------------------------------- - -my $rc = 0; -my $cdate = sprintf '%s%s', $pdy, $cyc; - -if( (-e $infile) ) { - - my $reduct_target = "penalty and grad reduction"; - my $reduct_num = 12; - - open( INFILE, "<${infile}" ) or die "Can't open ${infile}: $!\n"; - - my @reduct_array; - - while( my $line = ) { - if( $line =~ /$reduct_target/ ) { - my @reduct_ln = split( / +/, $line ); - push( @reduct_array, $reduct_ln[$reduct_num] ); - } - } - - close( INFILE ); - - - ################################# - # write reduct_array to outfile - ################################# - my $outfile = "${cdate}.reduction.ieee_d"; - open( OUTFILE, ">$outfile" ) or die "Can't open ${outfile}: $!\n"; - binmode OUTFILE; - - print OUTFILE pack( 'f*', @reduct_array); - close( OUTFILE ); - - #---------------------------- - # copy outfile to $M_TANKverf - #---------------------------- - my $tankdir = $ENV{"M_TANKverf"}; - if(! -d $tankdir) { - system( "mkdir -p $tankdir" ); - } - - if( -e $outfile ) { - my $newfile = "${tankdir}/${outfile}"; - system("cp -f $outfile $newfile"); - } - -} else { # $infile does not exist - $rc = 5; -} - -#-------------------------------------------------- -$msg = $scr . " HAS ENDED"; -@msgcmd = ("postmsg", $jlogfile, $msg); -system( @msgcmd ) == 0 - or die "system @msgcmd failed: $?"; -#-------------------------------------------------- - -print "$rc \n" - diff --git a/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.1/ush/minmon_xtrct_costs.pl b/util/Minimization_Monitor/nwprod/minmon_shared/ush/minmon_xtrct_costs.pl similarity index 92% rename from util/Minimization_Monitor/nwprod/minmon_shared.v1.0.1/ush/minmon_xtrct_costs.pl rename to util/Minimization_Monitor/nwprod/minmon_shared/ush/minmon_xtrct_costs.pl index ca866fbd02..502032da80 100755 --- a/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.1/ush/minmon_xtrct_costs.pl +++ b/util/Minimization_Monitor/nwprod/minmon_shared/ush/minmon_xtrct_costs.pl @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#!/usr/bin/env perl #--------------------------------------------------------------------------- # minmon_xtrct_costs.pl @@ -36,14 +36,9 @@ my $use_costterms = 0; my $no_data = 0.00; -#-------------------------------------------------- my $scr = "minmon_xtrct_costs.pl"; -my $msg = $scr . " HAS STARTED"; +print "$scr has started\n"; -my @msgcmd = ("postmsg", $jlogfile, $msg); -system( @msgcmd ) == 0 - or die "system @msgcmd failed: $?"; -#-------------------------------------------------- my $rc = 0; my $cdate = sprintf '%s%s', $pdy, $cyc; @@ -68,9 +63,7 @@ my $jc_number = 7; my $jl_number = 8; -# my $FIXminmon = $ENV{"FIXminmon"}; my $costfile = $ENV{"mm_costfile"}; -# my $costfile = sprintf '%s', "./minmon_cost.txt"; if( (-e $costfile) ) { open( COSTFILE, "<${costfile}" ) or die "Can't open ${costfile}: $!\n"; @@ -235,12 +228,4 @@ $rc = 1; } -#-------------------------------------------------- -$msg = $scr . " HAS ENDED"; -@msgcmd = ("postmsg", $jlogfile, $msg); -system( @msgcmd ) == 0 - or die "system @msgcmd failed: $?"; -#-------------------------------------------------- - -print "$rc \n" - +print "$scr has ended, return code = $rc \n" diff --git a/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.1/ush/minmon_xtrct_gnorms.pl b/util/Minimization_Monitor/nwprod/minmon_shared/ush/minmon_xtrct_gnorms.pl similarity index 95% rename from util/Minimization_Monitor/nwprod/minmon_shared.v1.0.1/ush/minmon_xtrct_gnorms.pl rename to util/Minimization_Monitor/nwprod/minmon_shared/ush/minmon_xtrct_gnorms.pl index b921fb7fa1..61da749a1d 100755 --- a/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.1/ush/minmon_xtrct_gnorms.pl +++ b/util/Minimization_Monitor/nwprod/minmon_shared/ush/minmon_xtrct_gnorms.pl @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; @@ -41,14 +41,9 @@ sub updateGnormData { $yr, $mon, $day, $hr, $igrad, $fgnorm, $avg_gnorm, $min_gnorm, $max_gnorm, "\n"; - # + #------------------------------------------------------------- # attempt to locate the latest $gdfile and copy it locally # - - #if( ! -e $gdfile ) { - # if( $hr -eq "00" ) - #} - if( -e $gdfile ) { open( INFILE, "<${gdfile}" ) or die "Can't open ${gdfile}: $!\n"; @@ -202,15 +197,9 @@ sub updateGnormData { my $infile = $ARGV[3]; my $jlogfile = $ARGV[4]; -#-------------------------------------------------- -my $scr = "minmon_xtrct_gnorms.pl"; -my $msg = $scr . " HAS STARTED"; - -my @msgcmd = ("postmsg", $jlogfile, $msg); -#system( @msgcmd ) == 0 -# or die "system @msgcmd failed: $?"; -#-------------------------------------------------- +my $scr = "minmon_xtrct_gnorms.pl"; +print "$scr Has Started\n"; # # This needs to be redesigned to get the gnorm value from the gsistat file @@ -310,8 +299,6 @@ sub updateGnormData { my $grad_sqr = $grad**2; my $gnorm = $grad_sqr/$igrad_sqr; -# print "grad_sqr, igrad_sqr, gnorm = $grad_sqr, $igrad_sqr, $gnorm\n"; - push( @gnorm_array, $gnorm ); } @@ -454,12 +441,4 @@ sub updateGnormData { $rc = 3; } -#-------------------------------------------------- -$msg = $scr . " HAS ENDED"; -@msgcmd = ("postmsg", $jlogfile, $msg); -#system( @msgcmd ) == 0 -# or die "system @msgcmd failed: $?"; -#-------------------------------------------------- - -print "$rc \n" - +print "$scr has ended, return code = $rc \n" diff --git a/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.1/ush/minmon_xtrct_reduct.pl b/util/Minimization_Monitor/nwprod/minmon_shared/ush/minmon_xtrct_reduct.pl similarity index 78% rename from util/Minimization_Monitor/nwprod/minmon_shared.v1.0.1/ush/minmon_xtrct_reduct.pl rename to util/Minimization_Monitor/nwprod/minmon_shared/ush/minmon_xtrct_reduct.pl index 38152ed299..1b8186b6ad 100755 --- a/util/Minimization_Monitor/nwprod/minmon_shared.v1.0.1/ush/minmon_xtrct_reduct.pl +++ b/util/Minimization_Monitor/nwprod/minmon_shared/ush/minmon_xtrct_reduct.pl @@ -1,4 +1,5 @@ -#! /usr/bin/perl +#!/usr/bin/env perl + use strict; #--------------------------------------------------------------------------- @@ -23,14 +24,8 @@ my $infile = $ARGV[3]; my $jlogfile = $ARGV[4]; -#-------------------------------------------------- my $scr = "minmon_xtrct_reduct.pl"; -my $msg = $scr . " HAS STARTED"; - -my @msgcmd = ("postmsg", $jlogfile, $msg); -system( @msgcmd ) == 0 - or die "system @msgcmd failed: $?"; -#-------------------------------------------------- +print "$scr has started\n"; my $rc = 0; my $cdate = sprintf '%s%s', $pdy, $cyc; @@ -39,9 +34,7 @@ if( (-e $infile) ) { -# my $reduct_target = "penalty and grad reduction"; my $reduct_target = "cost,grad,step,b,step?"; -# my $reduct_num = 12; my $gradient_num = 5; my $reduct; @@ -59,7 +52,6 @@ $reduct = $iter_gradient / $initial_gradient; -# push( @reduct_array, $reduct_ln[$reduct_num] ); push( @reduct_array, $reduct ); } } @@ -94,12 +86,4 @@ $rc = 5; } -#-------------------------------------------------- -$msg = $scr . " HAS ENDED"; -@msgcmd = ("postmsg", $jlogfile, $msg); -system( @msgcmd ) == 0 - or die "system @msgcmd failed: $?"; -#-------------------------------------------------- - -print "$rc \n" - +print "$scr has ended, return code = $rc \n" diff --git a/util/Minimization_Monitor/nwprod/nam_minmon.v1.0.0/driver/test_nam_minmon.sh b/util/Minimization_Monitor/nwprod/nam_minmon/driver/test_nam_minmon.sh similarity index 100% rename from util/Minimization_Monitor/nwprod/nam_minmon.v1.0.0/driver/test_nam_minmon.sh rename to util/Minimization_Monitor/nwprod/nam_minmon/driver/test_nam_minmon.sh diff --git a/util/Minimization_Monitor/nwprod/nam_minmon.v1.0.0/fix/nam_minmon_cost.txt b/util/Minimization_Monitor/nwprod/nam_minmon/fix/nam_minmon_cost.txt similarity index 100% rename from util/Minimization_Monitor/nwprod/nam_minmon.v1.0.0/fix/nam_minmon_cost.txt rename to util/Minimization_Monitor/nwprod/nam_minmon/fix/nam_minmon_cost.txt diff --git a/util/Minimization_Monitor/nwprod/nam_minmon.v1.0.0/fix/nam_minmon_gnorm.txt b/util/Minimization_Monitor/nwprod/nam_minmon/fix/nam_minmon_gnorm.txt similarity index 100% rename from util/Minimization_Monitor/nwprod/nam_minmon.v1.0.0/fix/nam_minmon_gnorm.txt rename to util/Minimization_Monitor/nwprod/nam_minmon/fix/nam_minmon_gnorm.txt diff --git a/util/Minimization_Monitor/nwprod/nam_minmon.v1.0.0/jobs/JNAM_MINMON b/util/Minimization_Monitor/nwprod/nam_minmon/jobs/JNAM_MINMON similarity index 100% rename from util/Minimization_Monitor/nwprod/nam_minmon.v1.0.0/jobs/JNAM_MINMON rename to util/Minimization_Monitor/nwprod/nam_minmon/jobs/JNAM_MINMON diff --git a/util/Minimization_Monitor/nwprod/nam_minmon.v1.0.0/parm/nam_minmon.parm b/util/Minimization_Monitor/nwprod/nam_minmon/parm/nam_minmon.parm similarity index 100% rename from util/Minimization_Monitor/nwprod/nam_minmon.v1.0.0/parm/nam_minmon.parm rename to util/Minimization_Monitor/nwprod/nam_minmon/parm/nam_minmon.parm diff --git a/util/Minimization_Monitor/nwprod/nam_minmon.v1.0.0/scripts/exnam_vrfminmon.sh.ecf b/util/Minimization_Monitor/nwprod/nam_minmon/scripts/exnam_vrfminmon.sh.ecf similarity index 100% rename from util/Minimization_Monitor/nwprod/nam_minmon.v1.0.0/scripts/exnam_vrfminmon.sh.ecf rename to util/Minimization_Monitor/nwprod/nam_minmon/scripts/exnam_vrfminmon.sh.ecf diff --git a/util/Minimization_Monitor/parm/MinMon.ver b/util/Minimization_Monitor/parm/MinMon.ver deleted file mode 100644 index 9de5a047c4..0000000000 --- a/util/Minimization_Monitor/parm/MinMon.ver +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -if [[ $MINMON_VER -ne 1 ]]; then - - export MINMON_VER=1 - - export gdas_minmon_ver=v1.0.0 - export gfs_minmon_ver=v1.0.0 - export nam_minmon_ver=v1.0.0 - export minmon_shared_ver=v1.0.1 - -else - echo "MinMon.ver is already loaded" -fi - diff --git a/util/Minimization_Monitor/parm/MinMon_config b/util/Minimization_Monitor/parm/MinMon_config index c24af7aa8a..adc9293f0f 100644 --- a/util/Minimization_Monitor/parm/MinMon_config +++ b/util/Minimization_Monitor/parm/MinMon_config @@ -1,26 +1,22 @@ #!/bin/sh -################################################################### -# Note: MinMon/parm/MinMon.ver file must be sourced before this file -################################################################### - if [[ $MINMON_CONFIG -ne 1 ]]; then export MINMON_CONFIG=1 - export MY_MACHINE=hera + export MY_MACHINE=wcoss2 - export MY_MINMON=${MY_MINMON:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/ProdGSI/util/Minimization_Monitor} + export MY_MINMON=${MY_MINMON:-/lfs/h2/emc/da/noscrub/Edward.Safford/git/gsi/GSI/util/Minimization_Monitor} - export HOMEgdas=${MY_MINMON}/nwprod/gdas.${gdas_minmon_ver} - export HOMEgfs=${MY_MINMON}/nwprod/gfs.${gfs_minmon_ver} + export HOMEgdas=${MY_MINMON}/nwprod/gdas + export HOMEgfs=${MY_MINMON}/nwprod/gfs export M_FIXgdas=${M_FIXgdas:-${HOMEgdas}/fix} export M_FIXgfs=${M_FIXgfs:-${HOMEgfs}/fix} - export HOMEnam=${MY_MINMON}/nwprod/nam_minmon.${nam_minmon_ver} - export HOMEminmon=${MY_MINMON}/nwprod/minmon_shared.${minmon_shared_ver} + export HOMEnam=${MY_MINMON}/nwprod/nam_minmon + export HOMEminmon=${MY_MINMON}/nwprod/minmon_shared export MINMON_DE=${MINMON_DE:-${MY_MINMON}/data_xtrct} export M_DE_SCRIPTS=${M_DE_SCRIPTS:-${MINMON_DE}/ush} @@ -30,18 +26,18 @@ if [[ $MINMON_CONFIG -ne 1 ]]; then export M_IG_GRDS=${M_IG_GRDS:-${MINMON_IG}/grds} export M_IG_PARM=${M_IG_PARM:-${MINMON_IG}/parm} - export MY_STMP=${MY_STMP:-/scratch2/NCEPDEV/stmp3/Edward.Safford} - export MY_PTMP=${MY_PTMP:-/scratch2/NCEPDEV/stmp3/Edward.Safford} + export MY_STMP=${MY_STMP:-/lfs/h2/emc/stmp/Edward.Safford} + export MY_PTMP=${MY_PTMP:-/lfs/h2/emc/ptmp/Edward.Safford} export envir=${RUN_ENVIR:-prod} # # working directory # - export DATA_IN=${DATA_IN:-${MY_STMP}/${MINMON_SUFFIX}/${RUN}/minmon} + export DATA_IN=${DATA_IN:-${MY_STMP}/${MINMON_SUFFIX}/${RUN}/minmon} #rename to WORK_DIR export LOGdir=${LOGdir:-${MY_PTMP}/logs/${MINMON_SUFFIX}/${RUN}/minmon} - export MY_TANKDIR=${MY_TANKDIR:-/scratch1/NCEPDEV/da/Edward.Safford/nbns} + export MY_TANKDIR=${MY_TANKDIR:-/lfs/h2/emc/da/noscrub/Edward.Safford/nbns} export M_TANKverf=${M_TANKverf:-${MY_TANKDIR}} export MIN_IMGN_TANKDIR=${MY_TANKDIR}/imgn/${MINMON_SUFFIX} @@ -49,38 +45,23 @@ if [[ $MINMON_CONFIG -ne 1 ]]; then export WEBSERVER=${WEBSERVER:-emcrzdm} export WEBDIR=${WEBDIR:-/home/people/emc/www/htdocs/gmb/gdas/radiance/esafford/gsi_stat/pngs} - # # Utilities used by the MinMon package # export NCP=${NCP:-"/bin/cp -f"} export Z=${Z:-"gz"} - if [[ $MY_MACHINE = "wcoss" ]]; then - shell=sh - . /usrx/local/Modules/default/init/${shell} - module load lsf - module load GrADS/2.0.2 - - export SUB="bsub" - export NWPROD=/nwprod - export COMPRESS=/usrx/local/bin/pigz - export UNCOMPRESS="/usrx/local/bin/unpigz -f" - export RSYNC=/usr/bin/rsync - export PERL5LIB="/usrx/local/pm5/lib64/perl5:/usrx/local/pm5/share/perl5" - - - elif [[ $MY_MACHINE = "wcoss_d" ]]; then + if [[ $MY_MACHINE = "wcoss_d" ]]; then shell=sh source /usrx/local/prod/lmod/lmod/init/${shell} - MODULEPATH=/usrx/local/prod/lmod/lmod/modulefiles/Core:/usrx/local/prod/modulefiles/core_third:/usrx/local/prod/modulefiles/defs:/gpfs/dell1/nco/ops/nwprod/modulefiles/core_prod:/usrx/local/dev/modulefiles - + export MODULEPATH=/usrx/local/prod/lmod/lmod/modulefile/sCore:/usrx/local/prod/modulefiles/core_third:/usrx/local/prod/modulefiles/defs:/gpfs/dell1/nco/ops/nwprod/modulefiles/core_prod:/usrx/local/dev/modulefiles module purge + module load ips/18.0.1.163 module load metplus/2.1 module load lsf/10.1 - module load prod_util/1.1.2 + module load prod_util/1.1.6 module load pm5/1.0 module load GrADS/2.2.0 @@ -89,9 +70,24 @@ if [[ $MINMON_CONFIG -ne 1 ]]; then export UNCOMPRESS="gunzip -f" export RSYNC=/usr/bin/rsync + elif [[ $MY_MACHINE = "wcoss2" ]]; then + module load prod_util/2.0.10 + module load util_shared/1.4.0 + module load perl/5.32.0 - elif [[ $MY_MACHINE = "cray" ]]; then + # + # Note this GrADS mod is a temporary solution. NCO is to + # provide a more permanent fix on wcoss2 at some point. + # + module use /apps/test/modules + module load GrADS/2.2.1-cce-11.0.4 + + export SUB=`which qsub` + export COMPRESS=gzip + export UNCOMPRESS="gunzip -f" + export RSYNC=`which rsync` + elif [[ $MY_MACHINE = "cray" ]]; then sys=`hostname` sys1=`echo $sys | cut -c1` echo $sys1 @@ -136,6 +132,7 @@ if [[ $MINMON_CONFIG -ne 1 ]]; then export NDATE=${NWPROD}/ndate export COMPRESS=gzip export UNCOMPRESS="gunzip -f" + elif [[ $MY_MACHINE = "s4" ]]; then shell=sh . $MODULESHOME/init/$shell diff --git a/util/Minimization_Monitor/parm/MinMon_user_settings b/util/Minimization_Monitor/parm/MinMon_user_settings index 40357a3fa0..939d299c7e 100644 --- a/util/Minimization_Monitor/parm/MinMon_user_settings +++ b/util/Minimization_Monitor/parm/MinMon_user_settings @@ -14,19 +14,19 @@ if [[ $MINMON_USER_SETTINGS -ne 1 ]]; then # ACCOUNT is used on zeus only for use with the qsub -a flag. It is # empty on other platforms. # - export ACCOUNT=${ACCOUNT:-fv3-cpu} + export ACCOUNT=${ACCOUNT:-} # # PROJECT is used on wcoss only with the bjob -P flag. It is # empty on other platforms. # - export PROJECT=${PROJECT:-} + export PROJECT=${PROJECT:-GDAS-DEV} # - # JOB_QUEUE is used on wcoss only with the bjob -q flag. It is + # JOB_QUEUE is used on wcoss and wcoss2 bjob/qsub -q flag. It is # empty on other platforms. # - export JOB_QUEUE=${JOB_QUEUE:-dev_shared} + export JOB_QUEUE=${JOB_QUEUE:-dev} # # RUN_ONLY_ON_DEV 1 = dev machine only, 0 = run anywhere @@ -64,7 +64,7 @@ if [[ $MINMON_USER_SETTINGS -ne 1 ]]; then # # MAIL_TO is the mail recpient list for error reporting # - export MAIL_TO=${MAIL_TO:-""} + export MAIL_TO=${MAIL_TO:-"edward.safford@noaa.gov"} # # MAIL_CC is the mail recpient cc list for error reporting From 6256452b0511334ff57c0414bbc35a89613a2c2c Mon Sep 17 00:00:00 2001 From: "edward.safford" Date: Wed, 19 Jan 2022 20:42:57 +0000 Subject: [PATCH 4/7] GSI issue #288. Update ConMon and OznMon fix files. Completes #288 --- .../gdas_conmon/fix/gdas_conmon_base.txt | 8 +- .../gdas_conmon/fix/global_convinfo.txt | 76 +++++++++---------- .../gdas_oznmon/fix/gdas_oznmon_satype.txt | 2 +- 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/util/Conventional_Monitor/nwprod/gdas_conmon/fix/gdas_conmon_base.txt b/util/Conventional_Monitor/nwprod/gdas_conmon/fix/gdas_conmon_base.txt index 90d3e137dc..4095598284 100644 --- a/util/Conventional_Monitor/nwprod/gdas_conmon/fix/gdas_conmon_base.txt +++ b/util/Conventional_Monitor/nwprod/gdas_conmon/fix/gdas_conmon_base.txt @@ -10,7 +10,7 @@ 00, gps43_00, 882.53 00, gps440_00, 0.00 00, gps44_00, 9291.65 -00, gps4_00, 37071.76 +00, gps4_00, 0.00 00, gps5_00, 36483.18 00, gps722_00, 0.00 00, gps723_00, 0.00 @@ -112,7 +112,7 @@ 06, gps43_00, 1597.53 06, gps440_00, 0.00 06, gps44_00, 1592.58 -06, gps4_00, 34857.95 +06, gps4_00, 0.00 06, gps5_00, 34323.47 06, gps722_00, 0.00 06, gps723_00, 0.00 @@ -214,7 +214,7 @@ 12, gps43_00, 2185.16 12, gps440_00, 0.00 12, gps44_00, 8037.16 -12, gps4_00, 36665.89 +12, gps4_00, 0.00 12, gps5_00, 35531.68 12, gps722_00, 0.00 12, gps723_00, 0.00 @@ -316,7 +316,7 @@ 18, gps43_00, 1547.95 18, gps440_00, 0.00 18, gps44_00, 6163.37 -18, gps4_00, 35486.47 +18, gps4_00, 0.00 18, gps5_00, 34518.58 18, gps722_00, 0.00 18, gps723_00, 0.00 diff --git a/util/Conventional_Monitor/nwprod/gdas_conmon/fix/global_convinfo.txt b/util/Conventional_Monitor/nwprod/gdas_conmon/fix/global_convinfo.txt index 2a363e6529..47a951d4b1 100755 --- a/util/Conventional_Monitor/nwprod/gdas_conmon/fix/global_convinfo.txt +++ b/util/Conventional_Monitor/nwprod/gdas_conmon/fix/global_convinfo.txt @@ -202,43 +202,43 @@ dw 101 0 -1 3.0 0 0 0 4.0 5.0 2.0 8.0 0.000001 0 0. 0. 0 0. 0. 0 0 srw 999 0 -1 2.5 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 rw 999 0 -1 2.5 0 0 0 10.0 10.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 004 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 041 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 722 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 723 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 740 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 741 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 742 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 743 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 744 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 745 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 820 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 042 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 043 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 786 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 421 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 003 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 821 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 825 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 440 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 004 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 041 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 722 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 723 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 740 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 741 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 742 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 743 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 744 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 745 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 820 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 042 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 043 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 786 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 421 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 003 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 821 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 825 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 440 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 pm2_5 102 0 -1 1.0 0 0 0 100.0 1.5 0.75 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 pm10 102 0 -1 1.0 0 0 0 150.0 1.5 0.75 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 750 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 751 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 752 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 753 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 754 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 755 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 724 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 725 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 726 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 727 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 728 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 729 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 044 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 005 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 265 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 266 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 267 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 268 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 - gps 269 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 750 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 751 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 752 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 753 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 754 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 755 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 724 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 725 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 726 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 727 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 728 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 729 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 044 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 005 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 265 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 266 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 267 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 268 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 269 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_satype.txt b/util/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_satype.txt index dc89e86f5d..661296163e 100644 --- a/util/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_satype.txt +++ b/util/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_satype.txt @@ -1 +1 @@ -gome_metop-b omi_aura sbuv2_n19 ompsnp_npp ompstc8_npp +gome_metop-b omi_aura sbuv2_n19 ompsnp_npp ompstc8_npp ompsnp_n20 ompstc8_n20 ompslp_npp From 4028fc7c62a6cfc16bde1624d2a84230e89057ae Mon Sep 17 00:00:00 2001 From: "Ming.Hu" Date: Sat, 8 Jan 2022 20:09:27 +0000 Subject: [PATCH 5/7] GitHub Issue NOAA-EMC/GSI#280: Add code to GSI IO interface with fv3lam to handle subdomain restart files. --- src/gsi/gridmod.F90 | 5 +- src/gsi/gsi_rfv3io_mod.f90 | 460 ++++++++++++++++++++++++++++++++----- src/gsi/gsimod.F90 | 10 +- src/gsi/guess_grids.F90 | 26 ++- ush/build.comgsi | 6 +- 5 files changed, 430 insertions(+), 77 deletions(-) diff --git a/src/gsi/gridmod.F90 b/src/gsi/gridmod.F90 index e89250ff8e..acc460e9c9 100644 --- a/src/gsi/gridmod.F90 +++ b/src/gsi/gridmod.F90 @@ -92,6 +92,7 @@ module gridmod ! 2019-09-04 martin - add write_fv3_incr to write netCDF increment rather than analysis in NEMSIO format ! 2019-09-23 martin - add use_gfs_ncio to read global first guess from netCDF file ! 2020-12-18 Hu - add grid_type_fv3_regional +! 2021-12-30 Hu - add fv3_io_layout_y ! ! ! @@ -146,7 +147,7 @@ module gridmod public :: nlat_regional,nlon_regional,update_regsfc,half_grid,gencode public :: diagnostic_reg,nmmb_reference_grid,filled_grid public :: grid_ratio_nmmb,isd_g,isc_g,dx_gfs,lpl_gfs,nsig5,nmmb_verttype - public :: grid_ratio_fv3_regional,fv3_regional,grid_type_fv3_regional + public :: grid_ratio_fv3_regional,fv3_io_layout_y,fv3_regional,grid_type_fv3_regional public :: l_reg_update_hydro_delz public :: nsig3,nsig4,grid_ratio_wrfmass public :: use_gfs_ozone,check_gfs_ozone_date,regional_ozone,nvege_type @@ -205,6 +206,7 @@ module gridmod character(1) nmmb_reference_grid ! ='H': use nmmb H grid as reference for analysis grid ! ='V': use nmmb V grid as reference for analysis grid real(r_kind) grid_ratio_fv3_regional ! ratio of analysis grid to fv3 model grid in fv3 grid units. + integer(i_kind) fv3_io_layout_y ! = io_layout(2) of fv3 regional model (subdomain y direction). integer(i_kind) grid_type_fv3_regional! type of fv3 model grid (grid orientation). real(r_kind) grid_ratio_nmmb ! ratio of analysis grid to nmmb model grid in nmmb model grid units. real(r_kind) grid_ratio_wrfmass ! ratio of analysis grid to wrf model grid in wrf mass grid units. @@ -463,6 +465,7 @@ subroutine init_grid filled_grid = .false. half_grid = .false. grid_ratio_fv3_regional = one + fv3_io_layout_y = 1 grid_type_fv3_regional = 0 grid_ratio_nmmb = sqrt(two) grid_ratio_wrfmass = one diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index a61433d653..51624c7ba7 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -14,6 +14,9 @@ module gsi_rfv3io_mod ! 2019 ting - modifications for use for ensemble IO and cold start files ! 2019-03-13 CAPS(C. Tong) - Port direct radar DA capabilities. ! 2021-11-01 lei - modify for fv3-lam parallel IO +! 2022-01-07 Hu - add code to readi/write subdomain restart files. +! This function is needed when fv3 model sets +! io_layout(2)>1 ! subroutines included: ! sub gsi_rfv3io_get_grid_specs ! sub read_fv3_files @@ -41,6 +44,7 @@ module gsi_rfv3io_mod use constants, only:max_varname_length use gsi_bundlemod, only : gsi_bundle use general_sub2grid_mod, only: sub2grid_info + use gridmod, only: fv3_io_layout_y implicit none public type_fv3regfilenameg public bg_fv3regfilenameg @@ -62,6 +66,7 @@ module gsi_rfv3io_mod type(type_fv3regfilenameg):: bg_fv3regfilenameg integer(i_kind) nx,ny,nz + integer(i_kind),dimension(:),allocatable :: ny_layout_len,ny_layout_b,ny_layout_e real(r_kind),allocatable:: grid_lon(:,:),grid_lont(:,:),grid_lat(:,:),grid_latt(:,:) real(r_kind),allocatable:: ak(:),bk(:) integer(i_kind),allocatable:: ijns2d(:),displss2d(:),ijns(:),displss(:) @@ -242,6 +247,10 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) integer(i_kind) myear,mmonth,mday,mhour,mminute,msecond real(r_kind),allocatable:: abk_fv3(:) integer(i_kind) imiddle,jmiddle +! if fv3_io_layout_y > 1 + integer(i_kind) :: nio,nylen + integer(i_kind),allocatable :: gfile_loc_layout(:) + character(len=180) :: filename_layout coupler_res_filenam=fv3filenamegin%couplerres grid_spec=fv3filenamegin%grid_spec @@ -281,7 +290,43 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) enddo nlon_regional=nx nlat_regional=ny + + allocate(ny_layout_len(0:fv3_io_layout_y-1)) + allocate(ny_layout_b(0:fv3_io_layout_y-1)) + allocate(ny_layout_e(0:fv3_io_layout_y-1)) + ny_layout_len=ny + ny_layout_b=0 + ny_layout_e=0 + if(fv3_io_layout_y > 1) then + allocate(gfile_loc_layout(0:fv3_io_layout_y-1)) + do nio=0,fv3_io_layout_y-1 + write(filename_layout,'(a,a,I4.4)') trim(grid_spec),'.',nio + iret=nf90_open(filename_layout,nf90_nowrite,gfile_loc_layout(nio)) + if(iret/=nf90_noerr) then + write(6,*)' problem opening ',trim(filename_layout),', Status =',iret + ierr=1 + return + endif + iret=nf90_inquire(gfile_loc_layout(nio),ndimensions,nvariables,nattributes,unlimiteddimid) + do k=1,ndimensions + iret=nf90_inquire_dimension(gfile_loc_layout(nio),k,name,len) + if(trim(name)=='grid_yt') ny_layout_len(nio)=len + enddo + iret=nf90_close(gfile_loc_layout(nio)) + enddo + deallocate(gfile_loc_layout) +! figure out begin and end of each subdomain restart file + nylen=0 + do nio=0,fv3_io_layout_y-1 + ny_layout_b(nio)=nylen + 1 + nylen=nylen+ny_layout_len(nio) + ny_layout_e(nio)=nylen + enddo + endif if(mype==0)write(6,*),'nx,ny=',nx,ny + if(mype==0)write(6,*),'ny_layout_len=',ny_layout_len + if(mype==0)write(6,*),'ny_layout_b=',ny_layout_b + if(mype==0)write(6,*),'ny_layout_e=',ny_layout_e !!! get nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,nz,ak,bk @@ -1094,6 +1139,12 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) character(len=:),allocatable :: sfcdata !='fv3_sfcdata' character(len=:),allocatable :: dynvars !='fv3_dynvars' +! for io_layout > 1 + real(r_kind),allocatable,dimension(:,:):: sfc_fulldomain + integer(i_kind) :: nio + integer(i_kind),allocatable :: gfile_loc_layout(:) + character(len=180) :: filename_layout + sfcdata= fv3filenamegin%sfcdata dynvars= fv3filenamegin%dynvars @@ -1103,10 +1154,25 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) allocate( sfcn2d(lat2,lon2,n2d)) if(mype==mype_2d ) then - iret=nf90_open(sfcdata,nf90_nowrite,gfile_loc) - if(iret/=nf90_noerr) then - write(6,*)' problem opening3 ',trim(sfcdata),', Status = ',iret - return + allocate(sfc_fulldomain(nx,ny)) + + if(fv3_io_layout_y > 1) then + allocate(gfile_loc_layout(0:fv3_io_layout_y-1)) + do nio=0,fv3_io_layout_y-1 + write(filename_layout,'(a,a,I4.4)') trim(sfcdata),'.',nio + iret=nf90_open(filename_layout,nf90_nowrite,gfile_loc_layout(nio)) + if(iret/=nf90_noerr) then + write(6,*)' problem opening3 ',trim(filename_layout),', Status = ',iret + return + endif + enddo + gfile_loc=gfile_loc_layout(0) + else + iret=nf90_open(sfcdata,nf90_nowrite,gfile_loc) + if(iret/=nf90_noerr) then + write(6,*)' problem opening3 ',trim(sfcdata),', Status = ',iret + return + endif endif iret=nf90_inquire(gfile_loc,ndimensions,nvariables,nattributes,unlimiteddimid) allocate(dim(ndimensions)) @@ -1141,22 +1207,48 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) cycle endif iret=nf90_inquire_variable(gfile_loc,i,ndims=ndim) + if(ndim < 2) then + write(*,*) "wrong dimension number ndim =",ndim + call stop2(119) + endif if(allocated(dim_id )) deallocate(dim_id ) allocate(dim_id(ndim)) - iret=nf90_inquire_variable(gfile_loc,i,dimids=dim_id) - if(allocated(sfc )) deallocate(sfc ) - if(ndim >=3) then !the block of 10 lines is compied from GSL gsi. - allocate(sfc(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) - iret=nf90_get_var(gfile_loc,i,sfc) - else if (ndim == 2) then - allocate(sfc(dim(dim_id(1)),dim(dim_id(2)),1)) - iret=nf90_get_var(gfile_loc,i,sfc(:,:,1)) + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + iret=nf90_inquire_variable(gfile_loc_layout(nio),i,dimids=dim_id) + if(allocated(sfc )) deallocate(sfc ) + if(dim(dim_id(1)) == nx .and. dim(dim_id(2))==ny_layout_len(nio)) then + if(ndim >=3) then + allocate(sfc(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) + iret=nf90_get_var(gfile_loc_layout(nio),i,sfc) + else if (ndim == 2) then + allocate(sfc(dim(dim_id(1)),dim(dim_id(2)),1)) + iret=nf90_get_var(gfile_loc_layout(nio),i,sfc(:,:,1)) + endif + else + write(*,*) "Mismatch dimension in surfacei reading:",nx,ny_layout_len(nio),dim(dim_id(1)),dim(dim_id(2)) + call stop2(119) + endif + sfc_fulldomain(:,ny_layout_b(nio):ny_layout_e(nio))=sfc(:,:,1) + enddo else - write(*,*) "wrong dimension number ndim =",ndim - call stop2(119) + iret=nf90_inquire_variable(gfile_loc,i,dimids=dim_id) + if(allocated(sfc )) deallocate(sfc ) + if(dim(dim_id(1)) == nx .and. dim(dim_id(2))==ny) then + if(ndim >=3) then !the block of 10 lines is compied from GSL gsi. + allocate(sfc(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) + iret=nf90_get_var(gfile_loc,i,sfc) + else if (ndim == 2) then + allocate(sfc(dim(dim_id(1)),dim(dim_id(2)),1)) + iret=nf90_get_var(gfile_loc,i,sfc(:,:,1)) + endif + else + write(*,*) "Mismatch dimension in surfacei reading:",nx,ny,dim(dim_id(1)),dim(dim_id(2)) + call stop2(119) + endif + sfc_fulldomain(:,:)=sfc(:,:,1) endif - - call fv3_h_to_ll(sfc(:,:,1),a,nx,ny,nxa,nya,grid_reverse_flag) + call fv3_h_to_ll(sfc_fulldomain,a,nx,ny,nxa,nya,grid_reverse_flag) kk=0 do n=1,npe @@ -1170,13 +1262,33 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) end do end do enddo ! i - iret=nf90_close(gfile_loc) + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + iret=nf90_close(gfile_loc_layout(nio)) + enddo + deallocate (gfile_loc_layout) + else + iret=nf90_close(gfile_loc) + endif !!!! read in orog from dynam !!!!!!!!!!!! - iret=nf90_open(dynvars,nf90_nowrite,gfile_loc) - if(iret/=nf90_noerr) then - write(6,*)' problem opening4 ',trim(dynvars ),gfile_loc,', Status = ',iret - return + if(fv3_io_layout_y > 1) then + allocate(gfile_loc_layout(0:fv3_io_layout_y-1)) + do nio=0,fv3_io_layout_y-1 + write(filename_layout,'(a,a,I4.4)') trim(dynvars),'.',nio + iret=nf90_open(filename_layout,nf90_nowrite,gfile_loc_layout(nio)) + if(iret/=nf90_noerr) then + write(6,*)' problem opening4 ',trim(filename_layout),', Status =',iret + return + endif + enddo + gfile_loc=gfile_loc_layout(0) + else + iret=nf90_open(dynvars,nf90_nowrite,gfile_loc) + if(iret/=nf90_noerr) then + write(6,*)' problem opening4 ',trim(dynvars ),gfile_loc,', Status = ',iret + return + endif endif iret=nf90_inquire(gfile_loc,ndimensions,nvariables,nattributes,unlimiteddimid) @@ -1195,16 +1307,34 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) iret=nf90_inquire_variable(gfile_loc,k,ndims=ndim) if(allocated(dim_id )) deallocate(dim_id ) allocate(dim_id(ndim)) - iret=nf90_inquire_variable(gfile_loc,k,dimids=dim_id) - allocate(sfc1(dim(dim_id(1)),dim(dim_id(2))) ) - iret=nf90_get_var(gfile_loc,k,sfc1) + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + iret=nf90_inquire_variable(gfile_loc_layout(nio),k,dimids=dim_id) + if(allocated(sfc1 )) deallocate(sfc1 ) + allocate(sfc1(dim(dim_id(1)),dim(dim_id(2))) ) + iret=nf90_get_var(gfile_loc_layout(nio),k,sfc1) + sfc_fulldomain(:,ny_layout_b(nio):ny_layout_e(nio))=sfc1 + enddo + else + iret=nf90_inquire_variable(gfile_loc,k,dimids=dim_id) + allocate(sfc1(dim(dim_id(1)),dim(dim_id(2))) ) + iret=nf90_get_var(gfile_loc,k,sfc1) + sfc_fulldomain=sfc1 + endif exit endif enddo ! k - iret=nf90_close(gfile_loc) + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + iret=nf90_close(gfile_loc_layout(nio)) + enddo + deallocate(gfile_loc_layout) + else + iret=nf90_close(gfile_loc) + endif k=k_orog - call fv3_h_to_ll(sfc1,a,nx,ny,nxa,nya,grid_reverse_flag) + call fv3_h_to_ll(sfc_fulldomain,a,nx,ny,nxa,nya,grid_reverse_flag) kk=0 do n=1,npe @@ -1219,6 +1349,7 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) end do deallocate (dim_id,sfc,sfc1,dim) + deallocate (sfc_fulldomain) endif ! mype @@ -1396,6 +1527,11 @@ subroutine gsi_fv3ncdf_read(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) integer(i_kind) kbgn,kend integer(i_kind) gfile_loc,iret,var_id integer(i_kind) nz,nzp1,mm1 +! for io_layout > 1 + real(r_kind),allocatable,dimension(:,:):: uu2d_layout + integer(i_kind) :: nio + integer(i_kind),allocatable :: gfile_loc_layout(:) + character(len=180) :: filename_layout mm1=mype+1 nloncase=grd_ionouv%nlon @@ -1405,11 +1541,25 @@ subroutine gsi_fv3ncdf_read(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) kbgn=grd_ionouv%kbegin_loc kend=grd_ionouv%kend_loc allocate(uu2d(nxcase,nycase)) - iret=nf90_open(filenamein,nf90_nowrite,gfile_loc,comm=mpi_comm_world,info=MPI_INFO_NULL) !clt - if(iret/=nf90_noerr) then - write(6,*)' gsi_fv3ncdf_read: problem opening ',trim(filenamein),gfile_loc,', Status = ',iret - call flush(6) - call stop2(333) + + if(fv3_io_layout_y > 1) then + allocate(gfile_loc_layout(0:fv3_io_layout_y-1)) + do nio=0,fv3_io_layout_y-1 + write(filename_layout,'(a,a,I4.4)') trim(filenamein),'.',nio + iret=nf90_open(filename_layout,nf90_nowrite,gfile_loc_layout(nio),comm=mpi_comm_world,info=MPI_INFO_NULL) !clt + if(iret/=nf90_noerr) then + write(6,*)' gsi_fv3ncdf_read: problem opening ',trim(filename_layout),gfile_loc_layout(nio),', Status = ',iret + call flush(6) + call stop2(333) + endif + enddo + else + iret=nf90_open(filenamein,nf90_nowrite,gfile_loc,comm=mpi_comm_world,info=MPI_INFO_NULL) !clt + if(iret/=nf90_noerr) then + write(6,*)' gsi_fv3ncdf_read: problem opening ',trim(filenamein),gfile_loc,', Status = ',iret + call flush(6) + call stop2(333) + endif endif do ilevtot=kbgn,kend vgsiname=grd_ionouv%names(1,ilevtot) @@ -1428,15 +1578,34 @@ subroutine gsi_fv3ncdf_read(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin) startloc=(/1,1,inative/) countloc=(/nxcase,nycase,1/) - iret=nf90_inq_varid(gfile_loc,trim(adjustl(varname)),var_id) - iret=nf90_get_var(gfile_loc,var_id,uu2d,start=startloc,count=countloc) + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + countloc=(/nxcase,ny_layout_len(nio),1/) + allocate(uu2d_layout(nxcase,ny_layout_len(nio))) + iret=nf90_inq_varid(gfile_loc_layout(nio),trim(adjustl(varname)),var_id) + iret=nf90_get_var(gfile_loc_layout(nio),var_id,uu2d_layout,start=startloc,count=countloc) + uu2d(:,ny_layout_b(nio):ny_layout_e(nio))=uu2d_layout + deallocate(uu2d_layout) + enddo + else + iret=nf90_inq_varid(gfile_loc,trim(adjustl(varname)),var_id) + iret=nf90_get_var(gfile_loc,var_id,uu2d,start=startloc,count=countloc) + endif + call fv3_h_to_ll(uu2d,hwork(1,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,grid_reverse_flag) enddo ! ilevtot - call general_grid2sub(grd_ionouv,hwork,cstate_nouv%values) - iret=nf90_close(gfile_loc) - deallocate (uu2d) - + if(fv3_io_layout_y > 1) then + do nio=1,fv3_io_layout_y-1 + iret=nf90_close(gfile_loc_layout(nio)) + enddo + deallocate(gfile_loc_layout) + else + iret=nf90_close(gfile_loc) + endif + + deallocate (uu2d) + call general_grid2sub(grd_ionouv,hwork,cstate_nouv%values) return end subroutine gsi_fv3ncdf_read @@ -1601,6 +1770,12 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) integer(i_kind) gfile_loc,iret integer(i_kind) nz,nzp1,mm1 +! for fv3_io_layout_y > 1 + real(r_kind),allocatable,dimension(:,:):: u2d_layout,v2d_layout + integer(i_kind) :: nio + integer(i_kind),allocatable :: gfile_loc_layout(:) + character(len=180) :: filename_layout + mm1=mype+1 nloncase=grd_uv%nlon nlatcase=grd_uv%nlat @@ -1614,9 +1789,25 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) allocate(vc2d(nxcase,nycase)) allocate (worksub(2,grd_uv%lat2,grd_uv%lon2,grd_uv%nsig)) filenamein=fv3filenamegin%dynvars - iret=nf90_open(filenamein,nf90_nowrite,gfile_loc,comm=mpi_comm_world,info=MPI_INFO_NULL) !clt - if(iret/=nf90_noerr) then - write(6,*)' problem opening6 ',trim(filenamein),', Status = ',iret + + if(fv3_io_layout_y > 1) then + allocate(gfile_loc_layout(0:fv3_io_layout_y-1)) + do nio=0,fv3_io_layout_y-1 + write(filename_layout,'(a,a,I4.4)') trim(filenamein),".",nio + iret=nf90_open(filename_layout,nf90_nowrite,gfile_loc_layout(nio),comm=mpi_comm_world,info=MPI_INFO_NULL) + if(iret/=nf90_noerr) then + write(6,*)'problem opening6 ',trim(filename_layout),gfile_loc_layout(nio),', Status = ',iret + call flush(6) + call stop2(333) + endif + enddo + else + iret=nf90_open(filenamein,nf90_nowrite,gfile_loc,comm=mpi_comm_world,info=MPI_INFO_NULL) !clt + if(iret/=nf90_noerr) then + write(6,*)' problem opening6 ',trim(filenamein),', Status = ',iret + call flush(6) + call stop2(333) + endif endif do ilevtot=kbgn,kend vgsiname=grd_uv%names(1,ilevtot) @@ -1635,10 +1826,30 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) u_startloc=(/1,1,inative/) v_startloc=(/1,1,inative/) - call check( nf90_inq_varid(gfile_loc,'u',u_grd_VarId) ) - iret=nf90_get_var(gfile_loc,u_grd_VarId,u2d,start=u_startloc,count=u_countloc) - call check( nf90_inq_varid(gfile_loc,'v',v_grd_VarId) ) - iret=nf90_get_var(gfile_loc,v_grd_VarId,v2d,start=v_startloc,count=v_countloc) + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + u_countloc=(/nxcase,ny_layout_len(nio)+1,1/) + allocate(u2d_layout(nxcase,ny_layout_len(nio)+1)) + call check( nf90_inq_varid(gfile_loc_layout(nio),'u',u_grd_VarId) ) + iret=nf90_get_var(gfile_loc_layout(nio),u_grd_VarId,u2d_layout,start=u_startloc,count=u_countloc) + u2d(:,ny_layout_b(nio):ny_layout_e(nio))=u2d_layout(:,1:ny_layout_len(nio)) + if(nio==fv3_io_layout_y-1) u2d(:,ny_layout_e(nio)+1)=u2d_layout(:,ny_layout_len(nio)+1) + deallocate(u2d_layout) + + v_countloc=(/nxcase+1,ny_layout_len(nio),1/) + allocate(v2d_layout(nxcase+1,ny_layout_len(nio))) + call check( nf90_inq_varid(gfile_loc_layout(nio),'v',v_grd_VarId) ) + iret=nf90_get_var(gfile_loc_layout(nio),v_grd_VarId,v2d_layout,start=v_startloc,count=v_countloc) + v2d(:,ny_layout_b(nio):ny_layout_e(nio))=v2d_layout + deallocate(v2d_layout) + enddo + else + call check( nf90_inq_varid(gfile_loc,'u',u_grd_VarId) ) + iret=nf90_get_var(gfile_loc,u_grd_VarId,u2d,start=u_startloc,count=u_countloc) + call check( nf90_inq_varid(gfile_loc,'v',v_grd_VarId) ) + iret=nf90_get_var(gfile_loc,v_grd_VarId,v2d,start=v_startloc,count=v_countloc) + endif + if(.not.grid_reverse_flag) then call reverse_grid_r_uv (u2d,nxcase,nycase+1,1) call reverse_grid_r_uv (v2d,nxcase+1,nycase,1) @@ -1665,12 +1876,21 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin) call fv3_h_to_ll(vc2d,hwork(2,:,:,ilevtot),nxcase,nycase,nloncase,nlatcase,.true.) enddo ! i + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + iret=nf90_close(gfile_loc_layout(nio)) + enddo + deallocate(gfile_loc_layout) + else + iret=nf90_close(gfile_loc) + endif + deallocate(u2d,v2d,uc2d,vc2d) + call general_grid2sub(grd_uv,hwork,worksub) ges_u=worksub(1,:,:,:) ges_v=worksub(2,:,:,:) - iret=nf90_close(gfile_loc) + deallocate(worksub) - deallocate(u2d,v2d,uc2d,vc2d,worksub) end subroutine gsi_fv3ncdf_readuv subroutine gsi_fv3ncdf_readuv_v1(grd_uv,ges_u,ges_v,fv3filenamegin) !$$$ subprogram documentation block @@ -1854,6 +2074,7 @@ subroutine wrfv3_netcdf(fv3filenamegin) real(r_kind), dimension(lat2,lon2,nsig) :: io_arr_qg, io_arr_qnr real(r_kind), dimension(:,:,:),allocatable ::g_prsi + real(r_kind), dimension(:,:),allocatable ::ges_ps_write it=ntguessig ier=0 @@ -1918,8 +2139,10 @@ subroutine wrfv3_netcdf(fv3filenamegin) deallocate(g_prsi,ges_ps_inc) else - ges_ps=ges_ps*1000.0_r_kind - call gsi_bundleputvar (gsibundle_fv3lam_dynvar_nouv,'ps',ges_ps,istatus) + allocate(ges_ps_write(lat2,lon2)) + ges_ps_write=ges_ps*1000.0_r_kind + call gsi_bundleputvar (gsibundle_fv3lam_dynvar_nouv,'ps',ges_ps_write,istatus) + deallocate(ges_ps_write) endif ! write out if (ier/=0) call die('get ges','cannot get pointers for fv3 met-fields, ier =',ier) @@ -1944,6 +2167,9 @@ subroutine wrfv3_netcdf(fv3filenamegin) endif if(allocated(g_prsi)) deallocate(g_prsi) + deallocate(ny_layout_len) + deallocate(ny_layout_b) + deallocate(ny_layout_e) ! additional I/O for direct reflectivity DA capabilities end subroutine wrfv3_netcdf @@ -2006,6 +2232,12 @@ subroutine gsi_fv3ncdf_writeuv(grd_uv,ges_u,ges_v,add_saved,fv3filenamegin) real(r_kind),allocatable,dimension(:,:):: u2d,v2d,workau2,workav2 real(r_kind),allocatable,dimension(:,:):: workbu2,workbv2 +! for fv3_io_layout_y > 1 + real(r_kind),allocatable,dimension(:,:):: u2d_layout,v2d_layout + integer(i_kind) :: nio + integer(i_kind),allocatable :: gfile_loc_layout(:) + character(len=180) :: filename_layout + mm1=mype+1 nloncase=grd_uv%nlon @@ -2030,7 +2262,18 @@ subroutine gsi_fv3ncdf_writeuv(grd_uv,ges_u,ges_v,add_saved,fv3filenamegin) end do call general_sub2grid(grd_uv,worksub,hwork) filenamein=fv3filenamegin%dynvars - call check( nf90_open(filenamein,nf90_write,gfile_loc,comm=mpi_comm_world,info=MPI_INFO_NULL) ) + + if(fv3_io_layout_y > 1) then + allocate(gfile_loc_layout(0:fv3_io_layout_y-1)) + do nio=0,fv3_io_layout_y-1 + write(filename_layout,'(a,a,I4.4)') trim(filenamein),".",nio + call check( nf90_open(filename_layout,nf90_write,gfile_loc_layout(nio),comm=mpi_comm_world,info=MPI_INFO_NULL) ) + enddo + gfile_loc=gfile_loc_layout(0) + else + call check( nf90_open(filenamein,nf90_write,gfile_loc,comm=mpi_comm_world,info=MPI_INFO_NULL) ) + endif + do ilevtot=kbgn,kend varname=grd_uv%names(1,ilevtot) ilev=grd_uv%lnames(1,ilevtot) @@ -2053,8 +2296,25 @@ subroutine gsi_fv3ncdf_writeuv(grd_uv,ges_u,ges_v,add_saved,fv3filenamegin) allocate( workbu2(nlon_regional,nlat_regional+1)) allocate( workbv2(nlon_regional+1,nlat_regional)) !!!!!!!! readin work_b !!!!!!!!!!!!!!!! - call check( nf90_get_var(gfile_loc,ugrd_VarId,work_bu,start=u_startloc,count=u_countloc) ) - call check( nf90_get_var(gfile_loc,vgrd_VarId,work_bv,start=v_startloc,count=v_countloc) ) + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + allocate(u2d_layout(nxcase,ny_layout_len(nio)+1)) + u_countloc=(/nxcase,ny_layout_len(nio)+1,1/) + call check( nf90_get_var(gfile_loc_layout(nio),ugrd_VarId,u2d_layout,start=u_startloc,count=u_countloc) ) + work_bu(:,ny_layout_b(nio):ny_layout_e(nio))=u2d_layout(:,1:ny_layout_len(nio)) + if(nio==fv3_io_layout_y-1) work_bu(:,ny_layout_e(nio)+1)=u2d_layout(:,ny_layout_len(nio)+1) + deallocate(u2d_layout) + + allocate(v2d_layout(nxcase+1,ny_layout_len(nio))) + v_countloc=(/nxcase+1,ny_layout_len(nio),1/) + call check( nf90_get_var(gfile_loc_layout(nio),vgrd_VarId,v2d_layout,start=v_startloc,count=v_countloc) ) + work_bv(:,ny_layout_b(nio):ny_layout_e(nio))=v2d_layout + deallocate(v2d_layout) + enddo + else + call check( nf90_get_var(gfile_loc,ugrd_VarId,work_bu,start=u_startloc,count=u_countloc) ) + call check( nf90_get_var(gfile_loc,vgrd_VarId,work_bv,start=v_startloc,count=v_countloc) ) + endif if(.not.grid_reverse_flag) then call reverse_grid_r_uv(work_bu,nlon_regional,nlat_regional+1,1) call reverse_grid_r_uv(work_bv,nlon_regional+1,nlat_regional,1) @@ -2082,10 +2342,34 @@ subroutine gsi_fv3ncdf_writeuv(grd_uv,ges_u,ges_v,add_saved,fv3filenamegin) call reverse_grid_r_uv(work_bv,nlon_regional+1,nlat_regional,1) endif - call check( nf90_put_var(gfile_loc,ugrd_VarId,work_bu,start=u_startloc,count=u_countloc) ) - call check( nf90_put_var(gfile_loc,vgrd_VarId,work_bv,start=v_startloc,count=v_countloc) ) + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + allocate(u2d_layout(nxcase,ny_layout_len(nio)+1)) + u_countloc=(/nxcase,ny_layout_len(nio)+1,1/) + u2d_layout=work_bu(:,ny_layout_b(nio):ny_layout_e(nio)+1) + call check( nf90_put_var(gfile_loc_layout(nio),ugrd_VarId,u2d_layout,start=u_startloc,count=u_countloc) ) + deallocate(u2d_layout) + + allocate(v2d_layout(nxcase+1,ny_layout_len(nio))) + v_countloc=(/nxcase+1,ny_layout_len(nio),1/) + v2d_layout=work_bv(:,ny_layout_b(nio):ny_layout_e(nio)) + call check( nf90_put_var(gfile_loc_layout(nio),vgrd_VarId,v2d_layout,start=v_startloc,count=v_countloc) ) + deallocate(v2d_layout) + enddo + else + call check( nf90_put_var(gfile_loc,ugrd_VarId,work_bu,start=u_startloc,count=u_countloc) ) + call check( nf90_put_var(gfile_loc,vgrd_VarId,work_bv,start=v_startloc,count=v_countloc) ) + endif enddo !ilevltot - call check( nf90_close(gfile_loc) ) + + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + call check( nf90_close(gfile_loc_layout(nio)) ) + enddo + deallocate(gfile_loc_layout) + else + call check( nf90_close(gfile_loc) ) + endif deallocate(work_bu,work_bv,u2d,v2d) deallocate(work_au,work_av) @@ -2360,6 +2644,11 @@ subroutine gsi_fv3ncdf_write(grd_ionouv,cstate_nouv,add_saved,filenamein,fv3file real(r_kind),allocatable,dimension(:,:):: work_b real(r_kind),allocatable,dimension(:,:):: workb2,worka2 +! for io_layout > 1 + real(r_kind),allocatable,dimension(:,:):: work_b_layout + integer(i_kind) :: nio + integer(i_kind),allocatable :: gfile_loc_layout(:) + character(len=180) :: filename_layout mm1=mype+1 ! Convert from subdomain to full horizontal field distributed among @@ -2375,7 +2664,18 @@ subroutine gsi_fv3ncdf_write(grd_ionouv,cstate_nouv,add_saved,filenamein,fv3file allocate( work_b(nlon_regional,nlat_regional)) allocate( workb2(nlon_regional,nlat_regional)) allocate( worka2(nlatcase,nloncase)) - call check( nf90_open(filenamein,nf90_write,gfile_loc,comm=mpi_comm_world,info=MPI_INFO_NULL) ) + + if(fv3_io_layout_y > 1) then + allocate(gfile_loc_layout(0:fv3_io_layout_y-1)) + do nio=0,fv3_io_layout_y-1 + write(filename_layout,'(a,a,I4.4)') trim(filenamein),'.',nio + call check( nf90_open(filename_layout,nf90_write,gfile_loc_layout(nio),comm=mpi_comm_world,info=MPI_INFO_NULL) ) + enddo + gfile_loc=gfile_loc_layout(0) + else + call check( nf90_open(filenamein,nf90_write,gfile_loc,comm=mpi_comm_world,info=MPI_INFO_NULL) ) + endif + do ilevtot=kbgn,kend vgsiname=grd_ionouv%names(1,ilevtot) call getfv3lamfilevname(vgsiname,fv3filenamegin,filenamein2,varname) @@ -2399,28 +2699,64 @@ subroutine gsi_fv3ncdf_write(grd_ionouv,cstate_nouv,add_saved,filenamein,fv3file if(index(vgsiname,"delzinc") > 0) then - call check( nf90_get_var(gfile_loc,VarId,work_b,start = startloc, count = countloc) ) + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + countloc=(/nxcase,ny_layout_len(nio),1/) + allocate(work_b_layout(nxcase,ny_layout_len(nio))) + call check( nf90_get_var(gfile_loc_layout(nio),VarId,work_b_layout,start = startloc, count = countloc) ) + work_b(:,ny_layout_b(nio):ny_layout_e(nio))=work_b_layout + deallocate(work_b_layout) + enddo + else + call check( nf90_get_var(gfile_loc,VarId,work_b,start = startloc, count = countloc) ) + endif call fv3_ll_to_h(work_a(:,:),workb2,nloncase,nlatcase,nlon_regional,nlat_regional,grid_reverse_flag) work_b(:,:)=work_b(:,:)+workb2(:,:) else if(add_saved)then - call check( nf90_get_var(gfile_loc,VarId,work_b,start = startloc, count = countloc) ) - - + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + countloc=(/nxcase,ny_layout_len(nio),1/) + allocate(work_b_layout(nxcase,ny_layout_len(nio))) + call check( nf90_get_var(gfile_loc_layout(nio),VarId,work_b_layout,start = startloc, count = countloc) ) + work_b(:,ny_layout_b(nio):ny_layout_e(nio))=work_b_layout + deallocate(work_b_layout) + enddo + else + call check( nf90_get_var(gfile_loc,VarId,work_b,start = startloc, count = countloc) ) + endif call fv3_h_to_ll(work_b(:,:),worka2,nlon_regional,nlat_regional,nloncase,nlatcase,grid_reverse_flag) !!!!!!!! analysis_inc: work_a !!!!!!!!!!!!!!!! work_a(:,:)=work_a(:,:)-worka2(:,:) call fv3_ll_to_h(work_a(:,:),workb2,nloncase,nlatcase,nlon_regional,nlat_regional,grid_reverse_flag) work_b(:,:)=work_b(:,:)+workb2(:,:) else - call fv3_ll_to_h(work_a(:,:),work_b(:,:),nloncase,nlatcase,nlon_regional,nlat_regional,grid_reverse_flag) + call fv3_ll_to_h(work_a(:,:),work_b(:,:),nloncase,nlatcase,nlon_regional,nlat_regional,grid_reverse_flag) endif + endif + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + countloc=(/nxcase,ny_layout_len(nio),1/) + allocate(work_b_layout(nxcase,ny_layout_len(nio))) + work_b_layout=work_b(:,ny_layout_b(nio):ny_layout_e(nio)) + call check( nf90_put_var(gfile_loc_layout(nio),VarId,work_b_layout, start = startloc, count = countloc) ) + deallocate(work_b_layout) + enddo + else + call check( nf90_put_var(gfile_loc,VarId,work_b, start = startloc, count = countloc) ) endif - call check( nf90_put_var(gfile_loc,VarId,work_b, start = startloc, count = countloc) ) enddo !ilevtotl loop - call check(nf90_close(gfile_loc)) + if(fv3_io_layout_y > 1) then + do nio=0,fv3_io_layout_y-1 + call check(nf90_close(gfile_loc_layout(nio))) + enddo + deallocate(gfile_loc_layout) + else + call check(nf90_close(gfile_loc)) + endif deallocate(work_b,work_a) + deallocate(workb2,worka2) end subroutine gsi_fv3ncdf_write diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index 1c8b73841f..76abbc22a2 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -118,7 +118,7 @@ module gsimod use mod_strong, only: l_tlnmc,reg_tlnmc_type,nstrong,tlnmc_option,& period_max,period_width,init_strongvars,baldiag_full,baldiag_inc use gridmod, only: nlat,nlon,nsig,wrf_nmm_regional,nems_nmmb_regional,fv3_regional,cmaq_regional,& - nmmb_reference_grid,grid_ratio_nmmb,grid_ratio_wrfmass,grid_ratio_fv3_regional,& + nmmb_reference_grid,grid_ratio_nmmb,grid_ratio_wrfmass,grid_ratio_fv3_regional,fv3_io_layout_y,& filled_grid,half_grid,wrf_mass_regional,nsig1o,nnnn1o,update_regsfc,& diagnostic_reg,gencode,nlon_regional,nlat_regional,nvege_type,& twodvar_regional,regional,init_grid,init_reg_glob_ll,init_grid_vars,netcdf,& @@ -468,7 +468,10 @@ module gsimod ! 2021-01-05 x.zhang/lei - add code for updating delz analysis in regional da ! 09-07-2020 CAPS Add options for directDA_radaruse_mod to use direct radar DA capabilities ! 02-09-2021 CAPS(J. Park) Add vad_near_analtime flag (obsqc) to assimilate newvad obs around analysis time only -! +! 01-07-2022 Hu Add fv3_io_layout_y to let fv3lam interface read/write subdomain restart +! files. The fv3_io_layout_y needs to match fv3lam model +! option io_layout(2). +! !EOP !------------------------------------------------------------------------- @@ -754,6 +757,7 @@ module gsimod ! = 'V', then analysis grid covers V grid domain ! grid_ratio_nmmb - ratio of analysis grid to nmmb model grid in nmmb model grid units. ! grid_ratio_fv3_regional - ratio of analysis grid to fv3 grid in fv3 grid units. +! fv3_io_layout_y - set to the same number as io_layout of fv3 regional model in y direction. ! grid_ratio_wrfmass - ratio of analysis grid to wrf mass grid in wrf grid units. ! grid_type_fv3_regional - type of fv3 model grid (grid orientation). ! twodvar_regional - logical for regional 2d-var analysis @@ -774,7 +778,7 @@ module gsimod diagnostic_reg,update_regsfc,netcdf,regional,wrf_nmm_regional,nems_nmmb_regional,fv3_regional,& wrf_mass_regional,twodvar_regional,filled_grid,half_grid,nvege_type,nlayers,cmaq_regional,& nmmb_reference_grid,grid_ratio_nmmb,grid_ratio_fv3_regional,grid_ratio_wrfmass,jcap_gfs,jcap_cut,& - wrf_mass_hybridcord,grid_type_fv3_regional + wrf_mass_hybridcord,grid_type_fv3_regional,fv3_io_layout_y ! BKGERR (background error related variables): ! vs - scale factor for vertical correlation lengths for background error diff --git a/src/gsi/guess_grids.F90 b/src/gsi/guess_grids.F90 index 27d9c7a466..e19ce93638 100644 --- a/src/gsi/guess_grids.F90 +++ b/src/gsi/guess_grids.F90 @@ -1704,6 +1704,7 @@ subroutine load_gsdpbl_hgt(mype) ! !REVISION HISTORY: ! 2011-06-06 Ming Hu ! 2013-02-22 Jacob Carley - Added NMMB +! 2022-01-07 Ming Hu - added fv3_regional ! ! !REMARKS: ! language: f90 @@ -1724,9 +1725,8 @@ subroutine load_gsdpbl_hgt(mype) real(r_kind),dimension(:,: ),pointer::ges_ps=>NULL() real(r_kind),dimension(:,:,:),pointer::ges_tv=>NULL() - if (twodvar_regional) return - if (fv3_regional) then - if(mype==0)write(6,*)'not setup for fv3_regional in load_gsdpbl_hgt' + if (twodvar_regional) then + if(mype==0) write(6,*)'not setup for twodvar_regional in load_gsdpbl_hgt' return endif @@ -1745,13 +1745,19 @@ subroutine load_gsdpbl_hgt(mype) do k=1,nsig - if (wrf_mass_regional) pbk(k) = aeta1_ll(k)*(ges_ps_01(i,j)*ten-pt_ll)+aeta2_ll(k)+pt_ll - if (nems_nmmb_regional) then - pbk(k) = aeta1_ll(k)*pdtop_ll + aeta2_ll(k)*(ten*ges_ps(i,j) & - -pdtop_ll-pt_ll) + pt_ll - end if - - thetav(k) = ges_tv(i,j,k)*(r1000/pbk(k))**rd_over_cp_mass + if (wrf_mass_regional) then + pbk(k) = aeta1_ll(k)*(ges_ps_01(i,j)*ten-pt_ll)+aeta2_ll(k)+pt_ll + elseif (nems_nmmb_regional) then + pbk(k) = aeta1_ll(k)*pdtop_ll + aeta2_ll(k)*(ten*ges_ps(i,j) & + -pdtop_ll-pt_ll) + pt_ll + elseif (fv3_regional) then + pbk(k) = ges_prsl(i,j,k,1) * ten + else + write(*,*) "Error: not an model option in load_gsdpbl_hgt" + call stop2(1234) + end if + + thetav(k) = ges_tv(i,j,k)*(r1000/pbk(k))**rd_over_cp_mass end do pbl_height(i,j,jj) = zero diff --git a/ush/build.comgsi b/ush/build.comgsi index 889e17885f..319d0121f7 100755 --- a/ush/build.comgsi +++ b/ush/build.comgsi @@ -45,7 +45,11 @@ elif [[ -d /jetmon ]] ; then module load cmake/3.16.1 module load intel/18.0.5.274 module load impi/2018.4.274 - module load netcdf/4.7.0 #don't load netcdf/4.7.4 from hpc-stack, GSI does not compile with it. + module load szip/2.1 + module load hdf5parallel/1.10.6 + module load netcdf-hdf5parallel/4.7.4 + module load pnetcdf/1.11.2 + module load nco/4.9.1 module use /lfs4/HFIP/hfv3gfs/nwprod/hpc-stack/libs/modulefiles/stack module load hpc/1.1.0 From 2c4f6204b091ebd0ce6386022e4bf659732f5573 Mon Sep 17 00:00:00 2001 From: "michael.lueken" Date: Fri, 4 Feb 2022 17:55:34 +0000 Subject: [PATCH 6/7] Master: Remove extra declaration of variable, ges_ps_write, in src/gsi/gsi_rfv3io_mod.f90, to allow the code to compile. --- src/gsi/gsi_rfv3io_mod.f90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index 5bd6f18470..496370e7c5 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -2075,7 +2075,6 @@ subroutine wrfv3_netcdf(fv3filenamegin) real(r_kind), dimension(lat2,lon2,nsig) :: io_arr_qg, io_arr_qnr real(r_kind), dimension(:,:,:),allocatable ::g_prsi - real(r_kind), dimension(:,:),allocatable ::ges_ps_write it=ntguessig ier=0 From 8d002d3299b7687fff640c263b472a37b2e3f064 Mon Sep 17 00:00:00 2001 From: "Ming.Hu" Date: Sun, 9 Jan 2022 05:39:43 +0000 Subject: [PATCH 7/7] NOAA-EMC/GSI#282: GSL enhancements to the non-var cloud analysis. Update the code generating psuedo moisture observations from cloud observations. --- src/GSD/gsdcloud/cloudCover_Surface.f90 | 4 +- src/gsi/gsdcloudanalysis.F90 | 187 +++++++++++++++++++++--- src/gsi/gsdcloudanalysis4gfs.F90 | 9 +- src/gsi/gsdcloudlib_pseudoq_mod.f90 | 32 +++- src/gsi/gsi_cldtotOper.F90 | 2 +- src/gsi/gsimod.F90 | 54 ++++++- src/gsi/rapidrefresh_cldsurf_mod.f90 | 70 ++++++++- src/gsi/read_Lightning.f90 | 11 +- src/gsi/read_obs.F90 | 2 +- src/gsi/reorg_metar_cloud.f90 | 73 +++++++-- src/gsi/setupcldtot.F90 | 18 ++- 11 files changed, 400 insertions(+), 62 deletions(-) diff --git a/src/GSD/gsdcloud/cloudCover_Surface.f90 b/src/GSD/gsdcloud/cloudCover_Surface.f90 index 40554e9e4c..f56e43590d 100644 --- a/src/GSD/gsdcloud/cloudCover_Surface.f90 +++ b/src/GSD/gsdcloud/cloudCover_Surface.f90 @@ -1,4 +1,4 @@ -SUBROUTINE cloudCover_Surface(mype,nlat,nlon,nsig,r_radius,thunderRadius,& +SUBROUTINE cloudCover_Surface(mype,nlat,nlon,nsig,thunderRadius,& cld_bld_hgt,t_bk,p_bk,q,h_bk,zh, & mxst_p,NVARCLD_P,numsao,OI,OJ,OCLD,OWX,Oelvtn,Odist,& cld_cover_3d,cld_type_3d,wthr_type,pcp_type_3d, & @@ -23,7 +23,6 @@ SUBROUTINE cloudCover_Surface(mype,nlat,nlon,nsig,r_radius,thunderRadius,& ! nlon - no. of lons on subdomain (buffer points on ends) ! nlat - no. of lats on subdomain (buffer points on ends) ! nsig - no. of levels -! r_radius - influence radius of the cloud observation ! thunderRadius - ! cld_bld_hgt - Height below which cloud building is done ! @@ -71,7 +70,6 @@ SUBROUTINE cloudCover_Surface(mype,nlat,nlon,nsig,r_radius,thunderRadius,& implicit none integer(i_kind),intent(in) :: mype - REAL(r_single), intent(in) :: r_radius integer(i_kind),intent(in) :: nlat,nlon,nsig real(r_single), intent(in) :: thunderRadius real(r_kind), intent(in) :: cld_bld_hgt diff --git a/src/gsi/gsdcloudanalysis.F90 b/src/gsi/gsdcloudanalysis.F90 index 599208ed8c..21fc21b8a2 100644 --- a/src/gsi/gsdcloudanalysis.F90 +++ b/src/gsi/gsdcloudanalysis.F90 @@ -23,7 +23,21 @@ subroutine gsdcloudanalysis(mype) ! 2015-01-13 ladwig - add code for Qni and Qnc (cloud ice and water number concentration) ! 2017-03-23 Hu - add code to use hybrid vertical coodinate in WRF MASS ! core -! +! 2019-10-10 Zhao - add code to check and adjust Qr/qs/qg and Qnr for +! each vertical profile to reduce the background +! reflectivity ghost in final analysis. (for RTMA3D +! only now, option l_precip_vertical_check) +! 2020-04-16 Zhao - modifications to the code which checks and adjusts the vertical +! profile of Qg/Qr/Qs/Qnr retrieved through cloud analysis to +! alleviate the background ghost reflectivity in analysis. +! Modifications includes: +! 1. change option l_precip_vertical_check to i_precip_vertical_check +! 2. i_precip_vertical_check: +! = 0(no adjustment, default) +! = 1(Clean off Qg only, where dbz_obs_max<=35dbz in the profile) +! = 2(clean Qg as in 1, and adjustment to the retrieved Qr/Qs/Qnr throughout the whole profile) +! = 3(similar to 2, but adjustment to Qr/Qs/Qnr only below maximum reflectivity level +! and where the dbz_obs is missing); ! ! input argument list: ! mype - processor ID that does this IO @@ -66,7 +80,6 @@ subroutine gsdcloudanalysis(mype) use mpimod, only: mpi_comm_world,ierror,mpi_real4 use rapidrefresh_cldsurf_mod, only: dfi_radar_latent_heat_time_period, & metar_impact_radius, & - metar_impact_radius_lowCloud, & l_cleanSnow_WarmTs,l_conserve_thetaV,& r_cleanSnow_WarmTs_threshold, & i_conserve_thetaV_iternum, & @@ -76,16 +89,18 @@ subroutine gsdcloudanalysis(mype) iclean_hydro_withRef, iclean_hydro_withRef_allcol, & l_use_hydroretrieval_all, & i_lightpcp, l_numconc, qv_max_inc,ioption, & - l_precip_clear_only,l_fog_off,cld_bld_coverage,cld_clr_coverage + l_precip_clear_only,l_fog_off,cld_bld_coverage,cld_clr_coverage,& + i_T_Q_adjust,l_saturate_bkCloud,i_precip_vertical_check,l_rtma3d use gsi_metguess_mod, only: GSI_MetGuess_Bundle use gsi_bundlemod, only: gsi_bundlegetpointer + use gsi_io, only: verbose +#ifdef RR_CLOUDANALYSIS implicit none ! Declare passed variables integer(i_kind),intent(in):: mype -#ifdef RR_CLOUDANALYSIS ! ! background ! @@ -182,8 +197,6 @@ subroutine gsdcloudanalysis(mype) real(r_single),allocatable :: vis2qc(:,:) ! fog real(r_kind) :: thunderRadius=2.5_r_kind - real(r_single) :: r_radius ! influence radius of cloud based on METAR obs - real(r_single) :: r_radius_lowCloud ! influence radius of low cloud to cloud top pressure integer(i_kind) :: miss_obs_int real(r_kind) :: miss_obs_real parameter ( miss_obs_int = -99999 ) @@ -235,7 +248,10 @@ subroutine gsdcloudanalysis(mype) logical :: ifindomain integer(i_kind) :: imaxlvl_ref real(r_kind) :: max_retrieved_qrqs,max_bk_qrqs,ratio_hyd_bk2obs + real(r_kind) :: qrqs_retrieved real(r_kind) :: qrlimit,qrlimit_lightpcp + real(r_kind) :: qnr_limit + real(r_kind) :: dbz_clean_graupel character(10) :: obstype integer(i_kind) :: lunin, is, ier, istatus integer(i_kind) :: nreal,nchanl,ilat1s,ilon1s @@ -253,6 +269,9 @@ subroutine gsdcloudanalysis(mype) real(r_kind),parameter :: rho_w = 999.97_r_kind, rho_a = 1.2_r_kind real(r_kind),parameter :: cldDiameter = 10.0E3_r_kind +! local variables used for adjustment of qr/qs for RTMA_3D to alleviate ghost reflectivity + logical :: print_verbose + integer(i_kind) :: k_cap ! highest level when adjument is done (used for adjust qr/qs for RTMA_3D) ! ! @@ -289,8 +308,6 @@ subroutine gsdcloudanalysis(mype) ! ! krad_bot=7.0_r_single - r_radius=metar_impact_radius - r_radius_lowCloud=metar_impact_radius_lowCloud opt_hydrometeor_retri=3 ! 1=Kessler 2=Lin 3=Thompson opt_cloudtemperature=3 ! 3=latent heat, 4,5,6 = adiabat profile @@ -310,6 +327,9 @@ subroutine gsdcloudanalysis(mype) istat_lightning=0 istat_nasalarc=0 + print_verbose=.false. + if (verbose) print_verbose=.true. + call load_gsdpbl_hgt(mype) ! ! check consistency of the options @@ -694,7 +714,7 @@ subroutine gsdcloudanalysis(mype) ! ! if(istat_surface == 1) then - call cloudCover_surface(mype,lat2,lon2,nsig,r_radius,thunderRadius, & + call cloudCover_surface(mype,lat2,lon2,nsig,thunderRadius, & cld_bld_hgt,t_bk,p_bk,q_bk,h_bk,zh, & numsao,nvarcld_p,numsao,oi,oj,ocld,owx,oelvtn,odist, & cld_cover_3d,cld_type_3d,wthr_type_2d,pcp_type_3d, & @@ -869,7 +889,7 @@ subroutine gsdcloudanalysis(mype) ! 2013) ! - if(l_use_hydroretrieval_all) then !RTMA + if(l_use_hydroretrieval_all .or. l_rtma3d) then !RTMA qrlimit=15.0_r_kind*0.001_r_kind do k=1,nsig do j=2,lat2-1 @@ -907,6 +927,103 @@ subroutine gsdcloudanalysis(mype) end do end do end do + +! ---- verical check and adjustment to the analysis of precipitation +! in order to remove/reduce the backround reflectivity "ghost" in +! analysis. +! Note: here rain_3d, snow_3d have been already changed into unit of kg/kg. + if(i_precip_vertical_check > 0) then + + if(print_verbose) then + write(6,'(1x,A,I4.4,A)')"SUB gsdcloudanalysis: precip_vertical_check start... (for pe=",mype,")." + else + if(mype == 0) then + write(6,'(1x,A,I4.4,A)')"SUB gsdcloudanalysis: precip_vertical_check start ... (only print for pe=",mype,")." + end if + end if + + qnr_limit=200000_r_kind + dbz_clean_graupel=35.0_r_kind + + do j=2,lat2-1 + do i=2,lon2-1 + +! 1. search the max reflectivity obs for veritcal profile at each grid +! point (same code used in hydrometeor anlysis for RAP forecast) + refmax=-999.0_r_kind + imaxlvl_ref=0 + do k=1,nsig + if(ref_mos_3d(i,j,k) > refmax) then + imaxlvl_ref=k + refmax=ref_mos_3d(i,j,k) + endif + enddo +! 2. check and adjustment along the profile at each grid point + if( refmax > 0 .and. (imaxlvl_ref > 0 .and. imaxlvl_ref < nsig ) ) then + ! cleaning the Graupel, if refmax <= dbz_clean_graupel (35dbz) + ! because graupel is copied from background, not retrieved in cloud analysis. + ! (as seen above, graupel_3d(i,j,k) = ges_qg(j,i,k) ) + if( refmax <= dbz_clean_graupel ) graupel_3d(i,j,:) = zero + + ! adjusting hydrometeors based on maximum reflectivity level + select case (i_precip_vertical_check) + case(2) ! adjust each level along the profile (1:nsig) + max_retrieved_qrqs=snow_3d(i,j,imaxlvl_ref)+rain_3d(i,j,imaxlvl_ref) + do k=1,nsig + qrqs_retrieved=snow_3d(i,j,k)+rain_3d(i,j,k) + if(qrqs_retrieved > max_retrieved_qrqs .and. qrqs_retrieved > 0.0001_r_kind) then + ratio_hyd_bk2obs=max(min(max_retrieved_qrqs/qrqs_retrieved,1.0_r_kind),0.0_r_kind) + if(rain_3d(i,j,k) > zero) then + rain_3d(i,j,k) = rain_3d(i,j,k)*ratio_hyd_bk2obs + nrain_3d(i,j,k)= min(nrain_3d(i,j,k)/ratio_hyd_bk2obs*2.5_r_kind,qnr_limit) + endif + if(snow_3d(i,j,k) > zero) then + snow_3d(i,j,k) = snow_3d(i,j,k)*ratio_hyd_bk2obs + end if + end if + end do + case(3) ! adjust the dbz-obs-missed levels below max-dbz layer (1:kcap) + ! based on the qr+qs on max-refl level + ! keep the retrieved cloud analysis as much as possible + max_retrieved_qrqs=snow_3d(i,j,imaxlvl_ref)+rain_3d(i,j,imaxlvl_ref) + k_cap=min(imaxlvl_ref,nsig) + do k=k_cap,1,-1 + if( ref_mos_3d(i,j,k) <= -100.0_r_kind ) then ! dbz-obs-missing level + qrqs_retrieved=snow_3d(i,j,k)+rain_3d(i,j,k) + if(qrqs_retrieved > max_retrieved_qrqs .and. qrqs_retrieved > 0.0001_r_kind) then + ratio_hyd_bk2obs=max(min(max_retrieved_qrqs/qrqs_retrieved,1.0_r_kind),0.0_r_kind) + if(rain_3d(i,j,k) > zero) then + rain_3d(i,j,k) = rain_3d(i,j,k)*ratio_hyd_bk2obs + ! for nrain_3d: 2.5(old) or 1.0(new4) or 1.5(new5/6) 2.5(old, new7) 2.0(new8) + nrain_3d(i,j,k)= min(nrain_3d(i,j,k)/ratio_hyd_bk2obs*2.5_r_kind,qnr_limit) + endif + if(snow_3d(i,j,k) > zero) then + snow_3d(i,j,k) = snow_3d(i,j,k)*ratio_hyd_bk2obs + end if + end if + end if + end do + case default + rain_3d(i,j,k) = rain_3d(i,j,k) + nrain_3d(i,j,k)= nrain_3d(i,j,k) + snow_3d(i,j,k) = snow_3d(i,j,k) + end select + + end if + + end do + end do + + if(print_verbose) then + write(6,'(1x,A,I4.4,A)')"SUB gsdcloudanalysis: precip_vertical_check is done ... (for pe=",mype,")." + else + if(mype == 0) then + write(6,'(1x,A,I4.4,A)')"SUB gsdcloudanalysis: precip_vertical_check is done ... (only print for pe=",mype,")." + end if + end if + + end if + elseif(l_precip_clear_only) then !only clear for HRRRE do k=1,nsig do j=2,lat2-1 @@ -1099,7 +1216,7 @@ subroutine gsdcloudanalysis(mype) ! call cloud_saturation(mype,l_conserve_thetaV,i_conserve_thetaV_iternum, & lat2,lon2,nsig,q_bk,t_bk,p_bk, & - cld_cover_3d,wthr_type_2d,cldwater_3d,cldice_3d,sumqci,qv_max_inc) + cld_cover_3d,wthr_type_2d,cldwater_3d,cldice_3d,sumqci,qv_max_inc, l_saturate_bkCloud) ! @@ -1136,24 +1253,50 @@ subroutine gsdcloudanalysis(mype) do k=1,nsig do j=1,lat2 do i=1,lon2 - if(l_conserve_thetaV) then + ! T/Q update + ! =0 no T/Q adjustment + if(i_T_Q_adjust==0) then + if(mype==0) then + write(6,*) 'gsdcloudanalysis: no T/Q adjustment',mype + endif + ! =1 default T/Q adjustment + elseif(i_T_Q_adjust==1) then if(.not.twodvar_regional .or. .not.tsensible) then - ges_tv(j,i,k)=t_bk(i,j,k)*(p_bk(i,j,k)/h1000)**rd_over_cp * & ! t_bk is potential T - (one+fv*q_bk(i,j,k)) ! convert T to virtual T + ! t_bk is potential T, convert to virtual T + ges_tv(j,i,k)=t_bk(i,j,k)*(p_bk(i,j,k)/h1000)**rd_over_cp * (one+fv*q_bk(i,j,k)) ges_tsen(j,i,k,itsig) = ges_tv(j,i,k)/(one+fv*q_bk(i,j,k)) else - ges_tsen(j,i,k,itsig)=t_bk(i,j,k)*(p_bk(i,j,k)/h1000)**rd_over_cp ! t_bk is potential T - ges_tv(j,i,k) = ges_tsen(j,i,k,itsig)*(one+fv*q_bk(i,j,k)) ! convert virtual T to T + ! t_bk is potential T, convert virtual T to T + ges_tsen(j,i,k,itsig)=t_bk(i,j,k)*(p_bk(i,j,k)/h1000)**rd_over_cp + ges_tv(j,i,k) = ges_tsen(j,i,k,itsig)*(one+fv*q_bk(i,j,k)) endif - endif ! l_conserve_thetaV - ges_q(j,i,k)=q_bk(i,j,k)/(1+q_bk(i,j,k)) ! Here q is mixing ratio kg/kg, - ! need to convert to specific humidity + ! Here q is mixing ratio kg/kg, need to convert to specific humidity + ges_q(j,i,k)=q_bk(i,j,k)/(1+q_bk(i,j,k)) + ! =2 T/Q adjustment only for case of clearing + elseif(i_T_Q_adjust==2) then + if(.not.twodvar_regional .or. .not.tsensible) then + ! t_bk is potential T, convert to virtual T + ges_tv(j,i,k)=max(ges_tv(j,i,k),t_bk(i,j,k)*(p_bk(i,j,k)/h1000)**rd_over_cp * (one+fv*q_bk(i,j,k))) + ges_tsen(j,i,k,itsig) = max(ges_tsen(j,i,k,itsig),ges_tv(j,i,k)/(one+fv*q_bk(i,j,k))) + else + ! t_bk is potential T, convert virtual T to T + ges_tsen(j,i,k,itsig)= max(ges_tsen(j,i,k,itsig),t_bk(i,j,k)*(p_bk(i,j,k)/h1000)**rd_over_cp) + ges_tv(j,i,k) = max(ges_tv(j,i,k),ges_tsen(j,i,k,itsig)*(one+fv*q_bk(i,j,k))) + endif + ! Here q is mixing ratio kg/kg, need to convert to specific humidity + ges_q(j,i,k)=min(ges_q(j,i,k),q_bk(i,j,k)/(1+q_bk(i,j,k))) + else + write(6,*) 'gsdcloudanalysis: WARNING no T/Q adjustment, check i_T_Q_adjust value',mype + endif + + ! hydrometeor update ges_qr(j,i,k)=rain_3d(i,j,k) ges_qs(j,i,k)=snow_3d(i,j,k) ges_qg(j,i,k)=graupel_3d(i,j,k) ges_ql(j,i,k)=cldwater_3d(i,j,k) ges_qi(j,i,k)=cldice_3d(i,j,k) ges_qnr(j,i,k)=nrain_3d(i,j,k) + ! cloud number concentration update if( l_numconc ) then ges_qni(j,i,k)=nice_3d(i,j,k) ges_qnc(j,i,k)=nwater_3d(i,j,k) @@ -1193,9 +1336,13 @@ subroutine gsdcloudanalysis(mype) endif #else /* Start no RR cloud analysis library block */ + implicit none + +! Declare passed variables + integer(i_kind),intent(in):: mype +! if( mype == 0) write(6,*)'gsdcloudanalysis: dummy routine, does nothing!' #endif /* End no RR cloud analysis library block */ - end subroutine gsdcloudanalysis diff --git a/src/gsi/gsdcloudanalysis4gfs.F90 b/src/gsi/gsdcloudanalysis4gfs.F90 index c778471120..294ae32cf4 100644 --- a/src/gsi/gsdcloudanalysis4gfs.F90 +++ b/src/gsi/gsdcloudanalysis4gfs.F90 @@ -78,11 +78,11 @@ subroutine gsdcloudanalysis4gfs(mype) use gsi_metguess_mod, only: GSI_MetGuess_Bundle use gsi_bundlemod, only: gsi_bundlegetpointer +#ifdef RR_CLOUDANALYSIS implicit none ! Declare passed variables integer(i_kind),intent(in):: mype -#ifdef RR_CLOUDANALYSIS ! ! background ! @@ -931,10 +931,15 @@ subroutine gsdcloudanalysis4gfs(mype) write(6,*) 'gsdcloudanalysis: generalized cloud analysis finished:',mype write(6,*) '========================================' endif + #else /* Start no RR cloud analysis library block */ + implicit none + +! Declare passed variables + integer(i_kind),intent(in):: mype +! if( mype == 0) write(6,*)'gsdcloudanalysis: dummy routine, does nothing!' #endif /* End no RR cloud analysis library block */ - end subroutine gsdcloudanalysis4gfs diff --git a/src/gsi/gsdcloudlib_pseudoq_mod.f90 b/src/gsi/gsdcloudlib_pseudoq_mod.f90 index 5afba70452..b7544a860c 100644 --- a/src/gsi/gsdcloudlib_pseudoq_mod.f90 +++ b/src/gsi/gsdcloudlib_pseudoq_mod.f90 @@ -32,7 +32,8 @@ module gsdcloudlib_pseudoq_mod contains -SUBROUTINE cloudCover_Surface_col(mype,nsig,& +SUBROUTINE cloudCover_Surface_col(mype,nsig, & + i_cloud_q_innovation,& cld_bld_hgt,h_bk,zh, & NVARCLD_P,ocld,Oelvtn,& wthr_type,pcp_type_obs, & @@ -57,6 +58,7 @@ SUBROUTINE cloudCover_Surface_col(mype,nsig,& ! input argument list: ! mype - processor ID ! nsig - no. of levels +! i_cloud_q_innovation - flag to control building/clearing/both ! cld_bld_hgt - Height below which cloud building is done ! ! h_bk - 3D background height (m) @@ -96,6 +98,7 @@ SUBROUTINE cloudCover_Surface_col(mype,nsig,& integer(i_kind),intent(in) :: mype integer(i_kind),intent(in) :: nsig + integer(i_kind),intent(in) :: i_cloud_q_innovation real(r_kind), intent(in) :: cld_bld_hgt ! ! surface observation @@ -124,7 +127,7 @@ SUBROUTINE cloudCover_Surface_col(mype,nsig,& INTEGER(i_kind) :: k INTEGER(i_kind) :: ic integer(i_kind) :: firstcloud,cl_base_broken_k,obused - integer(i_kind) :: kcld + integer(i_kind) :: kcld,kclr real(r_single) :: underlim REAL(r_kind) :: zdiff REAL(r_kind) :: zlev_clr,cloud_dz,cl_base_ista,betav @@ -140,6 +143,7 @@ SUBROUTINE cloudCover_Surface_col(mype,nsig,& firstcloud = 0 obused =0 kcld=-9 + kclr=99 ! !***************************************************************** ! analysis of surface/METAR cloud observations @@ -161,6 +165,15 @@ SUBROUTINE cloudCover_Surface_col(mype,nsig,& endif enddo + ! cloud clearing obs + if(i_cloud_q_innovation==20 .or. i_cloud_q_innovation==22) then + do k=3,nsig,5 + if (h_bk(k) < zlev_clr) then + cld_cover_obs(k)=0.0_r_single + endif + enddo + endif + ! -- Now consider non-clear obs ! -------------------------- else @@ -203,10 +216,12 @@ SUBROUTINE cloudCover_Surface_col(mype,nsig,& if(k==8) underlim=95.0_r_kind ! 3000 feet if(k>=9 .and. k= 1.0_r_kind .and. (firstcloud==0 .or. abs(zdiff)= 3) cld_cover_obs(kclr)=0.0_r_single + endif - endif ! end if ocld valid endif ! obused enddo ! end IC loop endif ! end if cloudy ob diff --git a/src/gsi/gsi_cldtotOper.F90 b/src/gsi/gsi_cldtotOper.F90 index 5a63e24765..11516daac3 100644 --- a/src/gsi/gsi_cldtotOper.F90 +++ b/src/gsi/gsi_cldtotOper.F90 @@ -107,7 +107,7 @@ subroutine setup_(self, lunin, mype, is, nobs, init_pass,last_pass) diagsave = write_diag(jiter) .and. diag_conv select case(i_cloud_q_innovation) - case(2) + case(20, 21, 22) call setup(self%obsLL(:), self%odiagLL(:), & lunin,mype,bwork,awork(:,iwork),nele,nobs,is,diagsave) diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index 34fbd38ea0..95ff7f79b4 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -152,6 +152,9 @@ module gsimod use rapidrefresh_cldsurf_mod, only: init_rapidrefresh_cldsurf, & dfi_radar_latent_heat_time_period,metar_impact_radius,& metar_impact_radius_lowcloud,l_gsd_terrain_match_surftobs, & + l_metar_impact_radius_change, & + metar_impact_radius_max,metar_impact_radius_min,& + metar_impact_radius_max_height,metar_impact_radius_min_height,& l_sfcobserror_ramp_t, l_sfcobserror_ramp_q, & l_pbl_pseudo_surfobst,l_pbl_pseudo_surfobsq,l_pbl_pseudo_surfobsuv, & pblh_ration,pps_press_incr,l_gsd_limit_ocean_q, & @@ -165,7 +168,8 @@ module gsimod i_lightpcp,i_sfct_gross,l_use_hydroretrieval_all,l_numconc,l_closeobs,& i_coastline,i_gsdqc,qv_max_inc,ioption,l_precip_clear_only,l_fog_off,& cld_bld_coverage,cld_clr_coverage,& - i_cloud_q_innovation,i_ens_mean,DTsTmax + i_cloud_q_innovation,i_ens_mean,DTsTmax,& + i_T_Q_adjust,l_saturate_bkCloud,l_rtma3d,i_precip_vertical_check use gsi_metguess_mod, only: gsi_metguess_init,gsi_metguess_final use gsi_chemguess_mod, only: gsi_chemguess_init,gsi_chemguess_final use tcv_mod, only: init_tcps_errvals,tcp_refps,tcp_width,tcp_ermin,tcp_ermax @@ -468,10 +472,18 @@ module gsimod ! 2021-01-05 x.zhang/lei - add code for updating delz analysis in regional da ! 09-07-2020 CAPS Add options for directDA_radaruse_mod to use direct radar DA capabilities ! 02-09-2021 CAPS(J. Park) Add vad_near_analtime flag (obsqc) to assimilate newvad obs around analysis time only +! 10-10-2019 Zhao added options l_rtma3d and l_precip_vertical_check +! (adjustment to the cloud-analysis retrieved profile of +! Qg/Qs/Qr/QnrQto to alleviate the reflectivity ghost in +! RTMA3D.) +! 04-16-2020 Zhao change option l_precip_vertical_check to i_precip_vertical_check +! option for checking and adjusting the profile of Qr/Qs/Qg/Qnr +! retrieved through cloud analysis to reduce the background +! reflectivity ghost in analysis. (default is 0) ! 01-07-2022 Hu Add fv3_io_layout_y to let fv3lam interface read/write subdomain restart ! files. The fv3_io_layout_y needs to match fv3lam model ! option io_layout(2). -! +! !EOP !------------------------------------------------------------------------- @@ -1328,6 +1340,17 @@ module gsimod ! enhancement for RR appilcation ): ! dfi_radar_latent_heat_time_period - DFI forward integration window in minutes ! metar_impact_radius - metar low cloud observation impact radius in grid number +! l_metar_impact_radius_change - if .true. the impact radius will change +! with height that set up with the metar_impact_radius_max, min, +! max_height, min_height, (default:false) +! metar_impact_radius_max - The max impact radius of metar cloud observation +! in meter (default: 100000 m). +! metar_impact_radius_min - The min impact radius of metar cloud observation +! in meter (default: 10000 m). +! metar_impact_radius_max_height - The hight above which metar_impact_radius_max apply +! in meter (default: 1200m). +! metar_impact_radius_min_height - The hight below which metar_impact_radius_min apply +! in meter (default: 200m). ! l_gsd_terrain_match_surftobs - if .true., GSD terrain match for surface temperature observation ! l_sfcobserror_ramp_t - namelist logical for adjusting surface temperature observation error ! l_sfcobserror_ramp_q - namelist logical for adjusting surface moisture observation error @@ -1421,7 +1444,9 @@ module gsimod ! i_cloud_q_innovation - integer to choose if and how cloud obs are used ! 0= no innovations ! 1= cloud total innovations -! 2= water vapor innovations +! 20= cloud build/clear derived water vapor innovations +! 21= cloud build derived water vapor innovations +! 22= cloud clear derived water vapor innovations ! 3= cloud total & water vapor innovations ! i_ens_mean - integer for setupcldtot behavior ! 0=single model run @@ -1429,10 +1454,28 @@ module gsimod ! 2=ensemble members ! DTsTmax - maximum allowed difference between Tskin and the first ! level T. This is to safety guard soil T adjustment. +! i_T_Q_adjust - =0 no temperature and moisture adjustment in hydrometeor analyis +! =1 (default) temperature and moisture are adjusted in hydrometeor analyis +! =2 temperature and moisture only adjusted for clearing (warmer, drier) +! l_saturate_bkCloud - if .true. ensure saturation for all cloud 3-d points in background +! where observed cloud cover is missing (default:true). +! l_rtma3d - logical option for turning on configuration for RTMA3D +! (default is .FALSE.) +! i_precip_vertical_check - integer option for checking and adjusting +! Qr/Qs/Qg and Qnr after cloud analysis +! to reduce the background reflectivity ghost in +! analysis. (default is 0) +! = 0(no adjustment) +! = 1(Clean off Qg only, where dbz_obs_max<=35dbz in the profile) +! = 2(clean Qg as in 1, and adjustment to the retrieved Qr/Qs/Qnr throughout the whole profile) +! = 3(similar to 2, but adjustment to Qr/Qs/Qnr only below maximum reflectivity level +! and where the dbz_obs is missing); ! namelist/rapidrefresh_cldsurf/dfi_radar_latent_heat_time_period, & metar_impact_radius,metar_impact_radius_lowcloud, & - l_gsd_terrain_match_surftobs, & + l_metar_impact_radius_change,metar_impact_radius_max,& + metar_impact_radius_min,metar_impact_radius_max_height,& + metar_impact_radius_min_height,l_gsd_terrain_match_surftobs, & l_sfcobserror_ramp_t,l_sfcobserror_ramp_q, & l_pbl_pseudo_surfobst,l_pbl_pseudo_surfobsq,l_pbl_pseudo_surfobsuv, & pblh_ration,pps_press_incr,l_gsd_limit_ocean_q, & @@ -1446,7 +1489,8 @@ module gsimod i_lightpcp,i_sfct_gross,l_use_hydroretrieval_all,l_numconc,l_closeobs,& i_coastline,i_gsdqc,qv_max_inc,ioption,l_precip_clear_only,l_fog_off,& cld_bld_coverage,cld_clr_coverage,& - i_cloud_q_innovation,i_ens_mean,DTsTmax + i_cloud_q_innovation,i_ens_mean,DTsTmax, & + i_T_Q_adjust,l_saturate_bkCloud,l_rtma3d,i_precip_vertical_check ! chem(options for gsi chem analysis) : ! berror_chem - .true. when background for chemical species that require diff --git a/src/gsi/rapidrefresh_cldsurf_mod.f90 b/src/gsi/rapidrefresh_cldsurf_mod.f90 index 60c2bd84e6..1ee35fffba 100644 --- a/src/gsi/rapidrefresh_cldsurf_mod.f90 +++ b/src/gsi/rapidrefresh_cldsurf_mod.f90 @@ -22,6 +22,13 @@ module rapidrefresh_cldsurf_mod ! 04-01-2017 Hu added option i_gsdqc to turn on special observation qc ! from GSD (for RAP/HRRR application) ! 2018-09-12 Ladwig added options l_precip_clear_only +! 2019-10-10 Zhao added options l_rtma3d and l_precip_vertical_check (for +! RTMA3D only now) +! 2020-04-16 Zhao change option l_precip_vertical_check to i_precip_vertical_check +! option for checking and adjusting the profile of Qr/Qs/Qg/Qnr +! retrieved through cloud analysis to reduce the background +! reflectivity ghost in analysis. (default is 0) +! ! ! Subroutines Included: ! sub init_rapidrefresh_cldsurf - initialize RR related variables to default values @@ -33,6 +40,20 @@ module rapidrefresh_cldsurf_mod ! def metar_impact_radius - impact radius for METAR cloud observation ! def metar_impact_radius_lowCloud - impact radius for METAR cloud observation ! that indicate low cloud base +! def l_metar_impact_radius_change - if .true. the impact radius will change +! with height that set up with the +! metar_impact_radius_max, min, max_height, +! min_height, (default:false) +! def metar_impact_radius_max - The max impact radius of metar cloud +! observation in meter (default: 100000 m). +! def metar_impact_radius_min - The min impact radius of metar cloud +! observation in meter (default: 10000 m). +! def metar_impact_radius_max_height - The hight above which +! metar_impact_radius_max apply +! in meter (default: 1200m). +! def metar_impact_radius_min_height - The hight below which +! metar_impact_radius_min apply +! in meter (default: 200m). ! def l_gsd_terrain_match_surfTobs - namelist logical for GSD terrain ! match for surface temperature observation ! def l_sfcobserror_ramp_t - namelist logical for adjusting surface temperature observation error @@ -135,12 +156,31 @@ module rapidrefresh_cldsurf_mod ! i_cloud_q_innovation - integer to choose if and how cloud obs are used ! 0= no innovations ! 1= cloud total innovations -! 2= water vapor innovations +! 20= cloud build/clear derived water vapor innovations +! 21= cloud build derived water vapor innovations +! 22= cloud clear derived water vapor innovations ! 3= cloud total & water vapor innovations ! i_ens_mean - integer for setupcldtot behavior ! 0=single model run ! 1=ensemble mean ! 2=ensemble members +! i_T_Q_adjust - =0 no temperature and moisture adjustment in hydrometeor analyis +! =1 (default) temperature and moisture are adjusted in hydrometeor analyis +! =2 temperature and moisture only adjusted for clearing (warmer, drier) +! l_saturate_bkCloud - if .true. ensure saturation for all cloud 3-d points +! in background where observed cloud cover is missing +! (default:true). +! l_rtma3d - logical option for turning on configuration for RTMA3D +! (default is .FALSE.) +! i_precip_vertical_check - integer option for checking and adjusting +! Qr/Qs/Qg and Qnr after precipitation analysis +! to reduce the background reflectivity ghost in +! analysis. (default is 0) +! = 0(no adjustment) +! = 1(Clean off Qg only, where dbz_obs_max<=35dbz in the profile) +! = 2(clean Qg as in 1, and adjustment to the retrieved Qr/Qs/Qnr throughout the whole profile) +! = 3(similar to 2, but adjustment to Qr/Qs/Qnr only below maximum reflectivity level +! and where the dbz_obs is missing); ! ! attributes: ! language: f90 @@ -159,6 +199,11 @@ module rapidrefresh_cldsurf_mod public :: dfi_radar_latent_heat_time_period public :: metar_impact_radius public :: metar_impact_radius_lowCloud + public :: l_metar_impact_radius_change + public :: metar_impact_radius_max + public :: metar_impact_radius_min + public :: metar_impact_radius_max_height + public :: metar_impact_radius_min_height public :: l_gsd_terrain_match_surfTobs public :: l_sfcobserror_ramp_t public :: l_sfcobserror_ramp_q @@ -203,11 +248,20 @@ module rapidrefresh_cldsurf_mod public :: i_cloud_q_innovation public :: i_ens_mean public :: DTsTmax + public :: i_T_Q_adjust + public :: l_saturate_bkCloud + public :: l_rtma3d + public :: i_precip_vertical_check logical l_hydrometeor_bkio real(r_kind) dfi_radar_latent_heat_time_period real(r_kind) metar_impact_radius real(r_kind) metar_impact_radius_lowCloud + logical l_metar_impact_radius_change + real(r_kind) metar_impact_radius_max + real(r_kind) metar_impact_radius_min + real(r_kind) metar_impact_radius_max_height + real(r_kind) metar_impact_radius_min_height logical l_gsd_terrain_match_surfTobs logical l_sfcobserror_ramp_t logical l_sfcobserror_ramp_q @@ -252,6 +306,10 @@ module rapidrefresh_cldsurf_mod integer(i_kind) i_cloud_q_innovation integer(i_kind) i_ens_mean real(r_kind) DTsTmax + integer(i_kind) i_T_Q_adjust + logical l_saturate_bkCloud + logical l_rtma3d + integer(i_kind) i_precip_vertical_check contains @@ -293,6 +351,11 @@ subroutine init_rapidrefresh_cldsurf dfi_radar_latent_heat_time_period = 30.0_r_kind ! in minutes metar_impact_radius = 10.0_r_kind ! in grid metar_impact_radius_lowCloud = 4.0_r_kind ! in grid + l_metar_impact_radius_change = .false. ! .true. =radius change vertically + metar_impact_radius_max = 50000.0_r_kind ! in meter + metar_impact_radius_min = 20000.0_r_kind ! in meter + metar_impact_radius_max_height = 3000.0_r_kind ! in meter + metar_impact_radius_min_height = 200.0_r_kind ! in meter l_gsd_terrain_match_surfTobs = .false. ! .true. = turn on GSD terrain ! match for surface ! temperature observation @@ -351,6 +414,11 @@ subroutine init_rapidrefresh_cldsurf i_cloud_q_innovation = 0 ! 0 = no increments from cloud obs i_ens_mean = 0 ! typical ob behavior DTsTmax = 20.0_r_kind ! maximum allowed difference between Ts and T 1st level + i_T_Q_adjust= 1 ! temperature and moisture are adjusted + l_saturate_bkCloud= .true. + l_rtma3d = .false. ! turn configuration for rtma3d off + i_precip_vertical_check = 0 ! No check and adjustment to retrieved Qr/Qs/Qg (default) + return end subroutine init_rapidrefresh_cldsurf diff --git a/src/gsi/read_Lightning.f90 b/src/gsi/read_Lightning.f90 index 28f2814c9b..00dbcc3f69 100644 --- a/src/gsi/read_Lightning.f90 +++ b/src/gsi/read_Lightning.f90 @@ -402,11 +402,6 @@ subroutine read_lightning_grid(nread,ndata,infile,obstype,lunout,twind,sis,nobs) call stop2(50) endif loop_report: do while (ireadsb(lunin) == 0) - ntb = ntb+1 - if (ntb>maxobs) then - write(6,*)'read_lightning: reports exceed maximum ',maxobs - call stop2(50) - endif ! Extract type, date, and location information call ufbint(lunin,hdr,5,1,iret,hdrstr) @@ -426,6 +421,12 @@ subroutine read_lightning_grid(nread,ndata,infile,obstype,lunout,twind,sis,nobs) cycle loop_report endif endif +! + ntb = ntb+1 + if (ntb>maxobs) then + write(6,*)'read_lightning: reports exceed maximum ',maxobs + call stop2(50) + endif ! read in observations call ufbint(lunin,obs,1,35,iret,obsstr) diff --git a/src/gsi/read_obs.F90 b/src/gsi/read_obs.F90 index b08ea7f094..626952bf9d 100644 --- a/src/gsi/read_obs.F90 +++ b/src/gsi/read_obs.F90 @@ -1562,7 +1562,7 @@ subroutine read_obs(ndata,mype) if(i_gsdcldanal_type==2) then call read_NASA_LaRC_cloud(nread,npuse,nouse,infile,obstype,lunout,sis,nobs_sub1(1,i)) else if(i_gsdcldanal_type==1 .or. i_gsdcldanal_type==6 & - .or. i_gsdcldanal_type==3 .or. i_gsdcldanal_type==7) then + .or. i_gsdcldanal_type==3 .or. i_gsdcldanal_type==7 .or. i_gsdcldanal_type==99) then call read_nasa_larc(nread,npuse,infile,obstype,lunout,twind,sis,nobs_sub1(1,i)) end if string='READ_NASA_LaRC' diff --git a/src/gsi/reorg_metar_cloud.f90 b/src/gsi/reorg_metar_cloud.f90 index f21400910f..2d947f2ef3 100644 --- a/src/gsi/reorg_metar_cloud.f90 +++ b/src/gsi/reorg_metar_cloud.f90 @@ -42,8 +42,12 @@ subroutine reorg_metar_cloud(cdata,nreal,ndata,cdata_all,maxobs,ngrid) use kinds, only: r_kind,i_kind,r_double use gridmod, only: nlon,nlat - use constants, only: one,half + use gridmod, only: region_dx + use constants, only: one,half,zero use rapidrefresh_cldsurf_mod, only: metar_impact_radius + use rapidrefresh_cldsurf_mod, only: l_metar_impact_radius_change, & + metar_impact_radius_max,metar_impact_radius_min,& + metar_impact_radius_max_height,metar_impact_radius_min_height implicit none @@ -59,6 +63,8 @@ subroutine reorg_metar_cloud(cdata,nreal,ndata,cdata_all,maxobs,ngrid) ! integer(i_kind) :: ista_prev,ista_prev2,ista_save + real(r_kind),dimension(nreal) :: cdata_temp + real(r_kind),dimension(12) :: cloudlevel_temp INTEGER(i_kind),allocatable :: first_sta(:,:) INTEGER(i_kind),allocatable :: next_sta(:) INTEGER(i_kind) :: null_p @@ -84,10 +90,18 @@ subroutine reorg_metar_cloud(cdata,nreal,ndata,cdata_all,maxobs,ngrid) real(r_kind) :: spval_p parameter (spval_p = 99999._r_kind) + real(r_kind) :: mindx,dxij,delat_radius,delta_height,radiusij + integer(i_kind) :: isprdij ! ! isprd=int(metar_impact_radius + half) + if(l_metar_impact_radius_change) then + mindx=minval(region_dx) + isprd=int(metar_impact_radius_max/mindx + half) + delat_radius=metar_impact_radius_max-metar_impact_radius_min + delta_height=metar_impact_radius_max_height-metar_impact_radius_min_height + endif if(isprd <= 0) return if(ndata <= 0) return ngrid = 0 @@ -260,19 +274,54 @@ subroutine reorg_metar_cloud(cdata,nreal,ndata,cdata_all,maxobs,ngrid) if (min_dist < 1.e9_r_kind) then if (i1 > 1 .and. i1 < nlon .and. j1 > 1 .and. j1 < nlat) then - iout = iout + 1 - if(iout > maxobs) then - write(6,*)'reorg_metar_cloud: ***Error*** ndata > maxobs ' - call stop2(50) - end if + min_dist=sqrt(min_dist) do k=1,nreal - cdata_all(k,iout) = cdata(k,ista_min) + cdata_temp(k)=cdata(k,ista_min) enddo - cdata_all(24,iout) = cdata_all(2,iout) ! save observaion station i - cdata_all(25,iout) = cdata_all(3,iout) ! save observaion station j - cdata_all(2,iout) = float(i1) ! grid index i - cdata_all(3,iout) = float(j1) ! grid index j - cdata_all(23,iout)=sqrt(min_dist) ! distance from station + if(l_metar_impact_radius_change) then + dxij=region_dx(j1,i1) + + cloudlevel_temp=-99999.0_r_kind + ic=0 + do k=1,6 + if(cdata_temp(5+k) > zero .and. cdata_temp(11+k) > zero ) then + radiusij=metar_impact_radius_min + delat_radius* & + max(min((cdata_temp(11+k)-metar_impact_radius_min_height)/delta_height,one),zero) + isprdij=int(radiusij/dxij+half) + if(min_dist <= isprdij) then + ic=ic+1 + cloudlevel_temp(0+ic)=cdata_temp(5+k) + cloudlevel_temp(6+ic)=cdata_temp(11+k) + endif + endif + enddo + if(ic==0) then + if(abs(cdata_temp(6)) < 0.0001_r_kind) ic=1 ! clear + else + do k=1,6 + cdata_temp(5+k)=cloudlevel_temp(0+k) + cdata_temp(11+k)=cloudlevel_temp(6+k) + enddo + endif + else + ic=1 + endif + + if(ic > 0) then + iout = iout + 1 + if(iout > maxobs) then + write(6,*)'reorg_metar_cloud: ***Error*** ndata > maxobs ' + call stop2(50) + end if + do k=1,nreal + cdata_all(k,iout) = cdata_temp(k) + enddo + cdata_all(24,iout) = cdata_all(2,iout) ! save observaion station i + cdata_all(25,iout) = cdata_all(3,iout) ! save observaion station j + cdata_all(2,iout) = float(i1) ! grid index i + cdata_all(3,iout) = float(j1) ! grid index j + cdata_all(23,iout)= min_dist ! distance from station + endif endif endif enddo ! j1 diff --git a/src/gsi/setupcldtot.F90 b/src/gsi/setupcldtot.F90 index 565075bec3..3d899d1a82 100755 --- a/src/gsi/setupcldtot.F90 +++ b/src/gsi/setupcldtot.F90 @@ -12,7 +12,7 @@ subroutine setupcldtot(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_di !! . . . . ! subprogram: setupcldtot compute rhs of oi for pseudo moisture observations from ! METAR and Satellite cloud observations -! prgmmr: Ladwag org: GSD date: 2019-06-01 +! prgmmr: Ladwig org: GSD date: 2019-06-01 ! ! abstract: For moisture observations, this routine ! a) reads obs assigned to given mpi task (geographic region), @@ -272,7 +272,7 @@ subroutine setupcldtot(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_di allocate(cdiagbuf(nobs*nsig),rdiagbuf(nreal,nobs*nsig)) rdiagbuf=zero endif - if (i_cloud_q_innovation == 2 .or. i_cloud_q_innovation == 3) then + if (i_cloud_q_innovation >= 20 .or. i_cloud_q_innovation == 3) then iip=0 allocate(cdiagbufp(nobs*nsig),rdiagbufp(nreal,nobs*nsig)) cdiagbufp="EMPTY" @@ -460,7 +460,7 @@ subroutine setupcldtot(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_di cycle endif - call cloudCover_surface_col(mype,nsig,cld_bld_hgt,h_bk,z_bk, & + call cloudCover_surface_col(mype,nsig,i_cloud_q_innovation,cld_bld_hgt,h_bk,z_bk, & nvarcld_p,ocld,oelvtn,wthr_type,pcp_type_obs,vis2qc,cld_cover_obs) @@ -515,8 +515,8 @@ subroutine setupcldtot(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_di muse(i)=.true. !******************************************************************************* - if (i_cloud_q_innovation /= 2) then - write(*,*) "Warning - setupcldtot: this code version is only designed for i_cloud_q_innovation == 2" + if (i_cloud_q_innovation < 20 .or. i_cloud_q_innovation > 22 ) then + write(*,*) "Warning - setupcldtot: this code version is only designed for i_cloud_q_innovation == 20,21,22" return else @@ -565,6 +565,8 @@ subroutine setupcldtot(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_di ddiff=qv_ob-q_bk(k) q_build0_count=q_build0_count+1 endif + ! build error = 80% + error=one/(cloudqvis*8.E-01_r_kind) elseif (qob > -0.000001_r_single) then @@ -577,13 +579,15 @@ subroutine setupcldtot(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_di ddiff=qv_ob-q_bk(k) q_clear0_count=q_clear0_count+1 endif + ! clear error = 30% + error=one/(cloudqvis*3.E-01_r_kind) else cycle endif q_obcount=q_obcount+1 - error=one/(cloudqvis*3.E-01_r_kind) + ! all obs errors = 30% ratio_errors=1.0_r_kind val = error*ddiff @@ -711,7 +715,7 @@ subroutine setupcldtot(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_di !! Write information to diagnostic file if(conv_diagsave)then - if (i_cloud_q_innovation == 2 .and. iip>0) then + if (i_cloud_q_innovation >= 20 .and. iip>0) then if(netcdf_diag) call nc_diag_write if(binary_diag)then write(7)' q',nchar,nreal,iip,mype,ioff0