Question
Hi, hope you are well In the first image is code that takes multiple hdf files of images and creates a subplot/grid which works perfectly
Hi, hope you are well
In the first image is code that takes multiple hdf files of images and creates a subplot/grid which works perfectly fine (see the second image).
My question to you is simple: The hdf files are numbered from 56-67
At the moment these are plotted in a random order (see the second image for reference).
What do I implement into the code I have shown in the first image to order/sort these hdf files in the correct order?
I have tried: hdf_files = sorted(hdf_files, key=lambda x: int(x.split('_')[1])). This is inserted before the for loop in the first image of code however I get the error 'local variable 'hdf_files' referenced before assignment'
It should go 56, 57,58, 59 and so on...
Feel free to rewrite my script that works with the extra bit of code that sorts the files into order :)
Thanks in advance and try not to overcomplicate by listing each file please :)
\begin{tabular}{|c|c|c|c|} \hline 62 & 57 & 60 & 64 \\ \hline 58 & 65 & 56 & 61 \\ \hline 63 & 59 & 66 & 67 \\ \hline \end{tabular}Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started