diff --git a/analysator/vlsvfile/vlsvreader.py b/analysator/vlsvfile/vlsvreader.py index 12a5f414..281d3556 100644 --- a/analysator/vlsvfile/vlsvreader.py +++ b/analysator/vlsvfile/vlsvreader.py @@ -3848,8 +3848,10 @@ def read_velocity_cells(self, cellid, pop="proton"): if datatype == "float" and element_size == 4: data_avgs = np.fromfile(fptr, dtype = np.float32, count = vector_size*num_of_blocks) - if datatype == "float" and element_size == 8: + elif datatype == "float" and element_size == 8: data_avgs = np.fromfile(fptr, dtype = np.float64, count = vector_size*num_of_blocks) + else: + raise TypeError("Error! Bad data type in blocks! datatype found was "+datatype) data_avgs = data_avgs.reshape(num_of_blocks, vector_size) # Read in block coordinates: if ("name" in child.attrib) and (child.attrib["name"] == pop) and (child.tag == "BLOCKIDS"): @@ -4359,4 +4361,4 @@ def cache_optimization_files(self, force=False): ''' Create cached optimization files for this reader object (e.g. spatial index) ''' - self.__metadata_cache.set_cellid_spatial_index(force) \ No newline at end of file + self.__metadata_cache.set_cellid_spatial_index(force)