9 use fckit_configuration_module,
only: fckit_configuration
21 #define LISTED_TYPE ufo_geovals
24 #include "oops/util/linkedList_i.f"
33 #include "oops/util/linkedList_c.f"
38 integer(c_int),
intent(inout) :: c_key_self
48 subroutine ufo_geovals_setup_c(c_key_self, c_nlocs, c_vars, c_nvars, c_sizes) bind(c,name='ufo_geovals_setup_f90')
49 use oops_variables_mod
51 integer(c_int),
intent(inout) :: c_key_self
52 integer(c_int),
intent(in) :: c_nlocs, c_nvars
53 type(c_ptr),
value,
intent(in) :: c_vars
54 integer(c_size_t),
intent(in) :: c_sizes(c_nvars)
57 type(oops_variables) :: vars
63 vars = oops_variables(c_vars)
70 use oops_variables_mod
72 integer(c_int),
intent(inout) :: c_key_self
73 integer(c_int),
intent(in) :: c_nlocs
74 type(c_ptr),
value,
intent(in) :: c_vars
77 type(oops_variables) :: vars
83 vars = oops_variables(c_vars)
90 use oops_variables_mod
92 integer(c_int),
intent(inout) :: c_key_self
93 integer(c_int),
intent(in) :: c_nlevels
94 type(c_ptr),
value,
intent(in) :: c_vars
97 type(oops_variables) :: vars
101 vars = oops_variables(c_vars)
111 integer(c_int),
intent(in) :: c_key_self
112 integer(c_int),
intent(inout) :: c_key_other
130 integer(c_int),
intent(inout) :: c_key_self
131 integer(c_int),
intent(in) :: c_key_other
132 integer(c_int),
intent(in) :: c_ind
155 integer(c_int),
intent(in) :: c_key_self
156 type(c_ptr),
value,
intent(in) :: c_locs
157 type(c_ptr),
value,
intent(in) :: c_conf
161 character(len=30) :: ic
162 character(len=:),
allocatable :: str
163 type(fckit_configuration) :: f_conf
167 f_conf = fckit_configuration(c_conf)
168 call f_conf%get_or_die(
"analytic_init",str)
180 integer(c_int),
intent(inout) :: c_key_self
196 integer(c_int),
intent(in) :: c_key_self
211 integer(c_int),
intent(in) :: c_key_self
212 integer(c_int),
intent(in) :: lvar
213 character(kind=c_char, len=1),
intent(in) :: c_var(lvar+1)
214 integer(c_int),
intent(in) :: lvar1
215 character(kind=c_char, len=1),
intent(in) :: c_var1(lvar1+1)
216 character(len=MAXVARLEN) :: varname
217 character(len=MAXVARLEN) :: vardir
220 call c_f_string(c_var, varname)
221 call c_f_string(c_var1, vardir)
232 integer(c_int),
intent(in) :: c_key_self
245 integer(c_int),
intent(in) :: c_key_self
246 real(c_double),
intent(inout) :: vrms
259 integer(c_int),
intent(in) :: c_key_self
272 integer(c_int),
intent(in) :: c_key_self
273 real(c_double),
intent(in) :: zz
286 integer(c_int),
intent(in) :: c_key_self
287 integer(c_int),
intent(in) :: nlocs
288 real(c_float),
intent(in) :: values(nlocs)
301 integer(c_int),
intent(in) :: c_key_self
302 integer(c_int),
intent(in) :: c_key_rhs
317 integer(c_int),
intent(in) :: c_key_self
318 integer(c_int),
intent(in) :: c_key_other
333 integer(c_int),
intent(in) :: c_key_self
334 integer(c_int),
intent(in) :: c_key_other
349 integer(c_int),
intent(in) :: c_key_self
350 integer(c_int),
intent(in) :: c_key_other
365 integer(c_int),
intent(in) :: c_key_self
366 integer(c_int),
intent(in) :: c_key_other
379 subroutine ufo_geovals_split_c(c_key_self, c_key_other1, c_key_other2) bind(c,name='ufo_geovals_split_f90')
381 integer(c_int),
intent(in) :: c_key_self, c_key_other1, c_key_other2
394 subroutine ufo_geovals_merge_c(c_key_self, c_key_other1, c_key_other2) bind(c,name='ufo_geovals_merge_f90')
396 integer(c_int),
intent(in) :: c_key_self, c_key_other1, c_key_other2
411 integer(c_int),
intent(in) :: c_key_self
412 integer(c_int),
intent(inout) :: kobs
413 integer(c_int),
intent(in) :: kvar
414 real(c_double),
intent(inout) :: pmin, pmax, prms
427 integer(c_int),
intent(in) :: c_key_self
428 integer(c_size_t),
intent(inout) :: kobs
442 integer(c_int),
intent(in) :: c_key_self
443 integer(c_int),
intent(in) :: lvar
444 character(kind=c_char, len=1),
intent(in) :: c_var(lvar+1)
445 integer(c_int),
intent(out) :: nlevs
448 character(len=MAXVARLEN) :: varname
451 call c_f_string(c_var, varname)
462 subroutine ufo_geovals_get2d_c(c_key_self, lvar, c_var, nlocs, values) bind(c, name='ufo_geovals_get2d_f90')
466 integer(c_int),
intent(in) :: c_key_self
467 integer(c_int),
intent(in) :: lvar
468 character(kind=c_char, len=1),
intent(in) :: c_var(lvar+1)
469 integer(c_int),
intent(in) :: nlocs
470 real(c_double),
intent(inout) :: values(nlocs)
472 character(max_string) :: err_msg
474 character(len=MAXVARLEN) :: varname
477 call c_f_string(c_var, varname)
482 if (
size(geoval%vals,1) /= 1)
then
483 write(err_msg,*)
'ufo_geovals_get2d_f90',trim(varname),
'is not a 2D var:',
size(geoval%vals,1),
' levels'
484 call abor1_ftn(err_msg)
486 if (nlocs /=
size(geoval%vals,2))
then
487 write(err_msg,*)
'ufo_geovals_get2d_f90',trim(varname),
'error locs number:',nlocs,
size(geoval%vals,2)
488 call abor1_ftn(err_msg)
491 values(:) = geoval%vals(1,:)
497 subroutine ufo_geovals_get_c(c_key_self, lvar, c_var, c_lev, nlocs, values) bind(c, name='ufo_geovals_get_f90')
501 integer(c_int),
intent(in) :: c_key_self
502 integer(c_int),
intent(in) :: lvar
503 character(kind=c_char, len=1),
intent(in) :: c_var(lvar+1)
504 integer(c_int),
intent(in) :: c_lev
505 integer(c_int),
intent(in) :: nlocs
506 real(c_float),
intent(inout) :: values(nlocs)
508 character(max_string) :: err_msg
510 character(len=MAXVARLEN) :: varname
512 integer(c_int) :: lev
517 call c_f_string(c_var, varname)
522 if (lev<1 .or. lev>
size(geoval%vals,1))
then
523 write(err_msg,*)
'ufo_geovals_get_f90 "',trim(varname),
'" level out of range: 1~', &
524 size(geoval%vals,1),
', lev=', lev
525 call abor1_ftn(err_msg)
527 if (nlocs /=
size(geoval%vals,2))
then
528 write(err_msg,*)
'ufo_geovals_get_f90 "',trim(varname),
'" error locs number:',nlocs,&
529 ' /= ',
size(geoval%vals,2)
530 call abor1_ftn(err_msg)
533 values(:) = geoval%vals(lev,:)
539 subroutine ufo_geovals_get_loc_c(c_key_self, lvar, c_var, c_loc, nlevs, values) bind(c, name='ufo_geovals_get_loc_f90')
543 integer(c_int),
intent(in) :: c_key_self
544 integer(c_int),
intent(in) :: lvar
545 character(kind=c_char, len=1),
intent(in) :: c_var(lvar+1)
546 integer(c_int),
intent(in) :: c_loc
547 integer(c_int),
intent(in) :: nlevs
548 real(c_double),
intent(inout) :: values(nlevs)
550 character(max_string) :: err_msg
552 character(len=MAXVARLEN) :: varname
554 integer(c_int) :: loc
556 call c_f_string(c_var, varname)
564 if (loc<1 .or. loc>
size(geoval%vals,2))
then
565 write(err_msg,*)
'ufo_geovals_get_loc_f90',trim(varname),
'location out of range:',loc,
size(geoval%vals,2)
566 call abor1_ftn(err_msg)
568 if (nlevs /=
size(geoval%vals,1))
then
569 write(err_msg,*)
'ufo_geovals_get_loc_f90',trim(varname),
'incorrect number of levels:',nlevs,
size(geoval%vals,1)
570 call abor1_ftn(err_msg)
573 values(:) = geoval%vals(:,loc)
580 bind(c, name=
'ufo_geovals_getdouble_f90')
584 integer(c_int),
intent(in) :: c_key_self
585 integer(c_int),
intent(in) :: lvar
586 character(kind=c_char, len=1),
intent(in) :: c_var(lvar+1)
587 integer(c_int),
intent(in) :: c_lev
588 integer(c_int),
intent(in) :: nlocs
589 real(c_double),
intent(inout) :: values(nlocs)
592 character(len=MAXVARLEN) :: varname
594 integer(c_int) :: lev
599 call c_f_string(c_var, varname)
602 values(:) = geoval%vals(lev,:)
611 integer(c_int),
intent(in) :: c_key_self
612 integer(c_int),
intent(in) :: lvar
613 character(kind=c_char, len=1),
intent(in) :: c_var(lvar+1)
614 integer(c_int),
intent(in) :: c_lev
615 integer(c_int),
intent(in) :: nlocs
616 real(c_double),
intent(in) :: values(nlocs)
619 character(len=MAXVARLEN) :: varname
621 integer(c_int) :: lev
626 call c_f_string(c_var, varname)
629 geoval%vals(lev,:) = values(:)
634 subroutine ufo_geovals_put_loc_c(c_key_self, lvar, c_var, c_loc, nlevs, values) bind(c, name='ufo_geovals_put_loc_f90')
639 integer(c_int),
intent(in) :: c_key_self
640 integer(c_int),
intent(in) :: lvar
641 character(kind=c_char, len=1),
intent(in) :: c_var(lvar+1)
642 integer(c_int),
intent(in) :: c_loc
643 integer(c_int),
intent(in) :: nlevs
644 real(c_double),
intent(in) :: values(nlevs)
646 character(max_string) :: err_msg
648 character(len=MAXVARLEN) :: varname
650 integer(c_int) :: loc
652 call c_f_string(c_var, varname)
659 if (loc<1 .or. loc>
size(geoval%vals,2))
then
660 write(err_msg,*)
'ufo_geovals_put_loc_f90',trim(varname),
'location out of range:',loc,
size(geoval%vals,2)
661 call abor1_ftn(err_msg)
663 if (nlevs /=
size(geoval%vals,1))
then
664 write(err_msg,*)
'ufo_geovals_put_loc_f90',trim(varname),
'incorrect number of levels:',nlevs,
size(geoval%vals,1)
665 call abor1_ftn(err_msg)
668 geoval%vals(:,loc) = values(:)
676 integer(c_int),
intent(in) :: c_key_self
677 real(c_double),
intent(inout) :: mxval
678 integer(c_int),
intent(inout) :: iloc, ivar
690 use oops_variables_mod
694 integer(c_int),
intent(inout) :: c_key_self
695 type(c_ptr),
value,
intent(in) :: c_conf
696 type(c_ptr),
value,
intent(in) :: c_obspace
697 type(c_ptr),
value,
intent(in) :: c_vars
700 character(max_string) :: filename
701 integer :: loc_multiplier
702 character(len=:),
allocatable :: str
703 type(fckit_configuration) :: f_conf
704 type(oops_variables) :: vars
711 f_conf = fckit_configuration(c_conf)
712 call f_conf%get_or_die(
"filename",str)
715 if (f_conf%has(
"loc_multiplier"))
then
716 call f_conf%get_or_die(
"loc_multiplier", loc_multiplier)
721 vars = oops_variables(c_vars)
731 integer(c_int),
intent(in) :: c_key_self
732 type(c_ptr),
value,
intent(in) :: c_conf
733 integer(c_size_t),
intent(in) :: c_rank
736 character(max_string) :: fout, filename
738 character(len=10) :: cproc
740 character(len=:),
allocatable :: str
741 type(fckit_configuration) :: f_conf
744 f_conf = fckit_configuration(c_conf)
745 call f_conf%get_or_die(
"filename",str)
748 write(cproc,fmt=
'(i4.4)') c_rank
752 ppos = scan(trim(filename),
'.', back=.true.)
755 fout = filename(1:ppos-1) //
'_' // trim(adjustl(cproc)) // trim(filename(ppos:))
758 fout = trim(filename) //
'_' // trim(adjustl(cproc))
subroutine ufo_geovals_put_loc_c(c_key_self, lvar, c_var, c_loc, nlevs, values)
subroutine ufo_geovals_nlocs_c(c_key_self, kobs)
subroutine ufo_geovals_normalize_c(c_key_self, c_key_other)
subroutine ufo_geovals_setup_c(c_key_self, c_nlocs, c_vars, c_nvars, c_sizes)
subroutine ufo_geovals_abs_c(c_key_self)
subroutine ufo_geovals_merge_c(c_key_self, c_key_other1, c_key_other2)
subroutine ufo_geovals_get_loc_c(c_key_self, lvar, c_var, c_loc, nlevs, values)
subroutine ufo_geovals_getdouble_c(c_key_self, lvar, c_var, c_lev, nlocs, values)
subroutine ufo_geovals_nlevs_c(c_key_self, lvar, c_var, nlevs)
subroutine ufo_geovals_split_c(c_key_self, c_key_other1, c_key_other2)
subroutine ufo_geovals_write_file_c(c_key_self, c_conf, c_rank)
subroutine ufo_geovals_schurmult_c(c_key_self, c_key_other)
subroutine ufo_geovals_random_c(c_key_self)
subroutine ufo_geovals_allocate_c(c_key_self, c_nlevels, c_vars)
Allocate GeoVaLs.
subroutine ufo_geovals_read_file_c(c_key_self, c_conf, c_obspace, c_vars)
integer, parameter max_string
subroutine ufo_geovals_putdouble_c(c_key_self, lvar, c_var, c_lev, nlocs, values)
subroutine ufo_geovals_get2d_c(c_key_self, lvar, c_var, nlocs, values)
subroutine ufo_geovals_default_constr_c(c_key_self)
Linked list implementation.
subroutine ufo_geovals_copy_c(c_key_self, c_key_other)
Copy one GeoVaLs object into another.
subroutine ufo_geovals_reorderzdir_c(c_key_self, lvar, c_var, lvar1, c_var1)
subroutine ufo_geovals_copy_one_c(c_key_self, c_key_other, c_ind)
Copy one GeoVaLs location into another object.
subroutine ufo_geovals_get_c(c_key_self, lvar, c_var, c_lev, nlocs, values)
subroutine ufo_geovals_partial_setup_c(c_key_self, c_nlocs, c_vars)
Setup GeoVaLs (store nlocs, variables; don't do allocation yet)
type(registry_t), public ufo_geovals_registry
Linked list interface - defines registry_t type.
subroutine ufo_geovals_add_c(c_key_self, c_key_other)
subroutine ufo_geovals_diff_c(c_key_self, c_key_other)
subroutine ufo_geovals_zero_c(c_key_self)
subroutine ufo_geovals_delete_c(c_key_self)
subroutine ufo_geovals_minmaxavg_c(c_key_self, kobs, kvar, pmin, pmax, prms)
subroutine ufo_geovals_analytic_init_c(c_key_self, c_locs, c_conf)
Analytic init.
subroutine ufo_geovals_rms_c(c_key_self, vrms)
subroutine ufo_geovals_maxloc_c(c_key_self, mxval, iloc, ivar)
subroutine ufo_geovals_profmult_c(c_key_self, nlocs, values)
subroutine ufo_geovals_assign_c(c_key_self, c_key_rhs)
subroutine ufo_geovals_scalmult_c(c_key_self, zz)
subroutine, public ufo_geovals_reorderzdir(self, varname, zdir)
subroutine, public ufo_geovals_maxloc(self, mxval, iobs, ivar)
Location where the summed geovals value is maximum.
subroutine, public ufo_geovals_default_constr(self)
subroutine, public ufo_geovals_allocate(self, vars, nlevels)
Deprecated. Rely on ufo_geovals_setup to allocate GeoVaLs instead. Allocates GeoVaLs for vars variabl...
subroutine, public ufo_geovals_random(self)
subroutine, public ufo_geovals_setup(self, vars, nlocs, nvars, nvals)
Initializes and allocates self GeoVaLs with nlocs number of locations for vars variables....
subroutine, public ufo_geovals_write_netcdf(self, filename)
subroutine, public ufo_geovals_normalize(self, other)
Normalization of one GeoVaLs object by another.
subroutine, public ufo_geovals_split(self, other1, other2)
subroutine, public ufo_geovals_read_netcdf(self, filename, loc_multiplier, c_obspace, vars)
subroutine, public ufo_geovals_rms(self, vrms)
subroutine, public ufo_geovals_copy(self, other)
Copy one GeoVaLs object into another.
subroutine, public ufo_geovals_delete(self)
subroutine, public ufo_geovals_analytic_init(self, locs, ic)
Initialize a GeoVaLs object based on an analytic state.
subroutine, public ufo_geovals_diff(self, other)
Difference between two GeoVaLs objects.
subroutine, public ufo_geovals_profmult(self, nlocs, values)
subroutine, public ufo_geovals_copy_one(self, other, loc_index)
Copy one location from GeoVaLs into a new object.
subroutine, public ufo_geovals_minmaxavg(self, kobs, kvar, pmin, pmax, prms)
subroutine, public ufo_geovals_scalmult(self, zz)
subroutine, public ufo_geovals_assign(self, rhs)
subroutine, public ufo_geovals_add(self, other)
Sum of two GeoVaLs objects.
subroutine, public ufo_geovals_get_var(self, varname, geoval)
subroutine, public ufo_geovals_partial_setup(self, vars, nlocs)
Deprecated, use ufo_geovals_setup instead. Partially initializes self GeoVaLs with nlocs number of lo...
subroutine, public ufo_geovals_zero(self)
subroutine, public ufo_geovals_abs(self)
subroutine, public ufo_geovals_schurmult(self, other)
Schur product of two GeoVaLs objects.
subroutine, public ufo_geovals_merge(self, other1, other2)
Fortran interface to ufo::Locations.
integer, parameter, public maxvarlen
type to hold interpolated field for one variable, one observation
type to hold interpolated fields required by the obs operators