73 use mo_kind,
only : i4, dp
74 use mo_message,
only : message
76 use mo_netcdf,
only : ncdataset, ncdimension
77 use mo_string_utils,
only : num2str
82 character(256) :: fname
85 character(256),
dimension(:),
intent(in) :: outfile
87 integer(i4) :: idomain, domainid
96 logical,
dimension(:, :),
allocatable :: mask1
100 type(ncdimension) :: rows1, cols1, soil1, lcscenes, lais
102 real(dp),
dimension(:),
allocatable :: dummy_1d
105 domain_loop :
do idomain = 1,
domainmeta%nDomains
109 fname = trim(outfile(idomain))
111 call message(
" Writing Restart-file: ", trim(adjustl(fname)),
" ...")
113 nc = ncdataset(fname,
"w")
117 rows1 = nc%getDimension(
"nrows1")
118 cols1 = nc%getDimension(
"ncols1")
138 allocate(mask1(rows1%getLength(), cols1%getLength()))
139 s1 =
level1(idomain)%iStart
141 mask1 =
level1(idomain)%mask
143 call write_eff_params(mask1, s1, e1, rows1, cols1, soil1, lcscenes, lais, nc)
164 use mo_kind,
only : i4
174 use mo_netcdf,
only : ncdataset, ncdimension, ncvariable
178 logical,
dimension(:, :),
allocatable,
intent(in) :: mask1
179 integer(i4),
intent(in) :: s1
180 integer(i4),
intent(in) :: e1
181 type(ncdimension),
intent(in) :: rows1
182 type(ncdimension),
intent(in) :: cols1
183 type(ncdimension),
intent(in) :: soil1
184 type(ncdimension),
intent(in) :: lcscenes
185 type(ncdimension),
intent(in) :: lais
186 type(ncdataset),
intent(inout) :: nc
188 type(ncvariable) :: var
195 "fraction of Sealed area at level 1")
199 "exponent for the upper reservoir at level 1")
203 "increase of the Degree-day factor per mm of increase in precipitation at level 1")
207 "maximum degree-day factor at level 1")
211 "degree-day factor with no precipitation at level 1")
215 "degree-day factor with no precipitation at level 1")
219 "Karstic percolation loss at level 1")
223 "Fraction of roots in soil horizons at level 1")
227 "Maximum interception at level 1")
231 "fast interflow recession coefficient at level 1")
235 "slow interflow recession coefficient at level 1")
239 "baseflow recession coefficient at level 1")
243 "percolation coefficient at level 1")
247 "SM below which actual ET is reduced linearly till PWP at level 1 for processCase(3)=1")
251 "Saturation soil moisture for each horizon [mm] at level 1")
255 "Exponential parameter to how non-linear is the soil water retention at level 1")
260 "jarvis critical value for normalized soil water content")
266 "PET correction factor based on LAI")
271 "Threshold temperature for snow/rain at level 1")
275 "Threshold water depth controlling fast interflow at level 1")
279 "Threshold water depth for surface runoff in sealed surfaces at level 1")
283 "Permanent wilting point at level 1")
289 "PET correction factor due to terrain aspect at level 1")
294 "PET correction factor due to terrain aspect at level 1")
298 "Hargreaves-Samani coefficient")
303 "Priestley Taylor coeffiecient (alpha)")
308 "aerodynamical resitance")
312 "bulk surface resitance")
321 "N0 count at level 1")
324 "Bulk density at level 1 for processCase(10)")
327 "Lattice water content at level 1 for processCase(10)")
332 "N0 count at level 1")
335 "Bulk density at level 1 for processCase(10)")
338 "Lattice water content at level 1 for processCase(10)")
341 "COSMIC L3 parameter at level 1 for processCase(10)")
349 use mo_kind,
only : i4
350 use mo_netcdf,
only : ncdataset, ncdimension, ncvariable
355 type(ncdataset),
intent(inout) :: nc
358 character(*),
intent(in) :: var_name
361 type(ncdimension),
dimension(:),
intent(in) :: var_dims
364 integer(i4),
intent(in) :: fill_value
367 integer(i4),
dimension(:),
intent(in) :: data
370 logical,
dimension(:, :),
intent(in) :: mask
373 character(*),
optional,
intent(in) :: var_long_name
375 type(ncvariable) :: var
379 var = nc%setVariable(var_name,
"i32", var_dims)
380 call var%setFillValue(fill_value)
383 call var%setData(unpack(
data, mask, fill_value))
386 if (
present(var_long_name))
then
387 call var%setAttribute(
"long_name", trim(var_long_name))
395 use mo_kind,
only : dp
396 use mo_netcdf,
only : ncdataset, ncdimension, ncvariable
401 type(ncdataset),
intent(inout) :: nc
404 character(*),
intent(in) :: var_name
407 type(ncdimension),
dimension(:),
intent(in) :: var_dims
410 real(dp),
intent(in) :: fill_value
413 real(dp),
dimension(:),
intent(in) :: data
416 logical,
dimension(:, :),
intent(in) :: mask
419 character(*),
optional,
intent(in) :: var_long_name
421 type(ncvariable) :: var
425 var = nc%setVariable(var_name,
"f64", var_dims)
426 call var%setFillValue(fill_value)
429 call var%setData(unpack(
data, mask, fill_value))
432 if (
present(var_long_name))
then
433 call var%setAttribute(
"long_name", trim(var_long_name))
441 use mo_kind,
only : dp, i4
442 use mo_netcdf,
only : ncdataset, ncdimension, ncvariable
447 type(ncdataset),
intent(inout) :: nc
450 character(*),
intent(in) :: var_name
453 type(ncdimension),
dimension(:),
intent(in) :: var_dims
456 real(dp),
intent(in) :: fill_value
459 real(dp),
dimension(:, :),
intent(in) :: data
462 logical,
dimension(:, :),
intent(in) :: mask
465 character(*),
optional,
intent(in) :: var_long_name
467 type(ncvariable) :: var
469 real(dp),
dimension(:, :, :),
allocatable :: dummy_arr
471 integer(i4),
dimension(3) :: dim_length
477 var = nc%setVariable(var_name,
"f64", var_dims)
478 call var%setFillValue(fill_value)
480 dim_length = var%getShape()
481 allocate(dummy_arr(dim_length(1), dim_length(2), dim_length(3)))
482 do ii = 1,
size(
data, 2)
483 dummy_arr(:, :, ii) = unpack(
data(:, ii), mask, fill_value)
487 call var%setData(dummy_arr)
490 if (
present(var_long_name))
then
491 call var%setAttribute(
"long_name", trim(var_long_name))
499 use mo_kind,
only : dp, i4
500 use mo_netcdf,
only : ncdataset, ncdimension, ncvariable
505 type(ncdataset),
intent(inout) :: nc
508 character(*),
intent(in) :: var_name
511 type(ncdimension),
dimension(:),
intent(in) :: var_dims
514 real(dp),
intent(in) :: fill_value
517 real(dp),
dimension(:, :, :),
intent(in) :: data
520 logical,
dimension(:, :),
intent(in) :: mask
523 character(*),
optional,
intent(in) :: var_long_name
525 type(ncvariable) :: var
527 real(dp),
dimension(:, :, :, :),
allocatable :: dummy_arr
529 integer(i4),
dimension(4) :: dim_length
531 integer(i4) :: ii, jj
535 var = nc%setVariable(var_name,
"f64", var_dims)
536 call var%setFillValue(fill_value)
538 dim_length = var%getShape()
539 allocate(dummy_arr(dim_length(1), dim_length(2), dim_length(3), dim_length(4)))
540 do ii = 1,
size(
data, 2)
541 do jj = 1,
size(
data, 3)
542 dummy_arr(:, :, ii, jj) = unpack(
data(:, ii, jj), mask, fill_value)
547 call var%setData(dummy_arr)
550 if (
present(var_long_name))
then
551 call var%setAttribute(
"long_name", trim(var_long_name))
unpack parameter fields and write them to file
Provides constants commonly used by mHM, mRM and MPR.
character(64), parameter, public soilhorizonsvarname
character(64), parameter, public landcoverperiodsvarname
character(64), parameter, public laivarname
real(dp), parameter, public nodata_dp
integer(i4), parameter, public nodata_i4
subroutine, public write_grid_info(grid_in, level_name, nc)
write restart files for each domain
Provides structures needed by mHM, mRM and/or mpr.
type(domain_meta), public domainmeta
integer(i4), public nlcoverscene
integer(i4), dimension(:), allocatable, public lc_year_end
integer(i4), dimension(nprocesses, 3), public processmatrix
type(grid), dimension(:), allocatable, target, public level1
integer(i4), dimension(:), allocatable, public lc_year_start
Global variables for mpr only.
real(dp), dimension(:, :, :), allocatable, public l1_degday
real(dp), dimension(:, :, :), allocatable, public l1_degdaymax
real(dp), dimension(:, :, :), allocatable, public l1_soilmoistexp
real(dp), dimension(:, :, :), allocatable, public l1_harsamcoeff
real(dp), dimension(:, :, :), allocatable, public l1_karstloss
real(dp), dimension(:, :, :), allocatable, public l1_unsatthresh
real(dp), dimension(:, :, :), allocatable, public l1_kperco
real(dp), dimension(:, :, :), allocatable, public l1_alpha
real(dp), dimension(:, :, :), allocatable, public l1_surfresist
real(dp), dimension(:,:,:), allocatable, public l1_cosmicl3
real(dp), dimension(:, :, :), allocatable, public l1_degdayinc
real(dp), dimension(:, :, :), allocatable, public l1_petlaicorfactor
real(dp), dimension(:, :, :), allocatable, public l1_fasp
real(dp), dimension(:, :, :), allocatable, public l1_kbaseflow
real(dp), dimension(:, :, :), allocatable, public l1_soilmoistfc
integer(i4), public nsoilhorizons_mhm
real(dp), dimension(:, :, :), allocatable, public l1_maxinter
real(dp), dimension(:,:,:), allocatable, public l1_bulkdens
real(dp), dimension(:, :, :), allocatable, public l1_degdaynopre
real(dp), dimension(:, :, :), allocatable, public l1_wiltingpoint
real(dp), dimension(:, :, :), allocatable, public l1_prietayalpha
real(dp), dimension(:, :, :), allocatable, public l1_fsealed
real(dp), dimension(:, :, :), allocatable, public l1_froots
real(dp), dimension(:, :, :), allocatable, public l1_jarvis_thresh_c1
real(dp), dimension(:, :, :), allocatable, public l1_tempthresh
real(dp), dimension(:), allocatable, public horizondepth_mhm
real(dp), dimension(:,:,:), allocatable, public l1_no_count
real(dp), dimension(:, :, :), allocatable, public l1_kfastflow
real(dp), dimension(:, :, :), allocatable, public l1_kslowflow
real(dp), dimension(:, :, :), allocatable, public l1_aeroresist
real(dp), dimension(:, :, :), allocatable, public l1_sealedthresh
real(dp), dimension(:, :, :), allocatable, public l1_soilmoistsat
real(dp), dimension(:,:,:), allocatable, public l1_latticewater
reading and writing states, fluxes and configuration for restart of mHM.
subroutine, public write_mpr_restart_files(outfile)
write restart files for each domain
subroutine unpack_field_and_write_1d_dp(nc, var_name, var_dims, fill_value, data, mask, var_long_name)
unpack parameter fields and write them to file
subroutine unpack_field_and_write_3d_dp(nc, var_name, var_dims, fill_value, data, mask, var_long_name)
unpack parameter fields and write them to file
subroutine, public write_eff_params(mask1, s1, e1, rows1, cols1, soil1, lcscenes, lais, nc)
write effective parameter fields to given restart file
subroutine unpack_field_and_write_1d_i4(nc, var_name, var_dims, fill_value, data, mask, var_long_name)
unpack parameter fields and write them to file
subroutine unpack_field_and_write_2d_dp(nc, var_name, var_dims, fill_value, data, mask, var_long_name)
unpack parameter fields and write them to file