13 USE mo_kind,
ONLY : i4, dp
14 use mo_message,
only: message, error_message
44 use mo_append,
only : append
52 use mo_string_utils,
only : num2str
57 integer(i4) :: domainid, idomain, ndemcells
60 character(256) :: fname
62 real(dp),
dimension(:, :),
allocatable :: data_dp_2d
64 type(
grid),
pointer :: level0_idomain
79 if (idomain .gt. 1)
then
80 if (
domainmeta%L0DataFrom(idomain) < idomain)
then
82 call message(
' Using dem of domain ', &
84 trim(adjustl(num2str(idomain))),
'...')
92 call message(
' Reading dem for domain: ', trim(adjustl(num2str(domainid))),
' ...')
97 level0_idomain%nrows, level0_idomain%ncols, level0_idomain%xllcorner, &
98 level0_idomain%yllcorner, level0_idomain%cellsize, level0_idomain%nodata_value)
102 call error_message(
'***ERROR: resolutionHydrology (L1) should be coarser than the input data resolution (L0)', raise=.false.)
103 call error_message(
' check set-up (in mhm.nml) for domain: ', trim(adjustl(num2str(domainid))),
' ...')
109 level0_idomain%nrows, level0_idomain%ncols, level0_idomain%xllcorner, &
110 level0_idomain%yllcorner, level0_idomain%cellsize, data_dp_2d, level0_idomain%mask)
112 level0_idomain%nCells = count(level0_idomain%mask)
113 if (level0_idomain%nCells .eq. 0_i4)
then
114 ndemcells = level0_idomain%nrows * level0_idomain%ncols
115 call error_message(
'***ERROR: Domain ', trim(adjustl(num2str(domainid))), &
116 ' contains no valid cells. All ', trim(adjustl(num2str(ndemcells))),
' cells in the dem are masked')
120 data_dp_2d = merge(data_dp_2d,
nodata_dp, level0_idomain%mask)
122 call append(
l0_elev, pack(data_dp_2d, level0_idomain%mask))
124 deallocate(data_dp_2d)
149 use mo_append,
only : append, paste
155 use mo_string_utils,
only : num2str
160 integer(i4) :: domainid, idomain, ivar
163 character(256) :: fname
165 integer(i4),
dimension(:, :),
allocatable :: data_i4_2d
167 integer(i4),
dimension(:, :),
allocatable :: datamatrix_i4
169 logical,
dimension(:, :),
allocatable :: mask_2d
171 type(
grid),
pointer :: level0_idomain
181 if (
domainmeta%L0DataFrom(idomain) < idomain)
then
182 call message(
' Using lcover of domain ', &
183 trim(adjustl(num2str(
domainmeta%L0DataFrom(idomain)))),
' for domain: ',&
184 trim(adjustl(num2str(domainid))),
'...')
190 call message(
' Reading lcover for domain: ', trim(adjustl(num2str(domainid))),
' ...')
196 level0_idomain%nrows, level0_idomain%ncols, level0_idomain%xllcorner, &
197 level0_idomain%yllcorner, level0_idomain%cellsize, data_i4_2d, mask_2d)
199 data_i4_2d = merge(data_i4_2d,
nodata_i4, mask_2d)
200 call paste(datamatrix_i4, pack(data_i4_2d, level0_idomain%mask),
nodata_i4)
201 deallocate(data_i4_2d)
204 deallocate(datamatrix_i4)
Reads spatial data files of nc or ASCII format.
Provides constants commonly used by mHM, mRM and MPR.
real(dp), parameter, public nodata_dp
integer(i4), parameter, public nodata_i4
Provides file names and units for mRM.
integer, parameter ulcoverclass
Unit for LCover input data file.
character(len= *), parameter file_dem
DEM input data file.
integer, parameter udem
Unit for DEM input data file.
subroutine, public set_domain_indices(grids, indices)
TODO: add description.
subroutine, public read_lcover
TODO: add description.
subroutine, public read_dem
TODO: add description.
Provides common types needed by mHM, mRM and/or mpr.
Provides structures needed by mHM, mRM and/or mpr.
real(dp), dimension(:), allocatable, public resolutionhydrology
character(256), dimension(:), allocatable, public lcfilename
type(domain_meta), public domainmeta
integer(i4), public nlcoverscene
character(256), dimension(:), allocatable, public dirlcover
real(dp), dimension(:), allocatable, public l0_elev
character(256), dimension(:), allocatable, public dirmorpho
integer(i4), dimension(:, :), allocatable, public l0_lcover
type(grid), dimension(:), allocatable, target, public level0
Reads spatial input data.
subroutine, public read_header_nc_or_ascii(filepath, fileunit, header_ncols, header_nrows, header_xllcorner, header_yllcorner, header_cellsize, header_nodata, varname)
Read header information from either NetCDF or ASCII depending on file name/presence.