Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3a759ec
upload tutorial docs
cenlinhe May 25, 2023
e8a29e8
remove duplicated file
cenlinhe May 25, 2023
6c32ae7
Add an instruction to build dependent libraries
CharlesZheZhang May 26, 2023
d18477f
sync with noahmp for bug fix of canopy heat storage
cenlinhe Jun 7, 2023
dd03821
update user_build_options example files
cenlinhe Jun 7, 2023
9b30022
bug fix for detecting LCZ and update URBPARM_LCZ.TBL to be consistent…
cenlinhe Jun 7, 2023
ad12926
bug fix for urban vars initialization in hrldas driver
cenlinhe Jun 8, 2023
ca4a0b9
bug fix for initialization to work with BEP,BEM urban physics call
cenlinhe Jun 10, 2023
e93bb2c
fixing issues with ERA5 climate
tslin2 Jun 13, 2023
040ffe5
Merge pull request #78 from tslin2/develop
cenlinhe Jun 16, 2023
ef4fc0a
Add a bash script for fast ERA5 forcing extraction
cenlinhe Jul 31, 2023
12d6b77
Update README.md
cenlinhe Sep 8, 2023
ba09bf0
bug fix for ERA5 longitude, soil vert interpolation, and noahmp bug f…
cenlinhe Sep 19, 2023
98c2571
bug fix for create_forcing enclose
cenlinhe Sep 21, 2023
c4f4f9d
bug fix for example namelist for rainrate
cenlinhe Sep 22, 2023
a3ce25e
bug fix for the ground heat flux sign in diagnostic output for urban …
cenlinhe Oct 18, 2023
922a66f
bug fix for SLUCM saturated humidity calcualtion
cenlinhe Oct 22, 2023
0268d4b
Update ERA5-Land pre-processing code
CharlesZheZhang Oct 25, 2023
51f34fa
Update documentation regarding soil thickness
CharlesZheZhang Oct 25, 2023
aa08200
fixing typos
CharlesZheZhang Oct 25, 2023
da3ef3b
fixing typos
CharlesZheZhang Oct 26, 2023
74e2cbd
Merge pull request #121 from CharlesZheZhang/ERA5-Land_preprocess
CharlesZheZhang Oct 26, 2023
789b8c2
modify full_ic_frq mod for gfortran compiler and start j loop from 1 …
CharlesZheZhang Nov 14, 2023
65a8e59
Merge pull request #128 from CharlesZheZhang/develop
cenlinhe Nov 14, 2023
88c155d
add readin capability for urban 2d fraction
cenlinhe Nov 15, 2023
a977cc3
Code to prepare ERA5-Land forcing in develop branch
CharlesZheZhang Nov 28, 2023
34cd205
Merge pull request #133 from CharlesZheZhang/develop
cenlinhe Nov 28, 2023
d1044a6
sync with latest noahmp for undefined value change
cenlinhe Nov 30, 2023
bee8b68
Merge pull request #131 from cenlinhe/add_frc_urb2d
cenlinhe Jan 5, 2024
d3c9973
noahmp bug fix for albedo & leafmass init & ERA5 forcing scripts
cenlinhe Jan 5, 2024
984ee59
update URBPARM_LCZ.TBL based on Alberto Martilli
cenlinhe Jan 5, 2024
edd5781
add configure file for NoahMP container environment
cenlinhe Jan 5, 2024
1d5e50d
make undefined value & precision consistent in HRLDAS driver
cenlinhe Jan 5, 2024
c51b79b
add user_build_option file for derecho
cenlinhe Jan 5, 2024
423c132
bug fix for hrldas variable initialization
cenlinhe Jan 5, 2024
aa2ee8a
bug fix for compile setup of different compiler for NCAR Derecho HPC
cenlinhe Jan 6, 2024
c9aa8ce
bug fix for restart frequency setup for gfortran compiler
cenlinhe Jan 8, 2024
b42804f
Update README.md for new AMS tutorial notes
cenlinhe Feb 5, 2024
02dee4e
upload tutorial notes for AMS 2024 Noah-MP short course
cenlinhe Feb 5, 2024
0e2106e
Update README.md for uploading AMS short course material
cenlinhe Feb 5, 2024
90922d2
upload AMS 2024 Noah-MP tutorial
cenlinhe Feb 5, 2024
04a00b6
Adding NLDAS2 Initial conditions
CharlesZheZhang Feb 26, 2024
42d0cd5
Merge pull request #158 from CharlesZheZhang/develop
cenlinhe Feb 26, 2024
1232f7f
sync with latest noahmp for bug fix
cenlinhe Mar 8, 2024
b7176c8
merge develop to snicar_lin hrldas
cenlinhe Mar 11, 2024
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Technical documentation freely available at http://dx.doi.org/10.5065/ew8g-yr95
**Original HRLDAS model description paper**: Fei Chen, Kevin W. Manning, Margaret A. LeMone, Stanley B. Trier, Joseph G. Alfieri, Rita Roberts, Mukul Tewari, Dev Niyogi, Thomas W. Horst, Steven P. Oncley, Jeffrey B. Basara, and Peter D. Blanken, 2007: Description and Evaluation of the Characteristics of the NCAR High-Resolution Land Data Assimilation System. J. Appl. Meteor. Climatol., 46, 694–713.
doi: http://dx.doi.org/10.1175/JAM2463.1

**HRLDAS/Noah-MP version 5.0 model description paper**: He, C., Valayamkunnath, P., Barlage, M., Chen, F., Gochis, D., Cabell, R., Schneider, T., Rasmussen, R., Niu, G.-Y., Yang, Z.-L., Niyogi, D., and Ek, M. (2023): Modernizing the open-source community Noah-MP land surface model (version 5.0) with enhanced modularity, interoperability, and applicability, Geosci. Model Dev., https://doi.org/10.5194/egusphere-2023-675, in review.
**HRLDAS/Noah-MP version 5.0 model description paper**: He, C., Valayamkunnath, P., Barlage, M., Chen, F., Gochis, D., Cabell, R., Schneider, T., Rasmussen, R., Niu, G.-Y., Yang, Z.-L., Niyogi, D., and Ek, M.: Modernizing the open-source community Noah with multi-parameterization options (Noah-MP) land surface model (version 5.0) with enhanced modularity, interoperability, and applicability, Geosci. Model Dev., 16, 5131–5151, https://doi.org/10.5194/gmd-16-5131-2023, 2023.


## HRLDAS GitHub structure
Expand Down
36 changes: 31 additions & 5 deletions hrldas/HRLDAS_forcing/create_forcing.F
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ program create_forcing
integer :: ihour
integer :: numarg
integer :: unmatched
logical :: ic_flag
#ifndef _GFORTRAN_
! For some reason, gfortran does not like this declared external,
! but everyone else wants it declared external. So we use #ifndef
Expand Down Expand Up @@ -441,8 +442,16 @@ program create_forcing
ierr = nf90_close(ncid)
call error_handler(ierr, "Problem closing Netcdf file")

ic_flag = .false.
if ( full_ic_frq > -1 ) then ! full_ic_frq == -1 turns off extra processing for initial conditions.
if ( ( (full_ic_frq>0) .and. (mod(ihour, full_ic_frq)==0) ) .or. ( ihour==0 ) ) then
if ( ihour == 0) ic_flag = .true.
if ( full_ic_frq > 0 ) then
if (mod(ihour, full_ic_frq) == 0) then
ic_flag = .true.
endif
endif

if ( ic_flag .eqv. .true. ) then

call open_netcdf_for_output( trim(OutputDir)//"HRLDAS_setup_"//date(1:4)//date(6:7)//date(9:10)//date(12:13)//"_d"//hgrid, &
ncid, version, geo_em%idim, geo_em%jdim, geo_em, .true.)
Expand Down Expand Up @@ -1259,7 +1268,11 @@ subroutine remap(datastruct, geo_em, buff)
call latlon_to_ij(datastruct%proj, geo_em%lat(i,j), east_longitude, etax(i,j), etay(i,j))
#else
if (forcing_type=="ERA5") then
call latlon_to_ij(datastruct%proj, geo_em%lat(i,j), geo_em%lon(i,j)+360., etax(i,j), etay(i,j))
if (geo_em%lon(i,j) < 0) then
call latlon_to_ij(datastruct%proj, geo_em%lat(i,j), geo_em%lon(i,j)+360., etax(i,j), etay(i,j))
else
call latlon_to_ij(datastruct%proj, geo_em%lat(i,j), geo_em%lon(i,j), etax(i,j), etay(i,j))
endif
else
call latlon_to_ij(datastruct%proj, geo_em%lat(i,j), geo_em%lon(i,j), etax(i,j), etay(i,j))
endif
Expand Down Expand Up @@ -2103,7 +2116,7 @@ subroutine read_era5_netcdf_unit(ncid, datastruct, ierr, current)
array = [string('Tair_f_inst'),string('z'),string('lsm')] ! Only z (for geopotential) and lsm (for land-sea mask) are needed
nullify(datastruct%data)
! Match the netcdf attribute with one of the Vtable entries
VARSEARCH : do j = 0, vtable_count
VARSEARCH : do j = 1, vtable_count
if (current%label == vtable(j)%name) then
VAR_NAME = array(j)%str
datastruct%field = vtable(j)%name
Expand Down Expand Up @@ -2198,7 +2211,7 @@ end function check_if_same_map
!==============================================================================
!==============================================================================

end program create_forcing
!end program create_forcing

!==============================================================================
!==============================================================================
Expand Down Expand Up @@ -2727,7 +2740,15 @@ subroutine interp_rainfall_nearest_neighbor(datastruct, newarr, mix, mjx, geo_em

call latlon_to_ij(datastruct%proj, geo_em%lat(ii,jj), east_longitude, x, y)
#else
call latlon_to_ij(datastruct%proj, geo_em%lat(ii,jj), geo_em%lon(ii,jj), x, y)
if (forcing_type=="ERA5") then
if (geo_em%lon(ii,jj) < 0) then
call latlon_to_ij(datastruct%proj, geo_em%lat(ii,jj), geo_em%lon(ii,jj)+360.0, x, y)
else
call latlon_to_ij(datastruct%proj, geo_em%lat(ii,jj), geo_em%lon(ii,jj), x, y)
endif
else
call latlon_to_ij(datastruct%proj, geo_em%lat(ii,jj), geo_em%lon(ii,jj), x, y)
endif
#endif

xn = nint(x)
Expand Down Expand Up @@ -3196,3 +3217,8 @@ end subroutine close_flnm
!==============================================================================
!==============================================================================

end program create_forcing

!==============================================================================
!==============================================================================

10 changes: 5 additions & 5 deletions hrldas/HRLDAS_forcing/lib/cio.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

/* ****************************************************************** */

copen(nunit, name, mode, err, oflag)
int copen(nunit, name, mode, err, oflag)
/*
* nunit = UNIX file descriptor associated with file named *name*
* name = UNIX file name
Expand Down Expand Up @@ -145,7 +145,7 @@ copen(nunit, name, mode, err, oflag)
}

/* ****************************************************************** */
bnseek(fd, bread, mode, iprint)
int bnseek(fd, bread, mode, iprint)

/* Move the read/write file pointer
fd : Unix file descriptor.
Expand Down Expand Up @@ -183,7 +183,7 @@ bnseek(fd, bread, mode, iprint)

/* ****************************************************************** */

bnread(fd, buf, nbuf, bread, ios, idiag)
int bnread(fd, buf, nbuf, bread, ios, idiag)
/*
* fd = UNIX file descriptor number (NOT a Fortran unit)
* buf = area into which to read
Expand Down Expand Up @@ -234,7 +234,7 @@ bnread(fd, buf, nbuf, bread, ios, idiag)

/* ****************************************************************** */

bnwrit(fd, buf, nbuf, bwritten, err, idiag)
int bnwrit(fd, buf, nbuf, bwritten, err, idiag)
int *fd, *nbuf, buf[], *bwritten, *err, *idiag;

/*
Expand Down Expand Up @@ -268,7 +268,7 @@ bnwrit(fd, buf, nbuf, bwritten, err, idiag)

/* ****************************************************************** */

cclose(nunit, iprint, err)
int cclose(nunit, iprint, err)
/*
Close a C (UNIX?) file descriptor:
nunit : (INPUT) : The C (UNIX?) file descriptor to close.
Expand Down
190 changes: 190 additions & 0 deletions hrldas/HRLDAS_forcing/run/examples/ERA5/Prepare_ERA5-Land_Forcing.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
#!/bin/bash

#################################################################################################
# #
# Alessandro Anav JULY 2023 #
# #
# This script extracts and prepares the variables needed to run NOAH-MP from ERA5-Land #
# The program expects one single file per year, namely data should span from #
# YYYY-01-01_00:00:00 to YYYY-12-31_23:00:00 #
# #
# For questions or issues: alessandro.anav@enea.it #
# #
#################################################################################################


#################################################################################################
# #
# USER DEFINED INPUT FILES #
# #
#################################################################################################

# set date for data processing
inyear=2023
inmonth=11
inday=01
preyear=2023
premonth=10
preday=31

indate=${inyear}-${inmonth}-${inday}
INFILE=../../../ERA5_forcing/ERA5-Land-Noah-MP-${indate}.grib
predate=${preyear}-${premonth}-${preday}
PREVIOUS_FILE=../../../ERA5_forcing/ERA5-Land-Noah-MP-${predate}.grib

#################################################################################################
# #
# INPUT VARIABLES #
# #
#################################################################################################

vars_name=("10U" "10V" "2T" "2D" "SP" "SSRD" "STRD" "TP")
vars_nout=("10U" "10V" "2T" "2D" "SP" "ACSSRD" "ACSTRD" "ACTP")
vars_code=("var165" "var166" "var167" "var168" "var134" "var169" "var175" "var228")

#################################################################################################
# #
# START PROGRAM #
# #
#################################################################################################

echo ""
echo -e "\033[33m Processing Date: ${indate} FILE: $INFILE \033[0m"
echo ""

#-------------------------------------------------------------------------- CREATING OUTPUT DIRECTORIES

mkdir -p OUTPUTS

for i in ${!vars_name[@]}; do
mkdir -p OUTPUTS/${vars_name[$i]}
done

mkdir -p OUTPUTS/E
mkdir -p OUTPUTS/Q

#################################################################################################
# #
# PART 1: EXTRACT TIME-STEP VARIABLES #
# #
#################################################################################################

echo -e "\033[32m o-----------------> PART 1: EXTRACTING TIME-STEP VARIABLES \033[0m"

#-------------------------------------------------------------------------- SPLIT THE VARIABLES FROM INPUT FILE
grib_copy $INFILE OUTPUTS/[shortName].grb

for i in ${!vars_name[@]}; do
echo -e "\033[36m PROCESSING ${vars_nout[$i]} \033[0m"
var=${vars_name[$i]}
#-------------------------------------------------------------------------- SPLIT TIME
codes_split_file -1 OUTPUTS/${var,,}.grb

#-------------------------------------------------------------------------- LOOP OVER FILES TO RENAME THEM ACCORDING TO THE DATE
for f1 in $(ls OUTPUTS/${var,,}.grb_*); do
date=(`cdo -s showtimestamp $f1`)
timestamp=$(sed -e 's/T/''/g' -e 's/:00:00/''/g' -e 's/-/''/g' <<< $date)
mv $f1 OUTPUTS/${vars_name[$i]}/ERA5_"${vars_nout[$i]}"_"${timestamp}"
done
done
echo ""

#################################################################################################
# #
# PART 2: DECUMULATE FIELDS #
# #
#################################################################################################

echo -e "\033[32m o-----------------> PART 2: DECUMULATE FIELDS \033[0m"

#-------------------------------------------------------------------------- EXTRACT THE ACCUMULATED VARIABLES FROM THE LAST TIME STEP OF PREVIOUS YEAR

cdo -s -selvar,var169 -seldate,${predate}T23:00:00,${predate}T23:00:00 $PREVIOUS_FILE OUTPUTS/SSRD/ERA5_ACSSRD_"$preyear""$premonth""$preday"23
cdo -s -selvar,var175 -seldate,${predate}T23:00:00,${predate}T23:00:00 $PREVIOUS_FILE OUTPUTS/STRD/ERA5_ACSTRD_"$preyear""$premonth""$preday"23
cdo -s -selvar,var228 -seldate,${predate}T23:00:00,${predate}T23:00:00 $PREVIOUS_FILE OUTPUTS/TP/ERA5_ACTP_"$preyear""$premonth""$preday"23

#-------------------------------------------------------------------------- DECUMULATE VARIABLES
for i in ${!vars_nout[@]}; do
if [ ${vars_nout[$i]} = "ACSSRD" ] || [ ${vars_nout[$i]} = "ACSTRD" ] || [ ${vars_nout[$i]} = "ACTP" ] ; then

echo -e "\033[36m PROCESSING ${vars_nout[$i]} \033[0m"

FILES=OUTPUTS/${vars_name[$i]}/ERA5_"${vars_nout[$i]}"_"$inyear"*
prev_file="OUTPUTS/${vars_name[$i]}/ERA5_"${vars_nout[$i]}"_""$preyear""$premonth""$preday"23

for f in $FILES; do
# Find the hour reading the last two digits of the filename
file=$(basename "$f")
hour="${file: -2}"

# Create the output file name replacing the name of accumulated variable with instantaneous variable
outfile=$(sed 's/'${vars_nout[$i]}'/'${vars_name[$i]}'/g' <<< $f)

# Decumulate the 02-24 fields and copy the 01 data from accumulated to instantaneous variable
if [[ "$hour" = "01" ]]; then
echo -e "\033[32m We are at 01: cp $f to $outfile \033[0m"
cp $f $outfile
else
echo -e "\033[33m Decumulating: $f less $prev_file saved to $outfile \033[0m"
cdo -s -sub $f $prev_file $outfile
fi
prev_file=$f
done
echo ""
fi
done
echo ""

#################################################################################################
# #
# PART 3: COMPUTE SPECIFIC HUMIDITY #
# #
#################################################################################################

# Three steps are taken for calculating specific humidity
# (1) calculate saturated water pressure e from Td
# (2) combine e and SP
# (3) calculate q from e and SP

echo -e "\033[32m o-----------------> PART 3: COMPUTING SPECIFIC HUMIDITY \033[0m"

FILES=OUTPUTS/2D/ERA5_2D_"$inyear"*

for f in $FILES; do
outfile1=$(sed 's/'2D'/'E'/g' <<< $f)
echo -e "\033[33m Computing saturated water pressure from $f and save results to $outfile1 \033[0m"
cdo -s -expr,"var1=6.112*exp(17.67*(var168-273.15)/(var168-273.15+243.5))" $f $outfile1

mkdir -p OUTPUTS/TMP
SP_file=$(sed 's/'2D'/'SP'/g' <<< $f)
outfile2=$(sed 's/'2D'/'TMP'/g' <<< $f)
echo -e "\033[33m Merging $outfile1 and $SP_file to $outfile2 \033[0m"
cdo -s merge $outfile1 $SP_file $outfile2

outfile3=$(sed 's/'2D'/'Q'/g' <<< $f)
cdo -s -setparam,133.128 -expr,"var133=(0.622*var1)/(var134/100.-(0.378*var1))/1000." $outfile2 $outfile3
done
echo ""

#################################################################################################
# #
# CLEANING UP #
# #
#################################################################################################

rm OUTPUTS/*.grb
rm OUTPUTS/TP/ERA5_ACTP_"$inyear"*
rm OUTPUTS/SSRD/ERA5_ACSSRD_"$inyear"*
rm OUTPUTS/STRD/ERA5_ACSTRD_"$inyear"*
rm -rf OUTPUTS/TMP
rm -rf OUTPUTS/E

#################################################################################################
# #
# NICE ENDING MESSAGE #
# #
#################################################################################################

echo -e "\033[32m o-----------------> ALL DONE \033[0m"
echo ""

Loading