Python Forum
Creating look up table/matrix from 3d data array
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating look up table/matrix from 3d data array
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.

Attached Files

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.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs


Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding data in 3D array from 2D numpy array asmasattar 0 375 Jul-23-2020, 10:55 AM
Last Post: asmasattar
  Read json array data by pandas vipinct 0 360 Apr-13-2020, 02:24 PM
Last Post: vipinct
  sequential sampling from an array to a matrix nsansen 1 424 Mar-29-2020, 08:15 PM
Last Post: deanhystad
  Identifying consecutive masked values in a 3D data array chai0404 12 1,309 Feb-01-2020, 12:59 PM
Last Post: perfringo
  Creating new rows and adding them to empty data frame kapilan15 0 613 May-31-2019, 10:19 AM
Last Post: kapilan15
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 879 Apr-09-2019, 04:54 PM
Last Post: PhysChem
  while creating a array using numpy.arrange, how to negate only the last 50 numbers? vicky53 1 903 Apr-06-2019, 11:52 AM
Last Post: scidam
  Match a table with sub-total values to its detail value table klllmmm 2 1,708 Apr-03-2019, 11:28 AM
Last Post: klllmmm
  How to transform array into dataframe or table? python_newbie09 2 3,965 Mar-29-2019, 07:48 PM
Last Post: python_newbie09
  creating an empty NumPy array in Python sandeepatel 2 2,532 Jan-16-2019, 09:24 AM
Last Post: rinu

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020