From 82135ed93f29ba9289dcfa9819ae684ce2d9341c Mon Sep 17 00:00:00 2001 From: lkugler <lukas.kugler@gmail.com> Date: Tue, 23 May 2023 17:40:03 +0200 Subject: [PATCH] docs, template config --- config/cluster.py | 77 ------------------------------------------ config/exp_template.py | 12 +++---- dartwrf/utils.py | 48 +++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 84 deletions(-) delete mode 100755 config/cluster.py diff --git a/config/cluster.py b/config/cluster.py deleted file mode 100755 index c1c7791..0000000 --- a/config/cluster.py +++ /dev/null @@ -1,77 +0,0 @@ -import os, sys -import datetime as dt -from dartwrf import utils -from config.cfg import exp - -"""Configuration name docs - -When coding, use attributes of a dictionary like this: -$ from cfg import exp, cluster -$ path = cluster.archivedir - - -attribute name | description ------------------------------------------------------- -name any string (currently unused) - -python path of python version to use -python_enstools path of python version to use for verification script (not provided) -ncks path to 'ncks' program; type 'which ncks' to find the path, - if it doesn't exist, try to load the module first ('module load nco') -ideal path to WRF's ideal.exe -wrfexe path to WRF's wrf.exe - -wrf_rundir_base path for temporary files for WRF -dart_rundir_base path for temporary files for DART -archive_base path for long-time output storage - -srcdir path to where WRF has been compiled, including the 'run' folder of WRF, e.g. /home/WRF-4.3/run -dart_srcdir path to DART compile directory, e.g. /home/DART-9.11.9/models/wrf/work -rttov_srcdir path to RTTOV compile directory, e.g. /home/RTTOV13/rtcoef_rttov13/ -scriptsdir path where DART-WRF scripts reside, e.g. /home/DART-WRF/scripts - -namelist path to a namelist template; strings like <hist_interval>, will be overwritten in scripts/prepare_namelist.py -run_WRF path to script which runs WRF on a node of the cluster -obs_impact_filename path to obs_impact_filename (see DART guide; module assim_tools_mod and program obs_impact_tool) -geo_em path to NetCDF file of WRF domain (see WRF guide) - -slurm_cfg python dictionary, containing options of SLURM - defined in SLURM docs (https://slurm.schedmd.com/sbatch.html) - this configuration can be overwritten later on, for example: - 'dict(cluster.slurm_cfg, **cfg_update)' where - 'cfg_update = {"nodes": "2"}' -""" - -cluster = utils.ClusterConfig(exp) -cluster.name = 'srvx1' -cluster.max_nproc = 6 -cluster.use_slurm = False - -# binaries -cluster.python = 'python' -cluster.python_verif = '/users/staff/lkugler/miniconda3/bin/python' -cluster.ncks = '/home/swd/spack/opt/spack/linux-rhel8-skylake_avx512/gcc-8.5.0/nco-5.0.1-ntu44aoxlvwtr2tsrobfr4lht7cpvccf/bin/ncks' -cluster.ideal = '' #/jetfs/home/lkugler/bin/ideal-v4.3_v1.22.exe' -cluster.wrfexe = '' #/jetfs/home/lkugler/bin/wrf-v4.3_v1.22.exe' -cluster.dart_modules = '' -cluster.wrf_modules = '' - -# paths for data output -cluster.wrf_rundir_base = utils.userhome+'/AdvDA23/run_WRF/' # path for temporary files -cluster.dart_rundir_base = utils.userhome+'/AdvDA23/run_DART/' # path for temporary files -cluster.archive_base = utils.userhome+'/data/sim_archive/' - -# paths used as input -cluster.srcdir = '/users/staff/lkugler/AdvDA23/DART/WRF-4.3/run' -cluster.dart_srcdir = '/users/students/lehre/advDA_s2023/DART/models/wrf/work' -cluster.rttov_srcdir = '/users/students/lehre/advDA_s2023/RTTOV13/rtcoef_rttov13/' -cluster.scriptsdir = utils.userhome+'/AdvDA23/DART-WRF/dartwrf/' -cluster.geo_em = '/users/students/lehre/advDA_s2023/data/geo_em.d01.nc' - -# templates/run scripts -cluster.namelist = cluster.scriptsdir+'/../templates/namelist.input' -cluster.run_WRF = cluster.scriptsdir+'/run_ens.jet.sh' - -cluster.slurm_cfg = {"account": "lkugler", "partition": "compute", - "ntasks": "1", "ntasks-per-core": "1", "mem": "50G", - "mail-type": "FAIL", "mail-user": "lukas.kugler@univie.ac.at"} diff --git a/config/exp_template.py b/config/exp_template.py index 8a14c5d..71650ab 100755 --- a/config/exp_template.py +++ b/config/exp_template.py @@ -1,10 +1,10 @@ from dartwrf import utils exp = utils.Experiment() -exp.expname = "test_newcode" #exp_v1.22_P2_rr_VIS_obs10_loc20_oe3" +exp.expname = "template_experiment" exp.model_dx = 2000 -exp.n_ens = 10 -exp.superob_km = False # False or int (spatial averaging of observations) +exp.n_ens = 40 +exp.superob_km = False # False or int (spatial averaging of observations, unit: km) exp.use_existing_obsseq = False # False or pathname (use precomputed obs_seq.out files) #exp.use_existing_obsseq = '/users/students/lehre/advDA_s2023/dartwrf_tutorial/very_cold_observation.out' @@ -17,7 +17,7 @@ exp.input_profile = '/mnt/jetfs/home/lkugler/data/initial_profiles/wrf/ens/2022- exp.dart_nml = {'&assim_tools_nml': dict(filter_kind='1', - sampling_error_correction='.true.', + sampling_error_correction='.false.', # obs_impact_filename='/jetfs/home/lkugler/DART-WRF/templates/impactfactor_T.txt', ), '&filter_nml': @@ -57,10 +57,10 @@ exp.dart_nml = {'&assim_tools_nml': vis = dict(var_name='VIS 0.6µm', unit='[1]', kind='MSG_4_SEVIRI_BDRF', sat_channel=1, - n_obs=961, obs_locations='square_array_evenly_on_grid', + n_obs=256, obs_locations='square_array_evenly_on_grid', # n_obs=1, obs_locations=[(44.141, -0.99)], error_generate=0.03, error_assimilate=0.03, - loc_horiz_km=20) + loc_horiz_km=10) wv62 = dict(var_name='Brightness temperature WV 6.2µm', unit='[K]', kind='MSG_4_SEVIRI_TB', sat_channel=5, diff --git a/dartwrf/utils.py b/dartwrf/utils.py index 4ad6421..e5a1406 100755 --- a/dartwrf/utils.py +++ b/dartwrf/utils.py @@ -11,7 +11,53 @@ class Experiment(object): pass class ClusterConfig(object): - """Collection of variables regarding the cluster configuration""" + """Collection of variables regarding the cluster configuration + + Configuration name docs + + When coding, use configuration settings like this: + $ from exp_config import exp + $ from cluster_config import cluster + $ path = cluster.archivedir + + Attributes: + name (str): Name of the cluster + max_nproc (int): Maximum number of processors that can be used + use_slurm (bool): If True, use SLURM to submit jobs + size_jobarray (int): Size of SLURM job array + + python (str): Path to python executable + python_verif (str): Path to python executable for verification + ncks (str): Path to ncks executable + ideal (str): Path to ideal.exe + wrfexe (str): Path to wrf.exe + + dart_modules (str): Modules to load for DART + wrf_modules (str): Modules to load for WRF + + wrf_rundir_base (str): Path to temporary files for WRF + dart_rundir_base (str): Path to temporary files for DART + archive_base (str): Path to long-time output storage + + srcdir (str): Path to where WRF has been compiled, including the 'run' folder of WRF, e.g. /home/WRF-4.3/run + dart_srcdir (str): Path to DART compile directory, e.g. /home/DART-9.11.9/models/wrf/work + rttov_srcdir (str): Path to RTTOV compile directory, e.g. /home/RTTOV13/rtcoef_rttov13/ + scriptsdir (str): Path where DART-WRF scripts reside, e.g. /home/DART-WRF/scripts + + namelist (str): Path to a WRF namelist template; + strings like <hist_interval>, will be overwritten in scripts/prepare_namelist.py + run_WRF (str): Path to script which runs WRF on a node of the cluster + overwrite_coordinates_with_geo_em (bool): If WRF ideal: path to NetCDF file of WRF domain (see WRF guide) + if WRF real: set to False + obs_impact_filename (str): Path to obs_impact_filename (see DART guide; module assim_tools_mod and program obs_impact_tool) + + slurm_cfg python dictionary, containing options of SLURM + defined in SLURM docs (https://slurm.schedmd.com/sbatch.html) + this configuration can be overwritten later on, for example: + 'dict(cluster.slurm_cfg, **cfg_update)' where + 'cfg_update = {"nodes": "2"}' + + """ def __init__(self, exp): self.exp = exp # makes derived properties available -- GitLab