Skip to content

Commit

Permalink
Modify code based shoyokota comments NOAA-EMC#4 (and last for first s…
Browse files Browse the repository at this point in the history
…et of comments).
  • Loading branch information
jderber-NOAA committed Jan 10, 2024
1 parent e123548 commit 91d1f79
Show file tree
Hide file tree
Showing 30 changed files with 126 additions and 127 deletions.
2 changes: 1 addition & 1 deletion src/enkf/controlvec.f90
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ subroutine read_control()
! read ensemble members on IO tasks
implicit none
real(r_double) :: t1,t2
integer(i_kind) :: nb,nlev,ne
integer(i_kind) :: nb,ne
integer(i_kind) :: q_ind
integer(i_kind) :: ierr

Expand Down
57 changes: 30 additions & 27 deletions src/enkf/letkf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ subroutine letkf_update()
if (nproc == 0) print *,'using',nthreads,' openmp threads'

! define a few frequently used parameters
r_nanals=one/float(nanals)
r_nanalsm1=one/float(nanals-1)
r_nanals=one/real(nanals,r_kind)
r_nanalsm1=one/real(nanals-1,r_kind)
mincorrlength_factsq = mincorrlength_fact**2

kdobs=associated(kdtree_obs2)
Expand Down Expand Up @@ -276,24 +276,24 @@ subroutine letkf_update()

! Update ensemble on model grid.
! Loop for each horizontal grid points on this task.
!$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,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)
! !$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,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)
grdloop: do npt=1,numptsperproc(nproc+1)

t1 = mpi_wtime()
Expand Down Expand Up @@ -524,7 +524,7 @@ subroutine letkf_update()
if (allocated(sresults)) deallocate(sresults)
if (allocated(ens_tmp)) deallocate(ens_tmp)
end do grdloop
!$omp end parallel do
! !$omp end parallel do

! make sure posterior perturbations still have zero mean.
! (roundoff errors can accumulate)
Expand All @@ -541,31 +541,34 @@ subroutine letkf_update()
enddo
!$omp end parallel do

tmean=zero
tmin=zero
tmax=zero
tend = mpi_wtime()
call mpi_reduce(tend-tbegin,tmean,1,mpi_real8,mpi_sum,0,mpi_comm_world,ierr)
tmean = tmean/numproc
tmean = tmean/real(numproc,r_kind)
call mpi_reduce(tend-tbegin,tmin,1,mpi_real8,mpi_min,0,mpi_comm_world,ierr)
call mpi_reduce(tend-tbegin,tmax,1,mpi_real8,mpi_max,0,mpi_comm_world,ierr)
if (nproc .eq. 0) print *,'min/max/mean time to do letkf update ',tmin,tmax,tmean
t2 = t2/nthreads; t3 = t3/nthreads; t4 = t4/nthreads; t5 = t5/nthreads
if (nproc == 0) print *,'time to process analysis on gridpoint = ',t2,t3,t4,t5,' secs on task',nproc
call mpi_reduce(t2,tmean,1,mpi_real8,mpi_sum,0,mpi_comm_world,ierr)
tmean = tmean/numproc
tmean = tmean/real(numproc,r_kind)
call mpi_reduce(t2,tmin,1,mpi_real8,mpi_min,0,mpi_comm_world,ierr)
call mpi_reduce(t2,tmax,1,mpi_real8,mpi_max,0,mpi_comm_world,ierr)
if (nproc .eq. 0) print *,',min/max/mean t2 = ',tmin,tmax,tmean
call mpi_reduce(t3,tmean,1,mpi_real8,mpi_sum,0,mpi_comm_world,ierr)
tmean = tmean/numproc
tmean = tmean/real(numproc,r_kind)
call mpi_reduce(t3,tmin,1,mpi_real8,mpi_min,0,mpi_comm_world,ierr)
call mpi_reduce(t3,tmax,1,mpi_real8,mpi_max,0,mpi_comm_world,ierr)
if (nproc .eq. 0) print *,',min/max/mean t3 = ',tmin,tmax,tmean
call mpi_reduce(t4,tmean,1,mpi_real8,mpi_sum,0,mpi_comm_world,ierr)
tmean = tmean/numproc
tmean = tmean/real(numproc,r_kind)
call mpi_reduce(t4,tmin,1,mpi_real8,mpi_min,0,mpi_comm_world,ierr)
call mpi_reduce(t4,tmax,1,mpi_real8,mpi_max,0,mpi_comm_world,ierr)
if (nproc .eq. 0) print *,',min/max/mean t4 = ',tmin,tmax,tmean
call mpi_reduce(t5,tmean,1,mpi_real8,mpi_sum,0,mpi_comm_world,ierr)
tmean = tmean/numproc
tmean = tmean/real(numproc,r_kind)
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
Expand All @@ -590,7 +593,7 @@ subroutine letkf_update()
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))
if (nproc == 0) print *,'min/max/mean number of obs in local volume',nobslocal_minall,nobslocal_maxall,nint(nobslocal_meanall/real(numproc,r_kind))
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)
Expand Down
1 change: 0 additions & 1 deletion src/gsi/apply_scaledepwgts.f90
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ subroutine apply_scaledepwgts(m,grd_in,sp_in)
use general_specmod, only: spec_vars
use general_sub2grid_mod, only: sub2grid_info
use hybrid_ensemble_parameters, only: spc_multwgt,en_perts,nsclgrp,n_ens
use mpimod, only: mype
implicit none

! Declare passed variables
Expand Down
2 changes: 1 addition & 1 deletion src/gsi/convthin_time.f90
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ subroutine make3grids_tm(rmesh,nlevpp,ntmm)

real(r_kind),parameter:: r360 = 360.0_r_kind

integer(i_kind) i,j,it
integer(i_kind) i,j
integer(i_kind) mlonx,mlonj

real(r_kind) delonx,delat,dgv,halfpi,dx,dy
Expand Down
2 changes: 1 addition & 1 deletion src/gsi/deter_sfc_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ subroutine deter_sfc2(dlat_earth,dlon_earth,obstime,idomsfc,tsavg,ff10,sfcr,zz)


! Get time interpolation factors for surface files
if(obstime > hrdifsfc(1) .and. obstime <= hrdifsfc(nfldsfc))then
if(obstime > hrdifsfc(1) .and. obstime < hrdifsfc(nfldsfc))then
do j=1,nfldsfc-1
if(obstime > hrdifsfc(j) .and. obstime <= hrdifsfc(j+1))then
itsfc=j
Expand Down
3 changes: 1 addition & 2 deletions src/gsi/get_gefs_ensperts_dualres.f90
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ subroutine get_gefs_ensperts_dualres
!$$$ end documentation block

use mpeu_util, only: die
use gridmod, only: idsl5
use hybrid_ensemble_parameters, only: n_ens,write_ens_sprd,oz_univ_static,ntlevs_ens
use hybrid_ensemble_parameters, only: en_perts,ps_bar,nelen
use constants,only: zero,zero_single,half,fv,rd_over_cp,one,qcmin
use constants,only: zero,zero_single,half,fv,one,qcmin
use mpimod, only: mpi_comm_world,mype,npe
use kinds, only: r_kind,i_kind,r_single
use hybrid_ensemble_parameters, only: grd_ens,q_hyb_ens,limqens
Expand Down
4 changes: 2 additions & 2 deletions src/gsi/gsdcloudanalysis.F90
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ subroutine gsdcloudanalysis(mype)
!_____________________________________________________________________
!
!
use constants, only: zero,one,rad2deg,fv
use constants, only: rd_over_cp, h1000
use constants, only: zero,one
use constants, only: h1000
use kinds, only: r_single,i_kind, r_kind
use gridmod, only: pt_ll,eta1_ll,aeta1_ll,eta2_ll,aeta2_ll
use gridmod, only: regional,wrf_mass_regional,regional_time
Expand Down
11 changes: 5 additions & 6 deletions src/gsi/gsi_rfv3io_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr)
use netcdf, only: nf90_inquire_variable
use mpimod, only: mype
use mod_fv3_lola, only: definecoef_regular_grids
use gridmod, only:nsig,regional_time,regional_fhr,regional_fmin,aeta1_ll,aeta2_ll
use gridmod, only:nlon_regionalens,nlat_regionalens
use gridmod, only:grid_type_fv3_regional
use kinds, only: i_kind,r_kind
Expand All @@ -556,7 +555,7 @@ subroutine gsi_rfv3io_get_ens_grid_specs(grid_spec,ierr)
integer(i_kind), intent( out) :: ierr

integer(i_kind) gfile_grid_spec
integer(i_kind) i,k,ndimensions,iret,nvariables,nattributes,unlimiteddimid
integer(i_kind) k,ndimensions,iret,nvariables,nattributes,unlimiteddimid
integer(i_kind) gfile_loc,len
character(len=128) :: name
integer(i_kind) :: nio,nylen
Expand Down Expand Up @@ -2451,7 +2450,7 @@ subroutine gsi_fv3ncdf_read(grd_ionouv,cstate_nouv,filenamein,fv3filenamegin,ens
integer(i_kind) nz,nzp1,mm1,nx_phy

integer(i_kind):: iworld,iworld_group,nread,mpi_comm_read,i,ierror
integer(i_kind),dimension(npe):: members,members_read,mype_read,mype_read_rank
integer(i_kind),dimension(npe):: members,members_read,mype_read_rank
logical:: procuse

! for io_layout > 1
Expand Down Expand Up @@ -2788,7 +2787,7 @@ subroutine gsi_fv3ncdf_readuv(grd_uv,ges_u,ges_v,fv3filenamegin,ensgrid)
integer(i_kind) nz,nzp1,mm1

integer(i_kind):: iworld,iworld_group,nread,mpi_comm_read,i,ierror
integer(i_kind),dimension(npe):: members,members_read,mype_read,mype_read_rank
integer(i_kind),dimension(npe):: members,members_read,mype_read_rank
logical:: procuse

! for fv3_io_layout_y > 1
Expand Down Expand Up @@ -3965,7 +3964,7 @@ subroutine gsi_fv3ncdf_writeuv(grd_uv,ges_u,ges_v,add_saved,fv3filenamegin)
real(r_kind),allocatable,dimension(:,:):: workbu2,workbv2

integer(i_kind):: iworld,iworld_group,nread,mpi_comm_read,ierror
integer(i_kind),dimension(npe):: members,members_read,mype_read,mype_read_rank
integer(i_kind),dimension(npe):: members,members_read,mype_read_rank
logical:: procuse

! for fv3_io_layout_y > 1
Expand Down Expand Up @@ -4543,7 +4542,7 @@ subroutine gsi_fv3ncdf_write(grd_ionouv,cstate_nouv,add_saved,filenamein,fv3file
real(r_kind),allocatable,dimension(:,:):: work_b_tmp

integer(i_kind):: iworld,iworld_group,nread,mpi_comm_read,i,ierror
integer(i_kind),dimension(npe):: members,members_read,mype_read,mype_read_rank
integer(i_kind),dimension(npe):: members,members_read,mype_read_rank
logical:: procuse

! for io_layout > 1
Expand Down
2 changes: 1 addition & 1 deletion src/gsi/hdraobmod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ subroutine read_hdraob(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,&

! Write header record and data to output file for further processing

call count_obs(ndata,nreal,ilat,ilon,cdata_all(1,1:ndata),nobs)
call count_obs(ndata,nreal,ilat,ilon,cdata_all,nobs)
write(lunout) obstype,sis,nreal,nchanl,ilat,ilon,ndata
write(lunout) ((cdata_all(k,i),k=1,nreal),i=1,ndata)

Expand Down
2 changes: 1 addition & 1 deletion src/gsi/m_extOzone.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ subroutine ozlay_ncread_(dfile,dtype,ozout,nmrecs,ndata,nodata, gstime,twind)
use gridmod, only: nlat,nlon,regional,tll2xy,rlats,rlons
use gsi_4dvar, only: l4dvar,iwinbgn,winlen,l4densvar

use constants, only: deg2rad,zero,rad2deg,one_tenth,r60inv
use constants, only: deg2rad,zero,one_tenth,r60inv
use ozinfo, only: jpch_oz,nusis_oz,iuse_oz
use mpeu_util, only: perr,die
! use mpeu_util, only: mprefix,stdout
Expand Down
15 changes: 5 additions & 10 deletions src/gsi/mod_fv3_lola.f90
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,7 @@ subroutine definecoef_regular_grids(nxen,nyen,grid_lon,grid_lont,grid_lat,grid_l
real(r_kind),allocatable,dimension(:)::xbh_a,xa_a,xa_b
real(r_kind),allocatable,dimension(:)::ybh_a,ya_a,ya_b,yy
real(r_kind),allocatable,dimension(:,:)::xbh_b,ybh_b
real(r_kind) dlat,dlon,dyy,dxx,dyyi,dxxi
real(r_kind) dyyh,dxxh
real(r_kind) dlat,dlon

real(r_kind),allocatable:: region_lat_tmp(:,:),region_lon_tmp(:,:)
integer(i_kind), intent(in ) :: nxen,nyen ! fv3 tile x- and y-dimensions
Expand All @@ -642,18 +641,15 @@ subroutine definecoef_regular_grids(nxen,nyen,grid_lon,grid_lont,grid_lat,grid_l
real(r_kind) , intent(inout) :: grid_latt(nxen,nyen) ! fv3 cell center latitudes
integer(i_kind) i,j,ir,jr,n
real(r_kind),allocatable,dimension(:,:) :: xc,yc,zc,gclat,gclon,gcrlat,gcrlon,rlon_in,rlat_in
real(r_kind),allocatable,dimension(:,:) :: glon_an,glat_an
real(r_kind) xcent,ycent,zcent,rnorm,centlat,centlon
integer(i_kind) nlonh,nlath,nxh,nyh
integer(i_kind) nxh,nyh
integer(i_kind) ib1,ib2,jb1,jb2,jj
integer (i_kind):: index0
real(r_kind) region_lat_in(nlat_ens,nlon_ens),region_lon_in(nlat_ens,nlon_ens)
integer(i_kind) nord_e2a
real(r_kind)gxa,gya

real(r_kind) x(nxen+1,nyen+1),y(nxen+1,nyen+1),z(nxen+1,nyen+1),xr,yr,zr,xu,yu,zu,rlat,rlon
real(r_kind) xv,yv,zv,vval
real(r_kind) cx,cy
real(r_kind) uval,ewval,nsval

real(r_kind) d(4),ds
Expand Down Expand Up @@ -984,11 +980,11 @@ subroutine definecoef_regular_grids(nxen,nyen,grid_lon,grid_lont,grid_lat,grid_l
do i=1,nxen+1
rlat=half*(grid_lat(i,j)+grid_lat(i,j+1))
! rlon=half*(grid_lon(i,j)+grid_lon(i,j+1))
diff=(grid_lon(i,j)-grid_lon(i+1,j))**2
diff=(grid_lon(i,j)-grid_lon(i,j+1))**2
if(diff < sq180)then
rlon=half*(grid_lon(i,j)+grid_lon(i+1,j))
rlon=half*(grid_lon(i,j)+grid_lon(i,j+1))
else
rlon=half*(grid_lon(i,j)+grid_lon(i+1,j)-360._r_kind)
rlon=half*(grid_lon(i,j)+grid_lon(i,j+1)-360._r_kind)
endif
xr=cos(rlat*deg2rad)*cos(rlon*deg2rad)
yr=cos(rlat*deg2rad)*sin(rlon*deg2rad)
Expand Down Expand Up @@ -1258,7 +1254,6 @@ subroutine fv3_h_to_ll_ens(b_in,a,nb,mb,na,ma,rev_flg)
! machine:
!
!$$$ end documentation block
use mpimod, only: mype
use constants, only: zero,one
implicit none

Expand Down
3 changes: 2 additions & 1 deletion src/gsi/obs_para.f90
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@ subroutine count_obs(ndata,nn_obs,lat_data,lon_data,obs_data,nobs_s)
integer(i_kind) ,intent(in ) :: ndata,lat_data,lon_data
integer(i_kind) ,intent(in ) :: nn_obs
integer(i_kind),dimension(npe),intent(inout) :: nobs_s
real(r_kind),dimension(nn_obs,ndata),intent(in) :: obs_data
real(r_kind),dimension(nn_obs,*),intent(in) :: obs_data
! real(r_kind),dimension(nn_obs,ndata),intent(in) :: obs_data

! Declare local variables
integer(i_kind) lon,lat,n,k
Expand Down
7 changes: 3 additions & 4 deletions src/gsi/read_dbz_nc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ subroutine read_dbz_nc(nread,ndata,nodata,infile,lunout,obstype,sis,hgtl_full,no
logical :: luse

!--General declarations
integer(i_kind) :: ierror,i,j,k,nvol, &
ikx,mins_an
integer(i_kind) :: ierror,i,j,k,ikx,mins_an
integer(i_kind) :: maxobs,nchanl,ilat,ilon,scount

real(r_kind) :: thistiltr,thisrange,this_stahgt,thishgt
Expand All @@ -155,8 +154,8 @@ subroutine read_dbz_nc(nread,ndata,nodata,infile,lunout,obstype,sis,hgtl_full,no
real(r_double) rstation_id
logical, allocatable,dimension(:) :: rusage,rthin
logical save_all
! integer(i_kind) numthin,numqc,numrem
integer(i_kind) nxdata,pmot,numall
! integer(i_kind) numthin,numqc,numrem,numall
integer(i_kind) nxdata,pmot

character(8) cstaid
character(4) this_staid
Expand Down
7 changes: 3 additions & 4 deletions src/gsi/read_fed.f90
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ subroutine read_fed(nread,ndata,nodata,infile,obstype,lunout,twind,sis,nobs)
!
use kinds, only: r_kind,r_double,i_kind
use constants, only: zero,one,deg2rad,r60inv
use convinfo, only: nconvtype,ctwind,icuse,ioctype
use convinfo, only: nconvtype,icuse,ioctype
use gsi_4dvar, only: iwinbgn
use gridmod, only: tll2xy
use mod_wrfmass_to_a, only: wrfmass_obs_to_a8
Expand Down Expand Up @@ -83,15 +83,14 @@ subroutine read_fed(nread,ndata,nodata,infile,obstype,lunout,twind,sis,nobs)
integer(i_kind) :: kint_maxloc
real(r_kind) :: fed_max
integer(i_kind) :: ndata2
integer(i_kind) :: ppp

character(8) station_id
real(r_double) :: rstation_id
equivalence(rstation_id,station_id)

integer(i_kind) :: maxlvl
integer(i_kind) :: numlvl,numfed,nmsgmax,maxobs
integer(i_kind) :: k,iret
integer(i_kind) :: numfed,maxobs
integer(i_kind) :: k

real(r_kind),allocatable,dimension(:,:) :: fed3d_column ! 3D fed in column
real(r_kind),allocatable,dimension(:) :: fed3d_hgt ! fed height
Expand Down
10 changes: 6 additions & 4 deletions src/gsi/read_fl_hdob.f90
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si

logical, allocatable,dimension(:) :: rusage,rthin
logical save_all
! integer(i_kind) numthin,numqc,numrem
integer(i_kind) pmot,iqm,numall
! integer(i_kind) numthin,numqc,numrem,numall
integer(i_kind) pmot,iqm
integer(i_kind) nxdata

! Real variables
Expand Down Expand Up @@ -174,7 +174,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si
real(r_kind) :: es,qsat,rhob_calc,tdob_calc,tdry
real(r_kind) :: dummy
real(r_kind) :: del,ediff,errmin,jbmin
real(r_kind) :: tvflg
real(r_kind) :: tvflg,log100

real(r_kind) :: presl(nsig)
real(r_kind) :: obstime(6,1)
Expand Down Expand Up @@ -237,6 +237,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si
ierr_uv = 0
var_jb=zero
jbmin=zero
log100=log(100._r_kind)


lim_qm = 4
Expand Down Expand Up @@ -611,6 +612,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si
obserr = max(obserr,errmin)
endif
! Read extrapolated surface pressure [pa] and convert to [cb]
dlnpsob = log100 ! default (1000mb)
if (lpsob) then
call ufbint(lunin,obspsf,1,1,nlv,psfstr)
if (obspsf(1,1) >= missing .or. &
Expand Down Expand Up @@ -1221,7 +1223,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si
! Write header record and data to output file for further processing
! deallocate(etabl)

call count_obs(ndata,nreal,ilat,ilon,cdata_all(1,1:ndata),nobs)
call count_obs(ndata,nreal,ilat,ilon,cdata_all,nobs)
write(lunout) obstype,sis,nreal,nchanl,ilat,ilon
write(lunout) ((cdata_all(k,i),k=1,nreal),i=1,ndata)
deallocate(cdata_all,rusage,rthin)
Expand Down
Loading

0 comments on commit 91d1f79

Please sign in to comment.