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