Numpy Mgrid and Meshgrid. Conversion between Meshgrid and Mgrid

preview_player
Показать описание
Zen of Python advertise few principles, one of which states, that “There should be one– and preferably only one –obvious way to do it.” And from my point of view mgrid and meshgrid functions from NumPy are breaking this principle.
In this tutorial, I will explain how to use mgrid, meshgrid and what is the difference between them. I also will explain how to convert data from mgrid to meshgrid and back.
I will give you an idea, how to read external datafiles and understand what format is mgrid or meshgrid.
This guide will be interesting for Python coders who working with grid data, calculating vector and scalar fields.
Video content:
0:00 – Introduction
0:06 – Parameters of initial domain
0:30 – 1-dimensional case
0.52 – 2-dimensional case
1:15 – “Physical” sense behind mgrid function
2:07 – The same with meshgrid
2:57 – 2D case difference between mgrid and meshgrid
3:35 – 3D case with mgrid and meshgrid
4:45 – 3D case converting between mgrid and meshgrid
5:09 – 4D case
5:45 – A bit about data alignment.
So, after this very long discussion, I can tell you, that my choice is MGRID!
#numpy #pythoncoding #electricfield
Рекомендации по теме