UFO
new_obsop/example/ufo_example_mod.F90
Go to the documentation of this file.
1 ! (C) Copyright 2017-2018 UCAR
2 !
3 ! This software is licensed under the terms of the Apache Licence Version 2.0
4 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5 
6 !> Fortran module for example observation operator
7 
9 
10  use oops_variables_mod
11  use ufo_vars_mod
12 
13  implicit none
14  private
15 
16 !> Fortran derived type for the observation type
17 ! TODO: fill in if needed
18  type, public :: ufo_example
19  private
20  type(oops_variables), public :: obsvars
21  type(oops_variables), public :: geovars
22  contains
23  procedure :: setup => ufo_example_setup
24  procedure :: simobs => ufo_example_simobs
25  final :: destructor
26  end type ufo_example
27 
28 contains
29 
30 ! ------------------------------------------------------------------------------
31 ! TODO: add setup of your observation operator (optional)
32 subroutine ufo_example_setup(self, f_conf)
33 use fckit_configuration_module, only: fckit_configuration
34 implicit none
35 class(ufo_example), intent(inout) :: self
36 type(fckit_configuration), intent(in) :: f_conf
37 
38 
39 ! TODO: add input variables (requested from the model)
40 ! self%geovars%push_back("variable name")
41 
42 end subroutine ufo_example_setup
43 
44 ! ------------------------------------------------------------------------------
45 ! TODO: add cleanup of your observation operator (optional)
46 subroutine destructor(self)
47 implicit none
48 type(ufo_example), intent(inout) :: self
49 
50 end subroutine destructor
51 
52 ! ------------------------------------------------------------------------------
53 ! TODO: put code for your nonlinear observation operator in this routine
54 ! Code in this routine is for example only, please remove and replace
55 subroutine ufo_example_simobs(self, geovals, obss, nvars, nlocs, hofx)
56 use kinds
58 use iso_c_binding
59 use obsspace_mod
60 implicit none
61 class(ufo_example), intent(in) :: self
62 integer, intent(in) :: nvars, nlocs
63 type(ufo_geovals), intent(in) :: geovals
64 real(c_double), intent(inout) :: hofx(nvars, nlocs)
65 type(c_ptr), value, intent(in) :: obss
66 
67 ! Local variables
68 !type(ufo_geoval), pointer :: geoval
69 !real(kind_real), dimension(:), allocatable :: obss_metadata
70 
71 ! check if some variable is in geovals and get it (var_tv is defined in ufo_vars_mod)
72 !call ufo_geovals_get_var(geovals, var_tv, geoval)
73 
74 ! get some metadata from obsspace
75 !allocate(obss_metadata(nlocs))
76 !call obsspace_get_db(obss, "MetaData", "some_metadata", obss_metadata)
77 
78 ! put observation operator code here
79 
80 
81 end subroutine ufo_example_simobs
82 
83 
84 ! ------------------------------------------------------------------------------
85 
86 end module ufo_example_mod
Fortran module for example observation operator.
subroutine ufo_example_simobs(self, geovals, obss, nvars, nlocs, hofx)
subroutine ufo_example_setup(self, f_conf)
subroutine, public ufo_geovals_get_var(self, varname, geoval)
Fortran derived type for the observation type.
type to hold interpolated field for one variable, one observation
type to hold interpolated fields required by the obs operators