From f9a7c09cbfacc3461cbc2a7c81a0e1150622af51 Mon Sep 17 00:00:00 2001 From: Aashish Chaudhary Date: Fri, 1 May 2015 15:53:31 -0400 Subject: [PATCH 1/8] Added new script to run tests --- CMake/cdat_modules_extra/runtest.in | 4 ++++ CMakeLists.txt | 5 +++++ testing/CMakeLists.txt | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 CMake/cdat_modules_extra/runtest.in diff --git a/CMake/cdat_modules_extra/runtest.in b/CMake/cdat_modules_extra/runtest.in new file mode 100755 index 0000000000..7bfcf620b3 --- /dev/null +++ b/CMake/cdat_modules_extra/runtest.in @@ -0,0 +1,4 @@ +#!/bin/bash +# source is not portable whereas . is +. "@CMAKE_INSTALL_PREFIX@/bin/setup_runtime.sh" +python@PYVER@ "$@" diff --git a/CMakeLists.txt b/CMakeLists.txt index ae6547597d..ea4d8f15ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -729,6 +729,11 @@ configure_file(${cdat_CMAKE_SOURCE_DIR}/cdat_modules_extra/cdat.in @ONLY ) +configure_file(${cdat_CMAKE_SOURCE_DIR}/cdat_modules_extra/runtest.in + ${CMAKE_INSTALL_PREFIX}/bin/runtest + @ONLY +) + if (BUILD_TESTING) configure_file(${cdat_CMAKE_SOURCE_DIR}/cdat_modules_extra/runpytest.in diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt index dd153dce67..d95c012f4b 100644 --- a/testing/CMakeLists.txt +++ b/testing/CMakeLists.txt @@ -4,7 +4,8 @@ # Helper macro that sets the environment correctly macro (cdat_add_test name python_exe script) #string (REPLACE ";" " " TEST_ARGS "${ARGN}") - add_test (${name} "${python_exe}" ${script} ${ARGN}) + add_test(${name} "${CMAKE_INSTALL_PREFIX}/bin/runtest" + ${script} ${ARGN}) if(DEFINED ENV{UVCDAT_ANONYMOUS_LOG}) set_tests_properties (${name} PROPERTIES ENVIRONMENT "UVCDAT_ANONYMOUS_LOG=$ENV{UVCDAT_ANONYMOUS_LOG}" From a8213ca5a5157224ffe818bea623fe3acbd14504 Mon Sep 17 00:00:00 2001 From: Aashish Chaudhary Date: Fri, 1 May 2015 17:37:13 -0400 Subject: [PATCH 2/8] Using cdat macro for testing --- testing/vcs/vtk_ui/CMakeLists.txt | 58 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/testing/vcs/vtk_ui/CMakeLists.txt b/testing/vcs/vtk_ui/CMakeLists.txt index 77d56b6c5b..103aad70ef 100644 --- a/testing/vcs/vtk_ui/CMakeLists.txt +++ b/testing/vcs/vtk_ui/CMakeLists.txt @@ -2,168 +2,168 @@ set(BASELINE_DIR "${UVCDAT_GIT_TESTDATA_DIR}/baselines/vcs/vtk_ui") set(TEST_DIR "${cdat_SOURCE_DIR}/testing/vcs/vtk_ui") # Button tests -add_test(test_vtk_ui_button_draw +cdat_add_test(test_vtk_ui_button_draw "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_button_draw.py ${BASELINE_DIR}/test_vtk_ui_button_draw.png ) -add_test(test_vtk_ui_button_action +cdat_add_test(test_vtk_ui_button_action "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_button_action.py ) -add_test(test_vtk_ui_button_corner_radius +cdat_add_test(test_vtk_ui_button_corner_radius "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_button_corner_radius.py ${BASELINE_DIR}/test_vtk_ui_button_corner_radius.png ) -add_test(test_vtk_ui_button_dimensions +cdat_add_test(test_vtk_ui_button_dimensions "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_button_dimensions.py ${BASELINE_DIR}/test_vtk_ui_button_dimensions.png ) -add_test(test_vtk_ui_button_states +cdat_add_test(test_vtk_ui_button_states "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_button_states.py ${BASELINE_DIR}/test_vtk_ui_button_states.png ) -add_test(test_vtk_ui_button_click +cdat_add_test(test_vtk_ui_button_click "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_button_click.py ) -add_test(test_vtk_ui_button_font +cdat_add_test(test_vtk_ui_button_font "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_button_font.py ${BASELINE_DIR}/test_vtk_ui_button_font.png ) -add_test(test_vtk_ui_button_alignment +cdat_add_test(test_vtk_ui_button_alignment "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_button_alignment.py ${BASELINE_DIR}/test_vtk_ui_button_alignment.png ) -add_test(test_vtk_ui_button_image +cdat_add_test(test_vtk_ui_button_image "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_button_image.py ${BASELINE_DIR}/test_vtk_ui_button_image.png ) -add_test(test_vtk_ui_button_tooltip_show +cdat_add_test(test_vtk_ui_button_tooltip_show "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_button_tooltip_show.py ${BASELINE_DIR}/test_vtk_ui_button_tooltip_show.png ) -add_test(test_vtk_ui_button_tooltip_hide +cdat_add_test(test_vtk_ui_button_tooltip_hide "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_button_tooltip_hide.py ${BASELINE_DIR}/test_vtk_ui_button_tooltip_hide.png ) -add_test(test_vtk_ui_slider_jumps +cdat_add_test(test_vtk_ui_slider_jumps "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_slider_jumps.py ${BASELINE_DIR}/test_vtk_ui_slider_jumps.png ) -add_test(test_vtk_ui_textbox_highlight +cdat_add_test(test_vtk_ui_textbox_highlight "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_textbox_highlight.py ${BASELINE_DIR}/test_vtk_ui_textbox_highlight.png ) -add_test(test_vtk_ui_label_top +cdat_add_test(test_vtk_ui_label_top "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_label_top.py ${BASELINE_DIR}/test_vtk_ui_label_top.png ) -add_test(test_vtk_ui_label_y +cdat_add_test(test_vtk_ui_label_y "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_label_y.py ${BASELINE_DIR}/test_vtk_ui_label_y.png ) -add_test(test_vtk_ui_contrasting_colors +cdat_add_test(test_vtk_ui_contrasting_colors "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_contrasting_colors.py ) -add_test(test_vtk_ui_hsv_rgb +cdat_add_test(test_vtk_ui_hsv_rgb "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_hsv_rgb.py ) -add_test(test_vtk_ui_label_behaviors +cdat_add_test(test_vtk_ui_label_behaviors "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_label_behaviors.py ${BASELINE_DIR}/test_vtk_ui_label_behaviors.png ) -add_test(test_vtk_ui_label_bounds +cdat_add_test(test_vtk_ui_label_bounds "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_label_bounds.py ) -add_test(test_vtk_ui_label_detach +cdat_add_test(test_vtk_ui_label_detach "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_label_detach.py ${BASELINE_DIR}/test_vtk_ui_label_detach.png ) -add_test(test_vtk_ui_label_font_attrs +cdat_add_test(test_vtk_ui_label_font_attrs "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_label_font_attrs.py ${BASELINE_DIR}/test_vtk_ui_label_font_attrs.png ) -add_test(test_vtk_ui_label_left +cdat_add_test(test_vtk_ui_label_left "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_label_left.py ${BASELINE_DIR}/test_vtk_ui_label_left.png ) -add_test(test_vtk_ui_label_render +cdat_add_test(test_vtk_ui_label_render "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_label_render.py ${BASELINE_DIR}/test_vtk_ui_label_render_initial.png ${BASELINE_DIR}/test_vtk_ui_label_render_color_change.png ) -add_test(test_vtk_ui_label_show_hide +cdat_add_test(test_vtk_ui_label_show_hide "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_label_show_hide.py ${BASELINE_DIR}/test_vtk_ui_label_show_hide.png ) -add_test(test_vtk_ui_label_text +cdat_add_test(test_vtk_ui_label_text "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_label_text.py ${BASELINE_DIR}/test_vtk_ui_label_text.png ) -add_test(test_vtk_ui_label_x +cdat_add_test(test_vtk_ui_label_x "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_label_x.py ${BASELINE_DIR}/test_vtk_ui_label_x.png ) -add_test(test_vtk_ui_set_font +cdat_add_test(test_vtk_ui_set_font "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_set_font.py ) -add_test(test_vtk_ui_text_dimensions +cdat_add_test(test_vtk_ui_text_dimensions "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_text_dimensions.py ) -add_test(test_vtk_ui_white_or_black +cdat_add_test(test_vtk_ui_white_or_black "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_white_or_black.py ) From 68652da7dddc140b1e555b3eb3184fdd91556aec Mon Sep 17 00:00:00 2001 From: Aashish Chaudhary Date: Fri, 1 May 2015 22:17:20 -0400 Subject: [PATCH 3/8] Converted last of tests to use cdat test macro --- testing/vcsaddons/CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/testing/vcsaddons/CMakeLists.txt b/testing/vcsaddons/CMakeLists.txt index 066e920164..64b8d1755b 100644 --- a/testing/vcsaddons/CMakeLists.txt +++ b/testing/vcsaddons/CMakeLists.txt @@ -1,43 +1,43 @@ set(BASELINE_DIR "${UVCDAT_GIT_TESTDATA_DIR}/baselines/vcsaddons") -add_test(vcs_addons_preview_2x2 +cdat_add_test(vcs_addons_preview_2x2 "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_vcsaddons_preview_2x2.py ${BASELINE_DIR}/test_vcsaddons_preview_2x2.png ) -add_test(vcs_addons_test_12_plot_one_leg_per_row +cdat_add_test(vcs_addons_test_12_plot_one_leg_per_row "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_12_plot_one_leg_per_row.py ${BASELINE_DIR}/test_12_plot_one_leg_per_row.png ) -add_test(vcs_addons_test_12_plot_one_leg_per_row_right +cdat_add_test(vcs_addons_test_12_plot_one_leg_per_row_right "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_12_plot_one_leg_per_row_right.py ${BASELINE_DIR}/test_12_plot_one_leg_per_row_right.png ) -add_test(vcs_addons_test_EzTemplate_12_plots_margins_thickness +cdat_add_test(vcs_addons_test_EzTemplate_12_plots_margins_thickness "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_EzTemplate_12_plots_margins_thickness.py ${BASELINE_DIR}/test_EzTemplate_12_plots_margins_thickness.png ) -add_test(vcs_addons_test_EzTemplate_12_plots_legd_direction +cdat_add_test(vcs_addons_test_EzTemplate_12_plots_legd_direction "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_EzTemplate_12_plots_legd_direction.py ${BASELINE_DIR}/test_EzTemplate_12_plots_legd_direction.png ) -add_test(vcs_addons_test_EzTemplate_12_plots_mix_glb_local +cdat_add_test(vcs_addons_test_EzTemplate_12_plots_mix_glb_local "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_EzTemplate_12_plots_mix_glb_local.py ${BASELINE_DIR}/test_EzTemplate_12_plots_mix_glb_local.png ) -add_test(vcs_addons_test_EzTemplate_12_plots_spacing +cdat_add_test(vcs_addons_test_EzTemplate_12_plots_spacing "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_EzTemplate_12_plots_spacing.py ${BASELINE_DIR}/test_EzTemplate_12_plots_spacing.png ) if (CDAT_DOWNLOAD_SAMPLE_DATA) - add_test(vcs_addons_EzTemplate_2x2 + cdat_add_test(vcs_addons_EzTemplate_2x2 "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_vcs_addons_EzTemplate_2x2.py ${BASELINE_DIR}/test_vcs_addons_EzTemplate_2x2.png From 3aaa5dad2f087d3f90e6f4ade4c70e22ac650b5d Mon Sep 17 00:00:00 2001 From: Aashish Chaudhary Date: Sat, 2 May 2015 03:51:49 -0400 Subject: [PATCH 4/8] Removed osx as its failing on travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4cbcaf58de..e8eccc717d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ os: - linux - - osx +# - osx language: c++ From f63908b7a882398605691cd3fafb8d5a641444cf Mon Sep 17 00:00:00 2001 From: Thomas Maxwell Date: Mon, 4 May 2015 16:18:59 -0400 Subject: [PATCH 5/8] Remove references to Variable.name --- Packages/DV3D/StructuredVariableReader.py | 11 +++++------ .../DV3D/demo/demo_plots/gallery_vector_test.py | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 Packages/DV3D/demo/demo_plots/gallery_vector_test.py diff --git a/Packages/DV3D/StructuredVariableReader.py b/Packages/DV3D/StructuredVariableReader.py index 2f034c1162..2d893fa353 100644 --- a/Packages/DV3D/StructuredVariableReader.py +++ b/Packages/DV3D/StructuredVariableReader.py @@ -11,7 +11,6 @@ from StructuredDataset import * def getVarName( var ): - if hasattr( var,'outvar'): return var.outvar.name if hasattr( var,'name'): return var.name if hasattr( var,'name_in_file'): return var.name_in_file if hasattr( var,'id'): return var.id @@ -110,10 +109,10 @@ def __init__(self, **args): self.varSpecs = [ var.name_in_file for var in self.vars ] self.df = cdms2.open( self.fileSpecs ) else: - self.varSpecs = [ var.name for var in self.vars ] + self.varSpecs = [ var.id for var in self.vars ] plot_attributes = args.get( 'plot_attributes', None ) if plot_attributes <> None: - self.datasetId = plot_attributes.get( 'filename', self.vars[0].name ) + self.datasetId = plot_attributes.get( 'filename', self.vars[0].id ) for file_attribute_name in ['url', 'filename', 'file' ]: self.fileSpecs = plot_attributes.get( file_attribute_name, None ) if self.fileSpecs <> None: break @@ -122,8 +121,8 @@ def __init__(self, **args): print>>sys.stderr, "Warning, can't open data file '%s'" % self.fileSpecs self.df = None else: - self.datasetId = self.vars[0].name - self.fileSpecs = self.vars[0].name + self.datasetId = self.vars[0].id + self.fileSpecs = self.vars[0].id self.df = None self.referenceTimeUnits = None @@ -371,7 +370,7 @@ def getPortData( self, **args ): def generateVariableOutput( self, cdms_var ): print str(cdms_var.var) - self.set3DOutput( name=cdms_var.name, output=cdms_var.var ) + self.set3DOutput( name=cdms_var.id, output=cdms_var.var ) def refreshVersion(self): portData = self.getPortData() diff --git a/Packages/DV3D/demo/demo_plots/gallery_vector_test.py b/Packages/DV3D/demo/demo_plots/gallery_vector_test.py new file mode 100644 index 0000000000..42dd63d2ad --- /dev/null +++ b/Packages/DV3D/demo/demo_plots/gallery_vector_test.py @@ -0,0 +1,16 @@ +import vcs, cdms2, sys + +x = vcs.init() +f = cdms2.open( sys.prefix+"/sample_data/geos5-sample.nc" ) +dv3d = vcs.get3d_vector() +dv3d.VerticalScaling = 4.0 +dv3d.BasemapOpacity = 0.5 +dv3d.ScaleColormap = [50.0, 75.0, 1] +dv3d.ZSlider = [26.0], vcs.on +dv3d.GlyphDensity = 3.0 +dv3d.GlyphSize = 0.6 +dv3d = vcs.get3d_vector() +v0 = f["uwnd"] +v1 = f["vwnd"] +x.plot( v0, v1, dv3d ) +x.interact() \ No newline at end of file From 3c0155ba16bef1ed932e2eed39c8861d045aa484 Mon Sep 17 00:00:00 2001 From: Thomas Maxwell Date: Mon, 4 May 2015 16:31:10 -0400 Subject: [PATCH 6/8] Fix missing time axis --- Packages/DV3D/MultiVarPointCollection.py | 101 +++++++++++++++-------- 1 file changed, 67 insertions(+), 34 deletions(-) diff --git a/Packages/DV3D/MultiVarPointCollection.py b/Packages/DV3D/MultiVarPointCollection.py index a1171d7edd..bc71956796 100644 --- a/Packages/DV3D/MultiVarPointCollection.py +++ b/Packages/DV3D/MultiVarPointCollection.py @@ -101,6 +101,7 @@ def getCoordIndex( self, var, coord ): return axis_order.index(coord) except ValueError, err: print>>sys.stderr, "Can't find axis %s in axis order spec '%s' " % ( coord, axis_order ) + return None def getCoordDataBlock( self, var ): @@ -109,42 +110,74 @@ def getCoordDataBlock( self, var ): def getDataBlock( self, var ): np_var_data_block = None iTimeIndex = self.getCoordIndex( var, 't' ) - if iTimeIndex <> 0: - print>>sys.stderr, "Unimplemented axis order: %s " % var.getOrder() - else: - if self.lev == None: - if len( var.shape ) == 2: - np_var_data_block = var[ self.iTimeStep, self.istart::self.istep ].data - if self.roi_mask <> None: - np_var_data_block = numpy.compress( self.roi_mask, np_var_data_block ) - elif len( var.shape ) == 3: - np_var_data_block = var[ self.iTimeStep, :, self.istart::self.istep ].data - np_var_data_block = np_var_data_block.reshape( [ np_var_data_block.shape[0] * np_var_data_block.shape[1], ] ) - self.nLevels = 1 + try: + if iTimeIndex > 0: + print>>sys.stderr, "Unimplemented axis order: %s " % var.getOrder() + elif iTimeIndex is None: + if self.lev == None: + if len( var.shape ) == 1: + np_var_data_block = var[ self.istart::self.istep ].data + if self.roi_mask <> None: + np_var_data_block = numpy.compress( self.roi_mask, np_var_data_block ) + elif len( var.shape ) == 2: + np_var_data_block = var[ :, self.istart::self.istep ].data + np_var_data_block = np_var_data_block.reshape( [ np_var_data_block.shape[0] * np_var_data_block.shape[1], ] ) + self.nLevels = 1 + else: + iLevIndex = self.getCoordIndex( var, 'z' ) + if len( var.shape ) == 2: + if iLevIndex == 0: + np_var_data_block = var[ :, self.istart::self.istep ].data + elif iLevIndex == 1: + np_var_data_block = var[ self.istart::self.istep, : ].data + np_var_data_block = numpy.swapaxes( np_var_data_block, 0, 1 ) + else: + print>>sys.stderr, "Unimplemented axis order: %s " % var.getOrder() + if not isNone( np_var_data_block ): + if not isNone( self.roi_mask ): + np_var_data_block = numpy.compress( self.roi_mask, np_var_data_block, axis = 1 ) + elif len( var.shape ) == 3: + lev_data_arrays = [] + for ilev in range( var.shape[1] ): + data_z_slice = var[ ilev ].flatten() + lev_data_arrays.append( data_z_slice[self.istart::self.istep] ) + np_var_data_block = numpy.concatenate( lev_data_arrays ).astype( numpy.float32 ) else: - iLevIndex = self.getCoordIndex( var, 'z' ) - if len( var.shape ) == 3: - if iLevIndex == 1: + if self.lev == None: + if len( var.shape ) == 2: + np_var_data_block = var[ self.iTimeStep, self.istart::self.istep ].data + if self.roi_mask <> None: + np_var_data_block = numpy.compress( self.roi_mask, np_var_data_block ) + elif len( var.shape ) == 3: np_var_data_block = var[ self.iTimeStep, :, self.istart::self.istep ].data - elif iLevIndex == 2: - np_var_data_block = var[ self.iTimeStep, self.istart::self.istep, : ].data - np_var_data_block = numpy.swapaxes( np_var_data_block, 0, 1 ) - else: - print>>sys.stderr, "Unimplemented axis order: %s " % var.getOrder() - if not isNone( np_var_data_block ): - if not isNone( self.roi_mask ): - np_var_data_block = numpy.compress( self.roi_mask, np_var_data_block, axis = 1 ) - elif len( var.shape ) == 4: - lev_data_arrays = [] - for ilev in range( var.shape[1] ): - data_z_slice = var[ self.iTimeStep, ilev ].flatten() - lev_data_arrays.append( data_z_slice[self.istart::self.istep] ) - np_var_data_block = numpy.concatenate( lev_data_arrays ).astype( numpy.float32 ) -# print " GetDataBlock, var.shape = %s, grid = %s, ts = %d, newshape = %s, type = %s " % ( str(var.shape), str((self.istart,self.istep)), self.iTimeStep, str(np_var_data_block.shape), np_var_data_block.__class__.__name__ ) - - if not isNone( np_var_data_block ): - if self.missing_value: np_var_data_block = numpy.ma.masked_equal( np_var_data_block, self.missing_value, False ).flatten() - else: np_var_data_block = np_var_data_block.flatten() + np_var_data_block = np_var_data_block.reshape( [ np_var_data_block.shape[0] * np_var_data_block.shape[1], ] ) + self.nLevels = 1 + else: + iLevIndex = self.getCoordIndex( var, 'z' ) + if len( var.shape ) == 3: + if iLevIndex == 1: + np_var_data_block = var[ self.iTimeStep, :, self.istart::self.istep ].data + elif iLevIndex == 2: + np_var_data_block = var[ self.iTimeStep, self.istart::self.istep, : ].data + np_var_data_block = numpy.swapaxes( np_var_data_block, 0, 1 ) + else: + print>>sys.stderr, "Unimplemented axis order: %s " % var.getOrder() + if not isNone( np_var_data_block ): + if not isNone( self.roi_mask ): + np_var_data_block = numpy.compress( self.roi_mask, np_var_data_block, axis = 1 ) + elif len( var.shape ) == 4: + lev_data_arrays = [] + for ilev in range( var.shape[1] ): + data_z_slice = var[ self.iTimeStep, ilev ].flatten() + lev_data_arrays.append( data_z_slice[self.istart::self.istep] ) + np_var_data_block = numpy.concatenate( lev_data_arrays ).astype( numpy.float32 ) + except Exception, err: + print " Error in GetDataBlock, var.shape = %s, grid = %s, ts = %d " % ( str(var.shape), str((self.istart,self.istep)), self.iTimeStep ) + print str(err) + + if not isNone( np_var_data_block ): + if self.missing_value: np_var_data_block = numpy.ma.masked_equal( np_var_data_block, self.missing_value, False ).flatten() + else: np_var_data_block = np_var_data_block.flatten() return np_var_data_block From c32b6fe7582c33404c7eaf9e8bd1bace80d5e8b0 Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Mon, 4 May 2015 16:54:13 -0400 Subject: [PATCH 7/8] Fixes more typos in raise statements --- Packages/cdms2/Lib/dataset.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Packages/cdms2/Lib/dataset.py b/Packages/cdms2/Lib/dataset.py index 3c4cfc56be..a5f11921d3 100644 --- a/Packages/cdms2/Lib/dataset.py +++ b/Packages/cdms2/Lib/dataset.py @@ -130,7 +130,7 @@ def setNetcdfDeflateFlag(value): def setNetcdfDeflateLevelFlag(value): """ Sets NetCDF deflate level flag value""" if value not in [0,1,2,3,4,5,6,7,8,9]: - raise CDMSError, "Error NetCDF deflate_level flag must be an integer < 10" + raise CDMSError("Error NetCDF deflate_level flag must be an integer < 10") Cdunif.CdunifSetNCFLAGS("deflate_level",value) def getNetcdfClassicFlag(): @@ -245,14 +245,14 @@ def openDataset(uri,mode='r',template=None,dods=1,dpath=None, hostObj=None): file = CdmsFile(uri,mode) return file except: - raise CDMSError("Error in DODS open of: ",uri) + raise CDMSError("Error in DODS open of: "+uri) else: try: datanode = loadURI(uri) return datanode except: datanode = loadURI(uri) - raise CDMSError("Error in loadURI of: ",uri) + raise CDMSError("Error in loadURI of: "+uri) else: raise SchemeNotSupported(scheme) From 1d4a7ef6f6cd2c4e9aff49f2d7e6fbdb18bc78be Mon Sep 17 00:00:00 2001 From: Jonathan Beezley Date: Tue, 5 May 2015 08:54:24 -0400 Subject: [PATCH 8/8] Fix textbox_blank_text test --- testing/vcs/vtk_ui/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/vcs/vtk_ui/CMakeLists.txt b/testing/vcs/vtk_ui/CMakeLists.txt index 103aad70ef..db0c19daed 100644 --- a/testing/vcs/vtk_ui/CMakeLists.txt +++ b/testing/vcs/vtk_ui/CMakeLists.txt @@ -168,7 +168,7 @@ cdat_add_test(test_vtk_ui_white_or_black ${TEST_DIR}/test_vtk_ui_white_or_black.py ) -add_test(test_vtk_ui_textbox_blank_text +cdat_add_test(test_vtk_ui_textbox_blank_text "${PYTHON_EXECUTABLE}" ${TEST_DIR}/test_vtk_ui_textbox_blank_text.py )