FV3 Bundle
ufo_adt_mod.F90
Go to the documentation of this file.
1 ! (C) Copyright 2017 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 to handle adt observations
7 
8 module ufo_adt_mod
9 
10  use iso_c_binding
11  use ufo_vars_mod
12  use ioda_locs_mod
13  use ufo_geovals_mod
14  use kinds
16  use obsspace_mod
17 
18  implicit none
19  public :: ufo_adt
20  public :: ufo_adt_simobs
21  private
22  integer, parameter :: max_string=800
23 
24  !> Fortran derived type for adt observation operator
25  type :: ufo_adt
26  end type ufo_adt
27 
28  ! ------------------------------------------------------------------------------
29 
30 contains
31 
32  ! ------------------------------------------------------------------------------
33 
34  subroutine ufo_adt_simobs(self, geovals, hofx, obss)
35 
37  use iso_c_binding
38 
39  implicit none
40 
41  type(ufo_adt), intent(in) :: self
42  type(ufo_geovals), intent(in) :: geovals
43  type(c_ptr), value, intent(in) :: obss !< adt observations
44  real(c_double), intent(inout) :: hofx(:)
45 
46  character(len=*), parameter :: myname_="ufo_adt_simobs"
47  character(max_string) :: err_msg
48 
49  integer :: iobs
50  real(kind_real) :: offset_obs, offset_hofx
51  type(ufo_geoval), pointer :: geoval_adt
52 
53  real(kind_real), allocatable :: obs_adt(:)
54  integer :: nobs
55 
56  ! check if nobs is consistent in geovals & hofx
57  nobs = size(hofx,1)
58  if (geovals%nobs /= size(hofx,1)) then
59  write(err_msg,*) myname_, ' error: nobs inconsistent!'
60  call abor1_ftn(err_msg)
61  endif
62 
63  ! check if adt variable is in geovals and get it
64  call ufo_geovals_get_var(geovals, var_abs_topo, geoval_adt)
65 
66  hofx = 0.0
67 
68  !call obsspace_get_db(obss, "ObsValue", "adt", obs_adt)
69 
70  ! Compute offset
71  offset_hofx=sum(geoval_adt%vals(1,:))/nobs
72  offset_obs=0.0!sum(obs_adt(:))/nobs
73 
74  ! adt obs operator
75  do iobs = 1, nobs
76  ! remove offset from hofx
77  hofx(iobs) = geoval_adt%vals(1,iobs)+(offset_obs-offset_hofx)
78  enddo
79 
80  !deallocate(obs_adt)
81 
82  end subroutine ufo_adt_simobs
83 
84 end module ufo_adt_mod
Fortran module to handle temperature profile observations.
Definition: ncutils.F90:8
subroutine, public ufo_geovals_get_var(self, varname, geoval, status)
integer, parameter, public i_kind
Definition: ncd_kinds.F90:71
integer, parameter max_string
Fortran module to handle adt observations.
Definition: ufo_adt_mod.F90:8
Fortran derived type for adt observation operator.
Definition: ufo_adt_mod.F90:25
subroutine, public ufo_adt_simobs(self, geovals, hofx, obss)
Definition: ufo_adt_mod.F90:35
type to hold interpolated fields required by the obs operators
character(len=maxvarlen), public var_abs_topo
integer, parameter, public r_double
Definition: ncd_kinds.F90:80
Fortran module handling observation locations.
integer, parameter, public r_single
Definition: ncd_kinds.F90:79
Fortran interface to ObsSpace.
Definition: obsspace_mod.F90:9
integer, parameter, public r_kind
Definition: ncd_kinds.F90:108
type to hold interpolated field for one variable, one observation