Repository: ESMCI/cime

Issue:
GET_REFCASE error reporting 
If GET_REFCASE=TRUE but the refcase directory is invalid no error is reported until runtime. 


Discussion:

Resolving patch:
diff --git a/scripts/lib/CIME/case/check_input_data.py b/scripts/lib/CIME/case/check_input_data.py
--- a/scripts/lib/CIME/case/check_input_data.py
+++ b/scripts/lib/CIME/case/check_input_data.py
@@ -210,6 +210,8 @@ def stage_refcase(self, input_data_root=None, data_list_dir=None):
 
         if os.path.isabs(run_refdir):
             refdir = run_refdir
+            expect(os.path.isdir(refdir), "Reference case directory {} does not exist or is not readable".format(refdir))
+
         else:
             refdir = os.path.join(din_loc_root, run_refdir, run_refcase, run_refdate)
             if not os.path.isdir(refdir):
@@ -230,12 +232,12 @@ def stage_refcase(self, input_data_root=None, data_list_dir=None):
         if (not os.path.exists(rundir)):
             logger.debug("Creating run directory: {}".format(rundir))
             os.makedirs(rundir)
-
+        rpointerfile = None
         # copy the refcases' rpointer files to the run directory
         for rpointerfile in glob.iglob(os.path.join("{}","*rpointer*").format(refdir)):
             logger.info("Copy rpointer {}".format(rpointerfile))
             safe_copy(rpointerfile, rundir)
-
+        expect(rpointerfile,"Reference case directory {} does not contain any rpointer files".format(refdir))
         # link everything else
 
         for rcfile in glob.iglob(os.path.join(refdir,"*")):


Test patch:
diff --git a/tools/statistical_ensemble_test/README b/tools/statistical_ensemble_test/README
--- a/tools/statistical_ensemble_test/README
+++ b/tools/statistical_ensemble_test/README
@@ -12,16 +12,16 @@ UF-CAM-ECT - detects issues in CAM and CLM (9 time step runs)
 POP-ECT - detects issues in POP and CICE (12 month runs)
 
 The ECT process involves comparing runs generated with
-the new scenario ( 3 for CAM-ECT and UF-CAM-ECT, and 1 for POP-ECT) 
+the new scenario ( 3 for CAM-ECT and UF-CAM-ECT, and 1 for POP-ECT)
 to an ensemble built on a trusted machine (currently
 cheyenne). The python ECT tools are located in the pyCECT
 subdirectory or https://github.com/NCAR/PyCECT/releases.
 
 -OR-
-		
-We now provide a web server for CAM-ECT and UF-CAM-ECT,  where 
+
+We now provide a web server for CAM-ECT and UF-CAM-ECT,  where
 you can upload the (3) generated runs for comparison to our ensemble.
-Please see the webpage at http://www.cesm.ucar.edu/models/cesm2/verification/ 
+Please see the webpage at http://www.cesm.ucar.edu/models/cesm2/verification/
 for further instructions.
 
 -----------------------------------
@@ -40,12 +40,12 @@ $CESMDATAROOT/inputdata/validation/pop_ensembles
 
 If none of our ensembles are suitable for your needs, then you may create
 your own ensemble (and summary file) using the following instructions:
-     
-(1) To create a new ensemble, use the ensemble.py script in this directory. 
+
+(1) To create a new ensemble, use the ensemble.py script in this directory.
 This script creates and compiles a case, then creates clones of the
 original case, where the initial temperature perturbation is slightly modified
 for each ensemble member.  At this time, cime includes functionality
-to create ensembles for CAM-ECT, UF-CAM-ECT, and POP-ECT. 
+to create ensembles for CAM-ECT, UF-CAM-ECT, and POP-ECT.
 
 (2) Use --ect <pop,cam> to specify whether ensemble is for CAM or POP.
 (See 'python ensemble.py -h' for additional details).
@@ -71,21 +71,21 @@ POP-ECT:
 
 python ensemble.py --case /glade/scratch/cesm_user/cesm_tag/uf_ensemble/ensemble.cesm_tag.000 --mach cheyenne  --ensemble 40 --ect pop --project P99999999
 
-Notes: 
+Notes:
        (a) ensemble.py accepts (most of) the argumenets of create_newcase
 
        (b) case name must end in ".000" and include the full path
 
        (c) ensemble size must be specified, and suggested defaults are listed
-       	   above. Note that for CAM-ECT and UF-CAM-ECT, the ensemble size 
+       	   above. Note that for CAM-ECT and UF-CAM-ECT, the ensemble size
 	   needs to be larger than the number of variables that ECT will evaluate.
 
 
-(5) Once all ensemble simulations have run successfully, copy every cam history 
-file (*.cam.h0.*) for CAM-ECT and UF-CAM-ECT) or monthly pop history file 
-(*.pop.h.*) for POP-ECT from each ensemble run directory into a separate directory. 
+(5) Once all ensemble simulations have run successfully, copy every cam history
+file (*.cam.h0.*) for CAM-ECT and UF-CAM-ECT) or monthly pop history file
+(*.pop.h.*) for POP-ECT from each ensemble run directory into a separate directory.
 Next create the ensemble summary using the pyCECT tool pyEnsSum.py (for CAM-ECT and
-UF-CAM-ECT) or pyEnsSumPop.py (for POP-ECT).  For details see README_pyEnsSum.rst 
+UF-CAM-ECT) or pyEnsSumPop.py (for POP-ECT).  For details see README_pyEnsSum.rst
 and README_pyEnsSumPop.rst with the pyCECT tools.
 
 -------------------
@@ -103,14 +103,14 @@ attributes give this information.
 (2) For example, for CAM-ECT:
 
 python ensemble.py --case /glade/scratch/cesm_user/cesm_tag/camcase.cesm_tag.000 --ect cam --mach cheyenne --project P99999999
---compset   F2000climo --res f19_f19 
+--compset   F2000climo --res f19_f19_mg17
 For example, for UF-CAM-ECT:
 
-python ensemble.py --case /glade/scratch/cesm_user/cesm_tag/uf.camcase.cesm_tag.000 --ect cam --uf --mach cheyenne --project P99999999 --compset   F2000climo --res f19_f19 
+python ensemble.py --case /glade/scratch/cesm_user/cesm_tag/uf.camcase.cesm_tag.000 --ect cam --uf --mach cheyenne --project P99999999 --compset   F2000climo --res f19_f19_mg17
 
 For example, for POP-ECT:
 
-python ensemble.py --case /glade/scratch/cesm_user/cesm_tag/popcase.cesm_tag.000 --ect pop --mach cheyenne  --project P99999999 --compset   G --res T62_g17 
+python ensemble.py --case /glade/scratch/cesm_user/cesm_tag/popcase.cesm_tag.000 --ect pop --mach cheyenne  --project P99999999 --compset   G --res T62_g17
 
 (3) Next verify the new simulation(s) with the pyCECT tool pyCECT.py (see
 README_pyCECT.rst with the pyCECT tools).