Commit c811f359 authored by Akash Koppa's avatar Akash Koppa

added a switch to enable/disable preprocessing of meteorological files in DEM Processing

parent 9c670fd6
......@@ -9,8 +9,8 @@
#------------------------USER DEFINED SETTINGS-------------------------#
## input and output paths
# absolute path to target DEM
source_dem="/data/hicam/data/processed/de_hicam/morph/dem.asc"
met_dem="/data/hicam/data/processed/dem_OR/raw/dem_hicam_EU.nc"
source_dem="/data/hicam/data/processed/de_hicam/morph/dem_germany.asc"
#met_dem="/data/hicam/data/processed/dem_OR/raw/dem_hicam_EU.nc"
# absolute path to meteorological files (currently supports mHM inputs)
path_rr="/data/hicam/EOBS/raw/latlon/rr_ens_mean_0.1deg_reg_v20.0e.nc" # precipitation
path_tg="/data/hicam/EOBS/raw/latlon/tg_ens_mean_0.1deg_reg_v20.0e.nc" # average temperature
......@@ -19,19 +19,18 @@ path_tx="/data/hicam/EOBS/raw/latlon/tx_ens_mean_0.1deg_reg_v20.0e.nc" # maximu
# output directory
output_dir="/work/koppa/hicam_edk/test"
# domain specifications for target dem
# domain specifications for target dem (xmin, xmax, ymin, ymax)
# hicam domain of germany with headwaters [4.0, 20.0, 45.0, 55.5]
# hicam domain of only germany [5.93, 15.75, 46.96, 55.15]
xmin="4.0"
xmax="19.5"
xmax="20.0"
ymin="45.0"
ymax="55.5"
target_res="0.015625" # target resolution
# domain specification for meteorological datasets (to subset the met domain)
#xmin_met="3.7"
#xmax_met="19.8"
#ymin_met="44.7"
#ymax_met="55.8"
# meteorological flag
met_flag=0 # 0: no meteorological processing 1: met files will be processed
met_res="0.10" # resolution of meteorology datasets
crs_reqd="+init=epsg:3035" # provide the epsg of the m-m coordinate system
crs_reqd="+init=epsg:31468" # provide the epsg of the m-m coordinate system
# meteorological variable details (name of the variable in the netcdf file)
var_rr="rr"
......@@ -47,6 +46,7 @@ var_tx="tx"
# load netcdf and R modules
module load GCC/7.3.0-2.30 OpenMPI/3.1.1 NCO/4.7.8 CDO/1.9.5 GDAL/2.2.3-Python-3.6.6 ncview/2.1.7 R/3.6.0
echo "--------Processing DEM---------"
## process target DEM
# convert the ascii file to .tif
gdal_translate ${source_dem} "${output_dir}/dem_target.tif"
......@@ -68,6 +68,9 @@ cdo setmissval,-9999 "${output_dir}/dem_target.nc" "${output_dir}/dem_target.nc"
# add northing and easting to the target variable using the R script
Rscript latlon2northeast.R "${output_dir}/dem_target.nc" "dem" ${crs_reqd}
if [ ${met_flag} -gt 0 ]
then
echo "-----------Processing Meteorological Data-----------"
## process input meteorological forcing
# subset the meteorological forcing
ncks -d longitude,${xmin},${xmax} -d latitude,${ymin},${ymax} "${path_rr}" "${output_dir}/rr_temp.nc"
......@@ -103,6 +106,8 @@ Rscript add_dem2met.R "${output_dir}/rr_final.nc" "${output_dir}/dem_met.nc"
Rscript add_dem2met.R "${output_dir}/tg_final.nc" "${output_dir}/dem_met.nc"
Rscript add_dem2met.R "${output_dir}/tn_final.nc" "${output_dir}/dem_met.nc"
Rscript add_dem2met.R "${output_dir}/tx_final.nc" "${output_dir}/dem_met.nc"
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment