Skip to content

Commit

Permalink
Added full chemistry case
Browse files Browse the repository at this point in the history
  • Loading branch information
corink21 committed Mar 18, 2024
1 parent 50f1111 commit 6362654
Show file tree
Hide file tree
Showing 13 changed files with 2,622 additions and 0 deletions.
91 changes: 91 additions & 0 deletions cases/icon-art-full-chem/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Configuration file for the 'icon-art-full-chem-test' case with ICON

workflow: icon-art-full-chem
constraint: mc
run_on: cpu
compute_queue: normal
ntasks_per_node: 36
restart_step: PT6H
startdate: 2019-02-12T00:00:00Z
enddate: 2019-02-26T00:00:00Z

eccodes_dir: /users/icontest/pool/data/ICON/mch/eccodes_definitions
latbc_filename: LBC_<y><m><d><h>.nc
inidata_prefix: IC_
inidata_nameformat: '%Y%m%d%H'
inidata_filename_suffix: .nc
lbcdata_prefix: LBC_
lbcdata_nameformat: '%Y%m%d%H'
lbcdata_filename_suffix: .nc
output_filename: icon-full-chem-test
filename_format: <output_filename>_<ddhhmmss>
lateral_boundary_grid_order: lateral_boundary
art_input_folder: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/art

walltime:
prepare_icon: '00:10:00'
prepare_art_full_chem: '01:00:00'
icon: '02:00:00'

meteo:
dir: /scratch/snx3000/ckeller/proc_chain_data/input/meteo
prefix: era5_
nameformat: '%Y%m%d%H'
suffix: .grb
inc: 3

chem:
dir: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/chem
prefix: camchem_
nameformat: '%Y%m%d%H'
suffix: .nc
inc: 3
icbc_filename: camchem-20190212-20190226.nc
ref_date: '2000-03-01 00:00:00'


input_files:
radiation_grid_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/base_grid.nc
#radiation_grid_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/icon_R03B07_DOM01.nc
dynamics_grid_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/icon_R03B07_DOM01.nc
#dynamics_grid_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/icon_R03B08_DOM02.nc
map_file_latbc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/map_file.latbc
lateral_boundary_grid: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/lateral_boundary_DOM01.grid.nc
#lateral_boundary_grid: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/lateral_boundary_DOM02.grid.nc
extpar_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/extpar_DOM01.nc
#extpar_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/grid/extpar_DOM02.nc
cldopt_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/rad/rrtm_cldopt.nc
lrtm_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/rad/rrtmg_lw.nc
map_file_ana: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/mapping/map_file.ana
meccatracer_xml_filename: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/xml/mecca_tracers.xml
oem_gridded_emissions_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/oem/oem_gridded_emissions.nc
oem_vertical_profiles_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/oem/vertical_profiles.nc
oem_hourofday_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/oem/hourofday.nc
oem_dayofweek_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/oem/dayofweek.nc
oem_monthofyear_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/oem/monthofyear.nc
#oem_gridded_emissions_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/oem/oem_gridded_emissions_DOM02.nc
#oem_vertical_profiles_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/oem/vertical_profiles_DOM02.nc
#oem_hourofday_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/oem/hourofday_DOM02.nc
#oem_dayofweek_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/oem/dayofweek_DOM02.nc
#oem_monthofyear_nc: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/oem/monthofyear_DOM02.nc
aerodyn_tracers: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/aerodyn/tracers_aerosol.xml
aerodyn_modes: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/aerodyn/modes.xml
aerodyn_coag: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/aerodyn/coagulate.xml
aerodyn_emiss: /scratch/snx3000/ckeller/proc_chain_data/input/icon-art-full-chem/aerodyn/emiss.xml


icon:
binary_file: /scratch/snx3000/ckeller/proc_chain_data/ext/icon-art/bin/icon
runjob_filename: icon_runjob.cfg
era5_icjob: icon_era5_ic.sh
era5_lbcjob: icon_era5_lbc.sh
chem_icjob: icon_camchem_ic.sh
chem_lbcjob: icon_camchem_lbc.sh
compute_queue: normal
walltime: '02:00:00'
np_tot: 32
np_io: 3
np_restart: 1
np_prefetch: 1
timestep: 120.

40 changes: 40 additions & 0 deletions cases/icon-art-full-chem/icon_camchem_ic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

cd {cfg.icon_input_icbc}

# ---------------------------------
# -- Pre-processing
# ---------------------------------

rm -f {cfg.icon_input_icbc}/{cfg.chem_prefix}{cfg.startdate_sim_yyyymmddhh}_ic_icon{cfg.inidata_filename_suffix}

# -- Change variable and coordinates names to be consistent with MECCA nomenclature
cdo setpartabn,partab_chem,convert {cfg.icon_input_icbc}/{cfg.chem_prefix}{cfg.startdate_sim_yyyymmddhh}_ic{cfg.chem_suffix} data_in.nc

# ---------------------------------
# -- Re-mapping
# ---------------------------------

# -- Retrieve the triangular horizontal grid
cdo -s selgrid,2 {cfg.input_files_scratch_dynamics_grid_filename} triangular-grid.nc

# -- Create the weights for remapping CAM-Chem (lat,lon) grid onto the triangular grid
echo "creating weights"
cdo genbil,triangular-grid.nc data_in.nc weights.nc

# -- Remap
cdo -s remap,triangular-grid.nc,weights.nc data_in.nc chem_final.nc
rm data_in.nc triangular-grid.nc

# ---------------------------------
# -- Post-processing
# ---------------------------------

# -- Rename dimensions and order alphabetically
ncrename -h -d cell,ncells chem_final.nc
ncrename -h -d nv,vertices chem_final.nc
ncks chem_final.nc {cfg.icon_input_icbc}/{cfg.chem_prefix}{cfg.startdate_sim_yyyymmddhh}_ic_icon{cfg.inidata_filename_suffix}
rm chem_final.nc weights.nc

# -- Clean up
rm {cfg.icon_input_icbc}/{cfg.chem_prefix}{cfg.startdate_sim_yyyymmddhh}_ic{cfg.chem_suffix}
53 changes: 53 additions & 0 deletions cases/icon-art-full-chem/icon_camchem_lbc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

cd {cfg.icon_input_icbc}

# -- Loop over file list
i=0
echo "DATAFILELIST is {datafile_list_chem}"
for datafilename in {datafile_list_chem} ; do
datafile="${{datafilename##*/}}" # get filename without path
outdatafile=${{datafile%.*}} # get filename without suffix
((i++))

# ---------------------------------
# -- Pre-processing
# ---------------------------------

rm -f {cfg.icon_input_icbc}/${{outdatafile}}_icon{cfg.inidata_filename_suffix}

# -- Change variable and coordinates names to be consistent with ICON nomenclature
cdo setpartabn,partab_chem,convert $datafilename data_in.nc

# ---------------------------------
# -- Re-mapping
# ---------------------------------

# -- Retrieve the lateral boundary grid
cdo -s selgrid,2 {cfg.input_files_scratch_lateral_boundary_grid} triangular-grid.nc

# -- Create the weights for remapping CAM-Chem data from latlon grid onto the triangular grid
if [[ $i == "1" ]] ; then
echo "creating weights"
cdo genbil,triangular-grid.nc data_in.nc weights.nc
fi

# -- Remap
cdo -s remap,triangular-grid.nc,weights.nc data_in.nc chem_final.nc
rm data_in.nc triangular-grid.nc

# ---------------------------------
# -- Post-processing
# ---------------------------------

# -- Rename dimensions and order alphabetically
ncrename -h -d cell,ncells chem_final.nc
ncrename -h -d nv,vertices chem_final.nc
ncks chem_final.nc {cfg.icon_input_icbc}/${{outdatafile}}_icon{cfg.inidata_filename_suffix}
rm chem_final.nc

# -- Clean up
rm $datafilename
done
# -- Clean up
rm weights.nc
132 changes: 132 additions & 0 deletions cases/icon-art-full-chem/icon_era5_ic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#!/bin/bash

cd {cfg.icon_input_icbc}

# ---------------------------------
# -- Pre-processing
# ---------------------------------

rm -f {cfg.icon_input_icbc}/{cfg.meteo_prefix}{cfg.startdate_sim_yyyymmddhh}_ic{cfg.inidata_filename_suffix}

# -- Convert the GRIB files to NetCDF
cdo -t ecmwf -f nc copy {cfg.meteo_dir}/{cfg.meteo_prefix}{cfg.startdate_sim_yyyymmddhh}{cfg.meteo_suffix} era5_ori.nc

# -- Change variable and coordinates names to be consistent with ICON nomenclature
cdo setpartabn,partab_meteo,convert era5_ori.nc tmp.nc

# -- Order the variables alphabetically
ncks tmp.nc data_in.nc
rm tmp.nc era5_ori.nc

# ---------------------------------
# -- Re-mapping
# ---------------------------------

# -- Retrieve the triangular grid
cdo -s selgrid,2 {cfg.input_files_scratch_dynamics_grid_filename} triangular-grid.nc

# -- Create the weights for remapping era5 latlon grid onto the triangular grid
cdo gendis,triangular-grid.nc data_in.nc weights.nc

# -- Extract the land-sea mask variable
cdo selname,LSM data_in.nc LSM_in.nc
ncrename -h -v LSM,FR_LAND LSM_in.nc
cdo selname,FR_LAND {cfg.input_files_scratch_extpar_filename} LSM_out_tmp.nc

# -- Add time dimension to LSM_out.nc
ncecat -O -u time LSM_out_tmp.nc LSM_out_tmp.nc
ncks -h -A -v time LSM_in.nc LSM_out_tmp.nc

# -- Create two different files for land- and sea-mask
# --------------------------------------------------
# -- Comments:
# -- setctomoss,0. = setting missing values to 0.
# -- gtc = greater than constant (o(t,x) = 1 if i(t,x) > const, o(t,x) = 0 else)
# -- ltc = lower than constant (o(t,x) = 1 if i(t,x) < const, o(t,x) = 0 else)
# --------------------------------------------------
cdo -L setctomiss,0. -ltc,0.5 LSM_in.nc oceanmask_in.nc
cdo -L setctomiss,0. -gec,0.5 LSM_in.nc landmask_in.nc
cdo -L setctomiss,0. -ltc,0.5 LSM_out_tmp.nc oceanmask_out.nc
cdo -L setctomiss,0. -gec,0.5 LSM_out_tmp.nc landmask_out.nc
cdo setrtoc2,0.5,1.0,1,0 LSM_out_tmp.nc LSM_out.nc
rm LSM_in.nc LSM_out_tmp.nc

# -- Select surface sea variables defined only on sea
ncks -h -v SST,CI data_in.nc datasea_in.nc

# -- Select surface variables defined on both that must be remapped differently on sea and on land
ncks -h -v SKT,STL1,STL2,STL3,STL4,ALB_SNOW,W_SNOW,T_SNOW data_in.nc dataland_in.nc

# -----------------------------------------------------------------------------
# -- Remap land and ocean area differently for variables
# -----------------------------------------------------------------------------

# -- Ocean part
# -----------------

# -- Apply the ocean mask (by dividing)
cdo div dataland_in.nc oceanmask_in.nc tmp1_land.nc
cdo div datasea_in.nc oceanmask_in.nc tmp1_sea.nc

# -- Set missing values to a distance-weighted average
cdo setmisstodis tmp1_land.nc tmp2_land.nc
cdo setmisstodis tmp1_sea.nc tmp2_sea.nc

# -- Remap
cdo remap,triangular-grid.nc,weights.nc tmp2_land.nc tmp3_land.nc
cdo remap,triangular-grid.nc,weights.nc tmp2_sea.nc tmp3_sea.nc


# -- Apply the ocean mask to remapped variables (by dividing)
cdo div tmp3_land.nc oceanmask_out.nc dataland_ocean_out.nc
cdo div tmp3_sea.nc oceanmask_out.nc datasea_ocean_out.nc

# -- Clean the repository
rm tmp*.nc oceanmask*.nc

# -- Land part
# -----------------

cdo div dataland_in.nc landmask_in.nc tmp1.nc
cdo setmisstodis tmp1.nc tmp2.nc
cdo remap,triangular-grid.nc,weights.nc tmp2.nc tmp3.nc
cdo div tmp3.nc landmask_out.nc dataland_land_out.nc
rm tmp*.nc landmask*.nc dataland_in.nc datasea_in.nc

# -- merge remapped land and ocean part
# --------------------------------------

cdo ifthenelse LSM_out.nc dataland_land_out.nc dataland_ocean_out.nc dataland_out.nc
rm dataland_ocean_out.nc dataland_land_out.nc

# remap the rest and merge all files
# --------------------------------------

# -- Select all variables apart from these ones
ncks -h -x -v SKT,STL1,STL2,STL3,STL4,ALB_SNOW,W_SNOW,T_SNOW,SST,CI,LSM data_in.nc datarest_in.nc
# -- Remap
cdo -s remap,triangular-grid.nc,weights.nc datarest_in.nc era5_final.nc
rm datarest_in.nc data_in.nc

# -- Fill NaN values for SST and CI
cdo setmisstodis -selname,SST,CI datasea_ocean_out.nc dataland_ocean_out_filled.nc
rm datasea_ocean_out.nc

# -- Merge remapped files plus land-sea mask from EXTPAR
ncks -h -A dataland_out.nc era5_final.nc
ncks -h -A dataland_ocean_out_filled.nc era5_final.nc
ncks -h -A -v FR_LAND LSM_out.nc era5_final.nc
ncrename -h -v FR_LAND,LSM era5_final.nc
rm LSM_out.nc dataland_out.nc dataland_ocean_out_filled.nc

# ---------------------------------
# -- Post-processing
# ---------------------------------

ncrename -h -d cell,ncells era5_final.nc
ncrename -h -d nv,vertices era5_final.nc
ncks era5_final.nc {cfg.icon_input_icbc}/{cfg.meteo_prefix}{cfg.startdate_sim_yyyymmddhh}_ic{cfg.inidata_filename_suffix}
rm era5_final.nc

# -- Clean up
rm triangular-grid.nc weights.nc
54 changes: 54 additions & 0 deletions cases/icon-art-full-chem/icon_era5_lbc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

cd {cfg.icon_input_icbc}

# -- Loop over file list
i=0
for datafilename in {datafile_list_meteo} ; do
datafile="${{datafilename##*/}}" # get filename without path
outdatafile=${{datafile%.*}} # get filename without suffix
((i++))

# ---------------------------------
# -- Pre-processing
# ---------------------------------

rm -f {cfg.icon_input_icbc}/${{outdatafile}}_lbc{cfg.inidata_filename_suffix}

# -- Convert the GRIB files to NetCDF
cdo -t ecmwf -f nc copy $datafilename era5_ori.nc

# -- Change variable and coordinates names to be consistent with ICON nomenclature
cdo setpartabn,partab_meteo,convert era5_ori.nc tmp.nc
# -- Order the variables alphabetically
ncks tmp.nc data_in.nc
rm tmp.nc era5_ori.nc

# ---------------------------------
# -- Re-mapping
# ---------------------------------

# -- Retrieve the lateral boundary grid
cdo -s selgrid,2 {cfg.input_files_scratch_lateral_boundary_grid} triangular-grid.nc

# -- Create the weights for remapping era5 latlon grid onto the triangular grid
if [[ $i == "1" ]] ; then
echo "creating weights"
cdo gendis,triangular-grid.nc data_in.nc weights.nc
fi

# -- Remap
cdo -s remap,triangular-grid.nc,weights.nc data_in.nc era5_final.nc
rm data_in.nc triangular-grid.nc

# ---------------------------------
# -- Post-processing
# ---------------------------------

ncrename -h -d cell,ncells era5_final.nc
ncrename -h -d nv,vertices era5_final.nc
ncks era5_final.nc {cfg.icon_input_icbc}/${{outdatafile}}_lbc{cfg.inidata_filename_suffix}
rm era5_final.nc
done
# -- Clean up
rm weights.nc
Loading

0 comments on commit 6362654

Please sign in to comment.