viscid.grid module¶
Grids contain fields and coordinates
-
class
viscid.grid.
Grid
(*args, **kwargs)[source]¶ Bases:
viscid.tree.Node
Computational grid container
Grids contain fields and coordinates. Datasets recurse to grids using
__getitem__
and get_field in order to find fields. Grids can also calculate fields by defining_get_*
methods.Attributes can be overridden globally to affect all data reads of a given grid type. Subclasses of Grid document their own special attributes. For example, one can change the default vector layout with:
viscid.grid.Grid.force_vector_layout = LAYOUT_INTERLACED
-
force_vecter_layout
¶ force all vectors to be of a certain layout when they’re created (default: LAYOUT_DEFAULT)
Type: field.LAYOUT_*
-
longterm_field_caches
¶ If True, then when a field is cached, it must be explicitly removed from memory with “clear_cache” or using the ‘with’ statemnt. If False, “shell copies” of fields are made so that memory is freed when the returned instance is garbage collected. Default: False
Type: bool
-
add_field
(*fields)[source]¶ Note: in XDMF reader, the grid will NOT have crds when adding fields, so any grid crd transforms won’t be set
-
crds
¶
-
field_names
¶
-
fields
= None¶
-
force_vector_layout
= 'none'¶
-
geometry_info
= None¶
-
get_crd_cc
(axis, shaped=False)[source]¶ returns a flat ndarray of coordinates along a given axis axis can be crd name as string, or index, as in x==2, y==1, z==2
-
get_crd_ec
(axis, shaped=False)[source]¶ returns a flat ndarray of coordinates along a given axis axis can be crd name as string, or index, as in x==2, y==1, z==2
-
get_crd_fc
(axis, shaped=False)[source]¶ returns a flat ndarray of coordinates along a given axis axis can be crd name as string, or index, as in x==2, y==1, z==2
-
get_crd_nc
(axis, shaped=False)[source]¶ returns a flat ndarray of coordinates along a given axis axis can be crd name as string, or index, as in x==2, y==1, z==2
-
get_crds_cc
(axes=None, shaped=False)[source]¶ returns all cell centered coords as a list of ndarrays, flat if shaped==False, or shaped if shaped==True
-
get_crds_ec
(axes=None, shaped=False)[source]¶ returns all edge centered coords as a list of ndarrays, flat if shaped==False, or shaped if shaped==True
-
get_crds_fc
(axes=None, shaped=False)[source]¶ returns all face centered coords as a list of ndarrays, flat if shaped==False, or shaped if shaped==True
-
get_crds_nc
(axes=None, shaped=False)[source]¶ returns all node centered coords as a list of ndarrays, flat if shaped==False, or shaped if shaped==True
-
iter_field_items
(fld_names=None, **kwargs)[source]¶ iterate over fields in a grid, if fld_names is given, it should be a list of field names to iterate over
-
iter_fields
(fld_names=None, **kwargs)[source]¶ iterate over fields in a grid, if fld_names is given, it should be a list of field names to iterate over
-
longterm_field_caches
= False
-
to_dataframe
(fld_names=None, selection=Ellipsis, time_sel=slice(None, None, None), time_col='time', datetime_col='datetime')[source]¶ Consolidate grid’s field data into pandas dataframe
Parameters: - fld_names (sequence, None) – grab specific fields by name, or None to grab all fields
- selection (selection) – for selecting only parts of fields
Returns: pandas.DataFrame
-
topology_info
= None¶
-
xh_cc
¶
-
xh_nc
¶
-
xl_cc
¶
-
xl_nc
¶
-