From 922667415c6c56f4659d5a59286577fac14a3182 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Fri, 2 Jun 2023 11:53:51 -0500
Subject: [PATCH] snapshot...

---
 modules/util/setup_cloud_fraction.py | 50 ++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 modules/util/setup_cloud_fraction.py

diff --git a/modules/util/setup_cloud_fraction.py b/modules/util/setup_cloud_fraction.py
new file mode 100644
index 00000000..5a29a135
--- /dev/null
+++ b/modules/util/setup_cloud_fraction.py
@@ -0,0 +1,50 @@
+# To support both python 2 and python 3
+from __future__ import division, print_function, unicode_literals
+
+import os
+import sys
+
+from pathlib import Path
+
+# To plot pretty figures
+import matplotlib.pyplot as plt
+plt.rcParams['axes.labelsize'] = 14
+plt.rcParams['xtick.labelsize'] = 12
+plt.rcParams['ytick.labelsize'] = 12
+
+from datetime import datetime
+
+now = datetime.utcnow().strftime("%Y%m%d%H%M%S")
+
+home_dir = str(Path.home())
+root_logdir = home_dir+'/tf_logs'
+logdir = "{}/run-{}/".format(root_logdir, now)
+
+root_savedir = home_dir+'/tf_model'
+modeldir = "{}/run-{}/".format(root_savedir, now)
+ewa_varsdir = "{}/run_ewa_vars-{}/".format(root_savedir, now)
+
+root_cachedir = home_dir+'/cache'
+cachepath = "{}/run-{}".format(root_cachedir, now)
+cachepath = cachepath+'.pkl'
+
+gpu_devices = {0: '/device:GPU:0', 1: '/device:GPU:1', 2: '/device:GPU:2'}
+
+try:
+    user_paths = os.environ['PYTHONPATH'].split(os.pathsep)
+    python_path = None
+    if len(user_paths) > 1:
+        for up in user_paths:
+            if up.find('cimss_cloud_fraction') > 0:
+                python_path = up + os.sep
+    else:
+        python_path = user_paths[0] + os.sep
+    if python_path is None:
+        python_path = home_dir + os.sep + 'dev' + os.sep + 'python' + os.sep + 'modules' + os.sep
+        print('** No PYTHONPATH found containing cimss_cloud_fraction/model, using: '+python_path, file=sys.stderr)
+    ancillary_path = python_path + 'ancillary' + os.sep
+    model_path = python_path + 'tf_model' + os.sep
+except KeyError:
+    print('** PYTHONPATH must be defined! *', file=sys.stderr)
+    python_path = None
+
-- 
GitLab