9 use fckit_mpi_module,
only: fckit_mpi_comm
10 use kinds,
only: kind_real
20 integer :: is, ie, js, je
21 integer :: isl, iel, jsl, jel
30 real(kind=kind_real),
allocatable :: lon(:)
31 real(kind=kind_real),
allocatable :: lat(:)
32 real(kind=kind_real),
allocatable :: bgerr(:)
33 real(kind=kind_real),
allocatable :: bgerr_model(:,:)
38 procedure :: init => soca_omb_stats_init
41 procedure :: bin => soca_omb_stats_bin
44 procedure :: exit => soca_omb_stats_exit
54 subroutine soca_omb_stats_init(self, domain)
58 integer(kind=4) :: ncid
59 integer(kind=4) :: dimid
60 integer(kind=4) :: varid
61 type(fckit_mpi_comm) :: f_comm
62 integer :: myrank, root=0
65 f_comm = fckit_mpi_comm()
66 myrank = f_comm%rank()
68 if (myrank.eq.root)
then
70 call nc_check(nf90_open(
'godas_sst_bgerr.nc', nf90_nowrite,ncid))
73 call nc_check(nf90_inq_dimid(ncid,
'nlocs', dimid))
74 call nc_check(nf90_inquire_dimension(ncid, dimid, len = self%nlocs))
76 allocate(self%lon(self%nlocs), self%lat(self%nlocs), self%bgerr(self%nlocs))
79 call nc_check(nf90_inq_varid(ncid,
'longitude',varid))
80 call nc_check(nf90_get_var(ncid,varid,self%lon))
83 call nc_check(nf90_inq_varid(ncid,
'latitude',varid))
84 call nc_check(nf90_get_var(ncid,varid,self%lat))
87 call nc_check(nf90_inq_varid(ncid,
'sst_bgerr',varid))
88 call nc_check(nf90_get_var(ncid,varid,self%bgerr))
95 call f_comm%broadcast(self%nlocs, root)
96 if (myrank.ne.root)
then
97 allocate(self%lon(self%nlocs), self%lat(self%nlocs), self%bgerr(self%nlocs))
99 call f_comm%broadcast(self%lon, root)
100 call f_comm%broadcast(self%lat, root)
101 call f_comm%broadcast(self%bgerr, root)
102 call f_comm%barrier()
105 where (self%lon>180.0_kind_real)
106 self%lon=self%lon-360.0_kind_real
112 end subroutine soca_omb_stats_init
119 subroutine soca_omb_stats_bin(self, lon, lat)
121 real(kind=kind_real),
intent(in) :: lon(:,:)
122 real(kind=kind_real),
intent(in) :: lat(:,:)
124 integer :: is, ie, js, je
125 integer :: isl, iel, jsl, jel
134 isl = self%domain%isl
135 iel = self%domain%iel
136 jsl = self%domain%jsl
137 jel = self%domain%jel
139 allocate(self%bgerr_model(is:ie,js:je))
140 self%bgerr_model = 0.0_kind_real
142 lon(isl:iel,jsl:jel), lat(isl:iel,jsl:jel), &
143 self%bgerr_model(is:ie,js:je))
145 end subroutine soca_omb_stats_bin
152 subroutine soca_omb_stats_exit(self)
155 deallocate(self%lon, self%lat, self%bgerr, self%bgerr_model)
157 end subroutine soca_omb_stats_exit
surface background error used by soca_bkgerrgodas_mod
various utility functions
subroutine, public nc_check(status)
wrapper for netcdf calls
subroutine, public soca_remap_idw(lon_src, lat_src, data_src, lon_dst, lat_dst, data_dst)
inverse distance weighted remaping (modified Shepard's method)
domain indices used by soca_omb_stats
interpolate surface background error file to grid