Skip to content
Snippets Groups Projects
Commit 964302e7 authored by David Verelst's avatar David Verelst
Browse files

prepost.Simulations: updated test and data

parent 0c8bc7e4
No related branches found
No related tags found
No related merge requests found
Pipeline #
just one demo line
File deleted
File added
......@@ -63,7 +63,7 @@
[wdir] : 0
[windramp] : False
[wsp factor] : 1.0
[zip_root_files] : ['pbs_in_file_cache.txt', 'A0001_ErrorLog.csv']
[zip_root_files] : []
-------------------------------------------------------------------------------
opt_tags set
......@@ -119,7 +119,7 @@
[wdir] : 0
[windramp] : False
[wsp factor] : 0.888888888889
[zip_root_files] : ['pbs_in_file_cache.txt', 'A0001_ErrorLog.csv']
[zip_root_files] : []
-------------------------------------------------------------------------------
opt_tags set
......@@ -175,4 +175,4 @@
[wdir] : 0
[windramp] : False
[wsp factor] : 0.8
[zip_root_files] : ['pbs_in_file_cache.txt', 'A0001_ErrorLog.csv']
[zip_root_files] : []
just one demo line
......@@ -13,6 +13,7 @@ standard_library.install_aliases()
import unittest
import os
import filecmp
import pickle
from wetb.prepost import dlctemplate as tmpl
......@@ -26,29 +27,39 @@ class TestGenerateInputs(unittest.TestCase):
# manually configure paths, HAWC2 model root path is then constructed as
# p_root_remote/PROJECT/sim_id, and p_root_local/PROJECT/sim_id
# adopt accordingly when you have configured your directories differently
p_root_remote = os.path.join(self.basepath, 'data/')
p_root_local = os.path.join(self.basepath, 'data/')
p_root = os.path.join(self.basepath, 'data/')
# project name, sim_id, master file name
tmpl.PROJECT = 'demo_dlc'
tmpl.MASTERFILE = 'demo_dlc_master_A0001.htc'
# MODEL SOURCES, exchanche file sources
tmpl.P_RUN = os.path.join(p_root_remote, tmpl.PROJECT, 'remote/')
tmpl.P_SOURCE = os.path.join(p_root_local, tmpl.PROJECT, 'source/')
tmpl.P_RUN = os.path.join(p_root, tmpl.PROJECT, 'remote/')
tmpl.P_SOURCE = os.path.join(p_root, tmpl.PROJECT, 'source/')
# location of the master file
tmpl.P_MASTERFILE = os.path.join(p_root_local, tmpl.PROJECT,
tmpl.P_MASTERFILE = os.path.join(p_root, tmpl.PROJECT,
'source', 'htc', '_master/')
# location of the pre and post processing data
tmpl.POST_DIR = os.path.join(p_root_remote, tmpl.PROJECT, 'remote',
tmpl.POST_DIR = os.path.join(p_root, tmpl.PROJECT, 'remote',
'prepost/')
tmpl.force_dir = tmpl.P_RUN
tmpl.launch_dlcs_excel('remote', silent=True)
remote = os.path.join(p_root_remote, tmpl.PROJECT, 'remote')
ref = os.path.join(p_root_remote, tmpl.PROJECT, 'ref')
cmp = filecmp.dircmp(remote, ref)
self.assertTrue(len(cmp.diff_files)==0)
self.assertTrue(len(cmp.right_only)==0)
self.assertTrue(len(cmp.left_only)==0)
# we can not check-in empty dirs in git
for subdir in ['control', 'data', 'htc', 'pbs_in']:
remote = os.path.join(p_root, tmpl.PROJECT, 'remote', subdir)
ref = os.path.join(p_root, tmpl.PROJECT, 'ref', subdir)
cmp = filecmp.dircmp(remote, ref)
self.assertTrue(len(cmp.diff_files)==0)
self.assertTrue(len(cmp.right_only)==0)
self.assertTrue(len(cmp.left_only)==0)
# for the pickled file we can just read it
remote = os.path.join(p_root, tmpl.PROJECT, 'remote', 'prepost')
ref = os.path.join(p_root, tmpl.PROJECT, 'ref', 'prepost')
with open(os.path.join(remote, 'remote.pkl'), 'rb') as FILE:
pkl_remote = pickle.load(FILE)
with open(os.path.join(ref, 'remote.pkl'), 'rb') as FILE:
pkl_ref = pickle.load(FILE)
self.assertEqual(pkl_remote, pkl_ref)
if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment