FV3 Bundle
ufo_seaicefrac_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 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_seaicefrac
17  public :: ufo_seaicefrac_simobs
18  private
19  integer, parameter :: max_string=800
20 
21  !> Fortran derived type for sea ice fraction observation operator
23  end type ufo_seaicefrac
24 
25 
26  ! ------------------------------------------------------------------------------
27 
28 contains
29 
30  ! ------------------------------------------------------------------------------
31 
32  subroutine ufo_seaicefrac_simobs(self, geovals, hofx)
34  use ufo_vars_mod
35 
36  implicit none
37  type(ufo_seaicefrac), intent(in) :: self
38  type(ufo_geovals), intent(in) :: geovals
39  real(c_double), intent(inout) :: hofx(:)
40 
41  character(len=*), parameter :: myname_="ufo_seaicefrac_simobs"
42  character(max_string) :: err_msg
43 
44  integer :: iobs
45  type(ufo_geoval), pointer :: geoval
46 
47  ! Netcdf stuff to write out geovals
48  integer(kind=4) :: incid
49  integer(kind=4) :: idimstation_id, idimlev_id
50  integer(kind=4) :: ivarlev_id, ivargom_id
51  integer :: ncat,nobs
52 
53  ! netcdf stuff
54  character(len=120) :: filename !< name of outpu file for omf, lon, lat, ...
55  character(len=MAXVARLEN) :: dim_name
56  type(diag_marine_obs) :: sic_out
57 
58  ! check if nobs is consistent in geovals & hofx
59  if (geovals%nobs /= size(hofx,1)) then
60  write(err_msg,*) myname_, ' error: nobs inconsistent!'
61  call abor1_ftn(err_msg)
62  endif
63 
64  ! check if sea ice fraction variables is in geovals and get it
65  call ufo_geovals_get_var(geovals, var_seaicefrac, geoval)
66 
67  ! Information for temporary output file
68  filename='sic-test.nc'
69  call sic_out%init(size(hofx,1),filename)
70 
71  ! total sea ice fraction obs operator
72  do iobs = 1, size(hofx,1)
73  hofx(iobs) = sum(geoval%vals(:,iobs))
74  enddo
75 
76  dim_name="ncat"
77  call sic_out%write_geoval(var_seaicefrac,geoval,arg_dim_name=dim_name)
78  call sic_out%finalize()
79 
80  end subroutine ufo_seaicefrac_simobs
81 
82 end module ufo_seaicefrac_mod
Fortran module to handle temperature profile observations.
Definition: ncutils.F90:8
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_seaicefrac_simobs(self, geovals, hofx)
Fortran module to handle ice concentration observations.
Fortran derived type for sea ice fraction observation operator.
character(len=maxvarlen), public var_seaicefrac
type to hold interpolated field for one variable, one observation