| |
- gp_grid_cl
class gp_grid_cl |
|
grid class
Members:
------------------------------------------------------
1. ndim:<int>: number of the dimensions.
2. dims:<list>: shape of the grid
3. __axis_dict:<dictionary>: dictionary for id of gp_axis
4. axis_lst:<list>: list of the axises
5. attr_dict:<dictionary>: dictionary for the attributes
Functions:
------------------------------------------------------
1. __init__: initialize the class
2. __getitem__: overide index function to return axis.
3. set_attr: set attribute
4. get_attr: get attribute
5. allocate_point: find grid corners surrounding a given point.
6. allocate_point_subspace: find grid corners surrounding a point given in a subplace
7. update_axis: replace or add axis to the grid
8. get_axis_ids: get IDs for given axis names
9. get_value_at_point: interpolate data field to a point defined at the grid (N-d) space.
10. get_profile: interploate profiles of data field to a point defined at (N-1)-d space |
|
Methods defined here:
- __getitem__(self, ax_id)
- get axis
Inputs:
--------------------------------
1. ax_id:<integer/str>: Id for the axis to be found
Returns:
----------------------------------
1, gax:<gp_axis_cl>: axis if the ax_id is valid
- __init__(self, gp_axis_lst, **keywords)
- initialize grid
Inputs:
1. gp_axis_lst:<list>:list of gp_axis for definition of the grid.
2. keywords:<dict>: attributes
Notes:
----------------------------------------------------
each axis in gp_axis_lst is expected have different names
- allocate_point(self, p)
- find grid points around a given point, and
calculate their weights according to the distances from this point.
Inputs:
----------------------------------------------------------------
1. p:<array, (nax,)>: the coordiantes of the given point.
Returns:
-------------------------------------------------------------------
1. grd_pt_lst: <list, t:tuple>: list of the index of the surrounding grid points.
---If the dimension size nax is n, the length of grd_pt_lst is 2^n,
with each element being an array of size n.
2. grd_wgt_lst: <list, t:float>: Weights of the the surrounding points,
---which are calculated from their distances from the point.
- allocate_point_subspace(self, p, axis_id_lst)
- find grid points around a given point, and
calculate their weights according to the distances from this point.
Inputs:
----------------------------------------------------------------
1. p:<array, (nuse,)>: the coordiantes of the given point.
2. axis_id_lst:<list, t:integer>: the use the index
Returns:
-------------------------------------------------------------------
1. grd_pt_lst: <list, t:tuple>: list of the index of the surrounding grid points.
---If the dimension size nax is n, the length of grd_pt_lst is 2^n,
with each element being an array of size n with coordinate [:] for axis=axis_id
2. grd_wgt_lst: <list, t:float>: Weights of the the surrounding points,
---which are calculated from their distances from the point.
- copy(self)
- make a copy of itself
- copy_attr_dict(self)
- get one copy of the attr_dict
- get_attr(self, attr_name)
- find the attribute
Inputs:
----------------------------------
1. attr_name:<str>: name of the attribute
Returns:
------------------------------------------
1. attr: <obj>: if the attribute exists.
- get_axis(self, ax_id)
- wrapper for __getitem__
Inputs:
--------------------------------
1. ax_id:<integer/str>: Id for the axis to be found
Returns:
----------------------------------
1, gax:<gp_axis_cl>: axis if the ax_id is valid
- get_axis_ids(self, axis_name_lst)
- Find id for given names
Inputs:
----------------------------------------------------------------
1. axis_name_lst:<list, t:str>: the names
Returns:
------------------------------------------
1. axis_id_lst:<list,t:integer>: the index
- get_profile(self, p, field, axis_id_lst)
- extract profile at a given 'horizontal location'
Inputs:
----------------------------------------------------------------
1. p:<array, (nuse,)>: the sub coordiantes of the given points.
2. field:<array, dims>: gridded data
3. axis_id_lst:<integer>: index of the axis, where the axises to be used
Returns:
---------------------------------------------------------------
1. profile:<array, ...>: the profile at the locations
- get_value_at_point(self, p, field)
- calculate value at a given p by interpolating the
gridded data (field) at surrounding grid points
Inputs:
----------------------------------------------------------------
1. p:<array, (nax,)>: the coordiantes of the given point.
2. field:<array, (nx, ny, nz, ...)>:gridded data
Returns:
----------------------------------------------------------------
val:<float>: values at point p
- set_attr(self, attr_name, attr_value)
- set attribute
Inputs:
----------------------------
1. attr_name:<str>: name of the attribute
2. attr_value:<obj>: the value of the attribute
- shape(self)
- Return the shape of the grid
- size(self, ax_id=None)
- Return size along one direction or total size of the grid
Inputs:
--------------------------------
1. ax_id:<integer/str>: Id for the axis to be found
Returns:
1. nsize:<integer>: the size of axis if axis_id is provided, or the total size if no ax_id is specified.
- update_axis(self, gp_axis)
- add or replace axis
Inputs:
--------------------------------------------------
1. gp_axis:<gp_axis_cl>: class to be added or replaced
Output:
-------------------------------------------------
2. gax:<gp_axis>: axis if the Id is correct
| |