FV3 Bundle
ufo_seasurfacetemp_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 ice concentration observations
7 
9 
10  use iso_c_binding
11  use ufo_vars_mod
12  use ufo_geovals_mod
13  use kinds
14 
15  implicit none
16  public :: ufo_seasurfacetemp
18  private
19  integer, parameter :: max_string=800
20 
21  !> Fortran derived type for sea surface temperature observation operator
23  end type ufo_seasurfacetemp
24 
25 
26  ! ------------------------------------------------------------------------------
27 
28 contains
29 
30  ! ------------------------------------------------------------------------------
31  !!!!!!!!!!!!!!! TODO: PASS OBS to operator !!!!!!!!!!!!!!!!!!!!
32  subroutine ufo_seasurfacetemp_simobs(self, geovals, hofx)
33 
35 
36  implicit none
37  type(ufo_seasurfacetemp) ,intent(in) :: self
38  type(ufo_geovals) ,intent(in) :: geovals
39  real(c_double) ,intent(inout) :: hofx(:)
40 
41  character(len=*), parameter :: myname_="ufo_seasurfacetemp_simobs"
42  character(max_string) :: err_msg
43 
44  integer :: iobs
45  type(ufo_geoval), pointer :: geoval_sst
46 
47  ! Netcdf stuff to write out geovals
48  character(len=120) :: filename="sst_obs-2018-04-15_geovals.nc"
49  integer(kind=4) :: incid
50  integer(kind=4) :: idimstation_id, idimlev_id
51  integer(kind=4) :: ivarlev_id, ivargom_id
52  integer :: nlev,nobs
53 
54  type(diag_marine_obs) :: sst_out
55 
56  ! check if nobs is consistent in geovals & hofx
57  if (geovals%nobs /= size(hofx,1)) then
58  write(err_msg,*) myname_, ' error: nobs inconsistent!'
59  call abor1_ftn(err_msg)
60  endif
61 
62  ! check if sst variables is in geovals and get it
63  call ufo_geovals_get_var(geovals, var_ocn_sst, geoval_sst)
64 
65  ! Information for temporary output file ---------------------------------------!
66  filename='sst-test.nc'
67  call sst_out%init(size(hofx,1),filename)
68 
69  ! sst obs operator
70  do iobs = 1, size(hofx,1)
71  hofx(iobs) = geoval_sst%vals(1,iobs)
72 
73  ! Output information:
74  sst_out%diag(iobs)%Station_ID = 9999
75  sst_out%diag(iobs)%Observation_Type = 999.9
76  sst_out%diag(iobs)%Latitude = 999.9
77  sst_out%diag(iobs)%Longitude = 999.9
78  sst_out%diag(iobs)%Depth = 999.9
79  sst_out%diag(iobs)%Time = 999.9
80  sst_out%diag(iobs)%Observation = 999.9
81  sst_out%diag(iobs)%Obs_Minus_Forecast = 999.9
82  enddo
83 
84  call sst_out%write_diag()
85  call sst_out%write_geoval(var_ocn_sst,geoval_sst)
86  call sst_out%finalize()
87 
88  end subroutine ufo_seasurfacetemp_simobs
89 
90 end module ufo_seasurfacetemp_mod
character(len=maxvarlen), public var_ocn_sst
Fortran module to handle temperature profile observations.
Definition: ncutils.F90:8
Fortran module to handle ice concentration observations.
subroutine, public ufo_geovals_get_var(self, varname, geoval, status)
integer, parameter max_string
type to hold interpolated fields required by the obs operators
subroutine, public ufo_seasurfacetemp_simobs(self, geovals, hofx)
Fortran derived type for sea surface temperature observation operator.
type to hold interpolated field for one variable, one observation