From ee8706f376b995e028c8a3ad2e5036847fab5618 Mon Sep 17 00:00:00 2001
From: thopri <thopri@noc.ac.uk>
Date: Fri, 27 Mar 2020 07:37:41 +0000
Subject: [PATCH] moved unit test namelists to new folder

---
 README.rst                                          |  3 +--
 pynemo/unit_tests/UT_config.py                      |  6 ++++--
 .../{ => namelists}/namelist_unit_test_offset.bdy   |  0
 .../{ => namelists}/namelist_unit_test_orth.bdy     |  0
 .../{ => namelists}/namelist_unit_test_rotated.bdy  |  0
 pynemo/unit_tests/test_gen.py                       | 13 ++++++-------
 .../unit_tests => test_scripts}/resample_netcdf.py  |  0
 7 files changed, 11 insertions(+), 11 deletions(-)
 rename pynemo/unit_tests/{ => namelists}/namelist_unit_test_offset.bdy (100%)
 rename pynemo/unit_tests/{ => namelists}/namelist_unit_test_orth.bdy (100%)
 rename pynemo/unit_tests/{ => namelists}/namelist_unit_test_rotated.bdy (100%)
 rename {pynemo/unit_tests => test_scripts}/resample_netcdf.py (100%)

diff --git a/README.rst b/README.rst
index e224ae5..a86e8ab 100644
--- a/README.rst
+++ b/README.rst
@@ -20,7 +20,7 @@ Steps to take to install PyNEMO, creating a specific conda virtual environment i
 - Install Conda, either Anaconda or Miniconda (outside scope of this readme)
 - Create conda environment for PyNEMO::
 
-    $ cd to/PyNEMO/directory
+    $ cd PyNEMO
     $ conda env create -f pynemo_37.yml
 
 - Activate the new virtual environment::
@@ -56,7 +56,6 @@ To reactivate, the following needs to be typed::
 
     $ source activate pynemo3
 
-
 To use PyNEMO, the following command is entered: (the example will run an benchmarking test)::
 
     $ pynemo -s /path/to/namelist/file (e.g. PyNEMO/inputs/namelist_remote.bdy)
diff --git a/pynemo/unit_tests/UT_config.py b/pynemo/unit_tests/UT_config.py
index 3718484..732f6bf 100644
--- a/pynemo/unit_tests/UT_config.py
+++ b/pynemo/unit_tests/UT_config.py
@@ -8,5 +8,7 @@ Config file for Unit test functions, file paths for I/O etc are defined here.
 input_dir = 'pynemo/unit_tests/test_inputs/'
 # test output directory
 output_dir = 'pynemo/unit_tests/test_outputs/'
-# unit test directory
-unit_dir = 'pynemo/unit_tests/'
+# namelist directory
+unit_dir = 'pynemo/unit_tests/namelists/'
+# plot grids
+plot_grids = False
diff --git a/pynemo/unit_tests/namelist_unit_test_offset.bdy b/pynemo/unit_tests/namelists/namelist_unit_test_offset.bdy
similarity index 100%
rename from pynemo/unit_tests/namelist_unit_test_offset.bdy
rename to pynemo/unit_tests/namelists/namelist_unit_test_offset.bdy
diff --git a/pynemo/unit_tests/namelist_unit_test_orth.bdy b/pynemo/unit_tests/namelists/namelist_unit_test_orth.bdy
similarity index 100%
rename from pynemo/unit_tests/namelist_unit_test_orth.bdy
rename to pynemo/unit_tests/namelists/namelist_unit_test_orth.bdy
diff --git a/pynemo/unit_tests/namelist_unit_test_rotated.bdy b/pynemo/unit_tests/namelists/namelist_unit_test_rotated.bdy
similarity index 100%
rename from pynemo/unit_tests/namelist_unit_test_rotated.bdy
rename to pynemo/unit_tests/namelists/namelist_unit_test_rotated.bdy
diff --git a/pynemo/unit_tests/test_gen.py b/pynemo/unit_tests/test_gen.py
index 90725d8..af2bc3f 100644
--- a/pynemo/unit_tests/test_gen.py
+++ b/pynemo/unit_tests/test_gen.py
@@ -9,8 +9,7 @@ The source coordinate grid is also plotted (green).
 from pynemo.unit_tests import gen_tools as gt
 from pynemo.unit_tests import UT_config as config
 
-# TODO: remove hard coded file names and directories.
-# TODO: organise the variables better, (maybe in a single dict?)
+# TODO: organise the variables better, (maybe in a single dict or class?)
 
 def _main():
     #define directory for test input data for PyNEMO
@@ -101,10 +100,10 @@ def _main():
     bathy = gt.write_bathy(bathy_fname,grid_h3,grid_z3)
     if write_coord_H + write_coord_Z + bathy == 0:
         print("Offset child grid gneration successful!")
-
-    # plot orginal, rotatated and source lat and lon
-    #gt.plot_grids(grid_h2['latt'],grid_h2['lont'],grid_rot['latt'],grid_rot['lont'],grid_h3['latt'], \
-    #           grid_h3['lont'],grid_h1['latt'],grid_h1['lont'])
+    if config.plot_grids == True:
+        #plot orginal, rotatated and source lat and lon
+        gt.plot_grids(grid_h2['latt'],grid_h2['lont'],grid_rot['latt'],grid_rot['lont'],grid_h3['latt'], \
+                      grid_h3['lont'],grid_h1['latt'],grid_h1['lont'])
 
     # write boundary files (constant parameters)
     out_fname = config.input_dir+'output_boundary' #drop file extension
@@ -116,7 +115,7 @@ def _main():
               }
     params_v = {'param1': {'name':'vo','const_value':0.5,'longname':'Meridional current','units':'ms-1'}
               }
-    # TODO: This needs to be adapted for parameters that are not on the T grid.
+    # Define Grids using lowercase character string
     boundary_T = gt.write_parameter(out_fname,grid_h1,grid_z1,params_t,'t')
     boundary_U = gt.write_parameter(out_fname, grid_h1, grid_z1, params_u, 'u')
     boundary_V = gt.write_parameter(out_fname, grid_h1, grid_z1, params_v, 'v')
diff --git a/pynemo/unit_tests/resample_netcdf.py b/test_scripts/resample_netcdf.py
similarity index 100%
rename from pynemo/unit_tests/resample_netcdf.py
rename to test_scripts/resample_netcdf.py
-- 
GitLab