[cmor] 62/190: 2010-10-22 : fixed bug with variables using "grids" and singleton dimensions 2010-10-22 : upgraded to 2.4 in devel branch 2010-10-22 : exposed cmor_set_variable_attribute to users in Python 2010-10-22 : cell_measures var attribute is now called ext_cell_measures

Alastair McKinstry mckinstry at moszumanska.debian.org
Tue Jul 21 12:54:38 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 5235bd85d12592f1097bce75ffcea89c437cf1c3
Merge: 268f94d 1b68bd5
Author: Charles Doutriaux <doutriaux1 at llnl.gov>
Date:   Fri Oct 22 09:02:18 2010 -0700

    2010-10-22 : fixed bug with variables using "grids" and singleton dimensions
    2010-10-22 : upgraded to 2.4 in devel branch
    2010-10-22 : exposed cmor_set_variable_attribute to users in Python
    2010-10-22 : cell_measures var attribute is now called ext_cell_measures
    
    Merge branch 'master' into devel
    
    Conflicts:
    	include/cmor.h

 RELEASE-NOTES        |  5 +++++
 Src/_cmormodule.c    |  2 --
 Src/cmor.c           | 36 ++++++++++++++----------------------
 Src/cmor_tables.c    |  1 -
 Src/cmor_variables.c |  8 ++------
 include/cmor.h       |  2 +-
 6 files changed, 22 insertions(+), 32 deletions(-)

diff --cc RELEASE-NOTES
index ddd772d,7f66044..a414fed
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@@ -1,3 -1,4 +1,8 @@@
++2010-10-22 : fixed bug with variables using "grids" and singleton dimensions
++2010-10-22 : upgraded to 2.4 in devel branch
++2010-10-22 : exposed cmor_set_variable_attribute to users in Python
++2010-10-22 : cell_measures var attribute is now called ext_cell_measures
+ 2010-10-06 : tagging 2.3
  2010-09-29 : Cleaned up error messages, now tries to output var/axis it was working on as well as table used.
  2010-09-29 : When value that exceeds valid_min/max is found, now returns location of extreme point instead of first point encountered, as well as actuall coordinates values (not just indices)
  2010-09-22 : Joerg found a bug that was due to checking only the refvar.dimension w/o checking the actual tables as well
diff --cc Src/_cmormodule.c
index 93f6a65,1987caa..4d0bfe2
--- a/Src/_cmormodule.c
+++ b/Src/_cmormodule.c
@@@ -70,47 -70,6 +70,45 @@@ static PyObject 
    return Py_BuildValue("i",ierr);
  }
  
 +
 +static PyObject *
 +  PyCMOR_set_variable_attribute(PyObject *self,PyObject *args)
 +{
 +  char *name;
 +  char *value;
 +  int ierr, var_id;
 +  if (!PyArg_ParseTuple(args,"iss",&var_id,&name,&value))
 +    return NULL;
-   printf("ok set %s, to %s on %i\n",name,value,var_id);
 +  ierr = cmor_set_variable_attribute(var_id,name,'c',(void *)value);
-   printf("ok we got err: %i\n",ierr);
 +  if (ierr != 0 ) return NULL;
 +  /* Return NULL Python Object */
 +  Py_INCREF(Py_None);
 +  return Py_None;
 +}
 +static PyObject *
 +  PyCMOR_get_variable_attribute(PyObject *self,PyObject *args)
 +{
 +  char *name;
 +  char value[CMOR_MAX_STRING];
 +  int ierr, *var_id;
 +  if (!PyArg_ParseTuple(args,"is",&var_id,&name))
 +    return NULL;
 +  ierr = cmor_get_variable_attribute(*var_id,name,(void *)value);
 +  if (ierr != 0 ) return NULL;
 +  return Py_BuildValue("s",value);
 +}
 +
 +static PyObject *
 +  PyCMOR_has_variable_attribute(PyObject *self,PyObject *args)
 +{
 +  char *name;
 +  int ierr, *var_id;
 +  if (!PyArg_ParseTuple(args,"is",&var_id,&name))
 +    return NULL;
 +  ierr = cmor_has_variable_attribute(*var_id,name);
 +  return Py_BuildValue("i",ierr);
 +}
 +
  static PyObject *
    PyCMOR_setup(PyObject *self,PyObject *args)
  {
diff --cc Src/cmor.c
index 2881099,46eaefc..a01cc24
--- a/Src/cmor.c
+++ b/Src/cmor.c
@@@ -1668,6 -1668,6 +1668,7 @@@ int cmor_write(int var_id,void *data, c
    size_t uuidlen;
    extern int cmor_convert_char_to_hyphen(char c);
  
++
    cmor_add_traceback("cmor_write");
  
    strcpy(appending_to,""); /* initialize to nothing */
@@@ -2097,14 -2097,14 +2098,16 @@@
  
      strncat(ctmp,ctmp3,CMOR_MAX_STRING-strlen(ctmp));
  
 -    if (cmor_has_variable_attribute(var_id,"cell_measures")==0) {
 +    if (cmor_has_variable_attribute(var_id,"ext_cell_measures")==0) {
        /*Ok does it contain "area" */
 -      cmor_get_variable_attribute(var_id,"cell_measures",&ctmp5[0]);
 +      cmor_get_variable_attribute(var_id,"ext_cell_measures",&ctmp5[0]);
        k=-1;
--      for (i=0;i<strlen(ctmp5)-5;i++) {
--	if (strncmp(&ctmp5[i],"area:",5)==0) {
--	  k=i+6;
--	  break;
++      if (strlen(ctmp5)>5) {
++	for (i=0;i<strlen(ctmp5)-5;i++) {
++	  if (strncmp(&ctmp5[i],"area:",5)==0) {
++	    k=i+6;
++	    break;
++	  }
  	}
        }
        if (k!=-1) { /*ok we have this guy, let's figure out the name */
@@@ -2149,10 -2149,10 +2152,12 @@@
  	strncat(ctmp,ctmp3,CMOR_MAX_STRING-strlen(ctmp));
        }
        k=-1;
--      for (i=0;i<strlen(ctmp5)-7;i++) {
--	if (strncmp(&ctmp5[i],"volume:",7)==0) {
--	  k=i+8;
--	  break;
++      if (strlen(ctmp5)>7) {
++	for (i=0;i<strlen(ctmp5)-7;i++) {
++	  if (strncmp(&ctmp5[i],"volume:",7)==0) {
++	    k=i+8;
++	    break;
++	  }
  	}
        }
        if (k!=-1) { /*ok we have this guy, let's figureout the name */
@@@ -2829,7 -2829,7 +2834,7 @@@
        if (j!=-1) {
  	ierr = nc_def_var(ncid,cmor_axes[j].id,NC_DOUBLE,0,&nc_singletons[i],&nc_singletons[i]);
  	if (ierr != NC_NOERR) {
--	  snprintf(msg,CMOR_MAX_STRING,"NetCDF Error (%i: %s) defining scalar variable %s for variable %s (table: %s)",ierr,nc_strerror(ierr),cmor_axes[j].id,cmor_vars[var_id].id,cmor_vars[var_id].id,cmor_tables[cmor_vars[var_id].ref_table_id].table_id);
++	  snprintf(msg,CMOR_MAX_STRING,"NetCDF Error (%i: %s) defining scalar variable %s for variable %s (table: %s)",ierr,nc_strerror(ierr),cmor_axes[j].id,cmor_vars[var_id].id,cmor_tables[cmor_vars[var_id].ref_table_id].table_id);
  	  cmor_handle_error(msg,CMOR_CRITICAL);
  	}
  	/* now  puts on its attributes */
@@@ -3492,19 -3492,19 +3497,6 @@@ int cmor_close_variable(int var_id, cha
    cdCompTime comptime;
    int i,j,n;
    double interval;
--  /* these are for recopying in case of preserve */
--  char attribute_types[CMOR_MAX_ATTRIBUTES]; /*stores attributes type */
--  char attributes[CMOR_MAX_ATTRIBUTES][CMOR_MAX_STRING]; /*stores attributes names */
--  char attributes_values_char[CMOR_MAX_ATTRIBUTES][CMOR_MAX_STRING];
--  double attributes_values_num[CMOR_MAX_ATTRIBUTES];
--  int nattributes ; /* number of  attributes */
--  char itype;
--  double miss;
--  char iunits[CMOR_MAX_STRING];
--  int axes_ids[CMOR_MAX_DIMENSIONS];
--  int ndims;
--  double tolerance;
--  char positive;
    struct stat buf;
    off_t sz;
    long maxsz=(long) pow(2,32) -1;
diff --cc Src/cmor_tables.c
index bd4fbe1,bd4fbe1..78553e8
--- a/Src/cmor_tables.c
+++ b/Src/cmor_tables.c
@@@ -55,7 -55,7 +55,6 @@@ int cmor_set_dataset_att(cmor_table_t *
    char value[CMOR_MAX_STRING];
    char value2[CMOR_MAX_STRING];
    extern int cmor_ntables;
--  char **bstr;
  
    cmor_add_traceback("cmor_set_dataset_att");
    cmor_is_setup();
diff --cc Src/cmor_variables.c
index eab22f5,aa969c6..e95ceac
--- a/Src/cmor_variables.c
+++ b/Src/cmor_variables.c
@@@ -78,24 -78,17 +78,18 @@@ int cmor_set_variable_attribute(int id
    int i,index;
    char msg[CMOR_MAX_STRING];
    cmor_add_traceback("cmor_set_variable_attribute");
 +
-   if (type=='c') printf("in C: setting %s, to %s on var: %i\n",attribute_name, value, id);
    cmor_is_setup();
    index=-1;
    cmor_trim_string(attribute_name,msg);
    for (i=0;i<cmor_vars[id].nattributes;i++) {
      if (strcmp(cmor_vars[id].attributes[i],msg)==0) {index=i;break;} /* we found it */
    }
-   printf("ok it is found at index: %i\n",index);
    if (index==-1) {index=cmor_vars[id].nattributes; cmor_vars[id].nattributes+=1;}
-   printf("ok we now operate on index: %i, i is: %i\n",index,i);
    strncpy(cmor_vars[id].attributes[index],msg,CMOR_MAX_STRING); /*stores the name */
-   printf("copied attribute name (%s)\n",cmor_vars[id].attributes[index]);
 -  cmor_vars[id].attributes_type[i]=type;
 +  cmor_vars[id].attributes_type[index]=type;
-   printf("copied type: %c\n",type);
    if (type=='c')  {
      if (strlen(value)>0) {
-       printf("strlen is: %i\n",strlen(value));
        strncpytrim(cmor_vars[id].attributes_values_char[index],value,CMOR_MAX_STRING);
      }
      else {
@@@ -1238,6 -1221,6 +1232,8 @@@ int cmor_write_var_to_file(int ncid,cmo
    cmor_add_traceback("cmor_write_var_to_file");
    cmor_is_setup();
  
++  emax = 0.;
++  emin = 0.;
  /*   type = avar->itype; /\* stores input type for variable *\/ */
  
    if (strcmp(avar->ounits,avar->iunits)==0) dounits=0;
diff --cc include/cmor.h
index 048f13e,10c50a0..e966c2b
--- a/include/cmor.h
+++ b/include/cmor.h
@@@ -1,13 -1,5 +1,13 @@@
  #ifndef CMOR_H
  #define CMOR_H
 +
 +#define CMOR_VERSION_MAJOR 2
- #define CMOR_VERSION_MINOR 3
++#define CMOR_VERSION_MINOR 4
 +#define CMOR_VERSION_PATCH 0
 +
 +#define CMOR_CF_VERSION_MAJOR 1
 +#define CMOR_CF_VERSION_MINOR 4
 +
  #define CMOR_MAX_STRING 1024
  #define CMOR_DEF_ATT_STR_LEN 256
  #define CMOR_MAX_ELEMENTS 500

-- 
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