FV3 Bundle
c_qg_obs_data.F90
Go to the documentation of this file.
1 ! (C) Copyright 2009-2016 ECMWF.
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 ! In applying this licence, ECMWF does not waive the privileges and immunities
6 ! granted to it by virtue of its status as an intergovernmental organisation nor
7 ! does it submit to any jurisdiction.
8 
9 !> Fortran module handling observations for the QG model
10 
12 
13 use qg_obs_data
16 use iso_c_binding
17 use config_mod
18 use fckit_log_module, only : fckit_log
19 use string_f_c_mod
20 
21 ! ------------------------------------------------------------------------------
22 contains
23 ! ------------------------------------------------------------------------------
24 
25 subroutine qg_obs_setup(c_key_self, c_conf) bind(c,name='qg_obsdb_setup_f90')
26 implicit none
27 integer(c_int), intent(inout) :: c_key_self
28 type(c_ptr), intent(in) :: c_conf !< configuration
29 
30 type(obs_data), pointer :: self
31 character(len=max_string) :: fin, fout
32 character(len=max_string+30) :: record
33 
34 if (config_element_exists(c_conf,"ObsData.ObsDataIn")) then
35  fin = config_get_string(c_conf,max_string,"ObsData.ObsDataIn.obsfile")
36 else
37  fin = ""
38 endif
39 write(record,*)'qg_obs_setup: file in =',trim(fin)
40 call fckit_log%info(record)
41 
42 fout = config_get_string(c_conf,max_string,"ObsData.ObsDataOut.obsfile")
43 write(record,*)'qg_obs_setup: file out=',trim(fout)
44 call fckit_log%info(record)
45 
46 call obs_data_registry%init()
47 call obs_data_registry%add(c_key_self)
48 call obs_data_registry%get(c_key_self, self)
49 call obs_setup(trim(fin), trim(fout), self)
50 
51 end subroutine qg_obs_setup
52 
53 ! ------------------------------------------------------------------------------
54 
55 subroutine qg_obs_delete(c_key_self) bind(c,name='qg_obsdb_delete_f90')
56 implicit none
57 integer(c_int), intent(inout) :: c_key_self
58 type(obs_data), pointer :: self
59 
60 call obs_data_registry%get(c_key_self, self)
61 call obs_delete(self)
62 call obs_data_registry%remove(c_key_self)
63 
64 end subroutine qg_obs_delete
65 
66 ! ------------------------------------------------------------------------------
67 
68 subroutine qg_obs_get(c_key_self, lreq, c_req, lcol, c_col, c_key_ovec) bind(c,name='qg_obsdb_get_f90')
69 implicit none
70 integer(c_int), intent(in) :: c_key_self
71 integer(c_int), intent(in) :: lreq, lcol
72 character(kind=c_char,len=1), intent(in) :: c_req(lreq+1), c_col(lcol+1)
73 integer(c_int), intent(in) :: c_key_ovec
74 
75 type(obs_data), pointer :: self
76 type(obs_vect), pointer :: ovec
77 character(len=lreq) :: req
78 character(len=lcol) :: col
79 
80 call obs_data_registry%get(c_key_self, self)
81 call qg_obs_vect_registry%get(c_key_ovec,ovec)
82 call c_f_string(c_req, req)
83 call c_f_string(c_col, col)
84 
85 call obs_get(self, trim(req), trim(col), ovec)
86 
87 end subroutine qg_obs_get
88 
89 ! ------------------------------------------------------------------------------
90 
91 subroutine qg_obs_put(c_key_self, lreq, c_req, lcol, c_col, c_key_ovec) bind(c,name='qg_obsdb_put_f90')
92 implicit none
93 integer(c_int), intent(in) :: c_key_self
94 integer(c_int), intent(in) :: lreq, lcol
95 character(kind=c_char,len=1), intent(in) :: c_req(lreq+1), c_col(lcol+1)
96 integer(c_int), intent(in) :: c_key_ovec
97 
98 type(obs_data), pointer :: self
99 type(obs_vect), pointer :: ovec
100 character(len=lreq) :: req
101 character(len=lcol) :: col
102 
103 call obs_data_registry%get(c_key_self, self)
104 call qg_obs_vect_registry%get(c_key_ovec,ovec)
105 call c_f_string(c_req, req)
106 call c_f_string(c_col, col)
107 
108 call obs_put(self, trim(req), trim(col), ovec)
109 
110 end subroutine qg_obs_put
111 
112 ! ------------------------------------------------------------------------------
113 
114 end module c_qg_obs_data
subroutine, public obs_put(self, req, col, ovec)
subroutine, public obs_setup(fin, fout, self)
Linked list implementation.
Definition: qg_obs_data.F90:89
subroutine qg_obs_get(c_key_self, lreq, c_req, lcol, c_col, c_key_ovec)
type(registry_t), public qg_obs_vect_registry
Linked list interface - defines registry_t type.
Fortran module handling observations for the QG model.
type(registry_t), public obs_data_registry
Linked list interface - defines registry_t type.
Definition: qg_obs_data.F90:49
subroutine, public obs_get(self, req, col, ovec)
subroutine qg_obs_delete(c_key_self)
subroutine qg_obs_put(c_key_self, lreq, c_req, lcol, c_col, c_key_ovec)
Handle observations for the QG model.
Definition: qg_obs_data.F90:11
subroutine, public obs_delete(self)
subroutine qg_obs_setup(c_key_self, c_conf)
Fortran module for streamfunction observations for the QG model.
Fortran module handling observation vectors.
integer, parameter, public max_string
Definition: qg_obs_data.F90:33