Commit ee8706f3 authored by thopri's avatar thopri
Browse files

moved unit test namelists to new folder

parent 25555aba
...@@ -20,7 +20,7 @@ Steps to take to install PyNEMO, creating a specific conda virtual environment i ...@@ -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) - Install Conda, either Anaconda or Miniconda (outside scope of this readme)
- Create conda environment for PyNEMO:: - Create conda environment for PyNEMO::
$ cd to/PyNEMO/directory $ cd PyNEMO
$ conda env create -f pynemo_37.yml $ conda env create -f pynemo_37.yml
- Activate the new virtual environment:: - Activate the new virtual environment::
...@@ -56,7 +56,6 @@ To reactivate, the following needs to be typed:: ...@@ -56,7 +56,6 @@ To reactivate, the following needs to be typed::
$ source activate pynemo3 $ source activate pynemo3
To use PyNEMO, the following command is entered: (the example will run an benchmarking test):: 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) $ pynemo -s /path/to/namelist/file (e.g. PyNEMO/inputs/namelist_remote.bdy)
......
...@@ -8,5 +8,7 @@ Config file for Unit test functions, file paths for I/O etc are defined here. ...@@ -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/' input_dir = 'pynemo/unit_tests/test_inputs/'
# test output directory # test output directory
output_dir = 'pynemo/unit_tests/test_outputs/' output_dir = 'pynemo/unit_tests/test_outputs/'
# unit test directory # namelist directory
unit_dir = 'pynemo/unit_tests/' unit_dir = 'pynemo/unit_tests/namelists/'
# plot grids
plot_grids = False
...@@ -9,8 +9,7 @@ The source coordinate grid is also plotted (green). ...@@ -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 gen_tools as gt
from pynemo.unit_tests import UT_config as config 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 or class?)
# TODO: organise the variables better, (maybe in a single dict?)
def _main(): def _main():
#define directory for test input data for PyNEMO #define directory for test input data for PyNEMO
...@@ -101,10 +100,10 @@ def _main(): ...@@ -101,10 +100,10 @@ def _main():
bathy = gt.write_bathy(bathy_fname,grid_h3,grid_z3) bathy = gt.write_bathy(bathy_fname,grid_h3,grid_z3)
if write_coord_H + write_coord_Z + bathy == 0: if write_coord_H + write_coord_Z + bathy == 0:
print("Offset child grid gneration successful!") print("Offset child grid gneration successful!")
if config.plot_grids == True:
# plot orginal, rotatated and source lat and lon #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'], \ 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']) grid_h3['lont'],grid_h1['latt'],grid_h1['lont'])
# write boundary files (constant parameters) # write boundary files (constant parameters)
out_fname = config.input_dir+'output_boundary' #drop file extension out_fname = config.input_dir+'output_boundary' #drop file extension
...@@ -116,7 +115,7 @@ def _main(): ...@@ -116,7 +115,7 @@ def _main():
} }
params_v = {'param1': {'name':'vo','const_value':0.5,'longname':'Meridional current','units':'ms-1'} 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_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_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') boundary_V = gt.write_parameter(out_fname, grid_h1, grid_z1, params_v, 'v')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment