10 use fckit_mpi_module,
only: fckit_mpi_sum,fckit_mpi_status
32 real(kind_real),
parameter ::
cor_th = 0.2_kind_real
37 real(kind_real),
allocatable :: dist(:,:,:)
38 real(kind_real),
allocatable :: valid(:,:,:)
39 real(kind_real),
allocatable :: rhflt(:,:,:)
41 real(kind_real),
allocatable :: lon_c2a(:,:)
42 real(kind_real),
allocatable :: lat_c2a(:,:)
43 real(kind_real),
allocatable :: lon_c2a_raw(:,:,:)
44 real(kind_real),
allocatable :: lat_c2a_raw(:,:,:)
45 real(kind_real),
allocatable :: dist_c2a_raw(:,:,:)
46 real(kind_real),
allocatable :: lon_c2a_flt(:,:,:)
47 real(kind_real),
allocatable :: lat_c2a_flt(:,:,:)
48 real(kind_real),
allocatable :: dist_c2a_flt(:,:,:)
70 class(displ_type),
intent(inout) :: displ
71 type(nam_type),
intent(in) :: nam
72 type(geom_type),
intent(in) :: geom
73 type(samp_type),
intent(in) :: samp
76 allocate(displ%dist(0:nam%displ_niter,geom%nl0,2:nam%nts))
77 allocate(displ%valid(0:nam%displ_niter,geom%nl0,2:nam%nts))
78 allocate(displ%rhflt(0:nam%displ_niter,geom%nl0,2:nam%nts))
79 allocate(displ%lon_c2a(samp%nc2a,geom%nl0))
80 allocate(displ%lat_c2a(samp%nc2a,geom%nl0))
81 allocate(displ%lon_c2a_raw(samp%nc2a,geom%nl0,2:nam%nts))
82 allocate(displ%lat_c2a_raw(samp%nc2a,geom%nl0,2:nam%nts))
83 allocate(displ%dist_c2a_raw(samp%nc2a,geom%nl0,2:nam%nts))
84 allocate(displ%lon_c2a_flt(samp%nc2a,geom%nl0,2:nam%nts))
85 allocate(displ%lat_c2a_flt(samp%nc2a,geom%nl0,2:nam%nts))
86 allocate(displ%dist_c2a_flt(samp%nc2a,geom%nl0,2:nam%nts))
92 call msr(displ%lon_c2a)
93 call msr(displ%lat_c2a)
94 call msr(displ%lon_c2a_raw)
95 call msr(displ%lat_c2a_raw)
96 call msr(displ%dist_c2a_raw)
97 call msr(displ%lon_c2a_flt)
98 call msr(displ%lat_c2a_flt)
99 call msr(displ%dist_c2a_flt)
112 class(displ_type),
intent(inout) :: displ
115 if (
allocated(displ%dist))
deallocate(displ%dist)
116 if (
allocated(displ%valid))
deallocate(displ%valid)
117 if (
allocated(displ%rhflt))
deallocate(displ%rhflt)
118 if (
allocated(displ%lon_c2a))
deallocate(displ%lon_c2a)
119 if (
allocated(displ%lat_c2a))
deallocate(displ%lat_c2a)
120 if (
allocated(displ%lon_c2a_raw))
deallocate(displ%lon_c2a_raw)
121 if (
allocated(displ%lat_c2a_raw))
deallocate(displ%lat_c2a_raw)
122 if (
allocated(displ%dist_c2a_raw))
deallocate(displ%dist_c2a_raw)
123 if (
allocated(displ%lon_c2a_flt))
deallocate(displ%lon_c2a_flt)
124 if (
allocated(displ%lat_c2a_flt))
deallocate(displ%lat_c2a_flt)
125 if (
allocated(displ%dist_c2a_flt))
deallocate(displ%dist_c2a_flt)
138 class(displ_type),
intent(inout) :: displ
139 type(mpl_type),
intent(inout) :: mpl
140 type(nam_type),
intent(in) :: nam
141 type(geom_type),
intent(in) :: geom
142 type(samp_type),
intent(inout) :: samp
143 type(ens_type),
intent(in) :: ens
146 integer :: ic0,ic1,ic2,ic2a,jc0,jc1,il0,il0i,isub,iv,its,ie,ie_sub,iter,ic0a,jc0d,ind
147 real(kind_real) :: fac4,fac6,m11_avg,m2m2_avg,fld_1,fld_2,drhflt,dum,cormax
148 real(kind_real) :: lon_target,lat_target,rad_target,x_cm,y_cm,z_cm,n_cm
149 real(kind_real) :: norm_tot,distsum_tot
150 real(kind_real),
allocatable :: fld_ext(:,:,:,:)
151 real(kind_real),
allocatable :: m1_1(:,:,:,:,:,:),m2_1(:,:,:,:,:,:)
152 real(kind_real),
allocatable :: m1_2(:,:,:,:,:,:),m2_2(:,:,:,:,:,:)
153 real(kind_real),
allocatable :: m11(:,:,:,:,:,:)
154 real(kind_real),
allocatable :: cor(:),cor_avg(:)
155 real(kind_real),
allocatable :: x(:),y(:),z(:)
156 real(kind_real) :: dlon_c0a(geom%nc0a),dlat_c0a(geom%nc0a)
157 real(kind_real) :: dlon_c2a(samp%nc2a),dlat_c2a(samp%nc2a),dist_c2a(samp%nc2a)
158 real(kind_real) :: dlon_c2b(samp%nc2b),dlat_c2b(samp%nc2b)
159 real(kind_real) :: lon_c2a_ori(samp%nc2a,geom%nl0),lat_c2a_ori(samp%nc2a,geom%nl0)
160 real(kind_real) :: lon_c2a(samp%nc2a),lat_c2a(samp%nc2a)
161 real(kind_real),
allocatable :: lon_c2(:),lat_c2(:),valid_c2(:)
162 real(kind_real) :: x_ori(samp%nc2a),y_ori(samp%nc2a),z_ori(samp%nc2a)
163 real(kind_real) :: dx_ini(samp%nc2a),dy_ini(samp%nc2a),dz_ini(samp%nc2a)
164 real(kind_real) :: dx(samp%nc2a),dy(samp%nc2a),dz(samp%nc2a)
165 logical :: dichotomy,convergence
166 logical :: mask_c2a(samp%nc2a,geom%nl0),mask_c2(nam%nc2,geom%nl0)
167 type(mesh_type) :: mesh
170 call displ%alloc(nam,geom,samp)
171 allocate(fld_ext(samp%nc0d,geom%nl0,nam%nv,2:nam%nts))
172 allocate(m1_1(nam%nc1,samp%nc2a,geom%nl0,nam%nv,2:nam%nts,ens%nsub))
173 allocate(m2_1(nam%nc1,samp%nc2a,geom%nl0,nam%nv,2:nam%nts,ens%nsub))
174 allocate(m1_2(nam%nc1,samp%nc2a,geom%nl0,nam%nv,2:nam%nts,ens%nsub))
175 allocate(m2_2(nam%nc1,samp%nc2a,geom%nl0,nam%nv,2:nam%nts,ens%nsub))
176 allocate(m11(nam%nc1,samp%nc2a,geom%nl0,nam%nv,2:nam%nts,ens%nsub))
177 allocate(lon_c2(nam%nc2))
178 allocate(lat_c2(nam%nc2))
179 allocate(valid_c2(nam%nc2))
191 ic1 = samp%c2_to_c1(ic2)
192 mask_c2(ic2,il0) = samp%c1l0_log(ic1,il0)
195 ic2 = samp%c2a_to_c2(ic2a)
196 mask_c2a(ic2a,il0) = mask_c2(ic2,il0)
197 if (mask_c2a(ic2a,il0))
then 198 ic0 = samp%c2_to_c0(ic2)
199 lon_c2a_ori(ic2a,il0) = geom%lon(ic0)
200 lat_c2a_ori(ic2a,il0) = geom%lat(ic0)
206 displ%lon_c2a = lon_c2a_ori
207 displ%lat_c2a = lat_c2a_ori
210 write(mpl%info,
'(a7,a)')
'',
'Compute moments' 213 if (ens%nsub==1)
then 214 write(mpl%info,
'(a10,a)',advance=
'no')
'',
'Full ensemble, member:' 216 write(mpl%info,
'(a10,a,i4,a)',advance=
'no')
'',
'Sub-ensemble ',isub,
', member:' 221 do ie_sub=1,ens%ne/ens%nsub
222 write(mpl%info,
'(i4)',advance=
'no') ie_sub
226 ie = ie_sub+(isub-1)*ens%ne/ens%nsub
229 fac4 = 1.0/
real(ie_sub,kind_real)
230 fac6 =
real(ie_sub-1,kind_real)/
real(ie_sub,kind_real)
235 call samp%com_AD%ext(mpl,geom%nl0,ens%fld(:,:,iv,its,ie),fld_ext(:,:,iv,its))
244 ic2 = samp%c2a_to_c2(ic2a)
245 ic1 = samp%c2_to_c1(ic2)
246 if (samp%c1l0_log(ic1,il0))
then 248 if (samp%displ_mask(jc1,ic2))
then 250 ic0 = samp%c2_to_c0(ic2)
251 jc0 = samp%c1_to_c0(jc1)
252 ic0a = geom%c0_to_c0a(ic0)
253 jc0d = samp%c0_to_c0d(jc0)
256 fld_1 = ens%fld(ic0a,il0,iv,1,ie)
257 fld_2 = fld_ext(jc0d,il0,iv,its)
260 fld_1 = fld_1 - m1_1(jc1,ic2a,il0,iv,its,isub)
261 fld_2 = fld_2 - m1_2(jc1,ic2a,il0,iv,its,isub)
266 m11(jc1,ic2a,il0,iv,its,isub) = m11(jc1,ic2a,il0,iv,its,isub)+fac6*fld_1*fld_2
269 m2_1(jc1,ic2a,il0,iv,its,isub) = m2_1(jc1,ic2a,il0,iv,its,isub)+fac6*fld_1**2
270 m2_2(jc1,ic2a,il0,iv,its,isub) = m2_2(jc1,ic2a,il0,iv,its,isub)+fac6*fld_2**2
274 m1_1(jc1,ic2a,il0,iv,its,isub) = m1_1(jc1,ic2a,il0,iv,its,isub)+fac4*fld_1
275 m1_2(jc1,ic2a,il0,iv,its,isub) = m1_2(jc1,ic2a,il0,iv,its,isub)+fac4*fld_2
285 write(mpl%info,
'(a)')
'' 290 write(mpl%info,
'(a7,a)')
'',
'Find correlation propagation' 295 write(mpl%info,
'(a10,a,i2,a,i3)')
'',
'Timeslot ',its,
' - level ',nam%levs(il0)
299 call mpl%f_comm%allreduce(
real(count(mask_c2a(:,il0)),kind_real),norm_tot,fckit_mpi_sum())
304 ic2 = samp%c2a_to_c2(ic2a)
305 if (mask_c2a(ic2a,il0))
then 307 allocate(cor(nam%nv))
308 allocate(cor_avg(nam%nc1))
312 call msr(cor_avg(jc1))
314 if (samp%displ_mask(jc1,ic2))
then 318 m11_avg = sum(m11(jc1,ic2a,il0,iv,its,:))/
real(ens%nsub,kind_real)
319 m2m2_avg = sum(m2_1(jc1,ic2a,il0,iv,its,:))*sum(m2_2(jc1,ic2a,il0,iv,its,:))/
real(ens%nsub**2,kind_real)
320 if (m2m2_avg>0.0)
then 321 cor(iv) = m11_avg/sqrt(m2m2_avg)
329 cor_avg(jc1) = sum(cor,mask=
isnotmsr(cor))/
real(count(isnotmsr(cor)),kind_real)
331 call mpl%abort(
'average correlation contains missing values only')
339 if (maxval(cor_avg)>
cor_th)
then 344 if (cor_avg(jc1)>cormax)
then 346 cormax = cor_avg(jc1)
350 jc0 = samp%c1_to_c0(jc1)
351 lon_target = geom%lon(jc0)
352 lat_target = geom%lat(jc0)
357 case (
'cor_center_mass')
372 if (cor_avg(jc1)>
max(
cor_th,0.5*maxval(cor_avg)))
then 374 jc0 = samp%c1_to_c0(jc1)
375 call trans(1,geom%lat(jc0),geom%lon(jc0),x,y,z)
378 x_cm = x_cm+cor_avg(jc1)*x(1)
379 y_cm = y_cm+cor_avg(jc1)*y(1)
380 z_cm = z_cm+cor_avg(jc1)*z(1)
381 n_cm = n_cm+cor_avg(jc1)
392 call scoord(x_cm,y_cm,z_cm,lat_target,lon_target,rad_target)
405 dlon_c2a(ic2a) = lon_target-lon_c2a_ori(ic2a,il0)
406 dlat_c2a(ic2a) = lat_target-lat_c2a_ori(ic2a,il0)
407 call lonlatmod(dlon_c2a(ic2a),dlat_c2a(ic2a))
408 call sphere_dist(lon_c2a_ori(ic2a,il0),lat_c2a_ori(ic2a,il0),lon_target,lat_target,dist_c2a(ic2a))
419 lon_c2a(ic2a) = lon_c2a_ori(ic2a,il0)+dlon_c2a(ic2a)
420 lat_c2a(ic2a) = lat_c2a_ori(ic2a,il0)+dlat_c2a(ic2a)
421 call lonlatmod(lon_c2a(ic2a),lat_c2a(ic2a))
425 call mpl%loc_to_glb(samp%nc2a,lon_c2a,nam%nc2,samp%c2_to_proc,samp%c2_to_c2a,.false.,lon_c2)
426 call mpl%loc_to_glb(samp%nc2a,lat_c2a,nam%nc2,samp%c2_to_proc,samp%c2_to_c2a,.false.,lat_c2)
428 mesh = samp%mesh%copy()
429 call mesh%trans(lon_c2,lat_c2)
430 call mesh%check(valid_c2)
431 displ%valid(0,il0,its) = sum(valid_c2,mask=mask_c2(:,il0))/
real(count((mask_c2(:,il0))),kind_real)
433 call mpl%f_comm%broadcast(displ%valid(0,il0,its),mpl%ioproc-1)
434 displ%rhflt(0,il0,its) = 0.0
437 call mpl%f_comm%allreduce(sum(dist_c2a,mask=mask_c2a(:,il0)),distsum_tot,fckit_mpi_sum())
438 displ%dist(0,il0,its) = distsum_tot/norm_tot
441 displ%lon_c2a_raw(:,il0,its) = lon_c2a
442 displ%lat_c2a_raw(:,il0,its) = lat_c2a
443 displ%dist_c2a_raw(:,il0,its) = dist_c2a
445 if (nam%displ_niter>0)
then 449 call trans(samp%nc2a,lat_c2a_ori(:,il0),lon_c2a_ori(:,il0),x_ori,y_ori,z_ori)
450 call trans(samp%nc2a,lat_c2a,lon_c2a,dx_ini,dy_ini,dz_ini)
453 dx_ini = dx_ini-x_ori
454 dy_ini = dy_ini-y_ori
455 dz_ini = dz_ini-z_ori
458 displ%rhflt(1,il0,its) = nam%displ_rhflt
459 drhflt = displ%rhflt(1,il0,its)
461 do iter=1,nam%displ_niter
468 call samp%diag_filter(mpl,nam,geom,il0,
'median',displ%rhflt(iter,il0,its),dx)
469 call samp%diag_filter(mpl,nam,geom,il0,
'median',displ%rhflt(iter,il0,its),dy)
470 call samp%diag_filter(mpl,nam,geom,il0,
'median',displ%rhflt(iter,il0,its),dz)
473 call samp%diag_filter(mpl,nam,geom,il0,
'gc99',displ%rhflt(iter,il0,its),dx)
474 call samp%diag_filter(mpl,nam,geom,il0,
'gc99',displ%rhflt(iter,il0,its),dy)
475 call samp%diag_filter(mpl,nam,geom,il0,
'gc99',displ%rhflt(iter,il0,its),dz)
482 call scoord(dx(ic2a),dy(ic2a),dz(ic2a),lat_c2a(ic2a),lon_c2a(ic2a),dum)
487 if (mask_c2a(ic2a,il0))
then 488 ic2 = samp%c2a_to_c2(ic2a)
489 call reduce_arc(lon_c2a_ori(ic2a,il0),lat_c2a_ori(ic2a,il0),lon_c2a(ic2a),lat_c2a(ic2a),samp%mesh%bdist(ic2), &
491 dlon_c2a(ic2a) = lon_c2a(ic2a)-lon_c2a_ori(ic2a,il0)
492 dlat_c2a(ic2a) = lat_c2a(ic2a)-lat_c2a_ori(ic2a,il0)
498 lon_c2a(ic2a) = lon_c2a_ori(ic2a,il0)+dlon_c2a(ic2a)
499 lat_c2a(ic2a) = lat_c2a_ori(ic2a,il0)+dlat_c2a(ic2a)
500 call lonlatmod(lon_c2a(ic2a),lat_c2a(ic2a))
504 call mpl%loc_to_glb(samp%nc2a,lon_c2a,nam%nc2,samp%c2_to_proc,samp%c2_to_c2a,.false.,lon_c2)
505 call mpl%loc_to_glb(samp%nc2a,lat_c2a,nam%nc2,samp%c2_to_proc,samp%c2_to_c2a,.false.,lat_c2)
507 mesh = samp%mesh%copy()
508 call mesh%trans(lon_c2,lat_c2)
509 call mesh%check(valid_c2)
510 displ%valid(iter,il0,its) = sum(valid_c2,mask=mask_c2(:,il0))/
real(count((mask_c2(:,il0))),kind_real)
512 call mpl%f_comm%broadcast(displ%valid(iter,il0,its),mpl%ioproc-1)
516 if (mask_c2a(ic2a,il0))
call sphere_dist(lon_c2a_ori(ic2a,il0),lat_c2a_ori(ic2a,il0), &
517 & lon_c2a(ic2a),lat_c2a(ic2a),dist_c2a(ic2a))
521 call mpl%f_comm%allreduce(sum(dist_c2a,mask=mask_c2a(:,il0)),distsum_tot,fckit_mpi_sum())
522 displ%dist(iter,il0,its) = distsum_tot/norm_tot
525 write(mpl%info,
'(a13,a,i2,a,f10.2,a,f6.2,a,f6.2,a,f7.2,a)')
'',
'Iteration ',iter,
': rhflt = ', &
526 & displ%rhflt(iter,il0,its)*
reqkm,
' km, valid points: ',100.0*displ%valid(0,il0,its),
'% ~> ', &
527 & 100.0*displ%valid(iter,il0,its),
'%, average displacement = ',displ%dist(iter,il0,its)*
reqkm,
' km' 531 if (displ%valid(iter,il0,its)<1.0-nam%displ_tol)
then 535 if (iter<nam%displ_niter) displ%rhflt(iter+1,il0,its) = displ%rhflt(iter,il0,its)+drhflt
537 convergence = .false.
538 if (iter<nam%displ_niter) displ%rhflt(iter+1,il0,its) = displ%rhflt(iter,il0,its)+drhflt
546 if (.not.dichotomy)
then 553 if (iter<nam%displ_niter) displ%rhflt(iter+1,il0,its) = displ%rhflt(iter,il0,its)-drhflt
558 displ%lon_c2a_flt(:,il0,its) = lon_c2a
559 displ%lat_c2a_flt(:,il0,its) = lat_c2a
560 displ%dist_c2a_flt(:,il0,its) = dist_c2a
563 if (.not.convergence)
call mpl%abort(
'iterative filtering failed')
566 write(mpl%info,
'(a10,a22,f10.2,a,f6.2,a,f7.2,a)')
'',
'Raw displacement: rhflt = ', &
567 & displ%rhflt(0,il0,its)*
reqkm,
' km, valid points: ',100.0*displ%valid(0,il0,its),
'%, average displacement = ', &
568 & displ%dist(0,il0,its)*
reqkm,
' km' 574 call lonlatmod(dlon_c2a(ic2a),dlat_c2a(ic2a))
576 il0i =
min(il0,geom%nl0i)
577 call samp%com_AB%ext(mpl,dlon_c2a,dlon_c2b)
578 call samp%com_AB%ext(mpl,dlat_c2a,dlat_c2b)
579 call samp%h(il0i)%apply(mpl,dlon_c2b,dlon_c0a)
580 call samp%h(il0i)%apply(mpl,dlat_c2b,dlat_c0a)
584 ic0 = geom%c0a_to_c0(ic0a)
585 samp%displ_lon(ic0a,il0,its) = geom%lon(ic0)+dlon_c0a(ic0a)
586 samp%displ_lat(ic0a,il0,its) = geom%lat(ic0)+dlat_c0a(ic0a)
587 call lonlatmod(samp%displ_lon(ic0a,il0,its),samp%displ_lat(ic0a,il0,its))
595 ic0 = geom%c0a_to_c0(ic0a)
596 samp%displ_lon(ic0a,il0,1) = geom%lon(ic0)
597 samp%displ_lat(ic0a,il0,1) = geom%lat(ic0)
607 subroutine displ_write(displ,mpl,nam,geom,samp,filename)
612 class(displ_type),
intent(in) :: displ
613 type(mpl_type),
intent(inout) :: mpl
614 type(nam_type),
intent(in) :: nam
615 type(geom_type),
intent(in) :: geom
616 type(samp_type),
intent(in) :: samp
617 character(len=*),
intent(in) :: filename
620 integer :: ncid,nc2_id,nl0_id,nts_id,displ_niter_id,vunit_id,valid_id,dist_id,rhflt_id
621 integer :: lon_c2_id,lat_c2_id,lon_c2_raw_id,lat_c2_raw_id,dist_c2_raw_id,lon_c2_flt_id,lat_c2_flt_id,dist_c2_flt_id
622 integer :: iproc,its,il0,ic2a,ic2,i
623 integer,
allocatable :: c2a_to_c2(:)
624 real(kind_real),
allocatable :: sbuf(:),rbuf(:),lon_c2(:,:),lat_c2(:,:)
625 real(kind_real),
allocatable :: lon_c2_raw(:,:,:),lat_c2_raw(:,:,:),dist_c2_raw(:,:,:)
626 real(kind_real),
allocatable :: lon_c2_flt(:,:,:),lat_c2_flt(:,:,:),dist_c2_flt(:,:,:)
627 character(len=1024) :: subr =
'displ_write' 628 type(fckit_mpi_status) :: status
631 allocate(sbuf(samp%nc2a*geom%nl0*(2+(nam%nts-1)*6)))
637 sbuf(i) = displ%lon_c2a(ic2a,il0)*
rad2deg 639 sbuf(i) = displ%lat_c2a(ic2a,il0)*
rad2deg 642 sbuf(i) = displ%lon_c2a_raw(ic2a,il0,its)*
rad2deg 644 sbuf(i) = displ%lat_c2a_raw(ic2a,il0,its)*
rad2deg 646 sbuf(i) = displ%dist_c2a_raw(ic2a,il0,its)*
reqkm 648 sbuf(i) = displ%lon_c2a_flt(ic2a,il0,its)*
rad2deg 650 sbuf(i) = displ%lat_c2a_flt(ic2a,il0,its)*
rad2deg 652 sbuf(i) = displ%dist_c2a_flt(ic2a,il0,its)*
reqkm 660 allocate(lon_c2(nam%nc2,geom%nl0))
661 allocate(lat_c2(nam%nc2,geom%nl0))
662 allocate(lon_c2_raw(nam%nc2,geom%nl0,nam%nts-1))
663 allocate(lat_c2_raw(nam%nc2,geom%nl0,nam%nts-1))
664 allocate(dist_c2_raw(nam%nc2,geom%nl0,nam%nts-1))
665 allocate(lon_c2_flt(nam%nc2,geom%nl0,nam%nts-1))
666 allocate(lat_c2_flt(nam%nc2,geom%nl0,nam%nts-1))
667 allocate(dist_c2_flt(nam%nc2,geom%nl0,nam%nts-1))
671 allocate(c2a_to_c2(samp%proc_to_nc2a(iproc)))
672 allocate(rbuf(samp%proc_to_nc2a(iproc)*geom%nl0*(2+(nam%nts-1)*6)))
674 if (iproc==mpl%ioproc)
then 676 c2a_to_c2 = samp%c2a_to_c2
680 call mpl%f_comm%receive(c2a_to_c2,iproc-1,mpl%tag,status)
681 call mpl%f_comm%receive(rbuf,iproc-1,mpl%tag+1,status)
687 do ic2a=1,samp%proc_to_nc2a(iproc)
688 ic2 = c2a_to_c2(ic2a)
689 lon_c2(ic2,il0) = rbuf(i)
691 lat_c2(ic2,il0) = rbuf(i)
694 lon_c2_raw(ic2,il0,its-1) = rbuf(i)
696 lat_c2_raw(ic2,il0,its-1) = rbuf(i)
698 dist_c2_raw(ic2,il0,its-1) = rbuf(i)
700 lon_c2_flt(ic2,il0,its-1) = rbuf(i)
702 lat_c2_flt(ic2,il0,its-1) = rbuf(i)
704 dist_c2_flt(ic2,il0,its-1) = rbuf(i)
711 deallocate(c2a_to_c2)
716 call mpl%f_comm%send(samp%c2a_to_c2,mpl%ioproc-1,mpl%tag)
717 call mpl%f_comm%send(sbuf,mpl%ioproc-1,mpl%tag+1)
719 call mpl%update_tag(2)
726 call mpl%ncerr(subr,nf90_create(trim(nam%datadir)//
'/'//trim(filename),or(nf90_clobber,nf90_64bit_offset),ncid))
729 call nam%ncwrite(mpl,ncid)
732 call mpl%ncerr(subr,nf90_def_dim(ncid,
'nc2',nam%nc2,nc2_id))
733 call mpl%ncerr(subr,nf90_def_dim(ncid,
'nl0',geom%nl0,nl0_id))
734 call mpl%ncerr(subr,nf90_def_dim(ncid,
'nts',nam%nts-1,nts_id))
735 call mpl%ncerr(subr,nf90_def_dim(ncid,
'niter',nam%displ_niter+1,displ_niter_id))
738 call mpl%ncerr(subr,nf90_def_var(ncid,
'vunit',
ncfloat,(/nc2_id,nl0_id/),vunit_id))
739 call mpl%ncerr(subr,nf90_def_var(ncid,
'valid',
ncfloat,(/displ_niter_id,nl0_id,nts_id/),valid_id))
740 call mpl%ncerr(subr,nf90_put_att(ncid,valid_id,
'_FillValue',
msvalr))
741 call mpl%ncerr(subr,nf90_def_var(ncid,
'dist',
ncfloat,(/displ_niter_id,nl0_id,nts_id/),dist_id))
742 call mpl%ncerr(subr,nf90_put_att(ncid,dist_id,
'_FillValue',
msvalr))
743 call mpl%ncerr(subr,nf90_def_var(ncid,
'rhflt',
ncfloat,(/displ_niter_id,nl0_id,nts_id/),rhflt_id))
744 call mpl%ncerr(subr,nf90_put_att(ncid,rhflt_id,
'_FillValue',
msvalr))
745 call mpl%ncerr(subr,nf90_def_var(ncid,
'lon_c2',
ncfloat,(/nc2_id,nl0_id/),lon_c2_id))
746 call mpl%ncerr(subr,nf90_put_att(ncid,lon_c2_id,
'_FillValue',
msvalr))
747 call mpl%ncerr(subr,nf90_def_var(ncid,
'lat_c2',
ncfloat,(/nc2_id,nl0_id/),lat_c2_id))
748 call mpl%ncerr(subr,nf90_put_att(ncid,lat_c2_id,
'_FillValue',
msvalr))
749 call mpl%ncerr(subr,nf90_def_var(ncid,
'lon_c2_raw',
ncfloat,(/nc2_id,nl0_id,nts_id/),lon_c2_raw_id))
750 call mpl%ncerr(subr,nf90_put_att(ncid,lon_c2_raw_id,
'_FillValue',
msvalr))
751 call mpl%ncerr(subr,nf90_def_var(ncid,
'lat_c2_raw',
ncfloat,(/nc2_id,nl0_id,nts_id/),lat_c2_raw_id))
752 call mpl%ncerr(subr,nf90_put_att(ncid,lat_c2_raw_id,
'_FillValue',
msvalr))
753 call mpl%ncerr(subr,nf90_def_var(ncid,
'dist_c2_raw',
ncfloat,(/nc2_id,nl0_id,nts_id/),dist_c2_raw_id))
754 call mpl%ncerr(subr,nf90_put_att(ncid,dist_c2_raw_id,
'_FillValue',
msvalr))
755 call mpl%ncerr(subr,nf90_def_var(ncid,
'lon_c2_flt',
ncfloat,(/nc2_id,nl0_id,nts_id/),lon_c2_flt_id))
756 call mpl%ncerr(subr,nf90_put_att(ncid,lon_c2_flt_id,
'_FillValue',
msvalr))
757 call mpl%ncerr(subr,nf90_def_var(ncid,
'lat_c2_flt',
ncfloat,(/nc2_id,nl0_id,nts_id/),lat_c2_flt_id))
758 call mpl%ncerr(subr,nf90_put_att(ncid,lat_c2_flt_id,
'_FillValue',
msvalr))
759 call mpl%ncerr(subr,nf90_def_var(ncid,
'dist_c2_flt',
ncfloat,(/nc2_id,nl0_id,nts_id/),dist_c2_flt_id))
760 call mpl%ncerr(subr,nf90_put_att(ncid,dist_c2_flt_id,
'_FillValue',
msvalr))
763 call mpl%ncerr(subr,nf90_enddef(ncid))
766 call mpl%ncerr(subr,nf90_put_var(ncid,vunit_id,geom%vunit(samp%c2_to_c0,:)))
767 call mpl%ncerr(subr,nf90_put_var(ncid,valid_id,displ%valid))
768 call mpl%ncerr(subr,nf90_put_var(ncid,dist_id,displ%dist*
reqkm))
769 call mpl%ncerr(subr,nf90_put_var(ncid,rhflt_id,displ%rhflt*
reqkm))
770 call mpl%ncerr(subr,nf90_put_var(ncid,lon_c2_id,lon_c2))
771 call mpl%ncerr(subr,nf90_put_var(ncid,lat_c2_id,lat_c2))
772 call mpl%ncerr(subr,nf90_put_var(ncid,lon_c2_raw_id,lon_c2_raw))
773 call mpl%ncerr(subr,nf90_put_var(ncid,lat_c2_raw_id,lat_c2_raw))
774 call mpl%ncerr(subr,nf90_put_var(ncid,dist_c2_raw_id,dist_c2_raw))
775 call mpl%ncerr(subr,nf90_put_var(ncid,lon_c2_flt_id,lon_c2_flt))
776 call mpl%ncerr(subr,nf90_put_var(ncid,lat_c2_flt_id,lat_c2_flt))
777 call mpl%ncerr(subr,nf90_put_var(ncid,dist_c2_flt_id,dist_c2_flt))
780 call mpl%ncerr(subr,nf90_close(ncid))
785 deallocate(lon_c2_raw)
786 deallocate(lat_c2_raw)
787 deallocate(dist_c2_raw)
788 deallocate(lon_c2_flt)
789 deallocate(lat_c2_flt)
790 deallocate(dist_c2_flt)
character(len=1024) displ_method
subroutine displ_alloc(displ, nam, geom, samp)
subroutine displ_dealloc(displ)
real(kind_real), parameter cor_th
subroutine displ_compute(displ, mpl, nam, geom, samp, ens)
real(kind=kind_real), parameter req
Earth radius at equator (m)
subroutine displ_write(displ, mpl, nam, geom, samp, filename)
integer, parameter, public kind_real