SICOPOLIS V3.1
 All Classes Files Functions Variables Macros
read_target_topo_nc.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Subroutine : r e a d _ t a r g e t _ t o p o _ n c
4 !
5 !> @file
6 !!
7 !! Reading of the target-topography file (in NetCDF format).
8 !!
9 !! @section Copyright
10 !!
11 !! Copyright 2009-2013 Ralf Greve
12 !!
13 !! @section License
14 !!
15 !! This file is part of SICOPOLIS.
16 !!
17 !! SICOPOLIS is free software: you can redistribute it and/or modify
18 !! it under the terms of the GNU General Public License as published by
19 !! the Free Software Foundation, either version 3 of the License, or
20 !! (at your option) any later version.
21 !!
22 !! SICOPOLIS is distributed in the hope that it will be useful,
23 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
24 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 !! GNU General Public License for more details.
26 !!
27 !! You should have received a copy of the GNU General Public License
28 !! along with SICOPOLIS. If not, see <http://www.gnu.org/licenses/>.
29 !<
30 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 
32 !-------------------------------------------------------------------------------
33 !> Reading of the target-topography file (in NetCDF format).
34 !<------------------------------------------------------------------------------
35 subroutine read_target_topo_nc(target_topo_dat_name)
36 
37 use sico_types
39 use netcdf
40 use nc_check
41 
42 implicit none
43 
44 character(len=100), intent(in) :: target_topo_dat_name
45 
46 ! Return variables
47 ! (defined as global variables in module sico_variables):
48 !
49 ! maske_target(j,i),
50 ! zs_target(j,i), zb_target(j,i), zl_target(j,i), H_target(j,i)
51 
52 integer(i4b) :: i, j
53 
54 integer(i2b), dimension(0:JMAX,0:IMAX) :: maske_conv
55 real(sp), dimension(0:JMAX,0:IMAX) :: zs_conv, zb_conv, zl_conv, h_conv
56 
57 integer(i4b) :: ncid, ncv
58 ! ncid: ID of the output file
59 ! ncv: Variable ID
60 
61 character(len=64), parameter :: thisroutine = 'read_target_topo_nc'
62 
63 !-------- Read target-topography data
64 ! (from a time-slice file of a previous simulation) --------
65 
66 call check( nf90_open(target_topo_dat_path//'/'//trim(target_topo_dat_name), &
67  nf90_nowrite, ncid), thisroutine )
68 
69 call check( nf90_inq_varid(ncid, 'maske', ncv), thisroutine )
70 call check( nf90_get_var(ncid, ncv, maske_conv), thisroutine )
71 
72 call check( nf90_inq_varid(ncid, 'zs', ncv), thisroutine )
73 call check( nf90_get_var(ncid, ncv, zs_conv), thisroutine )
74 
75 call check( nf90_inq_varid(ncid, 'zb', ncv), thisroutine )
76 call check( nf90_get_var(ncid, ncv, zb_conv), thisroutine )
77 
78 call check( nf90_inq_varid(ncid, 'zl', ncv), thisroutine )
79 call check( nf90_get_var(ncid, ncv, zl_conv), thisroutine )
80 
81 call check( nf90_inq_varid(ncid, 'H', ncv), thisroutine )
82 call check( nf90_get_var(ncid, ncv, h_conv), thisroutine )
83 
84 call check( nf90_close(ncid), thisroutine )
85 
86 !-------- Convert data to double precision --------
87 
88 do i=0, imax
89 do j=0, jmax
90  maske_target(j,i) = maske_conv(j,i)
91  zs_target(j,i) = real(zs_conv(j,i),dp)
92  zb_target(j,i) = real(zb_conv(j,i),dp)
93  zl_target(j,i) = real(zl_conv(j,i),dp)
94  h_target(j,i) = real(H_conv(j,i), dp)
95 end do
96 end do
97 
98 end subroutine read_target_topo_nc
99 !