Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#short_name select? units signconv timeavg? min/max? std? vert.levels grib_id grib_scalefactor longname

#Energy balance components
Qle: 1 W/m2 UP 1 0 0 1 121 100 # Latent Heat Flux (W/m2)
Qh: 1 W/m2 UP 1 0 0 1 122 100 # Sensible Heat Flux (W/m2)
Qg: 1 W/m2 DN 1 0 0 1 155 100 # Ground Heat Flux (W/m2)

#Water balance components
TotalPrecip: 1 kg/m2 DN 3 0 0 1 61 10000 # Total Precipitation rate (kg/m2s)
Evap: 1 kg/m2s UP 1 0 0 1 204 10000 # Total Evapotranspiration (kg/m2s)
Qs: 1 kg/m2 OUT 3 0 0 1 235 10000 # Surface runoff (kg/m2s)
Qsb: 1 kg/m2 OUT 3 0 0 1 234 10000 # Subsurface runoff (kg/m2s)
RHMin: 1 % - 0 0 0 1 210 10 # Minimum 2-meter relative humidity (-)

#Surface state variables
AvgSurfT: 1 K - 2 0 0 1 11 100 # Average surface temperature (K)
Albedo: 1 % - 1 0 0 1 84 1000 # Surface Albedo (-)
SWE: 1 kg/m2 - 0 0 0 1 65 10000 # Snow Water Equivalent (kg/m2)

#Subsurface state variables
SoilMoist: 1 m3/m3 - 2 0 0 4 201 1000 # Average layer soil moisture (kg/m2)
SoilTemp: 1 K - 2 0 0 4 85 1000 # Average layer soil temperature (K)
SmLiqFrac: 1 m3/m3 - 0 0 0 4 10 1000 # Average layer fraction of liquid moisture (-)
RelSMC: 1 - - 0 0 0 4 194 1000 # Relative soil moisture

#Evaporation components
PotEvap: 1 W/m2 UP 1 0 0 1 208 100 # Potential Evapotranspiration (kg/m2s)
CanopInt: 1 kg/m2 - 0 0 0 1 207 1000 # Total canopy water storage (kg/m2)

#Cold season processes
Snowcover: 1 % - 0 0 0 1 238 100 # Snow Cover (-) or percentage Snow Coverage
SnowDepth: 1 m - 0 0 0 1 66 1000 # Snow Depth (m)

#Forcings
Wind_f: 1 m/s - 2 0 0 1 209 10000 # Near surface Wind (m/s)
Tair_f: 1 K - 2 1 0 1 11 10000 # Near surface air temperature
Qair_f: 1 kg/kg - 2 0 0 1 51 10000000 # Near surface specific humidity
Psurf_f: 1 Pa - 2 0 0 1 1 1000 # Surface pressure
SWdown_f: 1 W/m2 DN 2 0 0 1 145 10000 # Surface incident shortwave radiation
LWdown_f: 1 W/m2 DN 2 0 0 1 144 100000 # Surface incident longwave radiation

#Parameters
Landmask: 1 - - 0 0 0 1 81 1 # Land Mask (0 - Water, 1 - Land)
Landcover: 1 - - 0 0 0 1 241 1 # Land cover
Soiltype: 1 - - 0 0 0 1 205 1 # Soil type
Elevation: 1 m - 0 0 0 1 233 100 # Elevation
Greenness: 1 - - 0 0 0 1 193 1000 # Greenness

# HyMAP-2 Routing
Streamflow: 1 m3/s - 1 0 0 1 333 10 # Streamflow
SWS: 1 mm - 1 0 0 1 333 10 # Surface water storage
SurfElev: 0 m - 1 0 0 1 333 10 # SurfElev
RiverStor: 0 m3 - 1 0 0 1 333 10 # RiverStorage
RiverDepth: 0 m - 1 0 0 1 333 10 # RiverDepth
RiverVelocity: 0 m/s - 1 0 0 1 333 10 # RiverVelocity
FloodStor: 0 m3 - 1 0 0 1 333 10 # FloodStorage
FloodedFrac: 1 - - 1 0 0 1 333 10 # FloodedFrac
FloodedArea: 1 m2 - 1 0 0 1 333 10 # FloodedArea
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#short_name select? units signconv timeavg? min/max? std? vert.levels grib_id grib_scalefactor longname

#Energy balance components
Qle: 1 W/m2 UP 1 0 0 1 121 100 # Latent Heat Flux (W/m2)
Qh: 1 W/m2 UP 1 0 0 1 122 100 # Sensible Heat Flux (W/m2)
Qg: 1 W/m2 DN 1 0 0 1 155 100 # Ground Heat Flux (W/m2)

#Water balance components
TotalPrecip: 1 kg/m2 DN 3 0 0 1 61 10000 # Total Precipitation rate (kg/m2s)
Evap: 1 kg/m2s UP 1 0 0 1 204 10000 # Total Evapotranspiration (kg/m2s)
Qs: 1 kg/m2 OUT 3 0 0 1 235 10000 # Surface runoff (kg/m2s)
Qsb: 1 kg/m2 OUT 3 0 0 1 234 10000 # Subsurface runoff (kg/m2s)
RHMin: 1 % - 0 0 0 1 210 10 # Minimum 2-meter relative humidity (-)

#Surface state variables
AvgSurfT: 1 K - 2 0 0 1 11 100 # Average surface temperature (K)
Albedo: 1 % - 1 0 0 1 84 1000 # Surface Albedo (-)
SWE: 1 kg/m2 - 0 0 0 1 65 10000 # Snow Water Equivalent (kg/m2)

#Subsurface state variables
SoilMoist: 1 m3/m3 - 2 0 0 4 201 1000 # Average layer soil moisture (kg/m2)
SoilTemp: 1 K - 2 0 0 4 85 1000 # Average layer soil temperature (K)
SmLiqFrac: 1 m3/m3 - 0 0 0 4 10 1000 # Average layer fraction of liquid moisture (-)
RelSMC: 1 - - 0 0 0 4 194 1000 # Relative soil moisture

#Evaporation components
CanopInt: 1 kg/m2 - 0 0 0 1 207 1000 # Total canopy water storage (kg/m2)

#Cold season processes
Snowcover: 1 % - 0 0 0 1 238 100 # Snow Cover (-) or percentage Snow Coverage
SnowDepth: 1 m - 0 0 0 1 66 1000 # Snow Depth (m)

#Forcings
Wind_f: 1 m/s - 2 0 0 1 209 10000 # Near surface Wind (m/s)
Tair_f: 1 K - 2 1 0 1 11 10000 # Near surface air temperature
Qair_f: 1 kg/kg - 2 0 0 1 51 10000000 # Near surface specific humidity
Psurf_f: 1 Pa - 2 0 0 1 1 1000 # Surface pressure
SWdown_f: 1 W/m2 DN 2 0 0 1 145 10000 # Surface incident shortwave radiation
LWdown_f: 1 W/m2 DN 2 0 0 1 144 100000 # Surface incident longwave radiation

#Parameters
Landmask: 1 - - 0 0 0 1 81 1 # Land Mask (0 - Water, 1 - Land)
Landcover: 1 - - 0 0 0 1 241 1 # Land cover
Soiltype: 1 - - 0 0 0 1 205 1 # Soil type
Elevation: 1 m - 0 0 0 1 233 100 # Elevation
Greenness: 1 - - 0 0 0 1 193 1000 # Greenness

# HyMAP-2 Routing
Streamflow: 1 m3/s - 1 0 0 1 333 10 # Streamflow
SWS: 1 mm - 1 0 0 1 333 10 # Surface water storage
SurfElev: 0 m - 1 0 0 1 333 10 # SurfElev
RiverStor: 0 m3 - 1 0 0 1 333 10 # RiverStorage
RiverDepth: 0 m - 1 0 0 1 333 10 # RiverDepth
RiverVelocity: 0 m/s - 1 0 0 1 333 10 # RiverVelocity
FloodStor: 0 m3 - 1 0 0 1 333 10 # FloodStorage
FloodedFrac: 1 - - 1 0 0 1 333 10 # FloodedFrac
FloodedArea: 1 m2 - 1 0 0 1 333 10 # FloodedArea

3 changes: 2 additions & 1 deletion lis/core/LIS_PRIV_rcMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,8 @@ module LIS_PRIV_rcMod
integer :: laiInterval
real*8 :: laitime
real*8 :: saitime
character*50 :: wopt
character*50 :: wopt
character*50 :: wopt_routing
integer :: wopt_rst
character*50 :: wout
integer :: wsingle
Expand Down
68 changes: 38 additions & 30 deletions lis/core/LIS_historyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2420,20 +2420,20 @@ subroutine writeRoutingNetcdfOutput(n, group, ftn, ftn_stats, outInterval, &
xlong%valid_max = 0.0

if(LIS_masterproc) then
if(LIS_rc%wopt.eq."1d tilespace") then
if(LIS_rc%wopt_routing.eq."1d tilespace") then
write(LIS_logunit,*) '[ERR] 1d tilespace output for routing models'
write(LIS_logunit,*) '[ERR] is not supported currently'
call LIS_endrun()

elseif(LIS_rc%wopt.eq."2d gridspace") then
elseif(LIS_rc%wopt_routing.eq."2d gridspace") then
call LIS_verify(nf90_def_dim(ftn,'east_west',LIS_rc%gnc(n),&
dimID(1)),&
'nf90_def_dim for east_west failed in LIS_historyMod')
call LIS_verify(nf90_def_dim(ftn,'north_south',LIS_rc%gnr(n),&
dimID(2)),&
'nf90_def_dim for north_south failed in LIS_historyMod')

elseif(LIS_rc%wopt.eq."2d ensemble gridspace") then
elseif(LIS_rc%wopt_routing.eq."2d ensemble gridspace") then
call LIS_verify(nf90_def_dim(ftn,'east_west',LIS_rc%gnc(n),&
dimID(1)),&
'nf90_def_dim for east_west failed in LIS_historyMod')
Expand All @@ -2452,9 +2452,9 @@ subroutine writeRoutingNetcdfOutput(n, group, ftn, ftn_stats, outInterval, &
'nf90_put_att for missing_value failed in LIS_historyMod')

call defineNETCDFheaderVar(n,ftn,dimID, xlat,&
non_model_fields = 1 )
non_model_fields = 1, wopt=LIS_rc%wopt_routing )
call defineNETCDFheaderVar(n,ftn,dimID, xlong, &
non_model_fields = 2 )
non_model_fields = 2, wopt=LIS_rc%wopt_routing )

! defining time field
call LIS_verify(nf90_def_var(ftn,'time',&
Expand Down Expand Up @@ -2489,7 +2489,7 @@ subroutine writeRoutingNetcdfOutput(n, group, ftn, ftn_stats, outInterval, &
'nf90_put_att for begin_time failed in LIS_historyMod')

! Write ensemble information as a variable:
if( LIS_rc%wopt.eq."2d ensemble gridspace" ) then
if( LIS_rc%wopt_routing.eq."2d ensemble gridspace" ) then
call LIS_verify(nf90_def_var(ftn,'ensemble',&
nf90_float, dimids=dimID(3), varID=ensID),&
'nf90_def_var for ensemble failed in LIS_historyMod')
Expand All @@ -2511,7 +2511,7 @@ subroutine writeRoutingNetcdfOutput(n, group, ftn, ftn_stats, outInterval, &

do while ( associated(dataEntry) )
call defineNETCDFheaderVar(n,ftn,dimId,&
dataEntry)
dataEntry, wopt=LIS_rc%wopt_routing)
dataEntry => dataEntry%next
enddo

Expand Down Expand Up @@ -2632,7 +2632,7 @@ subroutine writeRoutingNetcdfOutput(n, group, ftn, ftn_stats, outInterval, &
call LIS_verify(nf90_put_var(ftn,xtimeID,0.0),&
'nf90_put_var for xtimeID failed in LIS_historyMod')
! Write ensemble var info:
if( LIS_rc%wopt.eq."2d ensemble gridspace" ) then
if( LIS_rc%wopt_routing.eq."2d ensemble gridspace" ) then
call LIS_verify(nf90_put_var(ftn,ensID,ensval,(/1/),(/LIS_rc%nensem(n)/)),&
'nf90_put_var for ensID failed in LIS_historyMod')
endif
Expand All @@ -2656,7 +2656,7 @@ subroutine writeRoutingNetcdfOutput(n, group, ftn, ftn_stats, outInterval, &
deallocate(xlong)

if( LIS_masterproc ) then
if( LIS_rc%wopt.eq."2d ensemble gridspace" ) then
if( LIS_rc%wopt_routing.eq."2d ensemble gridspace" ) then
deallocate(ensval)
endif
endif
Expand All @@ -2669,16 +2669,18 @@ end subroutine writeRoutingNetcdfOutput
! \label{defineNETCDFheaderVar}
!
! !INTERFACE:
subroutine defineNETCDFheaderVar(n,ftn,dimID, dataEntry, non_model_fields)
subroutine defineNETCDFheaderVar(n,ftn,dimID, dataEntry, non_model_fields, wopt)
! !USES:

! !ARGUMENTS:
integer :: n
integer :: ftn
integer :: dimID(4)
type(LIS_metadataEntry), pointer :: dataEntry
integer, optional :: non_model_fields
integer :: dimID(4)
!
character*50, optional :: wopt

!
! !DESCRIPTION:
! This routine writes the required NETCDF header for a single variable
!
Expand Down Expand Up @@ -2710,6 +2712,7 @@ subroutine defineNETCDFheaderVar(n,ftn,dimID, dataEntry, non_model_fields)
integer :: fill_value
integer :: dimID_vert
integer :: start, end
character*50 :: wopt_local

#if(defined USE_NETCDF3 || defined USE_NETCDF4)

Expand All @@ -2718,6 +2721,11 @@ subroutine defineNETCDFheaderVar(n,ftn,dimID, dataEntry, non_model_fields)
nmodel_status = non_model_fields
endif

wopt_local = trim(LIS_rc%wopt)
if (present(wopt)) then
wopt_local = trim(wopt)
endif

data_index = dataEntry%index

shuffle = NETCDF_shuffle
Expand All @@ -2732,22 +2740,22 @@ subroutine defineNETCDFheaderVar(n,ftn,dimID, dataEntry, non_model_fields)
trim(dataEntry%short_name)//'_profiles', &
dataEntry%vlevels, dimID_vert), &
'nf90_def_dim failed (2d gridspace) in LIS_historyMod')
if (LIS_rc%wopt.eq."1d tilespace") then
if (wopt_local.eq."1d tilespace") then
dimID(2) = dimID_vert
else if(LIS_rc%wopt.eq."2d gridspace") then
else if(wopt_local.eq."2d gridspace") then
dimID(3) = dimID_vert
else if(LIS_rc%wopt.eq."2d ensemble gridspace") then
else if(wopt_local.eq."2d ensemble gridspace") then
dimID(4) = dimID_vert
endif
endif

! Define start and end limits of dimID to pass to nf90_def_var
if (nmodel_status == 1) then
! Latitude. No vertical levels.
if (LIS_rc%wopt == "1d tilespace") then
if (wopt_local == "1d tilespace") then
start = 1; end = 1
else if (LIS_rc%wopt == "2d gridspace" .or. &
LIS_rc%wopt == "2d ensemble gridspace") then
else if (wopt_local == "2d gridspace" .or. &
wopt_local == "2d ensemble gridspace") then
if (LIS_rc%nlatlon_dimensions == '1D') then
start = 2; end = 2
else
Expand All @@ -2756,10 +2764,10 @@ subroutine defineNETCDFheaderVar(n,ftn,dimID, dataEntry, non_model_fields)
end if
else if (nmodel_status == 2) then
! Longitude. No vertical levels.
if (LIS_rc%wopt == "1d tilespace") then
if (wopt_local == "1d tilespace") then
start = 1; end = 1
else if (LIS_rc%wopt == "2d gridspace" .or. &
LIS_rc%wopt == "2d ensemble gridspace") then
else if (wopt_local == "2d gridspace" .or. &
wopt_local == "2d ensemble gridspace") then
if (LIS_rc%nlatlon_dimensions == '1D') then
start = 1; end = 1
else
Expand All @@ -2769,19 +2777,19 @@ subroutine defineNETCDFheaderVar(n,ftn,dimID, dataEntry, non_model_fields)
else
! General case. Must consider 1D vs 2D horizontal, ensembles,
! and vertical levels
if (LIS_rc%wopt == "1d tilespace") then
if (wopt_local == "1d tilespace") then
if (dataEntry%vlevels > 1) then
start = 1; end = 2
else
start = 1; end = 1
end if
else if (LIS_rc%wopt == "2d gridspace") then
else if (wopt_local == "2d gridspace") then
if (dataEntry%vlevels > 1) then
start = 1; end = 3
else
start = 1; end = 2
end if
else if (LIS_rc%wopt == "2d ensemble gridspace") then
else if (wopt_local == "2d ensemble gridspace") then
if (dataEntry%vlevels > 1) then
start = 1; end = 4
else
Expand Down Expand Up @@ -4166,12 +4174,12 @@ subroutine writeroutingvar_dist_bin(ftn,n,var,form)
REAL :: gtmp(LIS_rc%lnc(n),LIS_rc%lnr(n))
integer :: gid, c,r,i,t,m

if(LIS_rc%wopt.eq."1d tilespace") then !tiled output
if(LIS_rc%wopt_routing.eq."1d tilespace") then !tiled output
write(LIS_logunit,*) '[ERR] 1d tilespace option is not supported'
write(LIS_logunit,*) '[ERR] in the distributed binary mode'
call LIS_endrun()

elseif(LIS_rc%wopt.eq."2d gridspace") then !2d gridded output
elseif(LIS_rc%wopt_routing.eq."2d gridspace") then !2d gridded output

gtmp = LIS_rc%udef

Expand All @@ -4198,7 +4206,7 @@ subroutine writeroutingvar_dist_bin(ftn,n,var,form)

write(ftn) gtmp

elseif(LIS_rc%wopt.eq."2d ensemble gridspace") then !2d gridded output
elseif(LIS_rc%wopt_routing.eq."2d ensemble gridspace") then !2d gridded output

do m=1, LIS_rc%nensem(n)

Expand All @@ -4222,7 +4230,7 @@ subroutine writeroutingvar_dist_bin(ftn,n,var,form)
write(ftn) gtmp
enddo

elseif(LIS_rc%wopt.eq."1d gridspace") then !1d gridded output
elseif(LIS_rc%wopt_routing.eq."1d gridspace") then !1d gridded output

write(LIS_logunit,*) '[ERR] 1d gridspace option is not supported'
write(LIS_logunit,*) '[ERR] in the distributed binary mode'
Expand Down Expand Up @@ -6311,7 +6319,7 @@ subroutine writeroutingvar_netcdf_real(ftn,ftn_stats, n, var,varid, mvar,&

#if (defined USE_NETCDF3 || defined USE_NETCDF4)

if(LIS_rc%wopt.eq."2d gridspace") then
if(LIS_rc%wopt_routing.eq."2d gridspace") then
allocate(var1(LIS_rc%nroutinggrid(n)))
if(LIS_masterproc) then
allocate(gtmp(LIS_rc%gnc(n),LIS_rc%gnr(n)))
Expand Down Expand Up @@ -6424,7 +6432,7 @@ subroutine writeroutingvar_netcdf_real(ftn,ftn_stats, n, var,varid, mvar,&
deallocate(gtmp1)

! Write output in 2D ensemble grid space:
elseif(LIS_rc%wopt.eq."2d ensemble gridspace") then
elseif(LIS_rc%wopt_routing.eq."2d ensemble gridspace") then

! Non-model output field status (T=non-model; F=model-based):
if(nmodel_status.ne.0) then ! non-model output field status
Expand Down
12 changes: 11 additions & 1 deletion lis/core/LIS_readConfig.F90
Original file line number Diff line number Diff line change
Expand Up @@ -984,10 +984,20 @@ subroutine LIS_readConfig()
call LIS_verify(rc,'Bias restart file: not defined')
endif
enddo

call ESMF_ConfigGetAttribute(LIS_config, LIS_rc%routingmodel, &
label="Routing model:",default="none", rc=rc)

! EMK Add separate support for output of routing models.
if (LIS_rc%routingmodel .ne. "none") then
call ESMF_ConfigGetAttribute(LIS_config, LIS_rc%wopt_routing, &
label="Routing output methodology:", rc=rc)
if (rc .ne. 0) then
write(LIS_logunit,*)'[INFO] Routing output methodology: not found in config file'
write(LIS_logunit,*)'[INFO] Will use general Output methodology: setting'
LIS_rc%wopt_routing = trim(LIS_rc%wopt)
endif
endif
LIS_rc%endcode = 1

88 format(a4,25x,a3,5x,16a)
Expand Down
Loading