[cmor] 133/190: Removed a print added tests
Alastair McKinstry
mckinstry at moszumanska.debian.org
Tue Jul 21 12:54:47 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 8f69b182306484e34dc27d70cb8aee7c5dee9de2
Author: Charles Doutriaux <doutriaux1 at llnl.gov>
Date: Wed Jun 5 18:07:44 2013 -0700
Removed a print added tests
---
Makefile.in | 110 ++++++++++++---------
RELEASE-NOTES | 4 +
Src/cmor_variables.c | 1 -
Test/test_lon_gt_360.py | 71 ++++++++++++++
Test/test_lon_thro_360.py | 73 ++++++++++++++
Test/test_python_jamie_11.py | 171 +++++++++++++++++++++++++++++++++
Test/test_python_joerg_tim2_clim_02.py | 62 ++++++++++++
Test/test_site_ts.py | 76 +++++++++++++++
configure | 37 ++++---
configure.ac | 9 +-
10 files changed, 550 insertions(+), 64 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index f45a18d..d406c1b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,9 @@
-#!/usr/bin/env sh
+#!/usr/bin/env bash
FC=@FC@
+CC=@CC@
+CFLAGS=@CFLAGS@
CPPFLAGS_USER=""
-FFLAGS_USER="-fPIC @USERFFLAGS@"
+USERFFLAGS=@USERFFLAGS@
#MODULE_SUFFIX="mod"
PREFIX=@prefix@
FCFLAGS=@FCFLAGS@
@@ -10,56 +12,72 @@ NO_COLOR2=\x1b[0m
OK_COLOR2=\x1b[2;34m
NO_COLOR=${@NO_COLOR@}
OK_COLOR=${@OK_COLOR@}
-CFLAGS="@USERCFLAGS@"
-
+USERCFLAGS=@USERCFLAGS@
+NCCFLAGS=@NCCFLAGS@
+ZFLAGS=@ZFLAGS@
+UUIDFLAGS=@UUIDFLAGS@
+UDUNITS2FLAGS=@UDUNITS2FLAGS@
+NCLDFLAGS=@NCLDFLAGS@
+ZLDFLAGS=@ZLDFLAGS@
+UUIDLDFLAGS=@UUIDLDFLAGS@
+UDUNITS2LDFLAGS=@UDUNITS2LDFLAGS@
+RTAG=@RTAG@
+FTAG=@FTAG@
+FNCLDFLAGS=@NCLDFLAGS@
+FZLDFLAGS=@ZLDFLAGS@
+FUUIDLDFLAGS=@UUIDLDFLAGS@
+FUDUNITS2LDFLAGS=@UDUNITS2LDFLAGS@
+DEBUG=@DEBUG@
+VERB=@VERB@
+MACROS=@MACROS@
# Library name
-LIBNAME = libcmor.a
+LIBNAME=libcmor.a
# Library sources
-#LIBSOURCES = Src/cmor.c Src/cmor_variables.c Src/cmor_axes.c Src/cmor_tables.c Src/cmor_grids.c Src/cdTime/cdTimeConv.c Src/cdTime/cdUtil.c Src/cdTime/timeConv.c Src/cdTime/timeArith.c
-LIBSOURCES = @LIBSOURCES@
-LIBFSOURCES = @LIBFSOURCES@
+#LIBSOURCES=Src/cmor.c Src/cmor_variables.c Src/cmor_axes.c Src/cmor_tables.c Src/cmor_grids.c Src/cdTime/cdTimeConv.c Src/cdTime/cdUtil.c Src/cdTime/timeConv.c Src/cdTime/timeArith.c
+LIBSOURCES=@LIBSOURCES@
+LIBFSOURCES=@LIBFSOURCES@
-LIBFILES = @LIBFILES@
+LIBFILES=@LIBFILES@
#Include Files
-INCFILES = @INCFILES@
+INCFILES=@INCFILES@
# Temporary Files
-TMPFILES = *~ $(LIBFILES) *.mod a.out *.stb Test/*.nc Test/IPCC_Fourth_Assessment *.LOG* *.dSYM Test/IPCC Test/CMIP5 CMIP5
-DISTFILES = libcmor.a
-DEPEND= makedepend -c @DEBUG@ @CFLAGS@ @USERCFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDFLAGS@ @ZFLAGS@
+TMPFILES=*~ $(LIBFILES) *.mod a.out *.stb Test/*.nc Test/IPCC_Fourth_Assessment *.LOG* *.dSYM Test/IPCC Test/CMIP5 CMIP5
+DISTFILES=libcmor.a
+DEPEND= makedepend -c ${DEBUG} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS}
all: cmor
@echo
depend: $(LIBSOURCES)
${DEPEND} $(LIBSOURCES)
cmor.o: Src/cmor.c include/cmor.h include/cmor_func_def.h
- @CC@ -c @DEBUG@ @MACROS@ @CFLAGS@ @USERCFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDFLAGS@ @ZFLAGS@ Src/cmor.c
+ ${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor.c
cmor_variables.o: Src/cmor_variables.c include/cmor.h include/cmor_func_def.h
- @CC@ -c @DEBUG@ @MACROS@ @CFLAGS@ @USERCFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDFLAGS@ @ZFLAGS@ Src/cmor_variables.c
+ ${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor_variables.c
cmor_axes.o: Src/cmor_axes.c include/cmor.h include/cmor_func_def.h
- @CC@ -c @DEBUG@ @MACROS@ @CFLAGS@ @USERCFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDFLAGS@ @ZFLAGS@ Src/cmor_axes.c
+ ${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor_axes.c
cmor_tables.o: Src/cmor_tables.c include/cmor.h include/cmor_func_def.h
- @CC@ -c @DEBUG@ @MACROS@ @CFLAGS@ @USERCFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDFLAGS@ @ZFLAGS@ Src/cmor_tables.c
+ ${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor_tables.c
cmor_grids.o: Src/cmor_grids.c include/cmor.h include/cmor_func_def.h
- @CC@ -c @DEBUG@ @MACROS@ @CFLAGS@ @USERCFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDFLAGS@ @ZFLAGS@ Src/cmor_grids.c
+ ${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor_grids.c
cmor_md5.o: Src/cmor_md5.c include/cmor.h include/cmor_func_def.h include/cmor_md5.h
- @CC@ -c @DEBUG@ @MACROS@ @CFLAGS@ @USERCFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDFLAGS@ @ZFLAGS@ Src/cmor_md5.c
+ ${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor_md5.c
cmor_cfortran_interface.o: Src/cmor_cfortran_interface.c include/cmor.h include/cmor_func_def.h
- @CC@ -c @DEBUG@ @MACROS@ @CFLAGS@ @USERCFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDFLAGS@ @ZFLAGS@ Src/cmor_cfortran_interface.c
+ ${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor_cfortran_interface.c
cdTimeConv.o: Src/cdTime/cdTimeConv.c include/cmor.h include/cmor_func_def.h
- @CC@ -c @DEBUG@ @MACROS@ @CFLAGS@ @USERCFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDFLAGS@ @ZFLAGS@ Src/cdTime/cdTimeConv.c
+ ${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cdTime/cdTimeConv.c
cdUtil.o: Src/cdTime/cdUtil.c include/cmor.h include/cmor_func_def.h
- @CC@ -c @DEBUG@ @MACROS@ @CFLAGS@ @USERCFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDFLAGS@ @ZFLAGS@ Src/cdTime/cdUtil.c
+ ${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cdTime/cdUtil.c
timeConv.o: Src/cdTime/timeConv.c include/cmor.h include/cmor_func_def.h
- @CC@ -c @DEBUG@ @MACROS@ @CFLAGS@ @USERCFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDFLAGS@ @ZFLAGS@ Src/cdTime/timeConv.c
+ ${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cdTime/timeConv.c
timeArith.o:Src/cdTime/timeArith.c include/cmor.h include/cmor_func_def.h
- @CC@ -c @DEBUG@ @MACROS@ @CFLAGS@ @USERCFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDFLAGS@ @ZFLAGS@ Src/cdTime/timeArith.c
+ ${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cdTime/timeArith.c
cmor_fortran_interface.o: Src/cmor_fortran_interface.f90
- @FC@ -c @FCFLAGS@ @USERFFLAGS@ @DEBUG@ @MACROS@ Src/cmor_fortran_interface.f90
+ ${FC} -c ${FCFLAGS} ${USERFFLAGS} ${DEBUG} ${MACROS} Src/cmor_fortran_interface.f90
cmor: $(LIBFILES) @MAKEDEPPYTHON@
@ar crv $(LIBNAME) $(LIBFILES)
@ranlib $(LIBNAME)
@@ -70,17 +88,17 @@ distclean: clean
@echo "Completely cleaning [$(WHEREAMI)]..."
@rm -f $(DISTFILES)
install: cmor
- mkdir -p @prefix@/lib
- mkdir -p @prefix@/include
- mkdir -p @prefix@/include/cdTime
- mkdir -p @prefix@/include/cdTime/cdunifpp
- cp -p $(LIBNAME) @prefix@/lib
- cp -pr include/*.h @MODFILES@ @prefix@/include
- cp -pr include/cdTime/*.h @prefix@/include/cdTime
- cp -pr include/cdTime/cdunifpp/*.h @prefix@/include/cdTime/cdunifpp
+ mkdir -p ${PREFIX}/lib
+ mkdir -p ${PREFIX}/include
+ mkdir -p ${PREFIX}/include/cdTime
+ mkdir -p ${PREFIX}/include/cdTime/cdunifpp
+ cp -p $(LIBNAME) ${PREFIX}/lib
+ cp -pr include/*.h @MODFILES@ ${PREFIX}/include
+ cp -pr include/cdTime/*.h ${PREFIX}/include/cdTime
+ cp -pr include/cdTime/cdunifpp/*.h ${PREFIX}/include/cdTime/cdunifpp
uninstall: distclean
- rm @prefix@/lib/$(LIBNAME)
- cd @prefix@ ; rm $(INCFILES)
+ rm ${PREFIX}/lib/$(LIBNAME)
+ cd ${PREFIX} ; rm $(INCFILES)
backup: clean
@echo "Creating full backup tar file..."
@(cd ..; \
@@ -91,15 +109,15 @@ backup: clean
test: cmor test_C @TEST_FORTRAN@ @MAKETESTPYTHON@
@echo "All C and Fortran Test passed successfully"
test_C: cmor
- @rm -f ./ipcc_test_code ; @CC@ @CFLAGS@ @USERCFLAGS@ @CPPFLAGS@ Test/ipcc_test_code.c -L at prefix@/lib -I at prefix@/include -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDFLAGS@ -o ipcc_test_code @VERB@; ./ipcc_test_code @VERB@
- @rm -f test_grid ; @CC@ @CFLAGS@ @USERCFLAGS@ @CPPFLAGS@ Test/test_grid.c -L at prefix@/lib -I at prefix@/include -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDFLAGS@ -o test_grid @VERB@; ./test_grid @VERB@;
- @rm -f test_lots_of_variables ; @CC@ @CFLAGS@ @USERCFLAGS@ @CPPFLAGS@ Test/test_lots_of_variables.c -L at prefix@/lib -I at prefix@/include -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDFLAGS@ -o test_lots_of_variables @VERB@; ./test_lots_of_variables @VERB@;
+ @rm -f ./ipcc_test_code ; ${CC} ${CFLAGS} ${USERCFLAGS} @CPPFLAGS@ Test/ipcc_test_code.c -L${PREFIX}/lib -I${PREFIX}/include -L. -lcmor ${NCCFLAGS} ${NCLDFLAGS} ${UDUNITS2LDFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${UUIDFLAGS} -o ipcc_test_code ${VERB}; ./ipcc_test_code ${VERB}
+ @rm -f test_grid ; ${CC} ${CFLAGS} ${USERCFLAGS} @CPPFLAGS@ Test/test_grid.c -L${PREFIX}/lib -I${PREFIX}/include -L. -lcmor ${NCCFLAGS} ${NCLDFLAGS} ${UDUNITS2LDFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${UUIDFLAGS} -o test_grid ${VERB}; ./test_grid ${VERB};
+ @rm -f test_lots_of_variables ; ${CC} ${CFLAGS} ${USERCFLAGS} @CPPFLAGS@ Test/test_lots_of_variables.c -L${PREFIX}/lib -I${PREFIX}/include -L. -lcmor ${NCCFLAGS} ${NCLDFLAGS} ${UDUNITS2LDFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${UUIDFLAGS} -o test_lots_of_variables ${VERB}; ./test_lots_of_variables ${VERB};
python:
@echo "Building Python interface"
@${PYTHONEXEC} setup.py install @CDATPREFIX@
test_a_python:
@echo "${OK_COLOR}Testing ${TEST_NAME} ${NO_COLOR}"
- ${PYTHONEXEC} ${TEST_NAME} @VERB@
+ ${PYTHONEXEC} ${TEST_NAME} ${VERB}
test_python: python
@env TEST_NAME=Test/test_python_direct_calls.py make test_a_python
@env TEST_NAME=Test/test_python_user_interface_00.py make test_a_python
@@ -153,20 +171,24 @@ test_python: python
@env TEST_NAME=Test/test_python_max_variables.py make test_a_python
@env TEST_NAME=Test/test_python_max_variables_2.py make test_a_python
@env TEST_NAME=Test/test_python_reverted_lats.py make test_a_python
-# @env TEST_NAME= make test_a_python
+ @env TEST_NAME=Test/test_lon_gt_360.py make test_a_python
+ @env TEST_NAME=Test/test_lon_thro_360.py make test_a_python
+ @env TEST_NAME=Test/test_python_jamie_11.py make test_a_python
+ @env TEST_NAME=Test/test_python_joerg_tim2_clim_02.py make test_a_python
+ @env TEST_NAME=Test/test_site_ts.py make test_a_python
test_case:
@echo "${OK_COLOR}Testing: "${TEST_NAME}" with input file: ${INPUT_FILE}${NO_COLOR}"
- @rm -f ./${TEST_NAME} 2>/dev/null ; @FC@ @USERFFLAGS@ @FCFLAGS@ @DEBUG@ Test/${TEST_NAME}.f90 -L at prefix@/lib -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDFLAGS@ @ZFLAGS@ @ZLDFLAGS@ -o ${TEST_NAME} ;
- @./${TEST_NAME} @VERB@ < ${INPUT_FILE} ;
+ @rm -f ./${TEST_NAME} 2>/dev/null ; ${FC} ${USERFFLAGS} ${FCFLAGS} ${DEBUG} Test/${TEST_NAME}.f90 -L${PREFIX}/lib -L. -lcmor ${NCCFLAGS} ${FNCLDFLAGS} ${FUDUNITS2LDFLAGS} ${UDUNITS2FLAGS} ${FUUIDLDFLAGS} ${UUIDFLAGS} ${ZFLAGS} ${FZLDFLAGS} -o ${TEST_NAME} ;
+ @./${TEST_NAME} ${VERB} < ${INPUT_FILE} ;
@ rm ./${TEST_NAME}
ifeq (@MAKEDEPPYTHON@,python)
@env TEST_NAME="Test/check_results.py ${TEST_NAME}" make test_a_python
endif
test_case_old_cmor_tables:
@echo "Testing: "${TEST_NAME}" with input file: "${INPUT_FILE}
- @rm -f ./${TEST_NAME} 2>/dev/null ; @FC@ @USERFFLAGS@ @FCFLAGS@ @DEBUG@ Test/old_cmor_tables/${TEST_NAME}.f90 -L at prefix@/lib -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDFLAGS@ @ZFLAGS@ @ZLDFLAGS@ -o ${TEST_NAME} ;
- @./${TEST_NAME} @VERB@ < ${INPUT_FILE} ;
+ @rm -f ./${TEST_NAME} 2>/dev/null ; ${FC} ${USERFFLAGS} ${FCFLAGS} ${DEBUG} Test/old_cmor_tables/${TEST_NAME}.f90 -L${PREFIX}/lib -L. -lcmor ${NCCFLAGS} ${FNCLDFLAGS} ${FUDUNITS2LDFLAGS} ${UDUNITS2FLAGS} ${FUUIDLDFLAGS} ${UUIDFLAGS} ${ZFLAGS} ${FZLDFLAGS} -o ${TEST_NAME} ;
+ @./${TEST_NAME} ${VERB} < ${INPUT_FILE} ;
@ rm ./${TEST_NAME}
ifeq (@MAKEDEPPYTHON@,python)
@env TEST_NAME="Test/check_results.py old_cmor_tables_${TEST_NAME}" make test_a_python
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index e12dae6..5441a69 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -1,3 +1,7 @@
+2013-06-09 : Fixed Jamie's bug for limited area
+2013-06-05 : Fixed time gap
+2013-06-05 : Fixed free issue (thx Jamie for patch)
+2013-06-05 : Fixed first/last_bound issue with appending files and store_with
2012-12-14 : Tagging 2.8.2
2012-12-14 : Fixed a bug in py wrapper where some list object where decref where they shouldn't leading to memory leaks, thanks Jamie and al. for this bug fix
2012-01-30 : Tagging 2.8.1
diff --git a/Src/cmor_variables.c b/Src/cmor_variables.c
index 4131522..0039125 100644
--- a/Src/cmor_variables.c
+++ b/Src/cmor_variables.c
@@ -1653,7 +1653,6 @@ int cmor_write_var_to_file(int ncid,cmor_var_t *avar,void *data,char itype, int
}
ierr = cmor_convert_time_values(time_vals,'d',ntimes_passed,&tmp_vals[tmpindex],cmor_axes[avar->axes_ids[0]].iunits,msg,msg2,msg2);
ierr = cmor_check_monotonic(&tmp_vals[0],ntimes_passed+tmpindex,"time",0,avar->axes_ids[0]);
-printf("ok we got: %f, %f--------\n",avar->last_time,avar->last_bound);
if (avar->ntimes_written>0) {
if ((avar->last_time!=-999.)&&(avar->last_bound!=1.e20)) {
tmp_vals[0] = 2*avar->last_time-avar->last_bound;
diff --git a/Test/test_lon_gt_360.py b/Test/test_lon_gt_360.py
new file mode 100644
index 0000000..a1ef39d
--- /dev/null
+++ b/Test/test_lon_gt_360.py
@@ -0,0 +1,71 @@
+import cmor
+import numpy
+
+def cmor_initialisation():
+ cmor.setup(inpath='/git/cmip5-cmor-tables/Tables',
+ netcdf_file_action = cmor.CMOR_REPLACE_3,
+ create_subdirectories = 0)
+ cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day',
+ institute_id = 'ukmo',
+ model_id = 'HadCM3',
+ history = 'some global history',
+ forcing = 'N/A',
+ parent_experiment_id = 'N/A',
+ parent_experiment_rip = 'N/A',
+ branch_time = 0.,
+ contact = 'bob',
+ outpath = 'test_output')
+
+def setup_data():
+ axes = [ {'table_entry': 'time',
+ 'units': 'days since 2000-01-01 00:00:00'
+ },
+ {'table_entry': 'latitude',
+ 'units': 'degrees',
+ 'coord_vals': [0],
+ 'cell_bounds': [-0.5, 0.5]},
+ {'table_entry': 'longitude',
+ 'units': 'degrees',
+ 'coord_vals': [361., 362.],
+ 'cell_bounds': [360., 361., 362.]},
+ ]
+
+ values = numpy.array([215., 216.], numpy.float32)
+ return values, axes
+
+def cmor_define_and_write(values, axes):
+ table = 'CMIP5_Amon'
+ cmor.load_table(table)
+
+ axis_ids = list()
+ for axis in axes:
+ axis_ids.append(cmor.axis(**axis))
+
+ table = 'CMIP5_Amon'
+ cmor.load_table(table)
+
+ varid = cmor.variable('rlut',
+ 'W m-2',
+ axis_ids,
+ history = 'variable history',
+ missing_value = -99,
+ positive = 'up'
+ )
+
+ cmor.write(varid, values, time_vals = [15], time_bnds = [0, 30])
+
+def version(cmor):
+ return '%s.%s.%s' % (cmor.CMOR_VERSION_MAJOR,
+ cmor.CMOR_VERSION_MINOR,
+ cmor.CMOR_VERSION_PATCH)
+
+def main():
+ assert version(cmor) == '2.8.3'
+ cmor_initialisation()
+ values, axes = setup_data()
+ cmor_define_and_write(values, axes)
+ cmor.close()
+
+if __name__ == '__main__':
+
+ main()
diff --git a/Test/test_lon_thro_360.py b/Test/test_lon_thro_360.py
new file mode 100644
index 0000000..664c84d
--- /dev/null
+++ b/Test/test_lon_thro_360.py
@@ -0,0 +1,73 @@
+import cmor
+import numpy
+
+def cmor_initialisation():
+ cmor.setup(inpath='/git/cmip5-cmor-tables/Tables',
+ netcdf_file_action = cmor.CMOR_REPLACE_3,
+ create_subdirectories = 0)
+ cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day',
+ institute_id = 'ukmo',
+ model_id = 'HadCM3',
+ history = 'some global history',
+ forcing = 'N/A',
+ parent_experiment_id = 'N/A',
+ parent_experiment_rip = 'N/A',
+ branch_time = 0.,
+ contact = 'bob',
+ outpath = 'test_ltd')
+
+def setup_data():
+ axes = [ {'table_entry': 'time',
+ 'units': 'days since 2000-01-01 00:00:00'
+ },
+ {'table_entry': 'latitude',
+ 'units': 'degrees',
+ 'coord_vals': [0],
+ 'cell_bounds': [-0.5, 0.5]},
+ {'table_entry': 'longitude',
+ 'units': 'degrees',
+ 'coord_vals': [359., 361.,363.],
+ 'cell_bounds': [[358,359.9],
+ [359.9, 362.],
+ [362.,364.]]},
+ ]
+
+ values = numpy.array([360., 1.,3.], numpy.float32)
+ return values, axes
+
+def cmor_define_and_write(values, axes):
+ table = 'CMIP5_Amon'
+ cmor.load_table(table)
+
+ axis_ids = list()
+ for axis in axes:
+ axis_ids.append(cmor.axis(**axis))
+
+ table = 'CMIP5_Amon'
+ cmor.load_table(table)
+
+ varid = cmor.variable('rlut',
+ 'W m-2',
+ axis_ids,
+ history = 'variable history',
+ missing_value = -99,
+ positive = 'up'
+ )
+
+ cmor.write(varid, values, time_vals = [15], time_bnds = [0, 30])
+
+def version(cmor):
+ return '%s.%s.%s' % (cmor.CMOR_VERSION_MAJOR,
+ cmor.CMOR_VERSION_MINOR,
+ cmor.CMOR_VERSION_PATCH)
+
+def main():
+ #assert version(cmor) == '2.8.3'
+ cmor_initialisation()
+ values, axes = setup_data()
+ cmor_define_and_write(values, axes)
+ cmor.close()
+
+if __name__ == '__main__':
+
+ main()
diff --git a/Test/test_python_jamie_11.py b/Test/test_python_jamie_11.py
new file mode 100644
index 0000000..2eea704
--- /dev/null
+++ b/Test/test_python_jamie_11.py
@@ -0,0 +1,171 @@
+import cmor,numpy
+
+error_flag = cmor.setup(inpath='Test', netcdf_file_action=cmor.CMOR_REPLACE)
+
+error_flag = cmor.dataset(
+ outpath='Test',
+ experiment_id='noVolc2000',
+ institution= 'GICC (Generic International Climate Center, Geneva, Switzerland)',
+ source='GICCM1 (2002): ',
+ calendar='360_day',
+ realization=1,
+ contact = 'Rusty Koder (koder at middle_earth.net) ',
+ history='Output from archivcl_A1.nce/giccm_03_std_2xCO2_2256.',
+ comment='Equilibrium reached after 30-year spin-up ',
+ references='Model described by Koder and Tolkien ',
+ model_id="GICCM1",
+ institute_id="PCMDI",
+ forcing="TO",
+ parent_experiment_rip="r1i3p2",
+ parent_experiment_id="lgm",branch_time=0)
+
+
+# creates 1 degree grid
+nlat=180
+nlon=360
+alats = numpy.arange(180)-89.5
+bnds_lat = numpy.arange(181)-90
+alons=numpy.arange(360)+.5
+bnds_lon=numpy.arange(361)
+cmor.load_table("/git/cmip5-cmor-tables/Tables/CMIP5_aero")
+ilat = cmor.axis(
+ table_entry='latitude',
+ units='degrees_north',
+ length=nlat,
+ coord_vals=alats,
+ cell_bounds=bnds_lat)
+
+ilon = cmor.axis(
+ table_entry='longitude',
+ length=nlon,
+ units='degrees_east',
+ coord_vals=alons,
+ cell_bounds=bnds_lon)
+
+lev=1
+ntimes=12
+plevs = (numpy.arange(lev)+1)*1.E4
+
+
+itim = cmor.axis(
+ table_entry='time',
+ units='months since 2030-1-1',
+ length=ntimes,
+ interval='1 month')
+
+zlevs = numpy.array(( 0.1, ))
+zlev_bnds=numpy.array(( 0.,.2, ))
+table_entry='hybrid_height'
+if table_entry == 'hybrid_height':
+ ilev = cmor.axis(
+ table_entry='hybrid_height',
+ ## table_entry='standard_sigma',
+ ## table_entry='standard_hybrid_sigma',
+ units='m',
+ length=lev,
+ coord_vals=zlevs,
+ cell_bounds=zlev_bnds)
+
+ p0 = 0.5e4
+## p0 = 1.e5
+## a_coeff = (/ 0.1, 0.2, 0.3, 0.2, 0.1 /)
+ a_coeff = numpy.array(( 0.2, ))
+ b_coeff = numpy.array(( 0.0, ))
+
+## a_coeff_bnds=(/0.,.15, .25, .25, .15, 0./)
+ a_coeff_bnds=numpy.array((0.,.3,))
+ b_coeff_bnds=numpy.array((0.,.05,))
+
+## error_flag = cmor.zfactor(
+## zaxis_id=ilev,
+## zfactor_name='ptop',
+## units='Pa',
+## zfactor_values = p0)
+
+ error_flag = cmor.zfactor(
+ zaxis_id=ilev,
+ zfactor_name='b',
+ axis_ids= numpy.array( (ilev, )),
+ zfactor_values = b_coeff,
+ zfactor_bounds = b_coeff_bnds )
+
+## error_flag = cmor.zfactor(
+## zaxis_id=ilev,
+## zfactor_name='lev',
+## axis_ids= numpy.array(( ilev, )),
+## units='m',
+## zfactor_values = a_coeff,
+## zfactor_bounds = a_coeff_bnds )
+
+ data2d = numpy.random.random((180,360)).astype('f')*8000
+
+ zfactor_id = cmor.zfactor(
+ zaxis_id=ilev,
+ zfactor_name='orog',
+ axis_ids=numpy.array(( ilon, ilat )),
+ units='m' ,
+ zfactor_values = data2d)
+else:
+ print 'yep working case'
+ ilev = cmor.axis(
+ table_entry='standard_sigma',
+ units='1',
+ length=lev,
+ coord_vals=zlevs,
+ cell_bounds=zlev_bnds)
+
+ p0 = 0.5E4
+ a_coeff = numpy.array(( 0.2, 0.4, 0.6, 0.8, 0.95 ))
+ b_coeff = numpy.array(( 0.0, 0.1, 0.2, 0.5, 0.8 ))
+
+ a_coeff_bnds=numpy.array((0.,.3, .5, .7, .9, 1.))
+ b_coeff_bnds=numpy.array((0.,.05, .15, .35, .65, 1.))
+
+ error_flag = cmor.zfactor(
+ zaxis_id=ilev,
+ zfactor_name='ptop',
+ units='Pa',
+ zfactor_values = p0)
+
+ error_flag = cmor.zfactor(
+ zaxis_id=ilev,
+ zfactor_name='sigma',
+ axis_ids= numpy.array(( ilev, )),
+ zfactor_values = a_coeff,
+ zfactor_bounds = a_coeff_bnds )
+
+ data2d = numpy.random.random((180,360)).astype('f')-97000.
+
+ zfactor_id = cmor.zfactor(
+ zaxis_id=ilev,
+ zfactor_name='ps',
+ axis_ids=numpy.array(( ilon, ilat, itim )),
+ units='Pa')
+
+print "ILEV is:",ilev
+
+var3d_ids = cmor.variable(
+ table_entry='sconcoa',
+ units='kg m-3',
+ axis_ids=numpy.array((ilev, ilon, ilat, itim)),
+ missing_value=1.0e28,
+ original_name='cocoa is good, but concoa is better')
+
+
+
+for it in range(ntimes):
+
+ time = numpy.array((it))
+ bnds_time = numpy.array((it,it+1))
+ data3d = numpy.random.random((lev,360,180)).astype('f')*40.
+
+ error_flag = cmor.write(
+ var_id = var3d_ids,
+ data = data3d,
+ ntimes_passed = 1,
+ time_vals = time,
+ time_bnds = bnds_time )
+
+
+error_flag = cmor.close()
+
diff --git a/Test/test_python_joerg_tim2_clim_02.py b/Test/test_python_joerg_tim2_clim_02.py
new file mode 100644
index 0000000..d4b145a
--- /dev/null
+++ b/Test/test_python_joerg_tim2_clim_02.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+import cmor
+import numpy
+
+def main():
+
+ cmor.setup(inpath='/git/cmip5-cmor-tables/Tables',
+ netcdf_file_action = cmor.CMOR_REPLACE_3)
+ cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day',
+ institute_id = 'ukmo',
+ model_id = 'HadCM3',
+ history = 'some global history',
+ forcing = 'N/A',
+ parent_experiment_id = 'N/A',
+ parent_experiment_rip = 'N/A',
+ branch_time = 0,
+ contact = 'brian clough')
+
+ table = 'CMIP5_Oclim'
+ cmor.load_table(table)
+ axes = [ {'table_entry': 'time2',
+ 'units': 'days since 1850-01-01 00:00:00',
+ 'coord_vals' : [15.5, 45,],
+ 'cell_bounds':[[0,396],[31,424]]
+ },
+ {'table_entry': 'depth_coord',
+ 'units': 'm',
+ 'coord_vals': [5000., 3000., 2000., 1000.],
+ 'cell_bounds': [ 5000., 3000., 2000., 1000.,0]},
+ {'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]},
+ ]
+
+
+ axis_ids = list()
+ for axis in axes:
+ print 'doing:',axis
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+ for var, units, value in (('difvso', 'm2 s-1', 274.),):
+ values = numpy.ones(map(lambda x: len(x["coord_vals"]),axes))*value
+ values=values.astype("f")
+ varid = cmor.variable(var,
+ units,
+ axis_ids,
+ history = 'variable history',
+ missing_value = -99
+ )
+ cmor.write(varid, values)
+
+ cmor.close()
+
+if __name__ == '__main__':
+
+ main()
diff --git a/Test/test_site_ts.py b/Test/test_site_ts.py
new file mode 100644
index 0000000..e2955c8
--- /dev/null
+++ b/Test/test_site_ts.py
@@ -0,0 +1,76 @@
+import cmor
+import numpy
+
+def cmor_initialisation():
+ cmor.setup(inpath='//Users/doutriaux1',
+ netcdf_file_action = cmor.CMOR_REPLACE_3,
+ create_subdirectories = 0)
+ cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day',
+ institute_id = 'ukmo',
+ model_id = 'HadCM3',
+ history = 'some global history',
+ forcing = 'N/A',
+ parent_experiment_id = 'N/A',
+ parent_experiment_rip = 'N/A',
+ branch_time = 0.,
+ contact = 'bob',
+ outpath = './out')
+
+def setup_data():
+ axes = [ {'table_entry': 'time1',
+ 'units': 'days since 2000-01-01 00:00:00',
+ },
+ {'table_entry': 'site',
+ 'units': '',
+ 'coord_vals': [0]},
+ {'table_entry': 'hybrid_height',
+ 'units': 'm',
+ 'coord_vals': range(2),
+ 'cell_bounds': [[x-0.5, x+0.5] for x in range(2)],
+ },
+ ]
+
+ values = numpy.array([0.5, 0.5], numpy.float32)
+ return values, axes
+
+def cmor_define_and_write(values, axes):
+ table = 'CMIP5_cfSites'
+ cmor.load_table(table)
+
+ axis_ids = list()
+ for axis in axes:
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+ igrid = cmor.grid([axis_ids[1]], [0.], [0.])
+ cmor.zfactor(axis_ids[2], 'b', axis_ids = [axis_ids[2]],
+ zfactor_values = range(2),
+ zfactor_bounds = [[x-0.5, x+0.5] for x in range(2)])
+
+ cmor.zfactor(axis_ids[2], 'orog', 'm', axis_ids = [igrid],
+ zfactor_values = [0])
+
+ ids_for_var = [axis_ids[0], igrid, axis_ids[2]]
+ varid = cmor.variable('tnhus',
+ 's-1',
+ ids_for_var,
+ history = 'variable history',
+ missing_value = -99,
+ )
+
+ for time in [x * 1800./ 86400 for x in range(48)]:
+ cmor.write(varid, values, time_vals = [time])
+ return varid
+
+
+def main():
+
+ cmor_initialisation()
+ values, axes = setup_data()
+ varid = cmor_define_and_write(values, axes)
+ fname = cmor.close(varid, file_name = True)
+
+
+if __name__ == '__main__':
+
+ main()
diff --git a/configure b/configure
index 9973ff9..095065f 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.8.3.
+# Generated by GNU Autoconf 2.61 for cmor 2.9.0.
#
# 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.8.3'
-PACKAGE_STRING='cmor 2.8.3'
+PACKAGE_VERSION='2.9.0'
+PACKAGE_STRING='cmor 2.9.0'
PACKAGE_BUGREPORT='doutriaux1 at llnl.gov'
ac_default_prefix=/usr/local/cmor
@@ -628,6 +628,8 @@ target
target_cpu
target_vendor
target_os
+RTAG
+FTAG
PATH
NCCFLAGS
NCLDFLAGS
@@ -1188,7 +1190,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.8.3 to adapt to many kinds of systems.
+\`configure' configures cmor 2.9.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1254,7 +1256,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of cmor 2.8.3:";;
+ short | recursive ) echo "Configuration of cmor 2.9.0:";;
esac
cat <<\_ACEOF
@@ -1353,7 +1355,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-cmor configure 2.8.3
+cmor configure 2.9.0
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1367,7 +1369,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.8.3, which was
+It was created by cmor $as_me 2.9.0, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -1885,9 +1887,11 @@ RTAG="none"
case ${target_os} in
linux-*)
RTAG="-Wl,-rpath="
+ FTAG="-Wl,-rpath="
;;
darwin*)
RTAG="-R"
+ FTAG="-Wl,-rpath="
;;
esac
@@ -1897,7 +1901,6 @@ CMOR_VERSION=${PACKAGE_VERSION}" (commit: ${GIT_TAG})"
ac_config_files="$ac_config_files Makefile setup.py compile_line.txt include/cmor_locale.h"
-
INCFILES="include/cmor.h include/cmor_func_def.h include/cmor_md5.h "`ls -x --width=10000 include/cdTime/*.h include/cdTime/cdunifpp/*.h`
@@ -1929,6 +1932,9 @@ INCFILES="include/cmor.h include/cmor_func_def.h include/cmor_md5.h "`ls -x --w
+
+
+
MACROS=""
DEBUG=""
@@ -5000,7 +5006,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.8.3, which was
+This file was extended by cmor $as_me 2.9.0, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -5043,7 +5049,7 @@ Report bugs to <bug-autoconf at gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-cmor config.status 2.8.3
+cmor config.status 2.9.0
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
@@ -5255,6 +5261,8 @@ target!$target$ac_delim
target_cpu!$target_cpu$ac_delim
target_vendor!$target_vendor$ac_delim
target_os!$target_os$ac_delim
+RTAG!$RTAG$ac_delim
+FTAG!$FTAG$ac_delim
PATH!$PATH$ac_delim
NCCFLAGS!$NCCFLAGS$ac_delim
NCLDFLAGS!$NCLDFLAGS$ac_delim
@@ -5303,7 +5311,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 95; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@@ -5322,7 +5330,7 @@ fi
cat >>$CONFIG_STATUS <<_ACEOF
cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
_ACEOF
sed '
s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
@@ -5335,8 +5343,6 @@ N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
' >>$CONFIG_STATUS <conf$$subs.sed
rm -f conf$$subs.sed
cat >>$CONFIG_STATUS <<_ACEOF
-:end
-s/|#_!!_#|//g
CEOF$ac_eof
_ACEOF
@@ -5585,7 +5591,7 @@ s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@MKDIR_P@&$ac_MKDIR_P&;t t
$ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed 's/|#_!!_#|//g' >$tmp/out
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
@@ -5771,5 +5777,4 @@ echo "$as_me: " >&6;}
{ echo "$as_me:$LINENO: " >&5
echo "$as_me: " >&6;}
-
cat compile_line.txt
diff --git a/configure.ac b/configure.ac
index b235a9d..26131e7 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.8.3, doutriaux1 at llnl.gov)
+AC_INIT(cmor, 2.9.0, doutriaux1 at llnl.gov)
GIT_TAG=`./get_git_version.sh`
@@ -12,9 +12,11 @@ RTAG="none"
case ${target_os} in
linux-*)
RTAG="-Wl,-rpath="
+ FTAG="-Wl,-rpath="
;;
darwin*)
RTAG="-R"
+ FTAG="-Wl,-rpath="
;;
esac
@@ -23,8 +25,10 @@ CMOR_VERSION=${PACKAGE_VERSION}" (commit: ${GIT_TAG})"
AC_PREFIX_DEFAULT([/usr/local/cmor])
AC_CONFIG_FILES([Makefile setup.py compile_line.txt include/cmor_locale.h])
-
INCFILES="include/cmor.h include/cmor_func_def.h include/cmor_md5.h "`ls -x --width=10000 include/cdTime/*.h include/cdTime/cdunifpp/*.h`
+AC_SUBST(RTAG)
+AC_SUBST(FTAG)
+
AC_SUBST(PATH)
AC_SUBST(NCCFLAGS)
AC_SUBST(NCLDFLAGS)
@@ -372,5 +376,4 @@ AC_MSG_NOTICE([You can compile C or FORTRAN code using the compilation lines sho
AC_MSG_NOTICE([])
AC_MSG_NOTICE([])
-
cat compile_line.txt
--
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