Home > OS >  How do I store a multidimensional array?
How do I store a multidimensional array?

Time:01-29

I am trying to write a code in python that will display the trajectory of projectile on a 2D graph. The initial velocity and launch angle will be varying. Instead of calculating it every time, I was wondering if there is any way to create a data file which will store all the values of the coordinates for each of those different combinations of speed and launch angle. That is a 4 dimensional database. Is this even possible?

CodePudding user response:

This sounds like a pretty ideal case for using CSV as your file format. It's not a "4 dimension" so much as a "4 column" database.

initial_velocity, launch_angle, end_x, end_y

which you can write out and read in easily - using either the standard library's csv module, or pandas' read_csv()

CodePudding user response:

i think that you should look at the HDF5 format, which has been specialized to work with big data in NASA and bulletproof in very large scale applications :

From the webside

HDF5 lets you store huge amounts of numerical data, and easily manipulate that data from NumPy. For example, you can slice into multi-terabyte datasets stored on disk, as if they were real NumPy arrays. Thousands of datasets can be stored in a single file, categorized and tagged however you want.

In addition from me is the point that NumPy has been developed to work with multidimensional array very efficiently. Good luck !

  •  Tags:  
  • Related