Skip to content

raw2zarr should be envi2zarr #57

@aloboa

Description

@aloboa

"""Convert .hdr to .zarr""" requires the extension .raw
for a companion .hdr file. ENVI requires the .hdr extension
but has no requirements for the extension of the file with the actual data,
and different software packages (including SPECIM) write files with different extensions. The following
would be common file companions for a file named file01.hdr:
file01
file01.dat
file01.bin
file01. raw

Therefore I think you could relax your requirement of the .raw extension.


FileNotFoundError Traceback (most recent call last)
~/miniconda3/envs/sediment2/lib/python3.9/site-packages/napari_sediment/convert_widget.py in _on_click_convert(self=<napari_sediment.convert_widget.ConvertWidget object>, event=False)
79 """Convert .hdr to .zarr"""
80
---> 81 convert_bil_raw_to_zarr(self.imhdr_path, self.export_folder)
global convert_bil_raw_to_zarr = <function convert_bil_raw_to_zarr at 0x7caf5d882af0>
self.imhdr_path = PosixPath('/media/alobo/SP PHD U3/CERTEC/20240430_erica2/HSI/IQ_Prefire/297/results/REFLECTANCE_297.hdr')
self.export_folder = PosixPath('/media/alobo/SP PHD U3/CERTEC/20240430_erica2/HSI/IQ_Prefire/297')
82 self.save_params()
83

~/miniconda3/envs/sediment2/lib/python3.9/site-packages/napari_sediment/sediproc.py in convert_bil_raw_to_zarr(hdr_path=PosixPath('/media/alobo/SP PHD U3/CERTEC/2024043.../HSI/IQ_Prefire/297/results/REFLECTANCE_297.hdr'), export_folder=PosixPath('/media/alobo/SP PHD U3/CERTEC/20240430_erica2/HSI/IQ_Prefire/297'), num_rows_chunk=2000, force=False)
571 pos = offset + starting_row * img.sample_size * img.nbands * img.ncols
572 count = img.ncols * img.nbands * max_rows
--> 573 arr = np.fromfile(hdr_path.with_suffix('.raw') , dtype=img.dtype, offset=pos, count=count)
arr = undefined
global np.fromfile =
hdr_path.with_suffix = <bound method PurePath.with_suffix of PosixPath('/media/alobo/SP PHD U3/CERTEC/20240430_erica2/HSI/IQ_Prefire/297/results/REFLECTANCE_297.hdr')>
global dtype = undefined
img.dtype = '<f4'
offset = 0
pos = 0
count = 53477376
574 arr_resh = np.reshape(arr, (max_rows, img.nbands, img.ncols))
575

FileNotFoundError: [Errno 2] No such file or directory: '/media/alobo/SP PHD U3/CERTEC/20240430_erica2/HSI/IQ_Prefire/297/results/REFLECTANCE_297.raw'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions