From f6ded4c60a0e2a04160be8e3680c472b717be706 Mon Sep 17 00:00:00 2001
From: lkugler <lukas.kugler@gmail.com>
Date: Mon, 13 Mar 2023 11:34:10 +0100
Subject: [PATCH] docs

---
 dartwrf/assim_synth_obs.py |  9 +--------
 dartwrf/utils.py           | 41 +++++++++++++++++++++++++++++++++-----
 2 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/dartwrf/assim_synth_obs.py b/dartwrf/assim_synth_obs.py
index 2b57fad..89dd560 100755
--- a/dartwrf/assim_synth_obs.py
+++ b/dartwrf/assim_synth_obs.py
@@ -3,7 +3,7 @@ import time as time_module
 import datetime as dt
 import numpy as np
 
-from dartwrf.utils import symlink, copy, sed_inplace, append_file, mkdir, try_remove, print, shell
+from dartwrf.utils import symlink, copy, sed_inplace, append_file, mkdir, try_remove, print, shell, write_txt
 from dartwrf.obs import error_models as err
 import dartwrf.create_obsseq as osq
 from dartwrf import wrfout_add_geo
@@ -141,13 +141,6 @@ def prepare_prior_ensemble(assim_time, prior_init_time, prior_valid_time, prior_
     os.system("rm -rf " + cluster.dartrundir + "/perfect_output_*")
     os.system("rm -rf " + cluster.dartrundir + "/obs_seq.fina*")
 
-
-def write_txt(lines, fpath):
-    try_remove(fpath)
-    with open(fpath, "w") as file:
-        for line in lines:
-            file.write(line+'\n')
-
 def write_list_of_inputfiles_prior():
      files = []
      for iens in range(1, exp.n_ens+1):
diff --git a/dartwrf/utils.py b/dartwrf/utils.py
index b45b79f..05015db 100755
--- a/dartwrf/utils.py
+++ b/dartwrf/utils.py
@@ -109,7 +109,8 @@ def clean_wrfdir(dir):
             os.remove(f)
 
 def symlink(src, dst):
-    # Create a symbolic link pointing to src named dst.
+    """Create a symbolic link from src to dst
+    """
     try:
         os.symlink(src, dst)
     except FileExistsError:
@@ -123,12 +124,18 @@ def symlink(src, dst):
         raise e
 
 def link_contents(src, dst):
+    """Create symbolic links for all files in src to dst
+    
+    Args:
+        src (str): Path to source directory
+        dst (str): Path to destination directory
+        
+    Returns:
+        None
+    """
     for f in os.listdir(src):
         symlink(src+'/'+f, dst+'/'+f)
 
-def copy_scp_srvx8(src, dst):
-    os.system('scp '+src+' a1254888@srvx8.img.univie.ac.at:'+dst)
-
 def sed_inplace(filename, pattern, repl):
     '''Perform the pure-Python equivalent of in-place `sed` substitution
     Like `sed -i -e 's/'${pattern}'/'${repl}' "${filename}"`.
@@ -162,4 +169,28 @@ def sed_inplace(filename, pattern, repl):
     shutil.move(tmp_file.name, filename)
 
 def append_file(f_main, f_gets_appended):
-    os.system('cat '+f_gets_appended+' >> '+f_main)
\ No newline at end of file
+    """Append the contents of one file to another
+
+    Args:
+        f_main (str): Path to file that will be appended
+        f_gets_appended (str): Path to file that will be appended to f_main
+
+    Returns:
+        None
+    """
+    os.system('cat '+f_gets_appended+' >> '+f_main)
+
+def write_txt(lines, fpath):
+    """Write a list of strings to a text file
+    
+    Args:
+        lines (list): List of strings
+        fpath (str): Path to file
+        
+    Returns:
+        None
+    """
+    try_remove(fpath)
+    with open(fpath, "w") as file:
+        for line in lines:
+            file.write(line+'\n')
\ No newline at end of file
-- 
GitLab