UFO
ufo_identity_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 identity observation operator
7 !---------------------------------------------------------------------------------------------------
9 
10  use oops_variables_mod
11  use ufo_vars_mod
12 
13 ! Fortran derived type for the observation type
14 !---------------------------------------------------------------------------------------------------
15  type, public :: ufo_identity
16  type(oops_variables), public :: obsvars
17  type(oops_variables), public :: geovars
18  contains
19  procedure :: setup => identity_setup_
20  procedure :: simobs => identity_simobs_
21  end type ufo_identity
22 
23 contains
24 
25 ! ------------------------------------------------------------------------------
26 subroutine identity_setup_(self)
27 implicit none
28 class(ufo_identity), intent(inout) :: self
29 
30 integer :: nvars, ivar
31 
32 ! set variables requested from the model (same as simulated):
33 nvars = self%obsvars%nvars()
34 do ivar = 1, nvars
35  call self%geovars%push_back(self%obsvars%variable(ivar))
36 enddo
37 
38 end subroutine identity_setup_
39 
40 
41 ! ------------------------------------------------------------------------------
42 subroutine identity_simobs_(self, geovals, obss, nvars, nlocs, hofx)
43  use ufo_geovals_mod
44  use obsspace_mod
45  use iso_c_binding
46  implicit none
47  class(ufo_identity), intent(in) :: self
48  type(ufo_geovals), intent(in) :: geovals
49  integer, intent(in) :: nvars, nlocs
50  real(c_double), intent(inout) :: hofx(nvars, nlocs)
51  type(c_ptr), value, intent(in) :: obss
52 
53  integer :: iobs, ivar
54  type(ufo_geoval), pointer :: point
55  character(len=MAXVARLEN) :: geovar
56 
57  do ivar = 1, nvars
58  !> Get the name of input variable in geovals
59  geovar = self%geovars%variable(ivar)
60 
61  !> Get profile for this variable from geovals
62  call ufo_geovals_get_var(geovals, geovar, point)
63 
64  !> Here we just apply a identity hofx
65  do iobs = 1, nlocs
66  hofx(ivar,iobs) = point%vals(1,iobs)
67  enddo
68  enddo
69 
70 end subroutine identity_simobs_
71 
72 end module ufo_identity_mod
ufo_identity_mod
Definition: ufo_identity_mod.F90:8
ufo_identity_mod::identity_setup_
subroutine identity_setup_(self)
Definition: ufo_identity_mod.F90:27
ufo_geovals_mod
Definition: ufo_geovals_mod.F90:7
ufo_vars_mod
Definition: ufo_variables_mod.F90:8
ufo_identity_mod::identity_simobs_
subroutine identity_simobs_(self, geovals, obss, nvars, nlocs, hofx)
Definition: ufo_identity_mod.F90:43
ufo_geovals_mod::ufo_geovals_get_var
subroutine, public ufo_geovals_get_var(self, varname, geoval)
Definition: ufo_geovals_mod.F90:128
ufo_identity_mod::ufo_identity
Definition: ufo_identity_mod.F90:15
ufo_geovals_mod::ufo_geovals
type to hold interpolated fields required by the obs operators
Definition: ufo_geovals_mod.F90:47
ufo_geovals_mod::ufo_geoval
type to hold interpolated field for one variable, one observation
Definition: ufo_geovals_mod.F90:40