SICOPOLIS V3.2
 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-2016 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 sico_vars
40 use netcdf
41 use nc_check
42 
43 implicit none
44 
45 character(len=100), intent(in) :: target_topo_dat_name
46 character(len=256) :: filename_with_path
47 
48 ! Return variables
49 ! (defined as global variables in module sico_variables):
50 !
51 ! maske_target(j,i),
52 ! zs_target(j,i), zb_target(j,i), zl_target(j,i), H_target(j,i)
53 
54 integer(i4b) :: i, j
55 
56 integer(i2b), dimension(0:JMAX,0:IMAX) :: maske_conv
57 real(sp), dimension(0:JMAX,0:IMAX) :: zs_conv, zb_conv, zl_conv, h_conv
58 
59 integer(i4b) :: ncid, ncv
60 ! ncid: ID of the output file
61 ! ncv: Variable ID
62 
63 character(len=64), parameter :: thisroutine = 'read_target_topo_nc'
64 
65 !-------- Read target-topography data
66 ! (from a time-slice file of a previous simulation) --------
67 
68 filename_with_path = trim(target_topo_dat_path)//'/'//trim(target_topo_dat_name)
69 
70 call check( nf90_open(trim(filename_with_path), nf90_nowrite, ncid), &
71  thisroutine )
72 
73 call check( nf90_inq_varid(ncid, 'maske', ncv), thisroutine )
74 call check( nf90_get_var(ncid, ncv, maske_conv), thisroutine )
75 
76 call check( nf90_inq_varid(ncid, 'zs', ncv), thisroutine )
77 call check( nf90_get_var(ncid, ncv, zs_conv), thisroutine )
78 
79 call check( nf90_inq_varid(ncid, 'zb', ncv), thisroutine )
80 call check( nf90_get_var(ncid, ncv, zb_conv), thisroutine )
81 
82 call check( nf90_inq_varid(ncid, 'zl', ncv), thisroutine )
83 call check( nf90_get_var(ncid, ncv, zl_conv), thisroutine )
84 
85 call check( nf90_inq_varid(ncid, 'H', ncv), thisroutine )
86 call check( nf90_get_var(ncid, ncv, h_conv), thisroutine )
87 
88 call check( nf90_close(ncid), thisroutine )
89 
90 !-------- Convert data to double precision --------
91 
92 do i=0, imax
93 do j=0, jmax
94  maske_target(j,i) = maske_conv(j,i)
95  zs_target(j,i) = real(zs_conv(j,i),dp)
96  zb_target(j,i) = real(zb_conv(j,i),dp)
97  zl_target(j,i) = real(zl_conv(j,i),dp)
98  h_target(j,i) = real(H_conv(j,i), dp)
99 end do
100 end do
101 
102 end subroutine read_target_topo_nc
103 !
NetCDF error capturing.
Definition: nc_check.F90:35
Declarations of kind types for SICOPOLIS.
Definition: sico_types.F90:35
subroutine check(status, ch_calling_routine)
NetCDF error capturing.
Definition: nc_check.F90:45
Declarations of global variables for SICOPOLIS (for the ANT domain).
Definition: sico_vars.F90:35
subroutine read_target_topo_nc(target_topo_dat_name)
Reading of the target-topography file (in NetCDF format).
Declarations of global variables for SICOPOLIS.