9 #include <fckit/fctest.h>
12 testsuite(obsspace_fortran)
18 call liboops_initialise()
19 call fckit_main%init()
26 call fckit_main%final()
27 call liboops_finalise()
28 end_testsuite_finalize
31 test(test_obsspace_construct)
32 use fckit_configuration_module
33 use fckit_pathname_module,
only : fckit_pathname
37 use oops_variables_mod
38 use,
intrinsic :: iso_c_binding
41 character(len=:),
allocatable :: filename
42 type(fckit_configuration) :: config
43 type(fckit_configuration),
allocatable :: obsconfigs(:)
44 type(fckit_configuration) :: obsconfig
46 character(kind=c_char,len=:),
allocatable :: winbgnstr
47 character(kind=c_char,len=:),
allocatable :: winendstr
48 type(datetime) :: winbgn, winend
50 type(c_ptr),
allocatable,
dimension(:) :: obsspace
51 integer :: nlocs, nlocs_ref
52 integer :: nvars, nvars_ref
54 character(len=100) :: obsname
55 character(kind=c_char,len=:),
allocatable :: obsname_ref
56 type(oops_variables) :: vars
59 call fckit_resource(
"--config",
"", filename)
60 config = fckit_yamlconfiguration(fckit_pathname(filename))
61 call config%get_or_die(
"window begin", winbgnstr)
62 call config%get_or_die(
"window end", winendstr)
63 call datetime_create(winbgnstr, winbgn)
64 call datetime_create(winendstr, winend)
66 call config%get_or_die(
"observations", obsconfigs)
67 allocate(obsspace(
size(obsconfigs)))
68 do iobstype = 1,
size(obsconfigs)
69 call obsconfigs(iobstype)%get_or_die(
"obs space", obsconfig)
74 call obsconfig%get_or_die(
"name", obsname_ref)
75 check_equal(obsname, obsname_ref)
79 call obsconfig%get_or_die(
"test data.nlocs", nlocs_ref)
80 call obsconfig%get_or_die(
"test data.nvars", nvars_ref)
81 check_equal(nlocs, nlocs_ref)
82 check_equal(nvars, nvars_ref)
85 call obsconfig%get_or_die(
"test data.nvars obsvars", nvars_ref)
86 check_equal(vars%nvars(), nvars_ref)
89 do iobstype = 1,
size(obsspace)
92 deallocate(obsspace, obsname_ref)