From 71d5242adaab82ded6bd0d6b18b3055fc655c23d Mon Sep 17 00:00:00 2001
From: thopri <thopri@noc.ac.uk>
Date: Mon, 20 Apr 2020 11:13:59 +0100
Subject: [PATCH] fixed multiple HC crash bug

---
 README.rst                    | 4 ++--
 inputs/namelist_remote.bdy    | 3 +++
 pynemo/tide/fes_extract_HC.py | 6 +++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/README.rst b/README.rst
index 42607ce..024a401 100644
--- a/README.rst
+++ b/README.rst
@@ -86,7 +86,7 @@ New runs are appended onto the end of the log file so it will periodically need
 The above path for Java Home was valid for a Macbook Pro 2015 with macOS Catalina and Java SDK 13.0.2
 however for different java versions, operating systems etc this may be different
 
-The conda environment yaml file has been tested with Miniconda 3.7 and found to install the enironment correctly.
+The conda environment yaml file has been tested with miniconda 3.7 and found to install the environment correctly.
 
 Contribution guidelines
 -----------------------
@@ -116,7 +116,7 @@ Unit Tests
 To test operation of the PyNEMO module, running the PyTest script in the unit tests folder will perform a range of tests on different child grids,
 e.g. checking the interpolation of the source data on to the child grid. To do this the following command is required::
 
-    $ pytest -q pynemo/pynemo_unit_test.py
+    $ pytest -v pynemo/pynemo_unit_test.py
 
 The results of the test will show if all tests pass or the errors that result from failed tests.
 
diff --git a/inputs/namelist_remote.bdy b/inputs/namelist_remote.bdy
index c32173c..5aeb88f 100644
--- a/inputs/namelist_remote.bdy
+++ b/inputs/namelist_remote.bdy
@@ -71,6 +71,9 @@
     sn_tide_model  = 'fes'                !  Name of tidal model (fes|tpxo)
     clname(1)      = 'M2'                 !  constituent name
     clname(2)      = 'S2'
+    clname(3)      = 'O1'
+    clname(4)      = 'K1'
+    clname(5)      = 'N2'
     ln_trans       = .false.               !  interpolate transport rather than
                                           !  velocities
 !------------------------------------------------------------------------------
diff --git a/pynemo/tide/fes_extract_HC.py b/pynemo/tide/fes_extract_HC.py
index 7f87b04..eb444bb 100644
--- a/pynemo/tide/fes_extract_HC.py
+++ b/pynemo/tide/fes_extract_HC.py
@@ -40,7 +40,7 @@ class HcExtract(object):
             #constituents = ['2N2', 'EPS2', 'J1', 'K1', 'K2', 'L2', 'LA2', 'M2', 'M3', 'M4', 'M6', 'M8', 'MF', 'MKS2',
                             #'MM', 'MN4', 'MS4', 'MSF', 'MSQM', 'MTM', 'MU2', 'N2', 'N4', 'NU2', 'O1', 'P1', 'Q1', 'R2',
                             #'S1', 'S2', 'S4', 'SA', 'SSA', 'T2']
-            constituents = ['M2','S2']
+            constituents = ['M2','S2','O1','K1','N2']
 
             self.cons = constituents
             self.mask_dataset = {}
@@ -192,8 +192,8 @@ class HcExtract(object):
     def interpolate_constituents(self, nc_dataset, real_var_name, img_var_name, lon_var_name,
                                  lat_var_name, lon, lat, height_data=None, maskname=None):
         """ Interpolates the tidal constituents along the given lat lon coordinates """
-        amp = np.zeros((len(nc_dataset), lon.shape[0]))
-        gph = np.zeros((len(nc_dataset), lon.shape[0]))
+        amp = np.zeros((len(nc_dataset[2]), lon.shape[0]))
+        gph = np.zeros((len(nc_dataset[2]), lon.shape[0]))
 
         data = np.array(np.ravel(nc_dataset[2]), dtype=complex)
         data.imag = np.array(np.ravel(nc_dataset[3]))
-- 
GitLab