Python Forum

Full Version: Creating look up table/matrix from 3d data array
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
please show what you have so far.
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.
Please, don't post images of code.
Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.