Skip to content

Commit 50246b3

Browse files
authored
Merge pull request #1743 from agetiran/main
HyMAP-3 updates
2 parents f1f6c54 + 6f070b7 commit 50246b3

18 files changed

Lines changed: 1188 additions & 119 deletions

ldt/configs/ldt.config.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4493,6 +4493,8 @@ This section describes the parameters needed for the HYMAP, HYMAP2 and HYMAP3 ro
44934493

44944494
`HYMAP node lat:` specifies the name of the grid node latitude data file. This parameter is optional and not used in HYMAP routing models. But it is a "good-to-have" for post-processing purposes.
44954495

4496+
`HYMAP runoff bias correction map:` specifies the name of the runoff bias correction data file. This is an optional parameter that is required only when "`HYMAP3 runoff bias correction:`" is set to "`1`". If the runoff bias correction option is set to "`0`" or is not specified, the runoff bias correction map is not required.
4497+
44964498
.Example _ldt.config_ entry
44974499
....
44984500
HYMAP river width map: ../HYMAP_parms/lis_rivwth_0125.bin
@@ -4521,6 +4523,7 @@ HYMAP levee height map: ../HYMAP_parms/lis_levee_0125.bin
45214523
Land grid area map: ../HYMAP_parms/lis_lgrdare_0125.bin
45224524
HYMAP node lon: ../HYMAP_parms/lis_nodelon_0125.bin
45234525
HYMAP node lat: ../HYMAP_parms/lis_nodelat_0125.bin
4526+
HYMAP runoff bias correction map: ../HYMAP_parms/lis_runoff_bc_0125.bin
45244527
....
45254528

45264529
This section also outlines the domain specifications of the HYMAP parameter data. For the HYMAP parameters spatial transform option, only "`none`" is supported at this time, and the user is required to input the HYMAP parameters at the grid and resolution of interest.

ldt/params/HYMAP/HYMAP_parmsMod.F90

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module HYMAP_parmsMod
5353
character*50 :: hymap_proj
5454
character*50 :: hymap_gridtransform
5555
integer :: bfdwicode, rundwicode, rivflocode,urbdroutcode, &
56-
leveehgtcode,landareacode,nodeloncode,nodelatcode
56+
leveehgtcode,landareacode,nodeloncode,nodelatcode,runoffbiascode
5757
integer :: baseflowdelaycode,runoffdelaycode,runoffdelaymcode
5858
character(LDT_CONST_PATH_LEN) :: riverwidthfile
5959
character(LDT_CONST_PATH_LEN) :: riverheightfile
@@ -81,6 +81,7 @@ module HYMAP_parmsMod
8181
character(LDT_CONST_PATH_LEN) :: landgridareafile
8282
character(LDT_CONST_PATH_LEN) :: nodelonfile
8383
character(LDT_CONST_PATH_LEN) :: nodelatfile
84+
character(LDT_CONST_PATH_LEN) :: runoffbiasfile
8485
type(LDT_paramEntry) :: hymap_river_width
8586
type(LDT_paramEntry) :: hymap_river_height
8687
type(LDT_paramEntry) :: hymap_river_length
@@ -106,6 +107,7 @@ module HYMAP_parmsMod
106107
type(LDT_paramEntry) :: land_grid_area
107108
type(LDT_paramEntry) :: hymap_node_lon
108109
type(LDT_paramEntry) :: hymap_node_lat
110+
type(LDT_paramEntry) :: hymap_runoff_bias
109111
end type hymap_type_dec
110112

111113
type(hymap_type_dec), allocatable :: HYMAP_struc(:)
@@ -144,7 +146,7 @@ subroutine HYMAPparms_init
144146
integer :: n
145147
integer :: rc
146148
integer :: bfdwicode, rundwicode, rivflocode,urbdroutcode, &
147-
leveehgtcode,landareacode,nodeloncode,nodelatcode
149+
leveehgtcode,landareacode,nodeloncode,nodelatcode,runoffbiascode
148150
integer :: baseflowdelaycode,runoffdelaycode,runoffdelaymcode
149151
integer, allocatable :: nextx(:,:)
150152
integer, allocatable :: nexty(:,:)
@@ -233,6 +235,8 @@ subroutine HYMAPparms_init
233235
"HYMAP_node_lon")
234236
call set_param_attribs(HYMAP_struc(n)%hymap_node_lat,&
235237
"HYMAP_node_lat")
238+
call set_param_attribs(HYMAP_struc(n)%hymap_runoff_bias,&
239+
"HYMAP_runoff_bias_correction")
236240
end do
237241

238242
call ESMF_ConfigFindLabel(LDT_config, &
@@ -348,6 +352,10 @@ subroutine HYMAPparms_init
348352
LDT_rc%lnc(n),LDT_rc%lnr(n), &
349353
HYMAP_struc(n)%hymap_node_lat%vlevels))
350354

355+
allocate(HYMAP_struc(n)%hymap_runoff_bias%value( &
356+
LDT_rc%lnc(n),LDT_rc%lnr(n), &
357+
HYMAP_struc(n)%hymap_runoff_bias%vlevels))
358+
351359
enddo
352360

353361
call ESMF_ConfigFindLabel(LDT_config,"HYMAP river width map:",rc=rc)
@@ -567,6 +575,16 @@ subroutine HYMAPparms_init
567575
HYMAP_struc(n)%nodelatcode = nodelatcode
568576
enddo
569577

578+
call ESMF_ConfigFindLabel(LDT_config,"HYMAP runoff bias correction map:",rc=runoffbiascode)
579+
do n=1,LDT_rc%nnest
580+
call ESMF_ConfigGetAttribute(LDT_config, &
581+
HYMAP_struc(n)%runoffbiasfile,rc=rc)
582+
if (runoffbiascode.eq.0) then
583+
call LDT_verify(rc,'HYMAP runoff bias correction map: not specified')
584+
endif
585+
HYMAP_struc(n)%runoffbiascode = runoffbiascode
586+
enddo
587+
570588
write(LDT_logunit,*) &
571589
" - - - - - - - - HYMAP Router Parameters - - - - - - - - - -"
572590

@@ -889,6 +907,18 @@ subroutine HYMAPparms_init
889907
'Done reading '//trim(HYMAP_struc(n)%nodelatfile)
890908
endif
891909

910+
if (HYMAP_struc(n)%runoffbiascode.eq.0) then
911+
call LDT_gridOptChecks( n, "HYMAP runoff bias correction", &
912+
HYMAP_struc(n)%hymap_gridtransform, hymap_proj, &
913+
hymapparms_gridDesc(n,9) )
914+
write(LDT_logunit,*) &
915+
'reading '//trim(HYMAP_struc(n)%runoffbiasfile)
916+
call read_HYMAP_runoff_bias( &
917+
n,HYMAP_struc(n)%hymap_runoff_bias%value(:,:,1))
918+
write(LDT_logunit,*) &
919+
'Done reading '//trim(HYMAP_struc(n)%runoffbiasfile)
920+
endif
921+
892922
enddo
893923

894924
end subroutine HYMAPparms_init
@@ -995,6 +1025,11 @@ subroutine HYMAPparms_writeHeader(n,ftn,dimID,monthID)
9951025
call LDT_writeNETCDFdataHeader(n,ftn,dimID, &
9961026
HYMAP_struc(n)%land_grid_area)
9971027
endif
1028+
1029+
if (HYMAP_struc(n)%runoffbiascode.eq.0) then
1030+
call LDT_writeNETCDFdataHeader(n,ftn,dimID, &
1031+
HYMAP_struc(n)%hymap_runoff_bias)
1032+
endif
9981033

9991034
end subroutine HYMAPparms_writeHeader
10001035

@@ -1065,6 +1100,9 @@ subroutine HYMAPparms_writeData(n,ftn)
10651100
if (HYMAP_struc(n)%nodelatcode.eq.0) then
10661101
call LDT_writeNETCDFdata(n,ftn,HYMAP_struc(n)%hymap_node_lat)
10671102
endif
1103+
if (HYMAP_struc(n)%runoffbiascode.eq.0) then
1104+
call LDT_writeNETCDFdata(n,ftn,HYMAP_struc(n)%hymap_runoff_bias)
1105+
endif
10681106

10691107
end subroutine HYMAPparms_writeData
10701108

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
!-----------------------BEGIN NOTICE -- DO NOT EDIT-----------------------
2+
! NASA Goddard Space Flight Center
3+
! Land Information System Framework (LISF)
4+
! Version 7.5
5+
!
6+
! Copyright (c) 2024 United States Government as represented by the
7+
! Administrator of the National Aeronautics and Space Administration.
8+
! All Rights Reserved.
9+
!-------------------------END NOTICE -- DO NOT EDIT-----------------------
10+
!BOP
11+
!
12+
! !ROUTINE: read_HYMAP_runoff_bias
13+
! \label{read_HYMAP_runoff_bias}
14+
!
15+
! !REVISION HISTORY:
16+
! 13 Nov 2025: Augusto Getirana; Initial Specification
17+
!
18+
! !INTERFACE:
19+
subroutine read_HYMAP_runoff_bias(n, array)
20+
21+
! !USES:
22+
use ESMF
23+
use LDT_coreMod, only : LDT_rc, LDT_domain
24+
use LDT_logMod, only : LDT_logunit, LDT_getNextUnitNumber, &
25+
LDT_releaseUnitNumber, LDT_endrun
26+
use LDT_fileIOMod, only : readLISdata
27+
use HYMAP_parmsMod
28+
29+
implicit none
30+
! !ARGUMENTS:
31+
integer, intent(in) :: n
32+
real, intent(inout) :: array(LDT_rc%lnc(n),LDT_rc%lnr(n),1)
33+
34+
! !DESCRIPTION:
35+
! This subroutine retrieves runoff bias correction maps
36+
!
37+
! The arguments are:
38+
! \begin{description}
39+
! \item[n]
40+
! index of the nest
41+
! \item[mo]
42+
! time index (month or quarter)
43+
! \item[array]
44+
! output field with the retrieved greenness fraction
45+
! \end{description}
46+
!
47+
!EOP
48+
integer :: ftn
49+
integer :: c,r
50+
logical :: file_exists
51+
52+
ftn = LDT_getNextUnitNumber()
53+
54+
inquire(file=trim(HYMAP_struc(n)%runoffbiasfile), exist=file_exists)
55+
if(.not.file_exists) then
56+
write(LDT_logunit,*) '[ERR] HYMAP runoff bias correction map, ',&
57+
trim(HYMAP_struc(n)%runoffbiasfile),', not found.'
58+
write(LDT_logunit,*) 'Program stopping ...'
59+
call LDT_endrun
60+
endif
61+
62+
open(ftn, file=trim(HYMAP_struc(n)%runoffbiasfile), access='direct',&
63+
status='old', form="unformatted", convert="big_endian", recl=4)
64+
65+
call readLISdata(n, ftn, HYMAP_struc(n)%hymap_proj, &
66+
HYMAP_struc(n)%hymap_gridtransform, &
67+
HYMAP_struc(n)%hymapparms_gridDesc(:), 1, array) ! 1 indicates 2D layer
68+
69+
do r=1,LDT_rc%lnr(n)
70+
do c=1,LDT_rc%lnc(n)
71+
if(array(c,r,1).lt.0) then
72+
array(c,r,1) = LDT_rc%udef
73+
endif
74+
enddo
75+
enddo
76+
call LDT_releaseUnitNumber(ftn)
77+
78+
end subroutine read_HYMAP_runoff_bias

lis/configs/lis.config.adoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11163,6 +11163,17 @@ active restart file.
1116311163
`HYMAP3 2-way coupling flooded fraction threshold:` specifies the flooded fraction
1116411164
threshold used in the 2-way coupling mode.
1116511165
11166+
`HYMAP3 runoff bias correction:` specifies whether to account for a runoff bias correction. This option is elective and, if not defined, HYMAP3 does not account for runoff bias correction. This option requires a runoff bias correction field provided in the LIS domain and parameter data file (HYMAP_runoff_bias_correction).
11167+
11168+
Acceptable values are:
11169+
11170+
|====
11171+
|Value | Description
11172+
11173+
|0 | Do not use
11174+
|1 | Use
11175+
|====
11176+
1116611177
.Example _lis.config_ entry
1116711178
....
1116811179
HYMAP3 routing model time step: "30mn"
@@ -11185,6 +11196,7 @@ HYMAP3 routing model restart interval: "1mo"
1118511196
HYMAP3 routing model restart file: "./OL/ROUTING/197901/LIS_RST_HYMAP3_router_197901030000.d01.nc
1118611197
HYMAP3 enable 2-way coupling: 0
1118711198
HYMAP3 2-way coupling flooded fraction threshold: 0.1
11199+
HYMAP3 runoff bias correction: 1
1118811200
....
1118911201
1119011202

lis/routing/HYMAP2_router/runoffdata/LISoutput/LISrunoffdataMod.F90

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module LISrunoffdataMod
4949
integer :: nc,nr
5050
character(len=LIS_CONST_PATH_LEN) :: previous_filename
5151
real :: datares
52-
real, allocatable :: qs(:,:),qsb(:,:),evap(:,:)
52+
real, allocatable :: qs(:,:),qsb(:,:)
5353

5454
end type LISrunoffdatadec
5555

@@ -214,10 +214,8 @@ subroutine LISrunoffdata_init
214214
LISrunoffdata_struc(n)%previous_filename='none'
215215
allocate(LISrunoffdata_struc(n)%qs(LIS_rc%lnc(n),LIS_rc%lnr(n)))
216216
allocate(LISrunoffdata_struc(n)%qsb(LIS_rc%lnc(n),LIS_rc%lnr(n)))
217-
allocate(LISrunoffdata_struc(n)%evap(LIS_rc%lnc(n),LIS_rc%lnr(n)))
218217
LISrunoffdata_struc(n)%qs=LIS_rc%udef
219218
LISrunoffdata_struc(n)%qsb=LIS_rc%udef
220-
LISrunoffdata_struc(n)%evap=LIS_rc%udef
221219
enddo
222220

223221
end subroutine LISrunoffdata_init

lis/routing/HYMAP2_router/runoffdata/LISoutput/readLISrunoffdata.F90

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ subroutine readLISrunoffdata(n,surface_runoff, baseflow)
3333
integer, intent(in) :: n
3434
real :: surface_runoff(LIS_rc%lnc(n),LIS_rc%lnr(n))
3535
real :: baseflow(LIS_rc%lnc(n),LIS_rc%lnr(n))
36-
real :: total_evapotranspiration(LIS_rc%lnc(n),LIS_rc%lnr(n))
3736

3837
!caveats
3938
! 1) assumes the LIS outputs are the same output interval as that of
@@ -46,20 +45,19 @@ subroutine readLISrunoffdata(n,surface_runoff, baseflow)
4645
!
4746
! 5) LIS outputs are in NETCDF format.
4847
!
49-
!Added total evapotranspiration (Evap)
5048
integer :: c,r,t
5149
integer, allocatable :: nqs(:,:)
5250

5351
!ag - 17Mar2016
5452
!real, allocatable :: qs(:,:),qs_t(:)
5553
real :: qs2d(LISrunoffdata_struc(n)%nc,LISrunoffdata_struc(n)%nr)
5654
real :: qsb2d(LISrunoffdata_struc(n)%nc,LISrunoffdata_struc(n)%nr)
57-
real, allocatable :: qs_t(:),qsb_t(:),evap_t(:)
55+
real, allocatable :: qs_t(:),qsb_t(:)
5856
logical*1 :: lb(LISrunoffdata_struc(n)%nc*LISrunoffdata_struc(n)%nr)
5957
real :: var_input(LISrunoffdata_struc(n)%nc*LISrunoffdata_struc(n)%nr)
6058
logical*1 :: lo(LIS_rc%lnc(n)*LIS_rc%lnr(n))
6159
real :: var_out(LIS_rc%lnc(n)*LIS_rc%lnr(n))
62-
integer :: ios, nid,qsid,qsbid,evapid
60+
integer :: ios, nid,qsid,qsbid
6361
character(len=LIS_CONST_PATH_LEN) :: filename
6462
logical :: file_exists
6563
logical :: check_Flag
@@ -94,9 +92,6 @@ subroutine readLISrunoffdata(n,surface_runoff, baseflow)
9492
ios = nf90_inq_varid(nid,'Qsb_tavg',qsbid)
9593
call LIS_verify(ios,'failed to read Qsb_tavg field in readLISrunoffdata')
9694

97-
ios = nf90_inq_varid(nid,'Evap_tavg',evapid)
98-
call LIS_verify(ios,'failed to read Evap_tavg field in readLISrunoffdata')
99-
10095
if(LISrunoffdata_struc(n)%domainCheck) then
10196
if(LIS_rc%wopt.eq."2d gridspace") then
10297
ios = nf90_get_var(nid,qsid,LISrunoffdata_struc(n)%qs, &
@@ -109,10 +104,6 @@ subroutine readLISrunoffdata(n,surface_runoff, baseflow)
109104
count=(/LIS_rc%lnc(n),LIS_rc%lnr(n)/))
110105
call LIS_verify(ios, 'failed to read Qsb_tavg field in readLISrunoffdata')
111106

112-
ios = nf90_get_var(nid,evapid,LISrunoffdata_struc(n)%evap,&
113-
start=(/LIS_ews_halo_ind(n,LIS_localPet+1),LIS_nss_halo_ind(n,LIS_localPet+1)/),&
114-
count=(/LIS_rc%lnc(n),LIS_rc%lnr(n)/))
115-
call LIS_verify(ios, 'failed to read Evap_tavg field in readLISrunoffdata')
116107
else
117108
write(LIS_logunit,*) "Stand-alone HYMAP is only supported for '2d gridspace' outputs currently"
118109
call LIS_endrun()
@@ -247,11 +238,9 @@ subroutine readLISrunoffdata(n,surface_runoff, baseflow)
247238
where(LISrunoffdata_struc(n)%qs/=LIS_rc%udef)
248239
surface_runoff = LISrunoffdata_struc(n)%qs
249240
baseflow = LISrunoffdata_struc(n)%qsb
250-
total_evapotranspiration = LISrunoffdata_struc(n)%evap
251241
else where
252242
surface_runoff = 0.0
253243
baseflow = 0.0
254-
total_evapotranspiration = 0.0
255244
end where
256245

257246
end subroutine readLISrunoffdata

0 commit comments

Comments
 (0)