Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync release #1322

Merged
merged 16 commits into from
May 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,25 @@ if(APPLE)
if(IS_DIRECTORY "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk")
set(HAVE_10_10_SDK TRUE)
endif()

# Try for the lowest version SDK we can
if(HAVE_10_8_SDK)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -headerpad_max_install_names")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8 CACHE STRING "" FORCE)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk" CACHE PATH "" FORCE)
elseif(HAVE_10_9_SDK)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -headerpad_max_install_names")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9 CACHE STRING "" FORCE)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" CACHE PATH "" FORCE)
elseif(HAVE_10_10_SDK)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -headerpad_max_install_names")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10 CACHE STRING "" FORCE)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk" CACHE PATH "" FORCE)
if ((${OSX_VER_MAJOR} VERSION_EQUAL 8) AND (HAVE_10_8_SDK))
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -headerpad_max_install_names")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8 CACHE STRING "" FORCE)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk" CACHE PATH "" FORCE)
elseif((${OS_X_VER_MAJOR} VERSION_EQUAL 9) AND (HAVE_10_9_SDK))
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -headerpad_max_install_names")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9 CACHE STRING "" FORCE)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" CACHE PATH "" FORCE)
elseif((${OSX_VER_MAJOR} VERSION_EQUAL 10) AND (HAVE_10_10_SDK))
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -headerpad_max_install_names")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10 CACHE STRING "" FORCE)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk" CACHE PATH "" FORCE)
else()
message(FATAL_ERROR "[ERROR] CMAKE_OSX_SYSROOT='${CMAKE_OSX_SYSROOT}' not found. Requires MacOS X 10.8 or higher")
message(FATAL_ERROR "[ERROR] Could not match your OS VERSION (${OSX_VER_MAJOR}.${OSX_VER_MINOR}) with any of your SDKs, or OS not supported yet")
endif()

endif()
Expand Down
14 changes: 9 additions & 5 deletions Packages/vcs/Lib/Canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import os
import sys
import random
import genutil
from cdms2.grid import AbstractRectGrid
import shutil, inspect
import VCS_validation_functions
Expand Down Expand Up @@ -735,13 +734,16 @@ def _reconstruct_tv(self, arglist, keyargs):
_process_keyword(tv, 'name', 'name', keyargs, default=tv.id)
time = keyargs.get('time')
if time is not None:
ctime = time.tocomp()
ar.date = str(ctime)
if isinstance(time,(str,unicode)):
ctime = cdtime.s2c(str(time))
else:
ctime = time.tocomp()
tv.user_date = str(ctime)
_process_keyword(tv, 'units', 'units', keyargs)
_process_keyword(tv, 'date', 'ymd', keyargs)
# If date has still not been set, try to get it from the first
# time value if present
if not hasattr(tv, 'date') and not hasattr(tv, 'time'):
if not hasattr(tv, 'user_date') and not hasattr(tv, 'date') and not hasattr(tv, 'time'):
change_date_time(tv, 0)

# Draw continental outlines if specified.
Expand Down Expand Up @@ -885,8 +887,10 @@ def __init__(self, gui = 0, mode = 1, pause_time=0, call_from_gui=0, size=None,

is_canvas = len(vcs.return_display_names()[0])

## TODO get rid of all these gui_canvas_closed I think the code is not even here anymore
## I believe it was for the old editor style
if gui_canvas_closed == 1:
showerror( "Error Message to User", "There can only be one VCS Canvas GUI opened at any given time and the VCS Canvas GUI cannot operate with other VCS Canvases.")
raise RuntimeError("There can only be one VCS Canvas GUI opened at any given time and the VCS Canvas GUI cannot operate with other VCS Canvases.")
return

self.winfo_id = -99
Expand Down
7 changes: 7 additions & 0 deletions Packages/vcs/Lib/VTKPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,13 @@ def renderTemplate(self,tmpl,data,gm,taxis,zaxis):
returned["vtk_backend_%s_text_actor" % d.backend["vtk_backend_template_attribute"]] = t
self.canvas.display_names.remove(d.name)
del(vcs.elements["display"][d.name])
## Sometimes user passes "date" as an attribute to replace date
if hasattr(data,"user_date"):
taxis = cdms2.createAxis([cdtime.s2r(data.user_date,"days since 1900").value])
taxis.designateTime()
taxis.units="days since 1900"
if zaxis is not None and zaxis.isTime():
zaxis=taxis
if taxis is not None:
try:
tstr = str(cdtime.reltime(taxis[0],taxis.units).tocomp(taxis.getCalendar()))
Expand Down
1 change: 1 addition & 0 deletions Packages/vcs/Lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import colormap
import vcsaddons
import cdms2
import genutil

indent = 1
sort_keys = True
Expand Down
20 changes: 16 additions & 4 deletions Packages/vcs/Lib/vcs2vtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ def genGridOnPoints(data1,gm,deep=True,grid=None,geo=None):
if grid is None:
x = g.getLongitude()[:]
y = g.getLatitude()[:]
xm = x[0]
xM = x[-1]
ym = y[0]
yM = y[-1]
continents=True
wrap=[0,360]
if isinstance(g,cdms2.gengrid.AbstractGenericGrid): # Ok need unstrctured grid
Expand All @@ -97,6 +101,10 @@ def genGridOnPoints(data1,gm,deep=True,grid=None,geo=None):
if grid is None:
x=data1.getAxis(-1)[:]
y=data1.getAxis(-2)[:]
xm = x[0]
xM = x[-1]
ym = y[0]
yM = y[-1]

if grid is None:
if x.ndim==1:
Expand All @@ -109,10 +117,14 @@ def genGridOnPoints(data1,gm,deep=True,grid=None,geo=None):
x=numpy.reshape(x,sh)
y=numpy.reshape(y,sh)
#Ok we have our points in 2D let's create unstructured points grid
xm=x.min()
xM=x.max()
ym=y.min()
yM=y.max()
if xm is None:
xm=x.min()
if xM is None:
xM=x.max()
if ym is None:
ym=y.min()
if yM is None:
yM=y.max()
z = numpy.zeros(x.shape)
m3 = numpy.concatenate((x,y),axis=1)
m3 = numpy.concatenate((m3,z),axis=1)
Expand Down
2 changes: 1 addition & 1 deletion testing/dv3d/TestManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def test( self, interactive=False ):
try:
print "Copying ref image %s to %s in %s " % ( self.image_name, ref_image, os.path.abspath('.') )
shutil.copy( self.image_name, ref_image )
ret = checkimage.check_result_image( ref_image, test_image, checkimage.defaultThreshold+3. )
ret = checkimage.check_result_image( test_image, ref_image, checkimage.defaultThreshold+3. )
except IOError:
print "No ref image '%s' found." % ref_image
ret = 0
Expand Down
15 changes: 15 additions & 0 deletions testing/vcs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,26 @@ cdat_add_test(vcs_test_taylor_2_quads
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_boxfill_number_color_more_than_number_levels.py
)
cdat_add_test(test_vcs_user_passed_date
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_user_passed_date.py
"${BASELINE_DIR}/test_vcs_user_passed_date.png"
)
cdat_add_test(test_vcs_user_passed_date_as_string
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_user_passed_date_as_string.py
"${BASELINE_DIR}/test_vcs_user_passed_date_as_string.png"
)
cdat_add_test(test_vcs_auto_time_labels
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_auto_time_labels.py
"${BASELINE_DIR}/test_vcs_auto_time_labels.png"
)
cdat_add_test(test_vcs_isofill_data_read_north_to_south
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_isofill_data_read_north_to_south.py
"${BASELINE_DIR}/test_vcs_isofill_data_read_north_to_south.png"
)
cdat_add_test(test_vcs_lon_axes_freak_out
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_lon_axes_freak_out.py
Expand Down
21 changes: 21 additions & 0 deletions testing/vcs/test_vcs_isofill_data_read_north_to_south.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import cdms2
import vcs
import sys
import os
pth = os.path.join(os.path.dirname(__file__),"..")
sys.path.append(pth)
import checkimage
f = cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc"))
clt = f("clt",latitude=(80.0, 38.0),squeeze=1,longitude=(-180.0, 180.0),time=slice(0,1))
x = vcs.init()
gm = vcs.createisofill()
gm.projection="polar"
x.plot( clt,gm)
fnm = os.path.split(__file__)[-1][:-2]+"png"
src= sys.argv[1]
x.png(fnm)

print "fnm:",fnm
print "src:",src
ret = checkimage.check_result_image(fnm,src,checkimage.defaultThreshold)
sys.exit(ret)
17 changes: 17 additions & 0 deletions testing/vcs/test_vcs_user_passed_date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import vcs,cdms2,os,sys,cdtime
src=sys.argv[1]
pth = os.path.join(os.path.dirname(__file__),"..")
sys.path.append(pth)
import checkimage
f=cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc"))
s=f("clt",squeeze=1)
x=vcs.init()
x.drawlogooff()
x.setbgoutputdimensions(1200,1091,units="pixels")
x.plot(s,bg=1,time=cdtime.comptime(2015))
fnm = os.path.split(__file__)[1][:-3]+".png"
x.png(fnm)
print "fnm:",fnm
print "src:",src
ret = checkimage.check_result_image(fnm,src,checkimage.defaultThreshold)
sys.exit(ret)
17 changes: 17 additions & 0 deletions testing/vcs/test_vcs_user_passed_date_as_string.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import vcs,cdms2,os,sys,cdtime
src=sys.argv[1]
pth = os.path.join(os.path.dirname(__file__),"..")
sys.path.append(pth)
import checkimage
f=cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc"))
s=f("clt",squeeze=1)
x=vcs.init()
x.drawlogooff()
x.setbgoutputdimensions(1200,1091,units="pixels")
x.plot(s,bg=1,time='2015-02-23')
fnm = os.path.split(__file__)[1][:-3]+".png"
x.png(fnm)
print "fnm:",fnm
print "src:",src
ret = checkimage.check_result_image(fnm,src,checkimage.defaultThreshold)
sys.exit(ret)