Python Forum
Creating look up table/matrix from 3d data array - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Creating look up table/matrix from 3d data array (/thread-25684.html)



Creating look up table/matrix from 3d data array - chai0404 - Apr-08-2020

Hi,
I have a data array of coastal grid cells and I need to find adjacent ocean cells from a different dataset.
To begin with, I have a 3D data array with lat, lon and time dimensions.
In this data array, whenever the variable is not equal to zero, I want to store this value in a new matrix with time as the x axis and the lat,lon coordinates as the y axis.
I have written a loop for this. A screenshot of the code and the data array is attached.
I hope you can have a look at the for loop and help me figure out how to refine it.
Once this matrix is created, I will look at the lat,lon pairs and find the adjacent cells from another dataset.
I need help with figuring out the loop for the first part.
Hope you can help.
Thank you.


RE: Creating look up table/matrix from 3d data array - Larz60+ - Apr-08-2020

please show what you have so far.


RE: Creating look up table/matrix from 3d data array - chai0404 - Apr-08-2020

The image I have attached shows the for loop I have written but there is something wrong with it as it doesn't give me what I expect to see.


RE: Creating look up table/matrix from 3d data array - buran - Apr-09-2020

Please, don't post images of code.
Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.