@@ -221,6 +221,20 @@ def _markmodified(*args, **kwars):
221221 </StringVectorProperty>
222222 """
223223)
224+ @smproperty .xml (
225+ """
226+ <IntVectorProperty command="SetForceFloatPoints"
227+ name="ForceFloatPoints"
228+ default_values="1"
229+ number_of_elements="1">
230+ <BooleanDomain name="bool" />
231+ <Documentation>
232+ If True, the points of the dataset will be float, otherwise they will be float or double depending
233+ on the type of corner_lat and corner_lon variables in the connectivity file.
234+ </Documentation>
235+ </IntVectorProperty>
236+ """
237+ )
224238class EAMSliceSource (VTKPythonAlgorithmBase ):
225239 def __init__ (self ):
226240 VTKPythonAlgorithmBase .__init__ (
@@ -230,6 +244,7 @@ def __init__(self):
230244
231245 self ._DataFileName = None
232246 self ._ConnFileName = None
247+ self ._ForceFloatPoints = True
233248 self ._dirty = False
234249
235250 # Variables for dimension sliders
@@ -448,7 +463,12 @@ def _build_geometry(self, meshdata):
448463 lat = meshdata [latdim ][:].data .flatten ()
449464 lon = meshdata [londim ][:].data .flatten ()
450465
451- coords = np .empty ((len (lat ), 3 ), dtype = np .float64 )
466+
467+ if self ._ForceFloatPoints :
468+ points_type = np .float32
469+ else :
470+ points_type = np .float64 if lat .dtype == np .float64 else np .float32
471+ coords = np .empty ((len (lat ), 3 ), dtype = points_type )
452472 coords [:, 0 ] = lon
453473 coords [:, 1 ] = lat
454474 coords [:, 2 ] = 0.0
@@ -579,6 +599,11 @@ def SetConnFileName(self, fname):
579599 self ._populate_variable_metadata ()
580600 self .Modified ()
581601
602+ def SetForceFloatPoints (self , forceFloatPoints ):
603+ if self ._ForceFloatPoints != forceFloatPoints :
604+ self ._ForceFloatPoints = forceFloatPoints
605+ self .Modified ()
606+
582607 def SetSlicing (self , slice_str ):
583608 # Parse JSON string containing dimension slices and update self._slices
584609
0 commit comments