viscid.readers.openggcm module

Wrapper grid for some OpenGGCM convenience

class viscid.readers.openggcm.GGCMFile[source]

Bases: object

Mixin some GGCM convenience stuff

read_log_file

search for a log file to load some of the libmrc runtime parameters. This does not read parameters from all libmrc classes, but can be customized with :py:const`viscid.readers.ggcm_logfile.GGCMLogFile. watched_classes`. Defaults to False for performance.

Type:bool
dipoletime
static parse_timestring(timestr)[source]
read_log_file = True
read_logfile()[source]
class viscid.readers.openggcm.GGCMFileFortran(fname, crds=None, fld_templates=None, file_wrapper=None, **kwargs)[source]

Bases: viscid.readers.openggcm.GGCMFile, viscid.readers.vfile_bucket.ContainerFile

An abstract class from which jrrle and fortbin files are derived

Note

All subclasses should implement a _shape_discovery_hack

assume_mhd_crds = True
get_file_wrapper(filename)[source]
grid2 = None
classmethod group_fnames(fnames)[source]

Group File names

The default implementation just returns fnames, but some file types might do something fancy here

Parameters:fnames (list) – names that can be logically grouped, as in a bunch of file names that are different time steps of a given run
Returns:A list of things that can be given to the constructor of this class
load(fname)[source]
make_crds()[source]
read_grid2()[source]
set_file_wrapper(wrapper)[source]
class viscid.readers.openggcm.GGCMGrid(*args, **kwargs)[source]

Bases: viscid.grid.Grid

This defines some cool openggcm convinience stuff… The following attributes can be set by saying

viscid.grid.readers.openggcm.GGCMGrid.flag = value.

This should be done before a call to readers.load_file so that all grids that are instantiated have the flags you want.

Derived quantities accessable by dictionary lookup
  • T: Temperature, for now, just pressure / density
  • bx, by, bz: CC mag field components, if not already stored by component)
  • b, b_cc: B as CC vector field in nT, layout affected by
    GGCMGrid.derived_vector_layout
  • b_fc, b1, b2: B as FC vector field in nT, layout affected by
    GGCMGrid.derived_vector_layout
  • e_cc: E as CC vector field in mV/m?, layout affected by
    GGCMGrid.derived_vector_layout.
  • e_ec: E as EC vector field in mV/m?, layout affected by
    GGCMGrid.derived_vector_layout. This should be used even for jrrle files.
  • v: velocity as vector, same idea as b
  • beta: plasma beta, just pp/b^2
  • psi: flux function (only works for 2d files/grids)
mhd_to_gse_on_read

flips arrays on load to be in GSE crds. If ‘auto’, then try to use the runtime parameters to figure out if conversion is needed; auto requires reading the logfile. (default is False)

Type:bool, str
copy_on_transform

True means array will be contiguous after transform (if one is done), but makes data load 50%-60% slower (default is True)

Type:bool
force_vector_layout

inherited from grid.Grid, enforces layout for vector fields on load (default is viscid.field.LAYOUT_DEFAULT)

Type:str
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

copy_on_transform = False
mhd_to_gse_on_read = 'auto'
set_crds(crds_object)[source]
viscid.readers.openggcm.find_file_uptree(directory, basename, max_depth=8, _depth=0)[source]

Find basename by going up the file tree

Keep going up a directory until you find one that has the file “basename”

Parameters:
  • directory (str) – directory to start the search
  • basename (str) – bare file name
  • max_depth (int) – max number of directories to seach
Returns:

Relative path to file, or None if not found

viscid.readers.openggcm.group_ggcm_files_common(detector, fnames)[source]
viscid.readers.openggcm.mhd2gse_field_scalar(fld, crds, arr, comp_slc=None, copy_on_transform=False)[source]
viscid.readers.openggcm.mhd2gse_field_scalar_m1(fld, crds, arr, comp_slc=None, copy_on_transform=False)[source]
viscid.readers.openggcm.mhd2gse_field_vector(fld, crds, arr, comp_slc=None, copy_on_transform=False)[source]