From 84b3a171894824507fabb11ce4dd3d51883c8693 Mon Sep 17 00:00:00 2001
From: thopri <thopri@noc.ac.uk>
Date: Wed, 15 Apr 2020 16:05:24 +0100
Subject: [PATCH] nc write now working for tide HC boundary generation

---
 inputs/namelist_remote.bdy         | 2 +-
 pynemo/tide/nemo_bdy_tide3.py      | 5 ++++-
 pynemo/tide/nemo_bdy_tide_ncgen.py | 2 ++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/inputs/namelist_remote.bdy b/inputs/namelist_remote.bdy
index 48a1d8c..379e332 100644
--- a/inputs/namelist_remote.bdy
+++ b/inputs/namelist_remote.bdy
@@ -62,7 +62,7 @@
                                           !  baroclinic velocities
     ln_tra         = .true.               !  boundary conditions for T and S
     ln_ice         = .false.              !  ice boundary condition   
-    nn_rimwidth    = 9                    !  width of the relaxation zone
+    nn_rimwidth    = 1                    !  width of the relaxation zone
 
 !------------------------------------------------------------------------------
 !  unstructured open boundaries tidal parameters                        
diff --git a/pynemo/tide/nemo_bdy_tide3.py b/pynemo/tide/nemo_bdy_tide3.py
index ac89e54..7cac42d 100644
--- a/pynemo/tide/nemo_bdy_tide3.py
+++ b/pynemo/tide/nemo_bdy_tide3.py
@@ -288,7 +288,10 @@ def nemo_bdy_tide_rot(setup, DstCoord, Grid_T, Grid_U, Grid_V, comp,tide_model):
     sinv = rot_rep(sinuY, sinvY, 'v', 'en to j', dst_gcos, dst_gsin)
 
     #return the values
-    return cosz, sinz, cosu, sinu, cosv, sinv
+    cons = {}
+    cons['cos'] = {'z':cosz,'u':cosu,'v':cosv}
+    cons['sin'] = {'z':sinz,'u':sinu,'v':sinv}
+    return cons
 
 
 def constituents_index(constituents, inputcons):
diff --git a/pynemo/tide/nemo_bdy_tide_ncgen.py b/pynemo/tide/nemo_bdy_tide_ncgen.py
index 43943fa..f6701f3 100644
--- a/pynemo/tide/nemo_bdy_tide_ncgen.py
+++ b/pynemo/tide/nemo_bdy_tide_ncgen.py
@@ -36,9 +36,11 @@ def CreateBDYTideNetcdfFile(filename, N,I,J,h,fv,grd):
         varz1ID = ncid.createVariable('z1','f4',('yb','xb',),fill_value=fv)
         varz2ID = ncid.createVariable('z2','f4',('yb','xb',),fill_value=fv)
     elif grd == 'U':
+        varmskID = ncid.createVariable('bdy_msk', 'f4', ('y', 'x',), fill_value=fv)
         varu1ID = ncid.createVariable('u1','f4',('yb','xb',),fill_value=fv)
         varu2ID = ncid.createVariable('u2','f4',('yb','xb',),fill_value=fv)
     elif grd == 'V':
+        varmskID = ncid.createVariable('bdy_msk', 'f4', ('y', 'x',), fill_value=fv)
         varv1ID = ncid.createVariable('v1','f4',('yb','xb',),fill_value=fv)
         varv2ID = ncid.createVariable('v2','f4',('yb','xb',),fill_value=fv)
     else :
-- 
GitLab