def _data_type(self): """ Returns the data type for this netcdf dataset :rtype: str """ if len(self.files) < 1: raise RuntimeException("No files to import were specified.") netCDF4 = import_netcdf4() nci = netCDF4.Dataset(self.files[0].get_filepath(), 'r') netcdf_data_type = nci.variables[self.bands[0].identifier].dtype.name return GDALGmlUtil.data_type_to_gdal_type(netcdf_data_type)
def get_data_type(self, netcdf_recipe_converter): """ Return the data type of opened dataset :param: AbstractToCoverageConverter netcdf_recipe: Converter for netCDF recipe :return: str data_type """ collected_data_type = [] for band in netcdf_recipe_converter.bands: band_id = band.identifier netcdf_data_type = self.get_dataset().variables[band_id].dtype.name band_data_type = GDALGmlUtil.data_type_to_gdal_type( netcdf_data_type) collected_data_type.append(band_data_type) data_type = ",".join(collected_data_type) return data_type