class PVGeoGeologyMapper(GeologyMapper): def __init__(self): GeologyMapper.__init__(self) #### SETTERS AND GETTERS #### @smproperty.xml(_helpers.get_input_array_xml(nInputPorts=1, n_arrays=1)) def SetInputArrayToProcess(self, idx, port, connection, field, name): return GeologyMapper.SetInputArrayToProcess( self, idx, port, connection, field, name ) @smproperty.xml( ''' <StringVectorProperty panel_visibility="default" name="FileName" label="File Name" command="SetFileName" animateable="1" number_of_elements="1"> <FileListDomain name="filename"/> <Documentation>This is the file contating the mapping definitions.</Documentation> </StringVectorProperty>''' ) def SetFileName(self, filename): GeologyMapper.SetFileName(self, filename) @smproperty.stringvector( name="Delimiter", default_values=",", panel_visibility="advanced" ) def set_delimiter(self, deli): GeologyMapper.set_delimiter(self, deli)
class PVGeoArraysToRGBA(ArraysToRGBA): def __init__(self): ArraysToRGBA.__init__(self) #### Seters and Geters #### @smproperty.xml( _helpers.get_input_array_xml( nInputPorts=1, n_arrays=4, labels=['Red', 'Green', 'Blue', 'Transparency'])) def SetInputArrayToProcess(self, idx, port, connection, field, name): return ArraysToRGBA.SetInputArrayToProcess(self, idx, port, connection, field, name) @smproperty.xml( _helpers.get_property_xml( name='Use Transparency', command='set_use_transparency', default_values=False, help= 'A boolean to control whether or not to use the Transparency array.' )) def set_use_transparency(self, flag): ArraysToRGBA.set_use_transparency(self, flag) @smproperty.doublevector(name="Mask", default_values=-9999.0) def set_mask_value(self, val): ArraysToRGBA.set_mask_value(self, val)
class PVGeoPercentThreshold(PercentThreshold): def __init__(self): PercentThreshold.__init__(self) #### Seters and Geters #### @smproperty.doublevector(name="Percent", default_values=50.0) @smdomain.doublerange(min=0.0, max=100.0) def set_percent(self, percent): PercentThreshold.set_percent(self, percent) @smproperty.xml( _helpers.get_property_xml(name='Use Continuous Cell Range', command='set_use_continuous_cell_range', default_values=False)) def set_use_continuous_cell_range(self, flag): PercentThreshold.set_use_continuous_cell_range(self, flag) @smproperty.xml( _helpers.get_property_xml(name='Invert', command='set_invert', default_values=False, help='Use to invert the threshold filter.')) def set_invert(self, flag): PercentThreshold.set_invert(self, flag) @smproperty.xml(_helpers.get_input_array_xml(nInputPorts=1, n_arrays=1)) def SetInputArrayToProcess(self, idx, port, connection, field, name): return PercentThreshold.SetInputArrayToProcess(self, idx, port, connection, field, name)
class PVGeoArrayMath(ArrayMath): def __init__(self): ArrayMath.__init__(self) #### SETTERS AND GETTERS #### @smproperty.xml(_helpers.get_input_array_xml(nInputPorts=1, n_arrays=2)) def SetInputArrayToProcess(self, idx, port, connection, field, name): return ArrayMath.SetInputArrayToProcess(self, idx, port, connection, field, name) @smproperty.doublevector(name="Multiplier", default_values=1.0) def set_multiplier(self, val): ArrayMath.set_multiplier(self, val) @smproperty.stringvector(name="New Array Name", default_values="Mathed Up") def set_new_array_name(self, name): ArrayMath.set_new_array_name(self, name) @smproperty.xml( _helpers.get_drop_down_xml( name='Operation', command='set_operation', labels=ArrayMath.get_operation_names(), help='This is the type of operation to apply to the input arrays.') ) def set_operation(self, op): ArrayMath.set_operation(self, op)
class PVGeoSplitTableOnArray(SplitTableOnArray): def __init__(self): SplitTableOnArray.__init__(self) @smproperty.xml(_helpers.get_input_array_xml(nInputPorts=1, n_arrays=1)) def SetInputArrayToProcess(self, idx, port, connection, field, name): return SplitTableOnArray.SetInputArrayToProcess( self, idx, port, connection, field, name)
class PVGeoVoxelizePointsFromArrays(VoxelizePoints): def __init__(self): VoxelizePoints.__init__(self) self.__dx_id = [None, None] self.__dy_id = [None, None] self.__dz_id = [None, None] self.set_estimate_grid(False) # CRUCIAL def _copy_arrays(self, pdi, pdo): """Override to not pass spacing arrays to output""" exclude = [self.__dx_id[1], self.__dy_id[1], self.__dz_id[1]] for i in range(pdi.GetPointData().GetNumberOfArrays()): arr = pdi.GetPointData().GetArray(i) if arr.GetName() not in exclude: _helpers.add_array(pdo, 1, arr) # adds to CELL data return pdo def RequestData(self, request, inInfo, outInfo): # Handle input arrays pdi = self.GetInputData(inInfo, 0, 0) wpdi = dsa.WrapDataObject(pdi) dx = _helpers.get_numpy_array(wpdi, self.__dx_id[0], self.__dx_id[1]) dy = _helpers.get_numpy_array(wpdi, self.__dy_id[0], self.__dy_id[1]) dz = _helpers.get_numpy_array(wpdi, self.__dz_id[0], self.__dz_id[1]) VoxelizePoints.set_deltas(self, dx, dy, dz) # call parent and make sure EstimateGrid is set to False return VoxelizePoints.RequestData(self, request, inInfo, outInfo) #### Seters and Geters #### # (int idx, int port, int connection, int fieldAssociation, const char *name) @smproperty.xml( _helpers.get_input_array_xml(labels=['dx', 'dy', 'dz'], nInputPorts=1, n_arrays=3)) def SetInputArrayToProcess(self, idx, port, connection, field, name): if idx == 0: self.__dx_id = [field, name] elif idx == 1: self.__dy_id = [field, name] elif idx == 2: self.__dz_id = [field, name] else: raise RuntimeError('Bad input array index.') return 1 @smproperty.xml( _helpers.get_property_xml( name='Extract Unique', command='set_unique', default_values=True, help='Set a flag on whether to only use unique elements', )) def set_unique(self, flag): VoxelizePoints.set_unique(self, flag)
class PVGeoNormalizeArray(NormalizeArray): def __init__(self): NormalizeArray.__init__(self) #### SETTERS AND GETTERS #### @smproperty.xml(_helpers.get_input_array_xml(nInputPorts=1, n_arrays=1)) def SetInputArrayToProcess(self, idx, port, connection, field, name): return NormalizeArray.SetInputArrayToProcess(self, idx, port, connection, field, name) @smproperty.doublevector(name="Multiplier", default_values=1.0) def set_multiplier(self, val): NormalizeArray.set_multiplier(self, val) @smproperty.stringvector(name="New Array Name", default_values="Normalized") def set_new_array_name(self, name): NormalizeArray.set_new_array_name(self, name) @smproperty.xml( _helpers.get_drop_down_xml( name='Normalization', command='set_normalization', labels=NormalizeArray.get_normalization_names(), help= 'This is the type of normalization to apply to the input array.', )) def set_normalization(self, norm): NormalizeArray.set_normalization(self, norm) @smproperty.xml( _helpers.get_property_xml( name='Absolute Value', command='set_take_absolute_value', default_values=False, help= 'This will take the absolute value of the array before normalization.', )) def set_take_absolute_value(self, flag): NormalizeArray.set_take_absolute_value(self, flag) @smproperty.doublevector(name="Shifter", default_values=0.0) def set_shift(self, sft): NormalizeArray.set_shift(self, sft)
class PVGeoWriteImageDataToSurfer(WriteImageDataToSurfer): def __init__(self): WriteImageDataToSurfer.__init__(self) @smproperty.stringvector(name="FileName", panel_visibility="never") @smdomain.filelist() def SetFileName(self, filename): """Specify filename for the file to write.""" WriteImageDataToSurfer.SetFileName(self, filename) @smproperty.xml(_helpers.get_input_array_xml(nInputPorts=1, n_arrays=1)) def SetInputArrayToProcess(self, idx, port, connection, field, name): return WriteImageDataToSurfer.SetInputArrayToProcess(self, idx, port, connection, field, name) @smproperty.stringvector(name="Format", default_values='%.9e') def set_format(self, fmt): """Use to set the ASCII format for the writer default is ``'%.9e'``""" WriteImageDataToSurfer.set_format(self, fmt)