[cmor] 107/190: 2011-04-26 : was setting coordinates attribute multiple times, now first check if the bit we are trying to ad d is already in

Alastair McKinstry mckinstry at moszumanska.debian.org
Tue Jul 21 12:54:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch debian/master
in repository cmor.

commit b64bdbe039dde917c3cf465553956404f0c16aca
Author: Charles Doutriaux <doutriaux1 at llnl.gov>
Date:   Tue Apr 26 11:18:37 2011 -0700

    2011-04-26 : was setting coordinates attribute multiple times, now first check if the bit we are trying to ad
    d is already in
---
 RELEASE-NOTES                |  1 +
 Src/cmor.c                   | 13 ++++++--
 Test/test_python_jamie_12.py | 78 ++++++++++++++++++++++++++++++++++++++++++++
 configure                    | 18 +++++-----
 configure.ac                 |  2 +-
 include/cmor.h               |  2 +-
 6 files changed, 101 insertions(+), 13 deletions(-)

diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 8e67da9..8cbb6e7 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -1,3 +1,4 @@
+2011-04-26 : was setting coordinates attribute multiple times, now first check if the bit we are trying to add is already in
 2011-04-11 : releasing 2.5.8
 2011-04-07 : only adding extra time precision in file names if it is < 6hr instead of 1 day
 2011-04-05 : not overwriting user time values in climatology case
diff --git a/Src/cmor.c b/Src/cmor.c
index 17b1950..6e26926 100644
--- a/Src/cmor.c
+++ b/Src/cmor.c
@@ -2607,8 +2607,17 @@ int cmor_write(int var_id,void *data, char type, char *suffix, int ntimes_passed
 	}
 	if (cmor_has_variable_attribute(var_id,"coordinates")==0) {
 	  cmor_get_variable_attribute(var_id,"coordinates",msg);
-	  strncat(msg," ",CMOR_MAX_STRING-strlen(msg));
-	  strncat(msg,ctmp,CMOR_MAX_STRING-strlen(msg));
+	  l=0;
+	  for (j=0;j<strlen(msg)-strlen(ctmp)+1;j++) {
+	    if (strncmp(ctmp,&msg[j],strlen(ctmp))==0) {
+	      l=1;
+	      break;
+	    }
+	  }
+	  if (l==0) {
+	    strncat(msg," ",CMOR_MAX_STRING-strlen(msg));
+	    strncat(msg,ctmp,CMOR_MAX_STRING-strlen(msg));
+	  }
 	}
 	else {
 	  strncpy(msg,ctmp,CMOR_MAX_STRING);
diff --git a/Test/test_python_jamie_12.py b/Test/test_python_jamie_12.py
new file mode 100644
index 0000000..05beb96
--- /dev/null
+++ b/Test/test_python_jamie_12.py
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+
+import cmor
+import numpy
+
+def define_axes(axes):
+    axis_ids = list()
+    for axis in axes:
+        axis_id = cmor.axis(**axis)
+        axis_ids.append(axis_id)
+
+    print 'MY:cmor.axis calls complete'
+    return axis_ids
+
+def define_write_var(axis_ids, entry, unit, values):
+    varid = cmor.variable(entry,
+                          unit,
+                          axis_ids,
+                          missing_value = -99
+                          )
+
+
+
+    cmor.write(varid, values, time_vals = [15.0], time_bnds = [0., 30.0])
+    cmor.close(varid, preserve = True)
+    cmor.write(varid, values, time_vals = [45.0], time_bnds = [30., 60.0])
+    cmor.close()
+
+
+def cmor_ini():
+    cmor.setup(inpath='/git/cmip5-cmor-tables/Tables',
+               netcdf_file_action = cmor.CMOR_REPLACE)
+    cmor.dataset('pre-industrial control', 'mohc', 'HadGEM2: source',
+                 '360_day',
+                 institute_id = 'ukmo',
+                 model_id = 'HadGEM2',
+                 history = 'some global history',
+                 forcing = 'N/A',
+                 parent_experiment_id = 'N/A',
+                 parent_experiment_rip = 'N/A',
+                 branch_time = 0.,
+                 contact = 'brian clough')
+
+
+def define_write_landcoverfrac():
+    cmor.load_table('CMIP5_Lmon')
+    axes = [ {'table_entry': 'time',
+              'units': 'days since 2000-01-01 00:00:00',
+              },
+             {'table_entry': 'latitude',
+              'units': 'degrees_north',
+              'coord_vals': [0],
+              'cell_bounds': [-1, 1]},             
+             {'table_entry': 'longitude',
+              'units': 'degrees_east',
+              'coord_vals': [90],
+              'cell_bounds': [89, 91]},
+             {'table_entry': 'vegtype',
+              'coord_vals': ['landcover'],
+              'units': '1',
+              },
+             ]
+
+    axis_ids = define_axes(axes)
+
+    values = numpy.array([2.], numpy.float32)
+    values = numpy.reshape(values, (1, 1, 1, 1))
+             
+    define_write_var(axis_ids, 'landCoverFrac', '1', values)
+    
+def main():
+
+    cmor_ini()
+    define_write_landcoverfrac()
+    
+if __name__ == '__main__':
+
+    main()
diff --git a/configure b/configure
index 825770c..190aa39 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for cmor 2.5.8.
+# Generated by GNU Autoconf 2.61 for cmor 2.5.9.
 #
 # Report bugs to <doutriaux1 at llnl.gov>.
 #
@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='cmor'
 PACKAGE_TARNAME='cmor'
-PACKAGE_VERSION='2.5.8'
-PACKAGE_STRING='cmor 2.5.8'
+PACKAGE_VERSION='2.5.9'
+PACKAGE_STRING='cmor 2.5.9'
 PACKAGE_BUGREPORT='doutriaux1 at llnl.gov'
 
 ac_default_prefix=/usr/local/cmor
@@ -1185,7 +1185,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures cmor 2.5.8 to adapt to many kinds of systems.
+\`configure' configures cmor 2.5.9 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1251,7 +1251,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of cmor 2.5.8:";;
+     short | recursive ) echo "Configuration of cmor 2.5.9:";;
    esac
   cat <<\_ACEOF
 
@@ -1350,7 +1350,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-cmor configure 2.5.8
+cmor configure 2.5.9
 generated by GNU Autoconf 2.61
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1364,7 +1364,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by cmor $as_me 2.5.8, which was
+It was created by cmor $as_me 2.5.9, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
@@ -4989,7 +4989,7 @@ exec 6>&1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by cmor $as_me 2.5.8, which was
+This file was extended by cmor $as_me 2.5.9, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5032,7 +5032,7 @@ Report bugs to <bug-autoconf at gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-cmor config.status 2.5.8
+cmor config.status 2.5.9
 configured by $0, generated by GNU Autoconf 2.61,
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/configure.ac b/configure.ac
index 0ae2abd..d8ada66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ dnl                                                -*- Autoconf -*-
 dnl  Process this file with autoconf to produce a configure script.
 
 dnl AC_PREREQ(2.59)
-AC_INIT(cmor, 2.5.8, doutriaux1 at llnl.gov)
+AC_INIT(cmor, 2.5.9, doutriaux1 at llnl.gov)
 
 GIT_TAG=`./get_git_version.sh`
 
diff --git a/include/cmor.h b/include/cmor.h
index e97a769..55c34e0 100644
--- a/include/cmor.h
+++ b/include/cmor.h
@@ -3,7 +3,7 @@
 
 #define CMOR_VERSION_MAJOR 2
 #define CMOR_VERSION_MINOR 5
-#define CMOR_VERSION_PATCH 8
+#define CMOR_VERSION_PATCH 9
 
 #define CMOR_CF_VERSION_MAJOR 1
 #define CMOR_CF_VERSION_MINOR 4

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cmor.git



More information about the debian-science-commits mailing list