Index: /trunk/NEMOGCM/TOOLS/WEIGHTS/README
===================================================================
--- /trunk/NEMOGCM/TOOLS/WEIGHTS/README	(revision 2717)
+++ /trunk/NEMOGCM/TOOLS/WEIGHTS/README	(revision 2718)
@@ -48,6 +48,6 @@
                          ./
                           |
-     +-------------+--------------+
-  SCRIP1.4      nocsutil         bin
+     +-------------+--------------+--------------+
+  SCRIP1.4      nocsutil         src            bin
 
 SCRIP1.4 contains the unmodified copy (apart from compression of two sample netcdf
@@ -56,11 +56,12 @@
 
 The bin directory contains python script freeform.py.
-This is run to reformat the code for use within the NEMO 3.3 FCm framework.
+This is run to reformat the code for use within the NEMO 3.3 fcm framework.
 It creates and populates a directory called 'src' with copied and modified versions
-of the SCRIP library routines.  Changes are described in the src/CHANGES file.
+of the SCRIP library routines (and derived programs from the nocsutil directory).  
+Changes are described in the src/CHANGES file.
 This script has already been run and only needs to be re-executed if SCRIP is updated.
 
-The nocscrip directory contains the code for the three programs used to 
-generate a weights file. These are:
+The src directory also contains the three programs used to generate a weights file.
+The three programs are:
 
 scripgrid.exe (scripgrid.F90) which creates two grid description files suitable for
@@ -88,5 +89,13 @@
 example namelists provided are located in its refout subdirectory.
 
-Installation is by use of the makenemo script.
+Installation is by use of the maketools script.
+E.g. change to the NEMOGCM/TOOLS directory and type:
+
+./maketools -help
+
+and, for example:
+
+./maketools -m gfortran_linux -n WEIGHTS
+
 
 Example Use
@@ -173,7 +182,10 @@
 the grid centre and corner locations required by scrip. In the example given,
 a file called 'coordinates.nc' must exist in the current directory. This is
-recognised by scripgrid as a nemo coordinates file and the correct corner
+used by scripgrid as a nemo coordinates file and the correct corner
 locations appropriate to the named grid centres are obtained (i.e. since
 glamt is named, glamf and gphif will be used to provide corner coordinates).
+The nemo file need not be called 'coordinates.nc' (e.g. '1_coordinates.nc' instead),
+but must have longitude and latitude variables which start with the four 
+characters 'gphi' and 'glam' respectively.
 "input_file" file must contain at least one variable on a grid whose axes are
 described by the netcdf coordinate variables named in input_lon and input_lat.
Index: /trunk/NEMOGCM/TOOLS/WEIGHTS/nocsutil/scripgrid_mod.F90
===================================================================
--- /trunk/NEMOGCM/TOOLS/WEIGHTS/nocsutil/scripgrid_mod.F90	(revision 2717)
+++ /trunk/NEMOGCM/TOOLS/WEIGHTS/nocsutil/scripgrid_mod.F90	(revision 2718)
@@ -92,37 +92,32 @@
     call release_unit(iunit)
 
-    if (trim(nemo_file) .eq. 'coordinates.nc') then
-
-      ! set up the names of the corner variables for a given input
-      ! the offset represents what needs to be added to (i,j) to get to the correct 
-      ! element in the corner arrays to correspond to the point northeast of the center
-      if (nemo_lon(5:5) == "t") then
-        corn_lon = "glamf"
-        corn_lat = "gphif"
-        offset = (/ 0,0 /)
-      else if (nemo_lon(5:5) == "u") then
-        corn_lon = "glamv"
-        corn_lat = "gphiv"
-        offset = (/ 1,0 /)
-      else if (nemo_lon(5:5) == "v") then
-        corn_lon = "glamu"
-        corn_lat = "gphiu"
-        offset = (/ 0,1 /)
-      else
-        write(6,*) 'unknown nemo_lon name'
-        stop
-      endif
-
-      write(6,*) "processing " // trim(nemo_file)
-      call convertNEMO(nemo_file, nemo_lon, nemo_lat, corn_lon, corn_lat, &
-                       offset, nemogrid_file)
-
+    if (nemo_lon(1:4) .ne. 'glam' .or. nemo_lat(1:4) .ne. 'gphi') then
+      write(6,*) 'lon name does not start with "glam" or lat name does not start with "gphi"'
+      stop
+    endif
+
+    ! set up the names of the corner variables for a given input
+    ! the offset represents what needs to be added to (i,j) to get to the correct 
+    ! element in the corner arrays to correspond to the point northeast of the center
+    if (nemo_lon(5:5) == "t") then
+      corn_lon = "glamf"
+      corn_lat = "gphif"
+      offset = (/ 0,0 /)
+    else if (nemo_lon(5:5) == "u") then
+      corn_lon = "glamv"
+      corn_lat = "gphiv"
+      offset = (/ 1,0 /)
+    else if (nemo_lon(5:5) == "v") then
+      corn_lon = "glamu"
+      corn_lat = "gphiu"
+      offset = (/ 0,1 /)
     else
-
-      write(6,*) "processing regular grid " // trim(nemo_file)
-      call convertFLUX(nemo_file, nemo_lon, nemo_lat, &
-                       nemo_mask, nemo_mask_value, nemogrid_file)
-
+      write(6,*) 'unknown nemo_lon name'
+      stop
     endif
+
+    write(6,*) "processing " // trim(nemo_file)
+    call convertNEMO(nemo_file, nemo_lon, nemo_lat, corn_lon, corn_lat, &
+                     offset, nemogrid_file)
 
     write(6,*) "processing regular grid"
Index: /trunk/NEMOGCM/TOOLS/WEIGHTS/nocsutil/scripinterp.F90
===================================================================
--- /trunk/NEMOGCM/TOOLS/WEIGHTS/nocsutil/scripinterp.F90	(revision 2717)
+++ /trunk/NEMOGCM/TOOLS/WEIGHTS/nocsutil/scripinterp.F90	(revision 2718)
@@ -19,4 +19,5 @@
   write(6,*) 'enter the name of an input namelist'
   read(5,*) nm_in
+  call process_grid(nm_in)
 #endif
 
Index: /trunk/NEMOGCM/TOOLS/WEIGHTS/src/scripgrid_mod.F90
===================================================================
--- /trunk/NEMOGCM/TOOLS/WEIGHTS/src/scripgrid_mod.F90	(revision 2717)
+++ /trunk/NEMOGCM/TOOLS/WEIGHTS/src/scripgrid_mod.F90	(revision 2718)
@@ -92,37 +92,32 @@
     call release_unit(iunit)
 
-    if (trim(nemo_file) .eq. 'coordinates.nc') then
-
-      ! set up the names of the corner variables for a given input
-      ! the offset represents what needs to be added to (i,j) to get to the correct 
-      ! element in the corner arrays to correspond to the point northeast of the center
-      if (nemo_lon(5:5) == "t") then
-        corn_lon = "glamf"
-        corn_lat = "gphif"
-        offset = (/ 0,0 /)
-      else if (nemo_lon(5:5) == "u") then
-        corn_lon = "glamv"
-        corn_lat = "gphiv"
-        offset = (/ 1,0 /)
-      else if (nemo_lon(5:5) == "v") then
-        corn_lon = "glamu"
-        corn_lat = "gphiu"
-        offset = (/ 0,1 /)
-      else
-        write(6,*) 'unknown nemo_lon name'
-        stop
-      endif
-
-      write(6,*) "processing " // trim(nemo_file)
-      call convertNEMO(nemo_file, nemo_lon, nemo_lat, corn_lon, corn_lat, &
-                       offset, nemogrid_file)
-
+    if (nemo_lon(1:4) .ne. 'glam' .or. nemo_lat(1:4) .ne. 'gphi') then
+      write(6,*) 'lon name does not start with "glam" or lat name does not start with "gphi"'
+      stop
+    endif
+
+    ! set up the names of the corner variables for a given input
+    ! the offset represents what needs to be added to (i,j) to get to the correct 
+    ! element in the corner arrays to correspond to the point northeast of the center
+    if (nemo_lon(5:5) == "t") then
+      corn_lon = "glamf"
+      corn_lat = "gphif"
+      offset = (/ 0,0 /)
+    else if (nemo_lon(5:5) == "u") then
+      corn_lon = "glamv"
+      corn_lat = "gphiv"
+      offset = (/ 1,0 /)
+    else if (nemo_lon(5:5) == "v") then
+      corn_lon = "glamu"
+      corn_lat = "gphiu"
+      offset = (/ 0,1 /)
     else
-
-      write(6,*) "processing regular grid " // trim(nemo_file)
-      call convertFLUX(nemo_file, nemo_lon, nemo_lat, &
-                       nemo_mask, nemo_mask_value, nemogrid_file)
-
+      write(6,*) 'unknown nemo_lon name'
+      stop
     endif
+
+    write(6,*) "processing " // trim(nemo_file)
+    call convertNEMO(nemo_file, nemo_lon, nemo_lat, corn_lon, corn_lat, &
+                     offset, nemogrid_file)
 
     write(6,*) "processing regular grid"
Index: /trunk/NEMOGCM/TOOLS/WEIGHTS/src/scripinterp.F90
===================================================================
--- /trunk/NEMOGCM/TOOLS/WEIGHTS/src/scripinterp.F90	(revision 2717)
+++ /trunk/NEMOGCM/TOOLS/WEIGHTS/src/scripinterp.F90	(revision 2718)
@@ -19,4 +19,5 @@
   write(6,*) 'enter the name of an input namelist'
   read(5,*) nm_in
+  call process_grid(nm_in)
 #endif
 
