UFO
ROobserror.interface.F90
Go to the documentation of this file.
1 !
2 ! (C) Copyright 2017-2018 UCAR
3 !
4 ! This software is licensed under the terms of the Apache Licence Version 2.0
5 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6 !
8 
9 use fckit_configuration_module, only: fckit_configuration
10 use iso_c_binding
12 use kinds
13 
16 
17 implicit none
18 private
19 
20 #define LISTED_TYPE ufo_roobserror
21 
22 !> Linked list interface - defines registry_t type
23 #include "oops/util/linkedList_i.f"
24 
25 !> Global registry
26 type(registry_t) :: ufo_roobserror_registry
27 
28 ! ------------------------------------------------------------------------------
29 contains
30 ! ------------------------------------------------------------------------------
31 !> Linked list implementation
32 #include "oops/util/linkedList_c.f"
33 ! ------------------------------------------------------------------------------
34 
35 subroutine ufo_roobserror_create_c(c_self, c_obspace, c_conf, c_filtervar) bind(c,name='ufo_roobserror_create_f90')
36 use oops_variables_mod
37 implicit none
38 integer(c_int), intent(inout) :: c_self
39 type(c_ptr), value, intent(in) :: c_obspace
40 type(c_ptr), value, intent(in) :: c_conf
41 type(c_ptr), value, intent(in) :: c_filtervar
42 type(ufo_roobserror), pointer :: self
43 type(fckit_configuration) :: f_conf
44 
45 call ufo_roobserror_registry%setup(c_self, self)
46 f_conf = fckit_configuration(c_conf)
47 
48 self%obsvar = oops_variables(c_filtervar)
49 self%variable = self%obsvar%variable(1)
50 
51 call ufo_roobserror_create(self, c_obspace, f_conf)
52 
53 end subroutine ufo_roobserror_create_c
54 
55 ! ------------------------------------------------------------------------------
56 
57 subroutine ufo_roobserror_delete_c(c_self) bind(c,name='ufo_roobserror_delete_f90')
58 implicit none
59 integer(c_int), intent(inout) :: c_self
60 
61 type(ufo_roobserror), pointer :: self
62 
63 call ufo_roobserror_registry%get(c_self, self)
64 call ufo_roobserror_delete(self)
65 call ufo_roobserror_registry%delete(c_self, self)
66 
67 end subroutine ufo_roobserror_delete_c
68 
69 ! ------------------------------------------------------------------------------
70 
71 subroutine ufo_roobserror_prior_c(c_self, air_nobs, air_nlevs, air_temperature, &
72  height_nobs, height_nlevs, geopotential_height) bind(c,name='ufo_roobserror_prior_f90')
73 
74 implicit none
75 
76 integer(c_int), intent(in) :: c_self ! The object containing configuration info
77 integer(c_int), intent(in) :: air_nlevs ! The number of vertical levels in air_temperature
78 integer(c_int), intent(in) :: air_nobs ! The number of observations in air_temperature
79 real(c_float), intent(in) :: air_temperature(1:air_nobs,1:air_nlevs)
80  ! The geovals with air temperature
81 integer(c_int), intent(in) :: height_nlevs ! The number of vertical levels in geopotential_height
82 integer(c_int), intent(in) :: height_nobs ! The number of observations in geopotential_height
83 real(c_float), intent(in) :: geopotential_height(1:height_nobs,1:height_nlevs)
84  ! The geovals with geopotential height
85 
86 type(ufo_roobserror), pointer :: self
87 character(len=200) :: ErrorMessage ! Error message to be output
88 
89 call ufo_roobserror_registry%get(c_self, self)
90 
91 if (height_nlevs /= air_nlevs) then
92  write(errormessage, '(2A,2I7)') "air_temperature and geopotential_height must have the same number of levels", &
93  " I received: ", air_nlevs, height_nlevs
94  call abor1_ftn(errormessage)
95 end if
96 
97 if (height_nobs /= air_nobs) then
98  write(errormessage, '(2A,2I7)') "air_temperature and geopotential_height must have the same number of locations", &
99  " I received: ", air_nobs, height_nobs
100  call abor1_ftn(errormessage)
101 end if
102 
103 call ufo_roobserror_prior(self, air_nobs, air_nlevs, air_temperature, &
104  geopotential_height)
105 
106 end subroutine ufo_roobserror_prior_c
107 
108 ! ------------------------------------------------------------------------------
109 
110 end module ufo_roobserror_mod_c
type(registry_t), public ufo_geovals_registry
Linked list interface - defines registry_t type.
subroutine ufo_roobserror_delete_c(c_self)
type(registry_t) ufo_roobserror_registry
Linked list interface - defines registry_t type.
subroutine ufo_roobserror_prior_c(c_self, air_nobs, air_nlevs, air_temperature, height_nobs, height_nlevs, geopotential_height)
subroutine ufo_roobserror_create_c(c_self, c_obspace, c_conf, c_filtervar)
Linked list implementation.
Fortran module to implement RO observational error.
subroutine, public ufo_roobserror_prior(self, model_nobs, model_nlevs, air_temperature, geopotential_height)
subroutine, public ufo_roobserror_create(self, obspace, f_conf)
subroutine, public ufo_roobserror_delete(self)