[cmor] 57/190: Fixed Joerg's bug, had to do with checking only for the refvar dimension w/o also checking it's coming from the right table

Alastair McKinstry mckinstry at moszumanska.debian.org
Tue Jul 21 12:54:37 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 1102dbad4f5721e4de209b309479f9677e2fbf5b
Author: Charles Doutriaux <doutriaux1 at llnl.gov>
Date:   Fri Sep 24 16:38:42 2010 -0700

    Fixed Joerg's bug, had to do with checking only for the refvar dimension w/o also checking it's coming from the right table
---
 RELEASE-NOTES               |  1 +
 Src/cmor_variables.c        |  2 +-
 Test/test_joerg_broken.f90  |  5 +++--
 Test/test_python_joerg_9.py | 16 ++++++++--------
 4 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 3ebd18b..ae2c39f 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -1,3 +1,4 @@
+2010-09-22 : Joerg found a bug that was due to checking only the refvar.dimension w/o checking the actual tables as well
 2010-09-01 : fixed a bug on mac 32bit when reading in net3 version string
 2010-09-01 : some vars with grid and singleton dims were wrongly analyzed by cmor_variable has not being defined with the right number of dimmensions.
 2010-09-01 : updated doc. Was saying you can pass "none" for units when it really is: ""
diff --git a/Src/cmor_variables.c b/Src/cmor_variables.c
index 006966c..20059b9 100644
--- a/Src/cmor_variables.c
+++ b/Src/cmor_variables.c
@@ -871,7 +871,7 @@ int cmor_variable(int *var_id, char *name, char *units, int ndims, int axes_ids[
     else if ((refvar.dimensions[i]==-2) || (cmor_tables[CMOR_TABLE].axes[refvar.dimensions[i]].value == 1.e20)) { /* not a singleton dim */
       iref=-1;
       for (j=0;j<lndims;j++) {
-	if (refvar.dimensions[i]==cmor_axes[laxes_ids[j]].ref_axis_id) {
+	if ((refvar.table_id==cmor_axes[laxes_ids[j]].ref_table_id) && (refvar.dimensions[i]==cmor_axes[laxes_ids[j]].ref_axis_id)) {
 	  cmor_vars[vrid].axes_ids[k]=laxes_ids[j];
 	}
 	/* -2 means it is a zaxis */
diff --git a/Test/test_joerg_broken.f90 b/Test/test_joerg_broken.f90
index b21dd46..2c777d7 100644
--- a/Test/test_joerg_broken.f90
+++ b/Test/test_joerg_broken.f90
@@ -3,7 +3,7 @@ program joerg
   USE cmor_users_functions
   IMPLICIT NONE
 
-  integer axes(10),error_flag,ntables(2)
+  integer axes(2),error_flag,ntables(2)
 
   integer,parameter ::  nlon = 122, nlat=101, ntim=1
   integer tim_id,i,j,grid_id,var_ids
@@ -41,7 +41,7 @@ program joerg
   read(10,*) blon
 
   close(10)
-  error_flag = cmor_setup(inpath='Test', netcdf_file_action='append')
+  error_flag = cmor_setup(inpath='Test', netcdf_file_action='replace')
 
   error_flag = cmor_dataset(                                    &
        outpath='Test',                                          &
@@ -85,6 +85,7 @@ program joerg
        coord_vals         = yii,                                &
        units              = '1')
   
+  print*, 'Axes:',axes
   grid_id = cmor_grid(                                          &
        axis_ids           = axes,                               &
        latitude           = alat,                               &
diff --git a/Test/test_python_joerg_9.py b/Test/test_python_joerg_9.py
index a23a87f..031c346 100644
--- a/Test/test_python_joerg_9.py
+++ b/Test/test_python_joerg_9.py
@@ -34,20 +34,20 @@ axes=numpy.zeros(2,numpy.int32)
 axes[0] = cmor.axis(                            
     table_entry        = 'i_index',               
     length             = nlon,                    
-    coord_vals         = numpy.arange(0,nlon,1,numpy.int32),                     
+    coord_vals         = numpy.arange(0,nlon,1,numpy.float32),                     
     units              = '1')
   
 axes[1] = cmor.axis(                            
     table_entry        = 'j_index',               
     length             = nlat,                    
-    coord_vals         = numpy.arange(0,nlat,1,numpy.int32),                     
+    coord_vals         = numpy.arange(0,nlat,1,numpy.float32),                     
     units              = '1')
 
 
-olat_val  = f("grid_center_lat").filled()
-olon_val  = f("grid_center_lon").filled()
-bnds_olat = f("grid_corner_lat").filled()
-bnds_olon = f("grid_corner_lon").filled()
+olat_val  = f("grid_center_lat").filled().astype('f')
+olon_val  = f("grid_center_lon").filled().astype('f')
+bnds_olat = f("grid_corner_lat").filled().astype('f')
+bnds_olon = f("grid_corner_lon").filled().astype('f')
 
 grid_id = cmor.grid(                            
     axis_ids           = axes,                    
@@ -63,8 +63,8 @@ ntimes=12
 
 tim_id = cmor.axis( table_entry="time",
                     units="months since 2010")
-time_vals = numpy.arange(ntimes)
-bnds_time = numpy.arange(ntimes+1)
+time_vals = numpy.arange(ntimes).astype('f')
+bnds_time = numpy.arange(ntimes+1).astype('f')
 
 var_ids              = cmor.variable(           
     table_entry        = "sic",           

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